comparison gcc/cbc-goto.h @ 7:7ff9aed93de8

partially written goto with env...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 20 Aug 2009 19:09:17 +0900
parents 983001f85155
children 959d4c8c8abc
comparison
equal deleted inserted replaced
6:983001f85155 7:7ff9aed93de8
75 int save_pending_stack_adjust = 0; 75 int save_pending_stack_adjust = 0;
76 int save_stack_pointer_delta = 0; 76 int save_stack_pointer_delta = 0;
77 rtx insns; 77 rtx insns;
78 rtx before_call, next_arg_reg; 78 rtx before_call, next_arg_reg;
79 79
80 /* for environment. */
81 rtx env_rtx;
82 tree env_tree;
83
84 // env_tree = TREE_OPERAND(exp, 2);
85 env_tree = NULL_TREE;
86
87 /* State variables we need to save and restore between 80 /* State variables we need to save and restore between
88 iterations. */ 81 iterations. */
89 save_pending_stack_adjust = pending_stack_adjust; 82 save_pending_stack_adjust = pending_stack_adjust;
90 save_stack_pointer_delta = stack_pointer_delta; 83 save_stack_pointer_delta = stack_pointer_delta;
91 flags |= ECF_SIBCALL; 84 flags |= ECF_SIBCALL;
133 (pass == 0 ? 0 126 (pass == 0 ? 0
134 : preferred_stack_boundary)); 127 : preferred_stack_boundary));
135 128
136 old_stack_allocated = stack_pointer_delta - pending_stack_adjust; 129 old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
137 130
138 /* The argument block when performing a sibling call is the
139 incoming argument block. */
140 /*
141 if ( 0 && !CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl)) )
142 {
143 argblock = virtual_outgoing_args_rtx;
144 }
145 else
146 */
147
148 if ( env_tree!=NULL_TREE )
149 {
150 /*
151 * ebp <= TREE_VALUE ( env_tree );
152 * argsp <= TREE_PURPOSE ( env_tree );
153 *
154 */
155 //rtx tmp;
156 /* compute environment. */
157 push_temp_slots ();
158 /* expand_expr shouldn't be here... it's moved later. */
159 //env_rtx = expand_expr ( env_tree, NULL_RTX,
160 //VOIDmode, EXPAND_STACK_PARM);
161 //argblock = hard_frame_pointer_rtx;
162 //argblock = env_rtx;
163 //argblock = plus_constant (argblock, -current_function_arg_offset_rtx);
164 //tmp = gen_rtx_MINUS (Pmode, hard_frame_pointer_rtx, virtual_incoming_args_rtx);
165 //argblock = gen_rtx_MINUS (Pmode, env_rtx, tmp);
166 //argblock = plus_constant (argblock, frame_offset);
167 argblock = expand_expr ( TREE_VALUE (env_tree), NULL_RTX,
168 VOIDmode, EXPAND_STACK_PARM);
169 env_rtx = expand_expr ( TREE_PURPOSE (env_tree), NULL_RTX,
170 VOIDmode, EXPAND_STACK_PARM);
171 preserve_temp_slots (argblock);
172 pop_temp_slots ();
173 }
174 else
175 {
176 //argblock = virtual_incoming_args_rtx;
177 argblock = crtl->args.internal_arg_pointer; 131 argblock = crtl->args.internal_arg_pointer;
178 132
179 argblock 133 argblock
180 #ifdef STACK_GROWS_DOWNWARD 134 #ifdef STACK_GROWS_DOWNWARD
181 = plus_constant (argblock, crtl->args.pretend_args_size); 135 = plus_constant (argblock, crtl->args.pretend_args_size);
182 #else 136 #else
183 = plus_constant (argblock, -crtl->args.pretend_args_size); 137 = plus_constant (argblock, -crtl->args.pretend_args_size);
184 #endif 138 #endif
185 }
186 139
187 140
188 stored_args_map = sbitmap_alloc (args_size->constant); 141 stored_args_map = sbitmap_alloc (args_size->constant);
189 sbitmap_zero (stored_args_map); 142 sbitmap_zero (stored_args_map);
190 143
266 /* Precompute all register parameters. It isn't safe to compute anything 219 /* Precompute all register parameters. It isn't safe to compute anything
267 once we have started filling any specific hard regs. */ 220 once we have started filling any specific hard regs. */
268 precompute_register_parameters (num_actuals, args, &reg_parm_seen); 221 precompute_register_parameters (num_actuals, args, &reg_parm_seen);
269 222
270 /* operand[2] is environment. */ 223 /* operand[2] is environment. */
271 //if (TREE_OPERAND (exp, 2)) 224 if (TREE_OPERAND (exp, 2))
272 //static_chain_value = expand_normal (TREE_OPERAND (exp, 2)); 225 static_chain_value = expand_normal (TREE_OPERAND (exp, 2));
273 //else 226 else
274 static_chain_value = 0; 227 static_chain_value = 0;
275 228
276 229
277 /* parallel assignment */ 230 /* parallel assignment */
278 store_order = alloca (num_actuals * sizeof (int)); 231 store_order = alloca (num_actuals * sizeof (int));
348 now! */ 301 now! */
349 302
350 /* Stack must be properly aligned now. */ 303 /* Stack must be properly aligned now. */
351 gcc_assert (!pass 304 gcc_assert (!pass
352 || !(stack_pointer_delta % preferred_unit_stack_boundary)); 305 || !(stack_pointer_delta % preferred_unit_stack_boundary));
353 306 #if 0
354 /* store environment. */ 307 /* store environment. */
355 if ( env_tree!=NULL ) 308 if ( env_tree!=NULL )
356 { 309 {
357 emit_insn (gen_rtx_CLOBBER (VOIDmode, 310 emit_insn (gen_rtx_CLOBBER (VOIDmode,
358 gen_rtx_MEM (BLKmode, 311 gen_rtx_MEM (BLKmode,
361 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx)); 314 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
362 //pop_temp_slots (); 315 //pop_temp_slots ();
363 316
364 emit_indirect_jump (funexp); 317 emit_indirect_jump (funexp);
365 } 318 }
319 #endif
366 320
367 /* Generate the actual call instruction. */ 321 /* Generate the actual call instruction. */
368 emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size, 322 emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size,
369 adjusted_args_size.constant, struct_value_size, 323 adjusted_args_size.constant, struct_value_size,
370 //next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage, 324 //next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,