Commit 3a44d539 by Toon Moene Committed by Toon Moene

data.c (ffedata_eval_offset_): Only convert index...

2002-02-13  Toon Moene  <toon@moene.indiv.nluug.nl>

	* data.c (ffedata_eval_offset_): Only convert index,
	low and high bound in data statements to default integer
	if they are constants.  Use a copy of the data structure.

From-SVN: r49721
parent ca77b9e1
2002-02-13 Toon Moene <toon@moene.indiv.nluug.nl>
* data.c (ffedata_eval_offset_): Only convert index,
low and high bound in data statements to default integer
if they are constants. Use a copy of the data structure.
2002-02-09 Toon Moene <toon@moene.indiv.nluug.nl> 2002-02-09 Toon Moene <toon@moene.indiv.nluug.nl>
* data.c (ffedata_eval_offset_): Convert non-default integer * data.c (ffedata_eval_offset_): Convert non-default integer
......
...@@ -978,6 +978,7 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims) ...@@ -978,6 +978,7 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims)
while (subscripts != NULL) while (subscripts != NULL)
{ {
ffeinfoKindtype sub_kind, low_kind, hi_kind; ffeinfoKindtype sub_kind, low_kind, hi_kind;
ffebld sub1, low1, hi1;
++rank; ++rank;
assert (dims != NULL); assert (dims != NULL);
...@@ -986,16 +987,19 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims) ...@@ -986,16 +987,19 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims)
dim = ffebld_head (dims); dim = ffebld_head (dims);
assert (ffeinfo_basictype (ffebld_info (subscript)) == FFEINFO_basictypeINTEGER); assert (ffeinfo_basictype (ffebld_info (subscript)) == FFEINFO_basictypeINTEGER);
/* Force to default - it's a constant expression ! */ if (ffebld_op (subscript) == FFEBLD_opCONTER)
sub_kind = ffeinfo_kindtype (ffebld_info (subscript)); {
if (sub_kind == FFEINFO_kindtypeINTEGER2) /* Force to default - it's a constant expression ! */
subscript->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) subscript->u.conter.expr->u.integer2; sub_kind = ffeinfo_kindtype (ffebld_info (subscript));
else if (sub_kind == FFEINFO_kindtypeINTEGER3) sub1 = ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val (
subscript->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) subscript->u.conter.expr->u.integer3; sub_kind == FFEINFO_kindtypeINTEGER2 ? subscript->u.conter.expr->u.integer2 :
else if (sub_kind == FFEINFO_kindtypeINTEGER4) sub_kind == FFEINFO_kindtypeINTEGER3 ? subscript->u.conter.expr->u.integer3 :
subscript->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) subscript->u.conter.expr->u.integer4; sub_kind == FFEINFO_kindtypeINTEGER4 ? subscript->u.conter.expr->u.integer4 :
ffeinfo_kindtype (ffebld_info (subscript)) = FFEINFO_kindtypeINTEGERDEFAULT; subscript->u.conter.expr->u.integer1), NULL);
value = ffedata_eval_integer1_ (subscript); value = ffedata_eval_integer1_ (sub1);
}
else
value = ffedata_eval_integer1_ (subscript);
assert (ffebld_op (dim) == FFEBLD_opBOUNDS); assert (ffebld_op (dim) == FFEBLD_opBOUNDS);
low = ffebld_left (dim); low = ffebld_left (dim);
...@@ -1006,29 +1010,35 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims) ...@@ -1006,29 +1010,35 @@ ffedata_eval_offset_ (ffebld subscripts, ffebld dims)
else else
{ {
assert (ffeinfo_basictype (ffebld_info (low)) == FFEINFO_basictypeINTEGER); assert (ffeinfo_basictype (ffebld_info (low)) == FFEINFO_basictypeINTEGER);
/* Force to default - it's a constant expression ! */ if (ffebld_op (low) == FFEBLD_opCONTER)
low_kind = ffeinfo_kindtype (ffebld_info (low)); {
if (low_kind == FFEINFO_kindtypeINTEGER2) /* Force to default - it's a constant expression ! */
low->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) low->u.conter.expr->u.integer2; low_kind = ffeinfo_kindtype (ffebld_info (low));
else if (low_kind == FFEINFO_kindtypeINTEGER3) low1 = ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val (
low->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) low->u.conter.expr->u.integer3; low_kind == FFEINFO_kindtypeINTEGER2 ? low->u.conter.expr->u.integer2 :
else if (low_kind == FFEINFO_kindtypeINTEGER4) low_kind == FFEINFO_kindtypeINTEGER3 ? low->u.conter.expr->u.integer3 :
low->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) low->u.conter.expr->u.integer4; low_kind == FFEINFO_kindtypeINTEGER4 ? low->u.conter.expr->u.integer4 :
ffeinfo_kindtype (ffebld_info (low)) = FFEINFO_kindtypeINTEGERDEFAULT; low->u.conter.expr->u.integer1), NULL);
lowbound = ffedata_eval_integer1_ (low); lowbound = ffedata_eval_integer1_ (low1);
}
else
lowbound = ffedata_eval_integer1_ (low);
} }
assert (ffeinfo_basictype (ffebld_info (high)) == FFEINFO_basictypeINTEGER); assert (ffeinfo_basictype (ffebld_info (high)) == FFEINFO_basictypeINTEGER);
/* Force to default - it's a constant expression ! */ if (ffebld_op (high) == FFEBLD_opCONTER)
hi_kind = ffeinfo_kindtype (ffebld_info (high)); {
if (hi_kind == FFEINFO_kindtypeINTEGER2) /* Force to default - it's a constant expression ! */
high->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) high->u.conter.expr->u.integer2; hi_kind = ffeinfo_kindtype (ffebld_info (high));
else if (hi_kind == FFEINFO_kindtypeINTEGER3) hi1 = ffebld_new_conter_with_orig (ffebld_constant_new_integer1_val (
high->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) high->u.conter.expr->u.integer3; hi_kind == FFEINFO_kindtypeINTEGER2 ? high->u.conter.expr->u.integer2 :
else if (hi_kind == FFEINFO_kindtypeINTEGER4) hi_kind == FFEINFO_kindtypeINTEGER3 ? high->u.conter.expr->u.integer3 :
high->u.conter.expr->u.integer1 = (ffetargetIntegerDefault) high->u.conter.expr->u.integer4; hi_kind == FFEINFO_kindtypeINTEGER4 ? high->u.conter.expr->u.integer4 :
ffeinfo_kindtype (ffebld_info (high)) = FFEINFO_kindtypeINTEGERDEFAULT; high->u.conter.expr->u.integer1), NULL);
highbound = ffedata_eval_integer1_ (high); highbound = ffedata_eval_integer1_ (hi1);
}
else
highbound = ffedata_eval_integer1_ (high);
if ((value < lowbound) || (value > highbound)) if ((value < lowbound) || (value > highbound))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment