Changeset 183
- Timestamp:
- 05/20/07 15:09:11 (2 years ago)
- Files:
-
- trunk/gcc/gcc/algol60/Make-lang.in (modified) (1 diff)
- trunk/gcc/gcc/algol60/al60l-bind.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/gcc/gcc/algol60/Make-lang.in
r166 r183 91 91 algol60/label.h algol60/symbol.h algol60/type.h algol60/statement.h\ 92 92 algol60/expression.h algol60/for-elmt.h algol60/for-elmt.i\ 93 algol60/cursor.h algol60/cursor.i\ 93 94 algol60/statement.i algol60/expression.i algol60/desig-expr.i\ 94 95 algol60/type.i algol60/symbol.i\ trunk/gcc/gcc/algol60/al60l-bind.c
r182 r183 41 41 #include "visitor.h" 42 42 #include "a60_symtab.h" 43 #include "cursor.h" 43 44 44 45 struct struct_al60l_bind_state_t … … 544 545 // ------------------------------------ 545 546 547 static void 548 private_set_location (tree node, cursor_t * cursor) 549 { 550 if (cursor == NULL) 551 return; 552 553 location_t loc; 554 cursor_to_loc (cursor, &loc); 555 SET_EXPR_LOCATION (node, loc); 556 } 557 546 558 tree 547 559 stmt_build_generic (statement_t * statement, al60l_bind_state_t * state) 548 560 { 549 return (tree)a60_visitor_dispatch (state->statement_build_generic, statement, statement, state); 561 tree ret = a60_visitor_dispatch (state->statement_build_generic, statement, statement, state); 562 private_set_location (ret, stmt_cursor (statement)); 563 return ret; 550 564 } 551 565 … … 877 891 int len = estr_length (s) + 1; // +1 for trailing zero 878 892 tree ret = build_string_literal (len, estr_cstr (s)); 893 private_set_location (ret, expr_cursor (self)); 879 894 return ret; 880 895 } … … 909 924 tree expf = expr_build_generic (expr_if_falseb (self), data); 910 925 tree ret = build3 (COND_EXPR, ttt, cond, expt, expf); 926 private_set_location (ret, expr_cursor (self)); 911 927 return ret; 912 928 } … … 920 936 tree op2 = expr_build_generic (expr_binary_right (self), data); 921 937 tree ret = build2 (op, ttt, op1, op2); 938 private_set_location (ret, expr_cursor (self)); 922 939 return ret; 923 940 } … … 930 947 tree op1 = expr_build_generic (expr_unary_operand (self), data); 931 948 tree ret = build1 (op, ttt, op1); 949 private_set_location (ret, expr_cursor (self)); 932 950 return ret; 933 951 } … … 936 954 private_expr_build_ardiv (expression_t * self, void * data) 937 955 { 938 tree exp= private_expr_build_binary_generic (self, data, RDIV_EXPR);956 tree ret = private_expr_build_binary_generic (self, data, RDIV_EXPR); 939 957 // int / int also yields real. We must cast the operands explicitly 940 958 // to allow for this. 941 959 if (types_same (expr_type (expr_binary_left (self)), type_int ())) 942 960 { 943 tree tmp = TREE_OPERAND ( exp, 0);944 TREE_OPERAND ( exp, 0) = build1 (FLOAT_EXPR, TREE_TYPE (exp), tmp);961 tree tmp = TREE_OPERAND (ret, 0); 962 TREE_OPERAND (ret, 0) = build1 (FLOAT_EXPR, TREE_TYPE (ret), tmp); 945 963 } 946 964 947 965 if (types_same (expr_type (expr_binary_right (self)), type_int ())) 948 966 { 949 tree tmp = TREE_OPERAND (exp, 1); 950 TREE_OPERAND (exp, 1) = build1 (FLOAT_EXPR, TREE_TYPE (exp), tmp); 951 } 952 953 return exp; 967 tree tmp = TREE_OPERAND (ret, 1); 968 TREE_OPERAND (ret, 1) = build1 (FLOAT_EXPR, TREE_TYPE (ret), tmp); 969 } 970 971 private_set_location (ret, expr_cursor (self)); 972 return ret; 954 973 } 955 974 … … 1000 1019 expression_t * e = new_expr_call_sym (c, l, args, sym); 1001 1020 1002 return expr_build_generic (e, data); 1021 tree ret = expr_build_generic (e, data); 1022 private_set_location (ret, expr_cursor (self)); 1023 return ret; 1003 1024 } 1004 1025 … … 1011 1032 expression_t * e1 = new_expr_unary (c, euk_not, expr_binary_left (self)); 1012 1033 expression_t * e2 = new_expr_binary (c, ebk_lor, e1, expr_binary_right (self)); 1013 return expr_build_generic (e2, data); 1034 tree ret = expr_build_generic (e2, data); 1035 private_set_location (ret, expr_cursor (self)); 1036 return ret; 1014 1037 } 1015 1038 … … 1054 1077 { 1055 1078 case euk_uminus: 1056 return private_expr_build_unary_generic (self, data, NEGATE_EXPR);1079 return private_expr_build_unary_generic (self, data, NEGATE_EXPR); 1057 1080 case euk_not: 1058 return private_expr_build_unary_generic (self, data, TRUTH_NOT_EXPR);1081 return private_expr_build_unary_generic (self, data, TRUTH_NOT_EXPR); 1059 1082 }; 1060 1083 gcc_unreachable (); … … 1081 1104 arg_list = nreverse (arg_list); 1082 1105 1083 tree call_expr = build_function_call_expr (proc_decl, arg_list); 1084 TREE_SIDE_EFFECTS (call_expr) = 1; 1085 TREE_USED (call_expr) = 1; 1086 1087 return call_expr; 1106 tree ret = build_function_call_expr (proc_decl, arg_list); 1107 TREE_SIDE_EFFECTS (ret) = 1; 1108 TREE_USED (ret) = 1; 1109 1110 private_set_location (ret, expr_cursor (self)); 1111 return ret; 1088 1112 } 1089 1113 … … 1092 1116 { 1093 1117 symbol_t * sym = expr_symbol (self); 1094 tree array= symbol_extra (sym);1118 tree ret = symbol_extra (sym); 1095 1119 type_t * t = symbol_type (sym); 1096 gcc_assert ( array!= NULL);1120 gcc_assert (ret != NULL); 1097 1121 gcc_assert (t != NULL); 1098 1122 … … 1104 1128 t = type_host (t); 1105 1129 tree type = type_build_generic (t, data); 1106 array = build4 (ARRAY_REF, type, array, idx_tree, NULL_TREE, NULL_TREE);1130 ret = build4 (ARRAY_REF, type, ret, idx_tree, NULL_TREE, NULL_TREE); 1107 1131 } 1108 1132 delete_slist_it (it); 1109 1133 1110 return array; 1134 private_set_location (ret, expr_cursor (self)); 1135 return ret; 1111 1136 } 1112 1137
