aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-const.c
diff options
context:
space:
mode:
authorBrooks Moses <brooks.moses@codesourcery.com>2007-05-28 18:20:29 +0000
committerBrooks Moses <brooks@gcc.gnu.org>2007-05-28 11:20:29 -0700
commit20585ad66ab2455771dc13704f5a0c0f94de8ead (patch)
tree285e1933957cc1ea01f2d184aeb1656b76b6b3cb /gcc/fortran/trans-const.c
parent0258dc3a2c897ba06499af1493aac7e736adbbb9 (diff)
downloadgcc-20585ad66ab2455771dc13704f5a0c0f94de8ead.zip
gcc-20585ad66ab2455771dc13704f5a0c0f94de8ead.tar.gz
gcc-20585ad66ab2455771dc13704f5a0c0f94de8ead.tar.bz2
gfortran.h (gfc_expr): Remove from_H, add "representation" struct.
* gfortran.h (gfc_expr): Remove from_H, add "representation" struct. * primary.c (match_hollerith_constant): Store the representation of the Hollerith in representation, not in value.character. * arith.c: Add dependency on target-memory.h. (eval_intrinsic): Remove check for from_H. (hollerith2representation): New function. (gfc_hollerith2int): Determine value of the new constant. (gfc_hollerith2real): Likewise. (gfc_hollerith2complex): Likewise. (gfc_hollerith2logical): Likewise. (gfc_hollerith2character): Point both representation.string and value.character.string at the value string. * data.c (create_character_initializer): For BT_HOLLERITH rvalues, get the value from the representation rather than value.character. * expr.c (free_expr0): Update handling of BT_HOLLERITH values and values with representation.string. (gfc_copy_expr): Likewise. * intrinsic.c (do_simplify): Remove special treatement of variables resulting from Hollerith constants. * dump-parse-trees.c (gfc_show_expr): Update handling of Holleriths. * trans-const.c (gfc_conv_constant_to_tree): Replace from_H check with check for representation.string; get Hollerith representation from representation.string, not value.character. * trans-expr.c (is_zero_initializer_p): Replace from_H check with check for representation.string. * trans-stmt.c (gfc_trans_integer_select): Use gfc_conv_mpz_to_tree for case values, so as to avoid picking up the memory representation if the case is given by a transfer expression. * target-memory.c (gfc_target_encode_expr): Use the known memory representation rather than the value, if it exists. (gfc_target_interpret_expr): Store the memory representation of the interpreted expression as well as its value. (interpret_integer): Move to gfc_interpret_integer, make non-static. (interpret_float): Move to gfc_interpret_float, make non-static. (interpret_complex): Move to gfc_interpret_complex, make non-static. (interpret_logical): Move to gfc_interpret_logical, make non-static. (interpret_character): Move to gfc_interpret_character, make non-static. (interpret_derived): Move to gfc_interpret_derived, make non-static. * target-memory.h: Add prototypes for newly-exported gfc_interpret_* functions. From-SVN: r125135
Diffstat (limited to 'gcc/fortran/trans-const.c')
-rw-r--r--gcc/fortran/trans-const.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 435d5ec..24aa809 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -209,45 +209,45 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
{
gcc_assert (expr->expr_type == EXPR_CONSTANT);
- /* If it is converted from Hollerith constant, we build string constant
- and VIEW_CONVERT to its type. */
+ /* If it is has a prescribed memory representation, we build a string
+ constant and VIEW_CONVERT to its type. */
switch (expr->ts.type)
{
case BT_INTEGER:
- if (expr->from_H)
+ if (expr->representation.string)
return build1 (VIEW_CONVERT_EXPR,
gfc_get_int_type (expr->ts.kind),
- gfc_build_string_const (expr->value.character.length,
- expr->value.character.string));
+ gfc_build_string_const (expr->representation.length,
+ expr->representation.string));
else
return gfc_conv_mpz_to_tree (expr->value.integer, expr->ts.kind);
case BT_REAL:
- if (expr->from_H)
+ if (expr->representation.string)
return build1 (VIEW_CONVERT_EXPR,
gfc_get_real_type (expr->ts.kind),
- gfc_build_string_const (expr->value.character.length,
- expr->value.character.string));
+ gfc_build_string_const (expr->representation.length,
+ expr->representation.string));
else
return gfc_conv_mpfr_to_tree (expr->value.real, expr->ts.kind);
case BT_LOGICAL:
- if (expr->from_H)
+ if (expr->representation.string)
return build1 (VIEW_CONVERT_EXPR,
gfc_get_logical_type (expr->ts.kind),
- gfc_build_string_const (expr->value.character.length,
- expr->value.character.string));
+ gfc_build_string_const (expr->representation.length,
+ expr->representation.string));
else
return build_int_cst (gfc_get_logical_type (expr->ts.kind),
expr->value.logical);
case BT_COMPLEX:
- if (expr->from_H)
+ if (expr->representation.string)
return build1 (VIEW_CONVERT_EXPR,
gfc_get_complex_type (expr->ts.kind),
- gfc_build_string_const (expr->value.character.length,
- expr->value.character.string));
+ gfc_build_string_const (expr->representation.length,
+ expr->representation.string));
else
{
tree real = gfc_conv_mpfr_to_tree (expr->value.complex.r,
@@ -260,10 +260,13 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
}
case BT_CHARACTER:
- case BT_HOLLERITH:
return gfc_build_string_const (expr->value.character.length,
expr->value.character.string);
+ case BT_HOLLERITH:
+ return gfc_build_string_const (expr->representation.length,
+ expr->representation.string);
+
default:
fatal_error ("gfc_conv_constant_to_tree(): invalid type: %s",
gfc_typename (&expr->ts));