1 | /* Emit RTL for the GNU C-Compiler expander. |
---|
2 | Copyright (C) 1987, 88, 92-97, 1998 Free Software Foundation, Inc. |
---|
3 | |
---|
4 | This file is part of GNU CC. |
---|
5 | |
---|
6 | GNU CC is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | GNU CC is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with GNU CC; see the file COPYING. If not, write to |
---|
18 | the Free Software Foundation, 59 Temple Place - Suite 330, |
---|
19 | Boston, MA 02111-1307, USA. */ |
---|
20 | |
---|
21 | |
---|
22 | /* Middle-to-low level generation of rtx code and insns. |
---|
23 | |
---|
24 | This file contains the functions `gen_rtx', `gen_reg_rtx' |
---|
25 | and `gen_label_rtx' that are the usual ways of creating rtl |
---|
26 | expressions for most purposes. |
---|
27 | |
---|
28 | It also has the functions for creating insns and linking |
---|
29 | them in the doubly-linked chain. |
---|
30 | |
---|
31 | The patterns of the insns are created by machine-dependent |
---|
32 | routines in insn-emit.c, which is generated automatically from |
---|
33 | the machine description. These routines use `gen_rtx' to make |
---|
34 | the individual rtx's of the pattern; what is machine dependent |
---|
35 | is the kind of rtx's they make and what arguments they use. */ |
---|
36 | |
---|
37 | #include "config.h" |
---|
38 | #include <stdio.h> |
---|
39 | #ifdef __STDC__ |
---|
40 | #include <stdarg.h> |
---|
41 | #else |
---|
42 | #include <varargs.h> |
---|
43 | #endif |
---|
44 | #include "rtl.h" |
---|
45 | #include "tree.h" |
---|
46 | #include "flags.h" |
---|
47 | #include "except.h" |
---|
48 | #include "function.h" |
---|
49 | #include "expr.h" |
---|
50 | #include "regs.h" |
---|
51 | #include "hard-reg-set.h" |
---|
52 | #include "insn-config.h" |
---|
53 | #include "recog.h" |
---|
54 | #include "real.h" |
---|
55 | #include "obstack.h" |
---|
56 | |
---|
57 | #include "bytecode.h" |
---|
58 | #include "machmode.h" |
---|
59 | #include "bc-opcode.h" |
---|
60 | #include "bc-typecd.h" |
---|
61 | #include "bc-optab.h" |
---|
62 | #include "bc-emit.h" |
---|
63 | |
---|
64 | /* Opcode names */ |
---|
65 | #ifdef BCDEBUG_PRINT_CODE |
---|
66 | char *opcode_name[] = |
---|
67 | { |
---|
68 | #include "bc-opname.h" |
---|
69 | |
---|
70 | "***END***" |
---|
71 | }; |
---|
72 | #endif |
---|
73 | |
---|
74 | |
---|
75 | /* Commonly used modes. */ |
---|
76 | |
---|
77 | enum machine_mode byte_mode; /* Mode whose width is BITS_PER_UNIT. */ |
---|
78 | enum machine_mode word_mode; /* Mode whose width is BITS_PER_WORD. */ |
---|
79 | enum machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */ |
---|
80 | |
---|
81 | /* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function. |
---|
82 | After rtl generation, it is 1 plus the largest register number used. */ |
---|
83 | |
---|
84 | int reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; |
---|
85 | |
---|
86 | /* This is *not* reset after each function. It gives each CODE_LABEL |
---|
87 | in the entire compilation a unique label number. */ |
---|
88 | |
---|
89 | static int label_num = 1; |
---|
90 | |
---|
91 | /* Lowest label number in current function. */ |
---|
92 | |
---|
93 | static int first_label_num; |
---|
94 | |
---|
95 | /* Highest label number in current function. |
---|
96 | Zero means use the value of label_num instead. |
---|
97 | This is nonzero only when belatedly compiling an inline function. */ |
---|
98 | |
---|
99 | static int last_label_num; |
---|
100 | |
---|
101 | /* Value label_num had when set_new_first_and_last_label_number was called. |
---|
102 | If label_num has not changed since then, last_label_num is valid. */ |
---|
103 | |
---|
104 | static int base_label_num; |
---|
105 | |
---|
106 | /* Nonzero means do not generate NOTEs for source line numbers. */ |
---|
107 | |
---|
108 | static int no_line_numbers; |
---|
109 | |
---|
110 | /* Commonly used rtx's, so that we only need space for one copy. |
---|
111 | These are initialized once for the entire compilation. |
---|
112 | All of these except perhaps the floating-point CONST_DOUBLEs |
---|
113 | are unique; no other rtx-object will be equal to any of these. */ |
---|
114 | |
---|
115 | rtx pc_rtx; /* (PC) */ |
---|
116 | rtx cc0_rtx; /* (CC0) */ |
---|
117 | rtx cc1_rtx; /* (CC1) (not actually used nowadays) */ |
---|
118 | rtx const0_rtx; /* (CONST_INT 0) */ |
---|
119 | rtx const1_rtx; /* (CONST_INT 1) */ |
---|
120 | rtx const2_rtx; /* (CONST_INT 2) */ |
---|
121 | rtx constm1_rtx; /* (CONST_INT -1) */ |
---|
122 | rtx const_true_rtx; /* (CONST_INT STORE_FLAG_VALUE) */ |
---|
123 | |
---|
124 | /* We record floating-point CONST_DOUBLEs in each floating-point mode for |
---|
125 | the values of 0, 1, and 2. For the integer entries and VOIDmode, we |
---|
126 | record a copy of const[012]_rtx. */ |
---|
127 | |
---|
128 | rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE]; |
---|
129 | |
---|
130 | REAL_VALUE_TYPE dconst0; |
---|
131 | REAL_VALUE_TYPE dconst1; |
---|
132 | REAL_VALUE_TYPE dconst2; |
---|
133 | REAL_VALUE_TYPE dconstm1; |
---|
134 | |
---|
135 | /* All references to the following fixed hard registers go through |
---|
136 | these unique rtl objects. On machines where the frame-pointer and |
---|
137 | arg-pointer are the same register, they use the same unique object. |
---|
138 | |
---|
139 | After register allocation, other rtl objects which used to be pseudo-regs |
---|
140 | may be clobbered to refer to the frame-pointer register. |
---|
141 | But references that were originally to the frame-pointer can be |
---|
142 | distinguished from the others because they contain frame_pointer_rtx. |
---|
143 | |
---|
144 | When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little |
---|
145 | tricky: until register elimination has taken place hard_frame_pointer_rtx |
---|
146 | should be used if it is being set, and frame_pointer_rtx otherwise. After |
---|
147 | register elimination hard_frame_pointer_rtx should always be used. |
---|
148 | On machines where the two registers are same (most) then these are the |
---|
149 | same. |
---|
150 | |
---|
151 | In an inline procedure, the stack and frame pointer rtxs may not be |
---|
152 | used for anything else. */ |
---|
153 | rtx stack_pointer_rtx; /* (REG:Pmode STACK_POINTER_REGNUM) */ |
---|
154 | rtx frame_pointer_rtx; /* (REG:Pmode FRAME_POINTER_REGNUM) */ |
---|
155 | rtx hard_frame_pointer_rtx; /* (REG:Pmode HARD_FRAME_POINTER_REGNUM) */ |
---|
156 | rtx arg_pointer_rtx; /* (REG:Pmode ARG_POINTER_REGNUM) */ |
---|
157 | rtx struct_value_rtx; /* (REG:Pmode STRUCT_VALUE_REGNUM) */ |
---|
158 | rtx struct_value_incoming_rtx; /* (REG:Pmode STRUCT_VALUE_INCOMING_REGNUM) */ |
---|
159 | rtx static_chain_rtx; /* (REG:Pmode STATIC_CHAIN_REGNUM) */ |
---|
160 | rtx static_chain_incoming_rtx; /* (REG:Pmode STATIC_CHAIN_INCOMING_REGNUM) */ |
---|
161 | rtx pic_offset_table_rtx; /* (REG:Pmode PIC_OFFSET_TABLE_REGNUM) */ |
---|
162 | |
---|
163 | /* This is used to implement __builtin_return_address for some machines. |
---|
164 | See for instance the MIPS port. */ |
---|
165 | rtx return_address_pointer_rtx; /* (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM) */ |
---|
166 | |
---|
167 | rtx virtual_incoming_args_rtx; /* (REG:Pmode VIRTUAL_INCOMING_ARGS_REGNUM) */ |
---|
168 | rtx virtual_stack_vars_rtx; /* (REG:Pmode VIRTUAL_STACK_VARS_REGNUM) */ |
---|
169 | rtx virtual_stack_dynamic_rtx; /* (REG:Pmode VIRTUAL_STACK_DYNAMIC_REGNUM) */ |
---|
170 | rtx virtual_outgoing_args_rtx; /* (REG:Pmode VIRTUAL_OUTGOING_ARGS_REGNUM) */ |
---|
171 | |
---|
172 | /* We make one copy of (const_int C) where C is in |
---|
173 | [- MAX_SAVED_CONST_INT, MAX_SAVED_CONST_INT] |
---|
174 | to save space during the compilation and simplify comparisons of |
---|
175 | integers. */ |
---|
176 | |
---|
177 | #define MAX_SAVED_CONST_INT 64 |
---|
178 | |
---|
179 | static rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1]; |
---|
180 | |
---|
181 | /* The ends of the doubly-linked chain of rtl for the current function. |
---|
182 | Both are reset to null at the start of rtl generation for the function. |
---|
183 | |
---|
184 | start_sequence saves both of these on `sequence_stack' along with |
---|
185 | `sequence_rtl_expr' and then starts a new, nested sequence of insns. */ |
---|
186 | |
---|
187 | static rtx first_insn = NULL; |
---|
188 | static rtx last_insn = NULL; |
---|
189 | |
---|
190 | /* RTL_EXPR within which the current sequence will be placed. Use to |
---|
191 | prevent reuse of any temporaries within the sequence until after the |
---|
192 | RTL_EXPR is emitted. */ |
---|
193 | |
---|
194 | tree sequence_rtl_expr = NULL; |
---|
195 | |
---|
196 | /* INSN_UID for next insn emitted. |
---|
197 | Reset to 1 for each function compiled. */ |
---|
198 | |
---|
199 | static int cur_insn_uid = 1; |
---|
200 | |
---|
201 | /* Line number and source file of the last line-number NOTE emitted. |
---|
202 | This is used to avoid generating duplicates. */ |
---|
203 | |
---|
204 | static int last_linenum = 0; |
---|
205 | static char *last_filename = 0; |
---|
206 | |
---|
207 | /* A vector indexed by pseudo reg number. The allocated length |
---|
208 | of this vector is regno_pointer_flag_length. Since this |
---|
209 | vector is needed during the expansion phase when the total |
---|
210 | number of registers in the function is not yet known, |
---|
211 | it is copied and made bigger when necessary. */ |
---|
212 | |
---|
213 | char *regno_pointer_flag; |
---|
214 | int regno_pointer_flag_length; |
---|
215 | |
---|
216 | /* Indexed by pseudo register number, if nonzero gives the known alignment |
---|
217 | for that pseudo (if regno_pointer_flag is set). |
---|
218 | Allocated in parallel with regno_pointer_flag. */ |
---|
219 | char *regno_pointer_align; |
---|
220 | |
---|
221 | /* Indexed by pseudo register number, gives the rtx for that pseudo. |
---|
222 | Allocated in parallel with regno_pointer_flag. */ |
---|
223 | |
---|
224 | rtx *regno_reg_rtx; |
---|
225 | |
---|
226 | /* Stack of pending (incomplete) sequences saved by `start_sequence'. |
---|
227 | Each element describes one pending sequence. |
---|
228 | The main insn-chain is saved in the last element of the chain, |
---|
229 | unless the chain is empty. */ |
---|
230 | |
---|
231 | struct sequence_stack *sequence_stack; |
---|
232 | |
---|
233 | /* start_sequence and gen_sequence can make a lot of rtx expressions which are |
---|
234 | shortly thrown away. We use two mechanisms to prevent this waste: |
---|
235 | |
---|
236 | First, we keep a list of the expressions used to represent the sequence |
---|
237 | stack in sequence_element_free_list. |
---|
238 | |
---|
239 | Second, for sizes up to 5 elements, we keep a SEQUENCE and its associated |
---|
240 | rtvec for use by gen_sequence. One entry for each size is sufficient |
---|
241 | because most cases are calls to gen_sequence followed by immediately |
---|
242 | emitting the SEQUENCE. Reuse is safe since emitting a sequence is |
---|
243 | destructive on the insn in it anyway and hence can't be redone. |
---|
244 | |
---|
245 | We do not bother to save this cached data over nested function calls. |
---|
246 | Instead, we just reinitialize them. */ |
---|
247 | |
---|
248 | #define SEQUENCE_RESULT_SIZE 5 |
---|
249 | |
---|
250 | static struct sequence_stack *sequence_element_free_list; |
---|
251 | static rtx sequence_result[SEQUENCE_RESULT_SIZE]; |
---|
252 | |
---|
253 | /* During RTL generation, we also keep a list of free INSN rtl codes. */ |
---|
254 | static rtx free_insn; |
---|
255 | |
---|
256 | extern int rtx_equal_function_value_matters; |
---|
257 | |
---|
258 | /* Filename and line number of last line-number note, |
---|
259 | whether we actually emitted it or not. */ |
---|
260 | extern char *emit_filename; |
---|
261 | extern int emit_lineno; |
---|
262 | |
---|
263 | static rtx make_jump_insn_raw PROTO((rtx)); |
---|
264 | static rtx make_call_insn_raw PROTO((rtx)); |
---|
265 | static rtx find_line_node PROTO((rtx)); |
---|
266 | |
---|
267 | /* rtx gen_rtx (code, mode, [element1, ..., elementn]) |
---|
268 | ** |
---|
269 | ** This routine generates an RTX of the size specified by |
---|
270 | ** <code>, which is an RTX code. The RTX structure is initialized |
---|
271 | ** from the arguments <element1> through <elementn>, which are |
---|
272 | ** interpreted according to the specific RTX type's format. The |
---|
273 | ** special machine mode associated with the rtx (if any) is specified |
---|
274 | ** in <mode>. |
---|
275 | ** |
---|
276 | ** gen_rtx can be invoked in a way which resembles the lisp-like |
---|
277 | ** rtx it will generate. For example, the following rtx structure: |
---|
278 | ** |
---|
279 | ** (plus:QI (mem:QI (reg:SI 1)) |
---|
280 | ** (mem:QI (plusw:SI (reg:SI 2) (reg:SI 3)))) |
---|
281 | ** |
---|
282 | ** ...would be generated by the following C code: |
---|
283 | ** |
---|
284 | ** gen_rtx (PLUS, QImode, |
---|
285 | ** gen_rtx (MEM, QImode, |
---|
286 | ** gen_rtx (REG, SImode, 1)), |
---|
287 | ** gen_rtx (MEM, QImode, |
---|
288 | ** gen_rtx (PLUS, SImode, |
---|
289 | ** gen_rtx (REG, SImode, 2), |
---|
290 | ** gen_rtx (REG, SImode, 3)))), |
---|
291 | */ |
---|
292 | |
---|
293 | /*VARARGS2*/ |
---|
294 | rtx |
---|
295 | gen_rtx VPROTO((enum rtx_code code, enum machine_mode mode, ...)) |
---|
296 | { |
---|
297 | #ifndef __STDC__ |
---|
298 | enum rtx_code code; |
---|
299 | enum machine_mode mode; |
---|
300 | #endif |
---|
301 | va_list p; |
---|
302 | register int i; /* Array indices... */ |
---|
303 | register char *fmt; /* Current rtx's format... */ |
---|
304 | register rtx rt_val; /* RTX to return to caller... */ |
---|
305 | |
---|
306 | VA_START (p, mode); |
---|
307 | |
---|
308 | #ifndef __STDC__ |
---|
309 | code = va_arg (p, enum rtx_code); |
---|
310 | mode = va_arg (p, enum machine_mode); |
---|
311 | #endif |
---|
312 | |
---|
313 | if (code == CONST_INT) |
---|
314 | { |
---|
315 | HOST_WIDE_INT arg = va_arg (p, HOST_WIDE_INT); |
---|
316 | |
---|
317 | if (arg >= - MAX_SAVED_CONST_INT && arg <= MAX_SAVED_CONST_INT) |
---|
318 | return const_int_rtx[arg + MAX_SAVED_CONST_INT]; |
---|
319 | |
---|
320 | if (const_true_rtx && arg == STORE_FLAG_VALUE) |
---|
321 | return const_true_rtx; |
---|
322 | |
---|
323 | rt_val = rtx_alloc (code); |
---|
324 | INTVAL (rt_val) = arg; |
---|
325 | } |
---|
326 | else if (code == REG) |
---|
327 | { |
---|
328 | int regno = va_arg (p, int); |
---|
329 | |
---|
330 | /* In case the MD file explicitly references the frame pointer, have |
---|
331 | all such references point to the same frame pointer. This is used |
---|
332 | during frame pointer elimination to distinguish the explicit |
---|
333 | references to these registers from pseudos that happened to be |
---|
334 | assigned to them. |
---|
335 | |
---|
336 | If we have eliminated the frame pointer or arg pointer, we will |
---|
337 | be using it as a normal register, for example as a spill register. |
---|
338 | In such cases, we might be accessing it in a mode that is not |
---|
339 | Pmode and therefore cannot use the pre-allocated rtx. |
---|
340 | |
---|
341 | Also don't do this when we are making new REGs in reload, |
---|
342 | since we don't want to get confused with the real pointers. */ |
---|
343 | |
---|
344 | if (frame_pointer_rtx && regno == FRAME_POINTER_REGNUM && mode == Pmode |
---|
345 | && ! reload_in_progress) |
---|
346 | return frame_pointer_rtx; |
---|
347 | #if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM |
---|
348 | if (hard_frame_pointer_rtx && regno == HARD_FRAME_POINTER_REGNUM |
---|
349 | && mode == Pmode && ! reload_in_progress) |
---|
350 | return hard_frame_pointer_rtx; |
---|
351 | #endif |
---|
352 | #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM && HARD_FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM |
---|
353 | if (arg_pointer_rtx && regno == ARG_POINTER_REGNUM && mode == Pmode |
---|
354 | && ! reload_in_progress) |
---|
355 | return arg_pointer_rtx; |
---|
356 | #endif |
---|
357 | #ifdef RETURN_ADDRESS_POINTER_REGNUM |
---|
358 | if (return_address_pointer_rtx && regno == RETURN_ADDRESS_POINTER_REGNUM |
---|
359 | && mode == Pmode && ! reload_in_progress) |
---|
360 | return return_address_pointer_rtx; |
---|
361 | #endif |
---|
362 | if (stack_pointer_rtx && regno == STACK_POINTER_REGNUM && mode == Pmode |
---|
363 | && ! reload_in_progress) |
---|
364 | return stack_pointer_rtx; |
---|
365 | else |
---|
366 | { |
---|
367 | rt_val = rtx_alloc (code); |
---|
368 | rt_val->mode = mode; |
---|
369 | REGNO (rt_val) = regno; |
---|
370 | return rt_val; |
---|
371 | } |
---|
372 | } |
---|
373 | else |
---|
374 | { |
---|
375 | rt_val = rtx_alloc (code); /* Allocate the storage space. */ |
---|
376 | rt_val->mode = mode; /* Store the machine mode... */ |
---|
377 | |
---|
378 | fmt = GET_RTX_FORMAT (code); /* Find the right format... */ |
---|
379 | for (i = 0; i < GET_RTX_LENGTH (code); i++) |
---|
380 | { |
---|
381 | switch (*fmt++) |
---|
382 | { |
---|
383 | case '0': /* Unused field. */ |
---|
384 | break; |
---|
385 | |
---|
386 | case 'i': /* An integer? */ |
---|
387 | XINT (rt_val, i) = va_arg (p, int); |
---|
388 | break; |
---|
389 | |
---|
390 | case 'w': /* A wide integer? */ |
---|
391 | XWINT (rt_val, i) = va_arg (p, HOST_WIDE_INT); |
---|
392 | break; |
---|
393 | |
---|
394 | case 's': /* A string? */ |
---|
395 | XSTR (rt_val, i) = va_arg (p, char *); |
---|
396 | break; |
---|
397 | |
---|
398 | case 'e': /* An expression? */ |
---|
399 | case 'u': /* An insn? Same except when printing. */ |
---|
400 | XEXP (rt_val, i) = va_arg (p, rtx); |
---|
401 | break; |
---|
402 | |
---|
403 | case 'E': /* An RTX vector? */ |
---|
404 | XVEC (rt_val, i) = va_arg (p, rtvec); |
---|
405 | break; |
---|
406 | |
---|
407 | default: |
---|
408 | abort (); |
---|
409 | } |
---|
410 | } |
---|
411 | } |
---|
412 | va_end (p); |
---|
413 | return rt_val; /* Return the new RTX... */ |
---|
414 | } |
---|
415 | |
---|
416 | /* gen_rtvec (n, [rt1, ..., rtn]) |
---|
417 | ** |
---|
418 | ** This routine creates an rtvec and stores within it the |
---|
419 | ** pointers to rtx's which are its arguments. |
---|
420 | */ |
---|
421 | |
---|
422 | /*VARARGS1*/ |
---|
423 | rtvec |
---|
424 | gen_rtvec VPROTO((int n, ...)) |
---|
425 | { |
---|
426 | #ifndef __STDC__ |
---|
427 | int n; |
---|
428 | #endif |
---|
429 | int i; |
---|
430 | va_list p; |
---|
431 | rtx *vector; |
---|
432 | |
---|
433 | VA_START (p, n); |
---|
434 | |
---|
435 | #ifndef __STDC__ |
---|
436 | n = va_arg (p, int); |
---|
437 | #endif |
---|
438 | |
---|
439 | if (n == 0) |
---|
440 | return NULL_RTVEC; /* Don't allocate an empty rtvec... */ |
---|
441 | |
---|
442 | vector = (rtx *) alloca (n * sizeof (rtx)); |
---|
443 | |
---|
444 | for (i = 0; i < n; i++) |
---|
445 | vector[i] = va_arg (p, rtx); |
---|
446 | va_end (p); |
---|
447 | |
---|
448 | return gen_rtvec_v (n, vector); |
---|
449 | } |
---|
450 | |
---|
451 | rtvec |
---|
452 | gen_rtvec_v (n, argp) |
---|
453 | int n; |
---|
454 | rtx *argp; |
---|
455 | { |
---|
456 | register int i; |
---|
457 | register rtvec rt_val; |
---|
458 | |
---|
459 | if (n == 0) |
---|
460 | return NULL_RTVEC; /* Don't allocate an empty rtvec... */ |
---|
461 | |
---|
462 | rt_val = rtvec_alloc (n); /* Allocate an rtvec... */ |
---|
463 | |
---|
464 | for (i = 0; i < n; i++) |
---|
465 | rt_val->elem[i].rtx = *argp++; |
---|
466 | |
---|
467 | return rt_val; |
---|
468 | } |
---|
469 | |
---|
470 | rtvec |
---|
471 | gen_rtvec_vv (n, argp) |
---|
472 | int n; |
---|
473 | rtunion *argp; |
---|
474 | { |
---|
475 | register int i; |
---|
476 | register rtvec rt_val; |
---|
477 | |
---|
478 | if (n == 0) |
---|
479 | return NULL_RTVEC; /* Don't allocate an empty rtvec... */ |
---|
480 | |
---|
481 | rt_val = rtvec_alloc (n); /* Allocate an rtvec... */ |
---|
482 | |
---|
483 | for (i = 0; i < n; i++) |
---|
484 | rt_val->elem[i].rtx = (argp++)->rtx; |
---|
485 | |
---|
486 | return rt_val; |
---|
487 | } |
---|
488 | |
---|
489 | /* Generate a REG rtx for a new pseudo register of mode MODE. |
---|
490 | This pseudo is assigned the next sequential register number. */ |
---|
491 | |
---|
492 | rtx |
---|
493 | gen_reg_rtx (mode) |
---|
494 | enum machine_mode mode; |
---|
495 | { |
---|
496 | register rtx val; |
---|
497 | |
---|
498 | /* Don't let anything called by or after reload create new registers |
---|
499 | (actually, registers can't be created after flow, but this is a good |
---|
500 | approximation). */ |
---|
501 | |
---|
502 | if (reload_in_progress || reload_completed) |
---|
503 | abort (); |
---|
504 | |
---|
505 | if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT |
---|
506 | || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT) |
---|
507 | { |
---|
508 | /* For complex modes, don't make a single pseudo. |
---|
509 | Instead, make a CONCAT of two pseudos. |
---|
510 | This allows noncontiguous allocation of the real and imaginary parts, |
---|
511 | which makes much better code. Besides, allocating DCmode |
---|
512 | pseudos overstrains reload on some machines like the 386. */ |
---|
513 | rtx realpart, imagpart; |
---|
514 | int size = GET_MODE_UNIT_SIZE (mode); |
---|
515 | enum machine_mode partmode |
---|
516 | = mode_for_size (size * BITS_PER_UNIT, |
---|
517 | (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT |
---|
518 | ? MODE_FLOAT : MODE_INT), |
---|
519 | 0); |
---|
520 | |
---|
521 | realpart = gen_reg_rtx (partmode); |
---|
522 | imagpart = gen_reg_rtx (partmode); |
---|
523 | return gen_rtx (CONCAT, mode, realpart, imagpart); |
---|
524 | } |
---|
525 | |
---|
526 | /* Make sure regno_pointer_flag and regno_reg_rtx are large |
---|
527 | enough to have an element for this pseudo reg number. */ |
---|
528 | |
---|
529 | if (reg_rtx_no == regno_pointer_flag_length) |
---|
530 | { |
---|
531 | rtx *new1; |
---|
532 | char *new = |
---|
533 | (char *) savealloc (regno_pointer_flag_length * 2); |
---|
534 | bcopy (regno_pointer_flag, new, regno_pointer_flag_length); |
---|
535 | bzero (&new[regno_pointer_flag_length], regno_pointer_flag_length); |
---|
536 | regno_pointer_flag = new; |
---|
537 | |
---|
538 | new = (char *) savealloc (regno_pointer_flag_length * 2); |
---|
539 | bcopy (regno_pointer_align, new, regno_pointer_flag_length); |
---|
540 | bzero (&new[regno_pointer_flag_length], regno_pointer_flag_length); |
---|
541 | regno_pointer_align = new; |
---|
542 | |
---|
543 | new1 = (rtx *) savealloc (regno_pointer_flag_length * 2 * sizeof (rtx)); |
---|
544 | bcopy ((char *) regno_reg_rtx, (char *) new1, |
---|
545 | regno_pointer_flag_length * sizeof (rtx)); |
---|
546 | bzero ((char *) &new1[regno_pointer_flag_length], |
---|
547 | regno_pointer_flag_length * sizeof (rtx)); |
---|
548 | regno_reg_rtx = new1; |
---|
549 | |
---|
550 | regno_pointer_flag_length *= 2; |
---|
551 | } |
---|
552 | |
---|
553 | val = gen_rtx (REG, mode, reg_rtx_no); |
---|
554 | regno_reg_rtx[reg_rtx_no++] = val; |
---|
555 | return val; |
---|
556 | } |
---|
557 | |
---|
558 | /* Identify REG (which may be a CONCAT) as a user register. */ |
---|
559 | |
---|
560 | void |
---|
561 | mark_user_reg (reg) |
---|
562 | rtx reg; |
---|
563 | { |
---|
564 | if (GET_CODE (reg) == CONCAT) |
---|
565 | { |
---|
566 | REG_USERVAR_P (XEXP (reg, 0)) = 1; |
---|
567 | REG_USERVAR_P (XEXP (reg, 1)) = 1; |
---|
568 | } |
---|
569 | else if (GET_CODE (reg) == REG) |
---|
570 | REG_USERVAR_P (reg) = 1; |
---|
571 | else |
---|
572 | abort (); |
---|
573 | } |
---|
574 | |
---|
575 | /* Identify REG as a probable pointer register and show its alignment |
---|
576 | as ALIGN, if nonzero. */ |
---|
577 | |
---|
578 | void |
---|
579 | mark_reg_pointer (reg, align) |
---|
580 | rtx reg; |
---|
581 | int align; |
---|
582 | { |
---|
583 | REGNO_POINTER_FLAG (REGNO (reg)) = 1; |
---|
584 | |
---|
585 | if (align) |
---|
586 | REGNO_POINTER_ALIGN (REGNO (reg)) = align; |
---|
587 | } |
---|
588 | |
---|
589 | /* Return 1 plus largest pseudo reg number used in the current function. */ |
---|
590 | |
---|
591 | int |
---|
592 | max_reg_num () |
---|
593 | { |
---|
594 | return reg_rtx_no; |
---|
595 | } |
---|
596 | |
---|
597 | /* Return 1 + the largest label number used so far in the current function. */ |
---|
598 | |
---|
599 | int |
---|
600 | max_label_num () |
---|
601 | { |
---|
602 | if (last_label_num && label_num == base_label_num) |
---|
603 | return last_label_num; |
---|
604 | return label_num; |
---|
605 | } |
---|
606 | |
---|
607 | /* Return first label number used in this function (if any were used). */ |
---|
608 | |
---|
609 | int |
---|
610 | get_first_label_num () |
---|
611 | { |
---|
612 | return first_label_num; |
---|
613 | } |
---|
614 | |
---|
615 | /* Return a value representing some low-order bits of X, where the number |
---|
616 | of low-order bits is given by MODE. Note that no conversion is done |
---|
617 | between floating-point and fixed-point values, rather, the bit |
---|
618 | representation is returned. |
---|
619 | |
---|
620 | This function handles the cases in common between gen_lowpart, below, |
---|
621 | and two variants in cse.c and combine.c. These are the cases that can |
---|
622 | be safely handled at all points in the compilation. |
---|
623 | |
---|
624 | If this is not a case we can handle, return 0. */ |
---|
625 | |
---|
626 | rtx |
---|
627 | gen_lowpart_common (mode, x) |
---|
628 | enum machine_mode mode; |
---|
629 | register rtx x; |
---|
630 | { |
---|
631 | int word = 0; |
---|
632 | |
---|
633 | if (GET_MODE (x) == mode) |
---|
634 | return x; |
---|
635 | |
---|
636 | /* MODE must occupy no more words than the mode of X. */ |
---|
637 | if (GET_MODE (x) != VOIDmode |
---|
638 | && ((GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD |
---|
639 | > ((GET_MODE_SIZE (GET_MODE (x)) + (UNITS_PER_WORD - 1)) |
---|
640 | / UNITS_PER_WORD))) |
---|
641 | return 0; |
---|
642 | |
---|
643 | if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD) |
---|
644 | word = ((GET_MODE_SIZE (GET_MODE (x)) |
---|
645 | - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)) |
---|
646 | / UNITS_PER_WORD); |
---|
647 | |
---|
648 | if ((GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND) |
---|
649 | && (GET_MODE_CLASS (mode) == MODE_INT |
---|
650 | || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)) |
---|
651 | { |
---|
652 | /* If we are getting the low-order part of something that has been |
---|
653 | sign- or zero-extended, we can either just use the object being |
---|
654 | extended or make a narrower extension. If we want an even smaller |
---|
655 | piece than the size of the object being extended, call ourselves |
---|
656 | recursively. |
---|
657 | |
---|
658 | This case is used mostly by combine and cse. */ |
---|
659 | |
---|
660 | if (GET_MODE (XEXP (x, 0)) == mode) |
---|
661 | return XEXP (x, 0); |
---|
662 | else if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (XEXP (x, 0)))) |
---|
663 | return gen_lowpart_common (mode, XEXP (x, 0)); |
---|
664 | else if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x))) |
---|
665 | return gen_rtx (GET_CODE (x), mode, XEXP (x, 0)); |
---|
666 | } |
---|
667 | else if (GET_CODE (x) == SUBREG |
---|
668 | && (GET_MODE_SIZE (mode) <= UNITS_PER_WORD |
---|
669 | || GET_MODE_SIZE (mode) == GET_MODE_UNIT_SIZE (GET_MODE (x)))) |
---|
670 | return (GET_MODE (SUBREG_REG (x)) == mode && SUBREG_WORD (x) == 0 |
---|
671 | ? SUBREG_REG (x) |
---|
672 | : gen_rtx (SUBREG, mode, SUBREG_REG (x), SUBREG_WORD (x))); |
---|
673 | else if (GET_CODE (x) == REG) |
---|
674 | { |
---|
675 | /* If the register is not valid for MODE, return 0. If we don't |
---|
676 | do this, there is no way to fix up the resulting REG later. |
---|
677 | But we do do this if the current REG is not valid for its |
---|
678 | mode. This latter is a kludge, but is required due to the |
---|
679 | way that parameters are passed on some machines, most |
---|
680 | notably Sparc. */ |
---|
681 | if (REGNO (x) < FIRST_PSEUDO_REGISTER |
---|
682 | && ! HARD_REGNO_MODE_OK (REGNO (x) + word, mode) |
---|
683 | && HARD_REGNO_MODE_OK (REGNO (x), GET_MODE (x))) |
---|
684 | return 0; |
---|
685 | else if (REGNO (x) < FIRST_PSEUDO_REGISTER |
---|
686 | /* integrate.c can't handle parts of a return value register. */ |
---|
687 | && (! REG_FUNCTION_VALUE_P (x) |
---|
688 | || ! rtx_equal_function_value_matters) |
---|
689 | #ifdef CLASS_CANNOT_CHANGE_SIZE |
---|
690 | && ! (GET_MODE_SIZE (mode) != GET_MODE_SIZE (GET_MODE (x)) |
---|
691 | && GET_MODE_CLASS (GET_MODE (x)) != MODE_COMPLEX_INT |
---|
692 | && GET_MODE_CLASS (GET_MODE (x)) != MODE_COMPLEX_FLOAT |
---|
693 | && (TEST_HARD_REG_BIT |
---|
694 | (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE], |
---|
695 | REGNO (x)))) |
---|
696 | #endif |
---|
697 | /* We want to keep the stack, frame, and arg pointers |
---|
698 | special. */ |
---|
699 | && x != frame_pointer_rtx |
---|
700 | #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM |
---|
701 | && x != arg_pointer_rtx |
---|
702 | #endif |
---|
703 | && x != stack_pointer_rtx) |
---|
704 | return gen_rtx (REG, mode, REGNO (x) + word); |
---|
705 | else |
---|
706 | return gen_rtx (SUBREG, mode, x, word); |
---|
707 | } |
---|
708 | /* If X is a CONST_INT or a CONST_DOUBLE, extract the appropriate bits |
---|
709 | from the low-order part of the constant. */ |
---|
710 | else if ((GET_MODE_CLASS (mode) == MODE_INT |
---|
711 | || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) |
---|
712 | && GET_MODE (x) == VOIDmode |
---|
713 | && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)) |
---|
714 | { |
---|
715 | /* If MODE is twice the host word size, X is already the desired |
---|
716 | representation. Otherwise, if MODE is wider than a word, we can't |
---|
717 | do this. If MODE is exactly a word, return just one CONST_INT. |
---|
718 | If MODE is smaller than a word, clear the bits that don't belong |
---|
719 | in our mode, unless they and our sign bit are all one. So we get |
---|
720 | either a reasonable negative value or a reasonable unsigned value |
---|
721 | for this mode. */ |
---|
722 | |
---|
723 | if (GET_MODE_BITSIZE (mode) >= 2 * HOST_BITS_PER_WIDE_INT) |
---|
724 | return x; |
---|
725 | else if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT) |
---|
726 | return 0; |
---|
727 | else if (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_WIDE_INT) |
---|
728 | return (GET_CODE (x) == CONST_INT ? x |
---|
729 | : GEN_INT (CONST_DOUBLE_LOW (x))); |
---|
730 | else |
---|
731 | { |
---|
732 | /* MODE must be narrower than HOST_BITS_PER_INT. */ |
---|
733 | int width = GET_MODE_BITSIZE (mode); |
---|
734 | HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x) |
---|
735 | : CONST_DOUBLE_LOW (x)); |
---|
736 | |
---|
737 | if (((val & ((HOST_WIDE_INT) (-1) << (width - 1))) |
---|
738 | != ((HOST_WIDE_INT) (-1) << (width - 1)))) |
---|
739 | val &= ((HOST_WIDE_INT) 1 << width) - 1; |
---|
740 | |
---|
741 | return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x |
---|
742 | : GEN_INT (val)); |
---|
743 | } |
---|
744 | } |
---|
745 | |
---|
746 | /* If X is an integral constant but we want it in floating-point, it |
---|
747 | must be the case that we have a union of an integer and a floating-point |
---|
748 | value. If the machine-parameters allow it, simulate that union here |
---|
749 | and return the result. The two-word and single-word cases are |
---|
750 | different. */ |
---|
751 | |
---|
752 | else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
753 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
754 | || flag_pretend_float) |
---|
755 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
756 | && GET_MODE_SIZE (mode) == UNITS_PER_WORD |
---|
757 | && GET_CODE (x) == CONST_INT |
---|
758 | && sizeof (float) * HOST_BITS_PER_CHAR == HOST_BITS_PER_WIDE_INT) |
---|
759 | #ifdef REAL_ARITHMETIC |
---|
760 | { |
---|
761 | REAL_VALUE_TYPE r; |
---|
762 | HOST_WIDE_INT i; |
---|
763 | |
---|
764 | i = INTVAL (x); |
---|
765 | r = REAL_VALUE_FROM_TARGET_SINGLE (i); |
---|
766 | return CONST_DOUBLE_FROM_REAL_VALUE (r, mode); |
---|
767 | } |
---|
768 | #else |
---|
769 | { |
---|
770 | union {HOST_WIDE_INT i; float d; } u; |
---|
771 | |
---|
772 | u.i = INTVAL (x); |
---|
773 | return CONST_DOUBLE_FROM_REAL_VALUE (u.d, mode); |
---|
774 | } |
---|
775 | #endif |
---|
776 | else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
777 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
778 | || flag_pretend_float) |
---|
779 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
780 | && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD |
---|
781 | && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE) |
---|
782 | && GET_MODE (x) == VOIDmode |
---|
783 | && (sizeof (double) * HOST_BITS_PER_CHAR |
---|
784 | == 2 * HOST_BITS_PER_WIDE_INT)) |
---|
785 | #ifdef REAL_ARITHMETIC |
---|
786 | { |
---|
787 | REAL_VALUE_TYPE r; |
---|
788 | HOST_WIDE_INT i[2]; |
---|
789 | HOST_WIDE_INT low, high; |
---|
790 | |
---|
791 | if (GET_CODE (x) == CONST_INT) |
---|
792 | low = INTVAL (x), high = low >> (HOST_BITS_PER_WIDE_INT -1); |
---|
793 | else |
---|
794 | low = CONST_DOUBLE_LOW (x), high = CONST_DOUBLE_HIGH (x); |
---|
795 | |
---|
796 | /* REAL_VALUE_TARGET_DOUBLE takes the addressing order of the |
---|
797 | target machine. */ |
---|
798 | if (WORDS_BIG_ENDIAN) |
---|
799 | i[0] = high, i[1] = low; |
---|
800 | else |
---|
801 | i[0] = low, i[1] = high; |
---|
802 | |
---|
803 | r = REAL_VALUE_FROM_TARGET_DOUBLE (i); |
---|
804 | return CONST_DOUBLE_FROM_REAL_VALUE (r, mode); |
---|
805 | } |
---|
806 | #else |
---|
807 | { |
---|
808 | union {HOST_WIDE_INT i[2]; double d; } u; |
---|
809 | HOST_WIDE_INT low, high; |
---|
810 | |
---|
811 | if (GET_CODE (x) == CONST_INT) |
---|
812 | low = INTVAL (x), high = low >> (HOST_BITS_PER_WIDE_INT -1); |
---|
813 | else |
---|
814 | low = CONST_DOUBLE_LOW (x), high = CONST_DOUBLE_HIGH (x); |
---|
815 | |
---|
816 | #ifdef HOST_WORDS_BIG_ENDIAN |
---|
817 | u.i[0] = high, u.i[1] = low; |
---|
818 | #else |
---|
819 | u.i[0] = low, u.i[1] = high; |
---|
820 | #endif |
---|
821 | |
---|
822 | return CONST_DOUBLE_FROM_REAL_VALUE (u.d, mode); |
---|
823 | } |
---|
824 | #endif |
---|
825 | |
---|
826 | /* We need an extra case for machines where HOST_BITS_PER_WIDE_INT is the |
---|
827 | same as sizeof (double), such as the alpha. We only handle the |
---|
828 | REAL_ARITHMETIC case, which is easy. Testing HOST_BITS_PER_WIDE_INT |
---|
829 | is not strictly necessary, but is done to restrict this code to cases |
---|
830 | where it is known to work. */ |
---|
831 | #ifdef REAL_ARITHMETIC |
---|
832 | else if (mode == SFmode |
---|
833 | && GET_CODE (x) == CONST_INT |
---|
834 | && GET_MODE_BITSIZE (mode) * 2 == HOST_BITS_PER_WIDE_INT) |
---|
835 | { |
---|
836 | REAL_VALUE_TYPE r; |
---|
837 | HOST_WIDE_INT i; |
---|
838 | |
---|
839 | i = INTVAL (x); |
---|
840 | r = REAL_VALUE_FROM_TARGET_SINGLE (i); |
---|
841 | return CONST_DOUBLE_FROM_REAL_VALUE (r, mode); |
---|
842 | } |
---|
843 | #endif |
---|
844 | |
---|
845 | /* Similarly, if this is converting a floating-point value into a |
---|
846 | single-word integer. Only do this is the host and target parameters are |
---|
847 | compatible. */ |
---|
848 | |
---|
849 | else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
850 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
851 | || flag_pretend_float) |
---|
852 | && (GET_MODE_CLASS (mode) == MODE_INT |
---|
853 | || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) |
---|
854 | && GET_CODE (x) == CONST_DOUBLE |
---|
855 | && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT |
---|
856 | && GET_MODE_BITSIZE (mode) == BITS_PER_WORD) |
---|
857 | return operand_subword (x, word, 0, GET_MODE (x)); |
---|
858 | |
---|
859 | /* Similarly, if this is converting a floating-point value into a |
---|
860 | two-word integer, we can do this one word at a time and make an |
---|
861 | integer. Only do this is the host and target parameters are |
---|
862 | compatible. */ |
---|
863 | |
---|
864 | else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
865 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
866 | || flag_pretend_float) |
---|
867 | && (GET_MODE_CLASS (mode) == MODE_INT |
---|
868 | || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) |
---|
869 | && GET_CODE (x) == CONST_DOUBLE |
---|
870 | && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT |
---|
871 | && GET_MODE_BITSIZE (mode) == 2 * BITS_PER_WORD) |
---|
872 | { |
---|
873 | rtx lowpart |
---|
874 | = operand_subword (x, word + WORDS_BIG_ENDIAN, 0, GET_MODE (x)); |
---|
875 | rtx highpart |
---|
876 | = operand_subword (x, word + ! WORDS_BIG_ENDIAN, 0, GET_MODE (x)); |
---|
877 | |
---|
878 | if (lowpart && GET_CODE (lowpart) == CONST_INT |
---|
879 | && highpart && GET_CODE (highpart) == CONST_INT) |
---|
880 | return immed_double_const (INTVAL (lowpart), INTVAL (highpart), mode); |
---|
881 | } |
---|
882 | |
---|
883 | /* Otherwise, we can't do this. */ |
---|
884 | return 0; |
---|
885 | } |
---|
886 | |
---|
887 | /* Return the real part (which has mode MODE) of a complex value X. |
---|
888 | This always comes at the low address in memory. */ |
---|
889 | |
---|
890 | rtx |
---|
891 | gen_realpart (mode, x) |
---|
892 | enum machine_mode mode; |
---|
893 | register rtx x; |
---|
894 | { |
---|
895 | if (GET_CODE (x) == CONCAT && GET_MODE (XEXP (x, 0)) == mode) |
---|
896 | return XEXP (x, 0); |
---|
897 | else if (WORDS_BIG_ENDIAN) |
---|
898 | return gen_highpart (mode, x); |
---|
899 | else |
---|
900 | return gen_lowpart (mode, x); |
---|
901 | } |
---|
902 | |
---|
903 | /* Return the imaginary part (which has mode MODE) of a complex value X. |
---|
904 | This always comes at the high address in memory. */ |
---|
905 | |
---|
906 | rtx |
---|
907 | gen_imagpart (mode, x) |
---|
908 | enum machine_mode mode; |
---|
909 | register rtx x; |
---|
910 | { |
---|
911 | if (GET_CODE (x) == CONCAT && GET_MODE (XEXP (x, 0)) == mode) |
---|
912 | return XEXP (x, 1); |
---|
913 | else if (WORDS_BIG_ENDIAN) |
---|
914 | return gen_lowpart (mode, x); |
---|
915 | else |
---|
916 | return gen_highpart (mode, x); |
---|
917 | } |
---|
918 | |
---|
919 | /* Return 1 iff X, assumed to be a SUBREG, |
---|
920 | refers to the real part of the complex value in its containing reg. |
---|
921 | Complex values are always stored with the real part in the first word, |
---|
922 | regardless of WORDS_BIG_ENDIAN. */ |
---|
923 | |
---|
924 | int |
---|
925 | subreg_realpart_p (x) |
---|
926 | rtx x; |
---|
927 | { |
---|
928 | if (GET_CODE (x) != SUBREG) |
---|
929 | abort (); |
---|
930 | |
---|
931 | return SUBREG_WORD (x) == 0; |
---|
932 | } |
---|
933 | |
---|
934 | /* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value, |
---|
935 | return an rtx (MEM, SUBREG, or CONST_INT) that refers to the |
---|
936 | least-significant part of X. |
---|
937 | MODE specifies how big a part of X to return; |
---|
938 | it usually should not be larger than a word. |
---|
939 | If X is a MEM whose address is a QUEUED, the value may be so also. */ |
---|
940 | |
---|
941 | rtx |
---|
942 | gen_lowpart (mode, x) |
---|
943 | enum machine_mode mode; |
---|
944 | register rtx x; |
---|
945 | { |
---|
946 | rtx result = gen_lowpart_common (mode, x); |
---|
947 | |
---|
948 | if (result) |
---|
949 | return result; |
---|
950 | else if (GET_CODE (x) == REG) |
---|
951 | { |
---|
952 | /* Must be a hard reg that's not valid in MODE. */ |
---|
953 | result = gen_lowpart_common (mode, copy_to_reg (x)); |
---|
954 | if (result == 0) |
---|
955 | abort (); |
---|
956 | return result; |
---|
957 | } |
---|
958 | else if (GET_CODE (x) == MEM) |
---|
959 | { |
---|
960 | /* The only additional case we can do is MEM. */ |
---|
961 | register int offset = 0; |
---|
962 | if (WORDS_BIG_ENDIAN) |
---|
963 | offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD) |
---|
964 | - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)); |
---|
965 | |
---|
966 | if (BYTES_BIG_ENDIAN) |
---|
967 | /* Adjust the address so that the address-after-the-data |
---|
968 | is unchanged. */ |
---|
969 | offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode)) |
---|
970 | - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x)))); |
---|
971 | |
---|
972 | return change_address (x, mode, plus_constant (XEXP (x, 0), offset)); |
---|
973 | } |
---|
974 | else if (GET_CODE (x) == ADDRESSOF) |
---|
975 | return gen_lowpart (mode, force_reg (GET_MODE (x), x)); |
---|
976 | else |
---|
977 | abort (); |
---|
978 | } |
---|
979 | |
---|
980 | /* Like `gen_lowpart', but refer to the most significant part. |
---|
981 | This is used to access the imaginary part of a complex number. */ |
---|
982 | |
---|
983 | rtx |
---|
984 | gen_highpart (mode, x) |
---|
985 | enum machine_mode mode; |
---|
986 | register rtx x; |
---|
987 | { |
---|
988 | /* This case loses if X is a subreg. To catch bugs early, |
---|
989 | complain if an invalid MODE is used even in other cases. */ |
---|
990 | if (GET_MODE_SIZE (mode) > UNITS_PER_WORD |
---|
991 | && GET_MODE_SIZE (mode) != GET_MODE_UNIT_SIZE (GET_MODE (x))) |
---|
992 | abort (); |
---|
993 | if (GET_CODE (x) == CONST_DOUBLE |
---|
994 | #if !(TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT || defined (REAL_IS_NOT_DOUBLE)) |
---|
995 | && GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT |
---|
996 | #endif |
---|
997 | ) |
---|
998 | return gen_rtx (CONST_INT, VOIDmode, |
---|
999 | CONST_DOUBLE_HIGH (x) & GET_MODE_MASK (mode)); |
---|
1000 | else if (GET_CODE (x) == CONST_INT) |
---|
1001 | return const0_rtx; |
---|
1002 | else if (GET_CODE (x) == MEM) |
---|
1003 | { |
---|
1004 | register int offset = 0; |
---|
1005 | if (! WORDS_BIG_ENDIAN) |
---|
1006 | offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD) |
---|
1007 | - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)); |
---|
1008 | |
---|
1009 | if (! BYTES_BIG_ENDIAN |
---|
1010 | && GET_MODE_SIZE (mode) < UNITS_PER_WORD) |
---|
1011 | offset -= (GET_MODE_SIZE (mode) |
---|
1012 | - MIN (UNITS_PER_WORD, |
---|
1013 | GET_MODE_SIZE (GET_MODE (x)))); |
---|
1014 | |
---|
1015 | return change_address (x, mode, plus_constant (XEXP (x, 0), offset)); |
---|
1016 | } |
---|
1017 | else if (GET_CODE (x) == SUBREG) |
---|
1018 | { |
---|
1019 | /* The only time this should occur is when we are looking at a |
---|
1020 | multi-word item with a SUBREG whose mode is the same as that of the |
---|
1021 | item. It isn't clear what we would do if it wasn't. */ |
---|
1022 | if (SUBREG_WORD (x) != 0) |
---|
1023 | abort (); |
---|
1024 | return gen_highpart (mode, SUBREG_REG (x)); |
---|
1025 | } |
---|
1026 | else if (GET_CODE (x) == REG) |
---|
1027 | { |
---|
1028 | int word = 0; |
---|
1029 | |
---|
1030 | if (! WORDS_BIG_ENDIAN |
---|
1031 | && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD) |
---|
1032 | word = ((GET_MODE_SIZE (GET_MODE (x)) |
---|
1033 | - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)) |
---|
1034 | / UNITS_PER_WORD); |
---|
1035 | |
---|
1036 | /* |
---|
1037 | * ??? This fails miserably for complex values being passed in registers |
---|
1038 | * where the sizeof the real and imaginary part are not equal to the |
---|
1039 | * sizeof SImode. FIXME |
---|
1040 | */ |
---|
1041 | |
---|
1042 | if (REGNO (x) < FIRST_PSEUDO_REGISTER |
---|
1043 | /* integrate.c can't handle parts of a return value register. */ |
---|
1044 | && (! REG_FUNCTION_VALUE_P (x) |
---|
1045 | || ! rtx_equal_function_value_matters) |
---|
1046 | /* We want to keep the stack, frame, and arg pointers special. */ |
---|
1047 | && x != frame_pointer_rtx |
---|
1048 | #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM |
---|
1049 | && x != arg_pointer_rtx |
---|
1050 | #endif |
---|
1051 | && x != stack_pointer_rtx) |
---|
1052 | return gen_rtx (REG, mode, REGNO (x) + word); |
---|
1053 | else |
---|
1054 | return gen_rtx (SUBREG, mode, x, word); |
---|
1055 | } |
---|
1056 | else |
---|
1057 | abort (); |
---|
1058 | } |
---|
1059 | |
---|
1060 | /* Return 1 iff X, assumed to be a SUBREG, |
---|
1061 | refers to the least significant part of its containing reg. |
---|
1062 | If X is not a SUBREG, always return 1 (it is its own low part!). */ |
---|
1063 | |
---|
1064 | int |
---|
1065 | subreg_lowpart_p (x) |
---|
1066 | rtx x; |
---|
1067 | { |
---|
1068 | if (GET_CODE (x) != SUBREG) |
---|
1069 | return 1; |
---|
1070 | else if (GET_MODE (SUBREG_REG (x)) == VOIDmode) |
---|
1071 | return 0; |
---|
1072 | |
---|
1073 | if (WORDS_BIG_ENDIAN |
---|
1074 | && GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) > UNITS_PER_WORD) |
---|
1075 | return (SUBREG_WORD (x) |
---|
1076 | == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) |
---|
1077 | - MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)) |
---|
1078 | / UNITS_PER_WORD)); |
---|
1079 | |
---|
1080 | return SUBREG_WORD (x) == 0; |
---|
1081 | } |
---|
1082 | |
---|
1083 | /* Return subword I of operand OP. |
---|
1084 | The word number, I, is interpreted as the word number starting at the |
---|
1085 | low-order address. Word 0 is the low-order word if not WORDS_BIG_ENDIAN, |
---|
1086 | otherwise it is the high-order word. |
---|
1087 | |
---|
1088 | If we cannot extract the required word, we return zero. Otherwise, an |
---|
1089 | rtx corresponding to the requested word will be returned. |
---|
1090 | |
---|
1091 | VALIDATE_ADDRESS is nonzero if the address should be validated. Before |
---|
1092 | reload has completed, a valid address will always be returned. After |
---|
1093 | reload, if a valid address cannot be returned, we return zero. |
---|
1094 | |
---|
1095 | If VALIDATE_ADDRESS is zero, we simply form the required address; validating |
---|
1096 | it is the responsibility of the caller. |
---|
1097 | |
---|
1098 | MODE is the mode of OP in case it is a CONST_INT. */ |
---|
1099 | |
---|
1100 | rtx |
---|
1101 | operand_subword (op, i, validate_address, mode) |
---|
1102 | rtx op; |
---|
1103 | int i; |
---|
1104 | int validate_address; |
---|
1105 | enum machine_mode mode; |
---|
1106 | { |
---|
1107 | HOST_WIDE_INT val; |
---|
1108 | int size_ratio = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD; |
---|
1109 | |
---|
1110 | if (mode == VOIDmode) |
---|
1111 | mode = GET_MODE (op); |
---|
1112 | |
---|
1113 | if (mode == VOIDmode) |
---|
1114 | abort (); |
---|
1115 | |
---|
1116 | /* If OP is narrower than a word or if we want a word outside OP, fail. */ |
---|
1117 | if (mode != BLKmode |
---|
1118 | && (GET_MODE_SIZE (mode) < UNITS_PER_WORD |
---|
1119 | || (i + 1) * UNITS_PER_WORD > GET_MODE_SIZE (mode))) |
---|
1120 | return 0; |
---|
1121 | |
---|
1122 | /* If OP is already an integer word, return it. */ |
---|
1123 | if (GET_MODE_CLASS (mode) == MODE_INT |
---|
1124 | && GET_MODE_SIZE (mode) == UNITS_PER_WORD) |
---|
1125 | return op; |
---|
1126 | |
---|
1127 | /* If OP is a REG or SUBREG, we can handle it very simply. */ |
---|
1128 | if (GET_CODE (op) == REG) |
---|
1129 | { |
---|
1130 | /* If the register is not valid for MODE, return 0. If we don't |
---|
1131 | do this, there is no way to fix up the resulting REG later. */ |
---|
1132 | if (REGNO (op) < FIRST_PSEUDO_REGISTER |
---|
1133 | && ! HARD_REGNO_MODE_OK (REGNO (op) + i, word_mode)) |
---|
1134 | return 0; |
---|
1135 | else if (REGNO (op) >= FIRST_PSEUDO_REGISTER |
---|
1136 | || (REG_FUNCTION_VALUE_P (op) |
---|
1137 | && rtx_equal_function_value_matters) |
---|
1138 | /* We want to keep the stack, frame, and arg pointers |
---|
1139 | special. */ |
---|
1140 | || op == frame_pointer_rtx |
---|
1141 | #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM |
---|
1142 | || op == arg_pointer_rtx |
---|
1143 | #endif |
---|
1144 | || op == stack_pointer_rtx) |
---|
1145 | return gen_rtx (SUBREG, word_mode, op, i); |
---|
1146 | else |
---|
1147 | return gen_rtx (REG, word_mode, REGNO (op) + i); |
---|
1148 | } |
---|
1149 | else if (GET_CODE (op) == SUBREG) |
---|
1150 | return gen_rtx (SUBREG, word_mode, SUBREG_REG (op), i + SUBREG_WORD (op)); |
---|
1151 | else if (GET_CODE (op) == CONCAT) |
---|
1152 | { |
---|
1153 | int partwords = GET_MODE_UNIT_SIZE (GET_MODE (op)) / UNITS_PER_WORD; |
---|
1154 | if (i < partwords) |
---|
1155 | return operand_subword (XEXP (op, 0), i, validate_address, mode); |
---|
1156 | return operand_subword (XEXP (op, 1), i - partwords, |
---|
1157 | validate_address, mode); |
---|
1158 | } |
---|
1159 | |
---|
1160 | /* Form a new MEM at the requested address. */ |
---|
1161 | if (GET_CODE (op) == MEM) |
---|
1162 | { |
---|
1163 | rtx addr = plus_constant (XEXP (op, 0), i * UNITS_PER_WORD); |
---|
1164 | rtx new; |
---|
1165 | |
---|
1166 | if (validate_address) |
---|
1167 | { |
---|
1168 | if (reload_completed) |
---|
1169 | { |
---|
1170 | if (! strict_memory_address_p (word_mode, addr)) |
---|
1171 | return 0; |
---|
1172 | } |
---|
1173 | else |
---|
1174 | addr = memory_address (word_mode, addr); |
---|
1175 | } |
---|
1176 | |
---|
1177 | new = gen_rtx (MEM, word_mode, addr); |
---|
1178 | |
---|
1179 | MEM_VOLATILE_P (new) = MEM_VOLATILE_P (op); |
---|
1180 | MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (op); |
---|
1181 | RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (op); |
---|
1182 | |
---|
1183 | return new; |
---|
1184 | } |
---|
1185 | |
---|
1186 | /* The only remaining cases are when OP is a constant. If the host and |
---|
1187 | target floating formats are the same, handling two-word floating |
---|
1188 | constants are easy. Note that REAL_VALUE_TO_TARGET_{SINGLE,DOUBLE} |
---|
1189 | are defined as returning one or two 32 bit values, respectively, |
---|
1190 | and not values of BITS_PER_WORD bits. */ |
---|
1191 | #ifdef REAL_ARITHMETIC |
---|
1192 | /* The output is some bits, the width of the target machine's word. |
---|
1193 | A wider-word host can surely hold them in a CONST_INT. A narrower-word |
---|
1194 | host can't. */ |
---|
1195 | if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD |
---|
1196 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
1197 | && GET_MODE_BITSIZE (mode) == 64 |
---|
1198 | && GET_CODE (op) == CONST_DOUBLE) |
---|
1199 | { |
---|
1200 | long k[2]; |
---|
1201 | REAL_VALUE_TYPE rv; |
---|
1202 | |
---|
1203 | REAL_VALUE_FROM_CONST_DOUBLE (rv, op); |
---|
1204 | REAL_VALUE_TO_TARGET_DOUBLE (rv, k); |
---|
1205 | |
---|
1206 | /* We handle 32-bit and >= 64-bit words here. Note that the order in |
---|
1207 | which the words are written depends on the word endianness. |
---|
1208 | |
---|
1209 | ??? This is a potential portability problem and should |
---|
1210 | be fixed at some point. */ |
---|
1211 | if (BITS_PER_WORD == 32) |
---|
1212 | return GEN_INT ((HOST_WIDE_INT) k[i]); |
---|
1213 | #if HOST_BITS_PER_WIDE_INT > 32 |
---|
1214 | else if (BITS_PER_WORD >= 64 && i == 0) |
---|
1215 | return GEN_INT ((((HOST_WIDE_INT) k[! WORDS_BIG_ENDIAN]) << 32) |
---|
1216 | | (HOST_WIDE_INT) k[WORDS_BIG_ENDIAN]); |
---|
1217 | #endif |
---|
1218 | else if (BITS_PER_WORD == 16) |
---|
1219 | { |
---|
1220 | long value; |
---|
1221 | value = k[i >> 1]; |
---|
1222 | if ((i & 0x1) == 0) |
---|
1223 | value >>= 16; |
---|
1224 | value &= 0xffff; |
---|
1225 | return GEN_INT ((HOST_WIDE_INT) value); |
---|
1226 | } |
---|
1227 | else |
---|
1228 | abort (); |
---|
1229 | } |
---|
1230 | else if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD |
---|
1231 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
1232 | && GET_MODE_BITSIZE (mode) > 64 |
---|
1233 | && GET_CODE (op) == CONST_DOUBLE) |
---|
1234 | { |
---|
1235 | long k[4]; |
---|
1236 | REAL_VALUE_TYPE rv; |
---|
1237 | |
---|
1238 | REAL_VALUE_FROM_CONST_DOUBLE (rv, op); |
---|
1239 | REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k); |
---|
1240 | |
---|
1241 | if (BITS_PER_WORD == 32) |
---|
1242 | return GEN_INT ((HOST_WIDE_INT) k[i]); |
---|
1243 | } |
---|
1244 | #else /* no REAL_ARITHMETIC */ |
---|
1245 | if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
1246 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
1247 | || flag_pretend_float) |
---|
1248 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
1249 | && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD |
---|
1250 | && GET_CODE (op) == CONST_DOUBLE) |
---|
1251 | { |
---|
1252 | /* The constant is stored in the host's word-ordering, |
---|
1253 | but we want to access it in the target's word-ordering. Some |
---|
1254 | compilers don't like a conditional inside macro args, so we have two |
---|
1255 | copies of the return. */ |
---|
1256 | #ifdef HOST_WORDS_BIG_ENDIAN |
---|
1257 | return GEN_INT (i == WORDS_BIG_ENDIAN |
---|
1258 | ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op)); |
---|
1259 | #else |
---|
1260 | return GEN_INT (i != WORDS_BIG_ENDIAN |
---|
1261 | ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op)); |
---|
1262 | #endif |
---|
1263 | } |
---|
1264 | #endif /* no REAL_ARITHMETIC */ |
---|
1265 | |
---|
1266 | /* Single word float is a little harder, since single- and double-word |
---|
1267 | values often do not have the same high-order bits. We have already |
---|
1268 | verified that we want the only defined word of the single-word value. */ |
---|
1269 | #ifdef REAL_ARITHMETIC |
---|
1270 | if (GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
1271 | && GET_MODE_BITSIZE (mode) == 32 |
---|
1272 | && GET_CODE (op) == CONST_DOUBLE) |
---|
1273 | { |
---|
1274 | long l; |
---|
1275 | REAL_VALUE_TYPE rv; |
---|
1276 | |
---|
1277 | REAL_VALUE_FROM_CONST_DOUBLE (rv, op); |
---|
1278 | REAL_VALUE_TO_TARGET_SINGLE (rv, l); |
---|
1279 | return GEN_INT ((HOST_WIDE_INT) l); |
---|
1280 | } |
---|
1281 | #else |
---|
1282 | if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
1283 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
1284 | || flag_pretend_float) |
---|
1285 | && sizeof (float) * 8 == HOST_BITS_PER_WIDE_INT |
---|
1286 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
1287 | && GET_MODE_SIZE (mode) == UNITS_PER_WORD |
---|
1288 | && GET_CODE (op) == CONST_DOUBLE) |
---|
1289 | { |
---|
1290 | double d; |
---|
1291 | union {float f; HOST_WIDE_INT i; } u; |
---|
1292 | |
---|
1293 | REAL_VALUE_FROM_CONST_DOUBLE (d, op); |
---|
1294 | |
---|
1295 | u.f = d; |
---|
1296 | return GEN_INT (u.i); |
---|
1297 | } |
---|
1298 | if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT |
---|
1299 | && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) |
---|
1300 | || flag_pretend_float) |
---|
1301 | && sizeof (double) * 8 == HOST_BITS_PER_WIDE_INT |
---|
1302 | && GET_MODE_CLASS (mode) == MODE_FLOAT |
---|
1303 | && GET_MODE_SIZE (mode) == UNITS_PER_WORD |
---|
1304 | && GET_CODE (op) == CONST_DOUBLE) |
---|
1305 | { |
---|
1306 | double d; |
---|
1307 | union {double d; HOST_WIDE_INT i; } u; |
---|
1308 | |
---|
1309 | REAL_VALUE_FROM_CONST_DOUBLE (d, op); |
---|
1310 | |
---|
1311 | u.d = d; |
---|
1312 | return GEN_INT (u.i); |
---|
1313 | } |
---|
1314 | #endif /* no REAL_ARITHMETIC */ |
---|
1315 | |
---|
1316 | /* The only remaining cases that we can handle are integers. |
---|
1317 | Convert to proper endianness now since these cases need it. |
---|
1318 | At this point, i == 0 means the low-order word. |
---|
1319 | |
---|
1320 | We do not want to handle the case when BITS_PER_WORD <= HOST_BITS_PER_INT |
---|
1321 | in general. However, if OP is (const_int 0), we can just return |
---|
1322 | it for any word. */ |
---|
1323 | |
---|
1324 | if (op == const0_rtx) |
---|
1325 | return op; |
---|
1326 | |
---|
1327 | if (GET_MODE_CLASS (mode) != MODE_INT |
---|
1328 | || (GET_CODE (op) != CONST_INT && GET_CODE (op) != CONST_DOUBLE) |
---|
1329 | || BITS_PER_WORD > HOST_BITS_PER_WIDE_INT) |
---|
1330 | return 0; |
---|
1331 | |
---|
1332 | if (WORDS_BIG_ENDIAN) |
---|
1333 | i = GET_MODE_SIZE (mode) / UNITS_PER_WORD - 1 - i; |
---|
1334 | |
---|
1335 | /* Find out which word on the host machine this value is in and get |
---|
1336 | it from the constant. */ |
---|
1337 | val = (i / size_ratio == 0 |
---|
1338 | ? (GET_CODE (op) == CONST_INT ? INTVAL (op) : CONST_DOUBLE_LOW (op)) |
---|
1339 | : (GET_CODE (op) == CONST_INT |
---|
1340 | ? (INTVAL (op) < 0 ? ~0 : 0) : CONST_DOUBLE_HIGH (op))); |
---|
1341 | |
---|
1342 | /* If BITS_PER_WORD is smaller than an int, get the appropriate bits. */ |
---|
1343 | if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT) |
---|
1344 | val = ((val >> ((i % size_ratio) * BITS_PER_WORD)) |
---|
1345 | & (((HOST_WIDE_INT) 1 |
---|
1346 | << (BITS_PER_WORD % HOST_BITS_PER_WIDE_INT)) - 1)); |
---|
1347 | |
---|
1348 | return GEN_INT (val); |
---|
1349 | } |
---|
1350 | |
---|
1351 | /* Similar to `operand_subword', but never return 0. If we can't extract |
---|
1352 | the required subword, put OP into a register and try again. If that fails, |
---|
1353 | abort. We always validate the address in this case. It is not valid |
---|
1354 | to call this function after reload; it is mostly meant for RTL |
---|
1355 | generation. |
---|
1356 | |
---|
1357 | MODE is the mode of OP, in case it is CONST_INT. */ |
---|
1358 | |
---|
1359 | rtx |
---|
1360 | operand_subword_force (op, i, mode) |
---|
1361 | rtx op; |
---|
1362 | int i; |
---|
1363 | enum machine_mode mode; |
---|
1364 | { |
---|
1365 | rtx result = operand_subword (op, i, 1, mode); |
---|
1366 | |
---|
1367 | if (result) |
---|
1368 | return result; |
---|
1369 | |
---|
1370 | if (mode != BLKmode && mode != VOIDmode) |
---|
1371 | op = force_reg (mode, op); |
---|
1372 | |
---|
1373 | result = operand_subword (op, i, 1, mode); |
---|
1374 | if (result == 0) |
---|
1375 | abort (); |
---|
1376 | |
---|
1377 | return result; |
---|
1378 | } |
---|
1379 | |
---|
1380 | /* Given a compare instruction, swap the operands. |
---|
1381 | A test instruction is changed into a compare of 0 against the operand. */ |
---|
1382 | |
---|
1383 | void |
---|
1384 | reverse_comparison (insn) |
---|
1385 | rtx insn; |
---|
1386 | { |
---|
1387 | rtx body = PATTERN (insn); |
---|
1388 | rtx comp; |
---|
1389 | |
---|
1390 | if (GET_CODE (body) == SET) |
---|
1391 | comp = SET_SRC (body); |
---|
1392 | else |
---|
1393 | comp = SET_SRC (XVECEXP (body, 0, 0)); |
---|
1394 | |
---|
1395 | if (GET_CODE (comp) == COMPARE) |
---|
1396 | { |
---|
1397 | rtx op0 = XEXP (comp, 0); |
---|
1398 | rtx op1 = XEXP (comp, 1); |
---|
1399 | XEXP (comp, 0) = op1; |
---|
1400 | XEXP (comp, 1) = op0; |
---|
1401 | } |
---|
1402 | else |
---|
1403 | { |
---|
1404 | rtx new = gen_rtx (COMPARE, VOIDmode, |
---|
1405 | CONST0_RTX (GET_MODE (comp)), comp); |
---|
1406 | if (GET_CODE (body) == SET) |
---|
1407 | SET_SRC (body) = new; |
---|
1408 | else |
---|
1409 | SET_SRC (XVECEXP (body, 0, 0)) = new; |
---|
1410 | } |
---|
1411 | } |
---|
1412 | |
---|
1413 | /* Return a memory reference like MEMREF, but with its mode changed |
---|
1414 | to MODE and its address changed to ADDR. |
---|
1415 | (VOIDmode means don't change the mode. |
---|
1416 | NULL for ADDR means don't change the address.) */ |
---|
1417 | |
---|
1418 | rtx |
---|
1419 | change_address (memref, mode, addr) |
---|
1420 | rtx memref; |
---|
1421 | enum machine_mode mode; |
---|
1422 | rtx addr; |
---|
1423 | { |
---|
1424 | rtx new; |
---|
1425 | |
---|
1426 | if (GET_CODE (memref) != MEM) |
---|
1427 | abort (); |
---|
1428 | if (mode == VOIDmode) |
---|
1429 | mode = GET_MODE (memref); |
---|
1430 | if (addr == 0) |
---|
1431 | addr = XEXP (memref, 0); |
---|
1432 | |
---|
1433 | /* If reload is in progress or has completed, ADDR must be valid. |
---|
1434 | Otherwise, we can call memory_address to make it valid. */ |
---|
1435 | if (reload_completed || reload_in_progress) |
---|
1436 | { |
---|
1437 | if (! memory_address_p (mode, addr)) |
---|
1438 | abort (); |
---|
1439 | } |
---|
1440 | else |
---|
1441 | addr = memory_address (mode, addr); |
---|
1442 | |
---|
1443 | if (rtx_equal_p (addr, XEXP (memref, 0)) && mode == GET_MODE (memref)) |
---|
1444 | return memref; |
---|
1445 | |
---|
1446 | new = gen_rtx (MEM, mode, addr); |
---|
1447 | MEM_VOLATILE_P (new) = MEM_VOLATILE_P (memref); |
---|
1448 | RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (memref); |
---|
1449 | MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (memref); |
---|
1450 | return new; |
---|
1451 | } |
---|
1452 | |
---|
1453 | /* Return a newly created CODE_LABEL rtx with a unique label number. */ |
---|
1454 | |
---|
1455 | rtx |
---|
1456 | gen_label_rtx () |
---|
1457 | { |
---|
1458 | register rtx label; |
---|
1459 | |
---|
1460 | label = (output_bytecode |
---|
1461 | ? gen_rtx (CODE_LABEL, VOIDmode, NULL, bc_get_bytecode_label ()) |
---|
1462 | : gen_rtx (CODE_LABEL, VOIDmode, 0, NULL_RTX, |
---|
1463 | NULL_RTX, label_num++, NULL_PTR)); |
---|
1464 | |
---|
1465 | LABEL_NUSES (label) = 0; |
---|
1466 | return label; |
---|
1467 | } |
---|
1468 | |
---|
1469 | /* For procedure integration. */ |
---|
1470 | |
---|
1471 | /* Return a newly created INLINE_HEADER rtx. Should allocate this |
---|
1472 | from a permanent obstack when the opportunity arises. */ |
---|
1473 | |
---|
1474 | rtx |
---|
1475 | gen_inline_header_rtx (first_insn, first_parm_insn, first_labelno, |
---|
1476 | last_labelno, max_parm_regnum, max_regnum, args_size, |
---|
1477 | pops_args, stack_slots, forced_labels, function_flags, |
---|
1478 | outgoing_args_size, original_arg_vector, |
---|
1479 | original_decl_initial, regno_rtx, regno_flag, |
---|
1480 | regno_align, parm_reg_stack_loc) |
---|
1481 | rtx first_insn, first_parm_insn; |
---|
1482 | int first_labelno, last_labelno, max_parm_regnum, max_regnum, args_size; |
---|
1483 | int pops_args; |
---|
1484 | rtx stack_slots; |
---|
1485 | rtx forced_labels; |
---|
1486 | int function_flags; |
---|
1487 | int outgoing_args_size; |
---|
1488 | rtvec original_arg_vector; |
---|
1489 | rtx original_decl_initial; |
---|
1490 | rtvec regno_rtx; |
---|
1491 | char *regno_flag; |
---|
1492 | char *regno_align; |
---|
1493 | rtvec parm_reg_stack_loc; |
---|
1494 | { |
---|
1495 | rtx header = gen_rtx (INLINE_HEADER, VOIDmode, |
---|
1496 | cur_insn_uid++, NULL_RTX, |
---|
1497 | first_insn, first_parm_insn, |
---|
1498 | first_labelno, last_labelno, |
---|
1499 | max_parm_regnum, max_regnum, args_size, pops_args, |
---|
1500 | stack_slots, forced_labels, function_flags, |
---|
1501 | outgoing_args_size, original_arg_vector, |
---|
1502 | original_decl_initial, |
---|
1503 | regno_rtx, regno_flag, regno_align, |
---|
1504 | parm_reg_stack_loc); |
---|
1505 | return header; |
---|
1506 | } |
---|
1507 | |
---|
1508 | /* Install new pointers to the first and last insns in the chain. |
---|
1509 | Also, set cur_insn_uid to one higher than the last in use. |
---|
1510 | Used for an inline-procedure after copying the insn chain. */ |
---|
1511 | |
---|
1512 | void |
---|
1513 | set_new_first_and_last_insn (first, last) |
---|
1514 | rtx first, last; |
---|
1515 | { |
---|
1516 | rtx insn; |
---|
1517 | |
---|
1518 | first_insn = first; |
---|
1519 | last_insn = last; |
---|
1520 | cur_insn_uid = 0; |
---|
1521 | |
---|
1522 | for (insn = first; insn; insn = NEXT_INSN (insn)) |
---|
1523 | cur_insn_uid = MAX (cur_insn_uid, INSN_UID (insn)); |
---|
1524 | |
---|
1525 | cur_insn_uid++; |
---|
1526 | } |
---|
1527 | |
---|
1528 | /* Set the range of label numbers found in the current function. |
---|
1529 | This is used when belatedly compiling an inline function. */ |
---|
1530 | |
---|
1531 | void |
---|
1532 | set_new_first_and_last_label_num (first, last) |
---|
1533 | int first, last; |
---|
1534 | { |
---|
1535 | base_label_num = label_num; |
---|
1536 | first_label_num = first; |
---|
1537 | last_label_num = last; |
---|
1538 | } |
---|
1539 | |
---|
1540 | /* Save all variables describing the current status into the structure *P. |
---|
1541 | This is used before starting a nested function. */ |
---|
1542 | |
---|
1543 | void |
---|
1544 | save_emit_status (p) |
---|
1545 | struct function *p; |
---|
1546 | { |
---|
1547 | p->reg_rtx_no = reg_rtx_no; |
---|
1548 | p->first_label_num = first_label_num; |
---|
1549 | p->first_insn = first_insn; |
---|
1550 | p->last_insn = last_insn; |
---|
1551 | p->sequence_rtl_expr = sequence_rtl_expr; |
---|
1552 | p->sequence_stack = sequence_stack; |
---|
1553 | p->cur_insn_uid = cur_insn_uid; |
---|
1554 | p->last_linenum = last_linenum; |
---|
1555 | p->last_filename = last_filename; |
---|
1556 | p->regno_pointer_flag = regno_pointer_flag; |
---|
1557 | p->regno_pointer_align = regno_pointer_align; |
---|
1558 | p->regno_pointer_flag_length = regno_pointer_flag_length; |
---|
1559 | p->regno_reg_rtx = regno_reg_rtx; |
---|
1560 | } |
---|
1561 | |
---|
1562 | /* Restore all variables describing the current status from the structure *P. |
---|
1563 | This is used after a nested function. */ |
---|
1564 | |
---|
1565 | void |
---|
1566 | restore_emit_status (p) |
---|
1567 | struct function *p; |
---|
1568 | { |
---|
1569 | int i; |
---|
1570 | |
---|
1571 | reg_rtx_no = p->reg_rtx_no; |
---|
1572 | first_label_num = p->first_label_num; |
---|
1573 | last_label_num = 0; |
---|
1574 | first_insn = p->first_insn; |
---|
1575 | last_insn = p->last_insn; |
---|
1576 | sequence_rtl_expr = p->sequence_rtl_expr; |
---|
1577 | sequence_stack = p->sequence_stack; |
---|
1578 | cur_insn_uid = p->cur_insn_uid; |
---|
1579 | last_linenum = p->last_linenum; |
---|
1580 | last_filename = p->last_filename; |
---|
1581 | regno_pointer_flag = p->regno_pointer_flag; |
---|
1582 | regno_pointer_align = p->regno_pointer_align; |
---|
1583 | regno_pointer_flag_length = p->regno_pointer_flag_length; |
---|
1584 | regno_reg_rtx = p->regno_reg_rtx; |
---|
1585 | |
---|
1586 | /* Clear our cache of rtx expressions for start_sequence and |
---|
1587 | gen_sequence. */ |
---|
1588 | sequence_element_free_list = 0; |
---|
1589 | for (i = 0; i < SEQUENCE_RESULT_SIZE; i++) |
---|
1590 | sequence_result[i] = 0; |
---|
1591 | |
---|
1592 | free_insn = 0; |
---|
1593 | } |
---|
1594 | |
---|
1595 | /* Go through all the RTL insn bodies and copy any invalid shared structure. |
---|
1596 | It does not work to do this twice, because the mark bits set here |
---|
1597 | are not cleared afterwards. */ |
---|
1598 | |
---|
1599 | void |
---|
1600 | unshare_all_rtl (insn) |
---|
1601 | register rtx insn; |
---|
1602 | { |
---|
1603 | for (; insn; insn = NEXT_INSN (insn)) |
---|
1604 | if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN |
---|
1605 | || GET_CODE (insn) == CALL_INSN) |
---|
1606 | { |
---|
1607 | PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn)); |
---|
1608 | REG_NOTES (insn) = copy_rtx_if_shared (REG_NOTES (insn)); |
---|
1609 | LOG_LINKS (insn) = copy_rtx_if_shared (LOG_LINKS (insn)); |
---|
1610 | } |
---|
1611 | |
---|
1612 | /* Make sure the addresses of stack slots found outside the insn chain |
---|
1613 | (such as, in DECL_RTL of a variable) are not shared |
---|
1614 | with the insn chain. |
---|
1615 | |
---|
1616 | This special care is necessary when the stack slot MEM does not |
---|
1617 | actually appear in the insn chain. If it does appear, its address |
---|
1618 | is unshared from all else at that point. */ |
---|
1619 | |
---|
1620 | copy_rtx_if_shared (stack_slot_list); |
---|
1621 | } |
---|
1622 | |
---|
1623 | /* Mark ORIG as in use, and return a copy of it if it was already in use. |
---|
1624 | Recursively does the same for subexpressions. */ |
---|
1625 | |
---|
1626 | rtx |
---|
1627 | copy_rtx_if_shared (orig) |
---|
1628 | rtx orig; |
---|
1629 | { |
---|
1630 | register rtx x = orig; |
---|
1631 | register int i; |
---|
1632 | register enum rtx_code code; |
---|
1633 | register char *format_ptr; |
---|
1634 | int copied = 0; |
---|
1635 | |
---|
1636 | if (x == 0) |
---|
1637 | return 0; |
---|
1638 | |
---|
1639 | code = GET_CODE (x); |
---|
1640 | |
---|
1641 | /* These types may be freely shared. */ |
---|
1642 | |
---|
1643 | switch (code) |
---|
1644 | { |
---|
1645 | case REG: |
---|
1646 | case QUEUED: |
---|
1647 | case CONST_INT: |
---|
1648 | case CONST_DOUBLE: |
---|
1649 | case SYMBOL_REF: |
---|
1650 | case CODE_LABEL: |
---|
1651 | case PC: |
---|
1652 | case CC0: |
---|
1653 | case SCRATCH: |
---|
1654 | /* SCRATCH must be shared because they represent distinct values. */ |
---|
1655 | return x; |
---|
1656 | |
---|
1657 | case CONST: |
---|
1658 | /* CONST can be shared if it contains a SYMBOL_REF. If it contains |
---|
1659 | a LABEL_REF, it isn't sharable. */ |
---|
1660 | if (GET_CODE (XEXP (x, 0)) == PLUS |
---|
1661 | && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF |
---|
1662 | && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT) |
---|
1663 | return x; |
---|
1664 | break; |
---|
1665 | |
---|
1666 | case INSN: |
---|
1667 | case JUMP_INSN: |
---|
1668 | case CALL_INSN: |
---|
1669 | case NOTE: |
---|
1670 | case BARRIER: |
---|
1671 | /* The chain of insns is not being copied. */ |
---|
1672 | return x; |
---|
1673 | |
---|
1674 | case MEM: |
---|
1675 | /* A MEM is allowed to be shared if its address is constant |
---|
1676 | or is a constant plus one of the special registers. */ |
---|
1677 | if (CONSTANT_ADDRESS_P (XEXP (x, 0)) |
---|
1678 | || XEXP (x, 0) == virtual_stack_vars_rtx |
---|
1679 | || XEXP (x, 0) == virtual_incoming_args_rtx) |
---|
1680 | return x; |
---|
1681 | |
---|
1682 | if (GET_CODE (XEXP (x, 0)) == PLUS |
---|
1683 | && (XEXP (XEXP (x, 0), 0) == virtual_stack_vars_rtx |
---|
1684 | || XEXP (XEXP (x, 0), 0) == virtual_incoming_args_rtx) |
---|
1685 | && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1))) |
---|
1686 | { |
---|
1687 | /* This MEM can appear in more than one place, |
---|
1688 | but its address better not be shared with anything else. */ |
---|
1689 | if (! x->used) |
---|
1690 | XEXP (x, 0) = copy_rtx_if_shared (XEXP (x, 0)); |
---|
1691 | x->used = 1; |
---|
1692 | return x; |
---|
1693 | } |
---|
1694 | break; |
---|
1695 | |
---|
1696 | default: |
---|
1697 | break; |
---|
1698 | } |
---|
1699 | |
---|
1700 | /* This rtx may not be shared. If it has already been seen, |
---|
1701 | replace it with a copy of itself. */ |
---|
1702 | |
---|
1703 | if (x->used) |
---|
1704 | { |
---|
1705 | register rtx copy; |
---|
1706 | |
---|
1707 | copy = rtx_alloc (code); |
---|
1708 | bcopy ((char *) x, (char *) copy, |
---|
1709 | (sizeof (*copy) - sizeof (copy->fld) |
---|
1710 | + sizeof (copy->fld[0]) * GET_RTX_LENGTH (code))); |
---|
1711 | x = copy; |
---|
1712 | copied = 1; |
---|
1713 | } |
---|
1714 | x->used = 1; |
---|
1715 | |
---|
1716 | /* Now scan the subexpressions recursively. |
---|
1717 | We can store any replaced subexpressions directly into X |
---|
1718 | since we know X is not shared! Any vectors in X |
---|
1719 | must be copied if X was copied. */ |
---|
1720 | |
---|
1721 | format_ptr = GET_RTX_FORMAT (code); |
---|
1722 | |
---|
1723 | for (i = 0; i < GET_RTX_LENGTH (code); i++) |
---|
1724 | { |
---|
1725 | switch (*format_ptr++) |
---|
1726 | { |
---|
1727 | case 'e': |
---|
1728 | XEXP (x, i) = copy_rtx_if_shared (XEXP (x, i)); |
---|
1729 | break; |
---|
1730 | |
---|
1731 | case 'E': |
---|
1732 | if (XVEC (x, i) != NULL) |
---|
1733 | { |
---|
1734 | register int j; |
---|
1735 | int len = XVECLEN (x, i); |
---|
1736 | |
---|
1737 | if (copied && len > 0) |
---|
1738 | XVEC (x, i) = gen_rtvec_vv (len, XVEC (x, i)->elem); |
---|
1739 | for (j = 0; j < len; j++) |
---|
1740 | XVECEXP (x, i, j) = copy_rtx_if_shared (XVECEXP (x, i, j)); |
---|
1741 | } |
---|
1742 | break; |
---|
1743 | } |
---|
1744 | } |
---|
1745 | return x; |
---|
1746 | } |
---|
1747 | |
---|
1748 | /* Clear all the USED bits in X to allow copy_rtx_if_shared to be used |
---|
1749 | to look for shared sub-parts. */ |
---|
1750 | |
---|
1751 | void |
---|
1752 | reset_used_flags (x) |
---|
1753 | rtx x; |
---|
1754 | { |
---|
1755 | register int i, j; |
---|
1756 | register enum rtx_code code; |
---|
1757 | register char *format_ptr; |
---|
1758 | |
---|
1759 | if (x == 0) |
---|
1760 | return; |
---|
1761 | |
---|
1762 | code = GET_CODE (x); |
---|
1763 | |
---|
1764 | /* These types may be freely shared so we needn't do any resetting |
---|
1765 | for them. */ |
---|
1766 | |
---|
1767 | switch (code) |
---|
1768 | { |
---|
1769 | case REG: |
---|
1770 | case QUEUED: |
---|
1771 | case CONST_INT: |
---|
1772 | case CONST_DOUBLE: |
---|
1773 | case SYMBOL_REF: |
---|
1774 | case CODE_LABEL: |
---|
1775 | case PC: |
---|
1776 | case CC0: |
---|
1777 | return; |
---|
1778 | |
---|
1779 | case INSN: |
---|
1780 | case JUMP_INSN: |
---|
1781 | case CALL_INSN: |
---|
1782 | case NOTE: |
---|
1783 | case LABEL_REF: |
---|
1784 | case BARRIER: |
---|
1785 | /* The chain of insns is not being copied. */ |
---|
1786 | return; |
---|
1787 | |
---|
1788 | default: |
---|
1789 | break; |
---|
1790 | } |
---|
1791 | |
---|
1792 | x->used = 0; |
---|
1793 | |
---|
1794 | format_ptr = GET_RTX_FORMAT (code); |
---|
1795 | for (i = 0; i < GET_RTX_LENGTH (code); i++) |
---|
1796 | { |
---|
1797 | switch (*format_ptr++) |
---|
1798 | { |
---|
1799 | case 'e': |
---|
1800 | reset_used_flags (XEXP (x, i)); |
---|
1801 | break; |
---|
1802 | |
---|
1803 | case 'E': |
---|
1804 | for (j = 0; j < XVECLEN (x, i); j++) |
---|
1805 | reset_used_flags (XVECEXP (x, i, j)); |
---|
1806 | break; |
---|
1807 | } |
---|
1808 | } |
---|
1809 | } |
---|
1810 | |
---|
1811 | /* Copy X if necessary so that it won't be altered by changes in OTHER. |
---|
1812 | Return X or the rtx for the pseudo reg the value of X was copied into. |
---|
1813 | OTHER must be valid as a SET_DEST. */ |
---|
1814 | |
---|
1815 | rtx |
---|
1816 | make_safe_from (x, other) |
---|
1817 | rtx x, other; |
---|
1818 | { |
---|
1819 | while (1) |
---|
1820 | switch (GET_CODE (other)) |
---|
1821 | { |
---|
1822 | case SUBREG: |
---|
1823 | other = SUBREG_REG (other); |
---|
1824 | break; |
---|
1825 | case STRICT_LOW_PART: |
---|
1826 | case SIGN_EXTEND: |
---|
1827 | case ZERO_EXTEND: |
---|
1828 | other = XEXP (other, 0); |
---|
1829 | break; |
---|
1830 | default: |
---|
1831 | goto done; |
---|
1832 | } |
---|
1833 | done: |
---|
1834 | if ((GET_CODE (other) == MEM |
---|
1835 | && ! CONSTANT_P (x) |
---|
1836 | && GET_CODE (x) != REG |
---|
1837 | && GET_CODE (x) != SUBREG) |
---|
1838 | || (GET_CODE (other) == REG |
---|
1839 | && (REGNO (other) < FIRST_PSEUDO_REGISTER |
---|
1840 | || reg_mentioned_p (other, x)))) |
---|
1841 | { |
---|
1842 | rtx temp = gen_reg_rtx (GET_MODE (x)); |
---|
1843 | emit_move_insn (temp, x); |
---|
1844 | return temp; |
---|
1845 | } |
---|
1846 | return x; |
---|
1847 | } |
---|
1848 | |
---|
1849 | /* Emission of insns (adding them to the doubly-linked list). */ |
---|
1850 | |
---|
1851 | /* Return the first insn of the current sequence or current function. */ |
---|
1852 | |
---|
1853 | rtx |
---|
1854 | get_insns () |
---|
1855 | { |
---|
1856 | return first_insn; |
---|
1857 | } |
---|
1858 | |
---|
1859 | /* Return the last insn emitted in current sequence or current function. */ |
---|
1860 | |
---|
1861 | rtx |
---|
1862 | get_last_insn () |
---|
1863 | { |
---|
1864 | return last_insn; |
---|
1865 | } |
---|
1866 | |
---|
1867 | /* Specify a new insn as the last in the chain. */ |
---|
1868 | |
---|
1869 | void |
---|
1870 | set_last_insn (insn) |
---|
1871 | rtx insn; |
---|
1872 | { |
---|
1873 | if (NEXT_INSN (insn) != 0) |
---|
1874 | abort (); |
---|
1875 | last_insn = insn; |
---|
1876 | } |
---|
1877 | |
---|
1878 | /* Return the last insn emitted, even if it is in a sequence now pushed. */ |
---|
1879 | |
---|
1880 | rtx |
---|
1881 | get_last_insn_anywhere () |
---|
1882 | { |
---|
1883 | struct sequence_stack *stack; |
---|
1884 | if (last_insn) |
---|
1885 | return last_insn; |
---|
1886 | for (stack = sequence_stack; stack; stack = stack->next) |
---|
1887 | if (stack->last != 0) |
---|
1888 | return stack->last; |
---|
1889 | return 0; |
---|
1890 | } |
---|
1891 | |
---|
1892 | /* Return a number larger than any instruction's uid in this function. */ |
---|
1893 | |
---|
1894 | int |
---|
1895 | get_max_uid () |
---|
1896 | { |
---|
1897 | return cur_insn_uid; |
---|
1898 | } |
---|
1899 | |
---|
1900 | /* Return the next insn. If it is a SEQUENCE, return the first insn |
---|
1901 | of the sequence. */ |
---|
1902 | |
---|
1903 | rtx |
---|
1904 | next_insn (insn) |
---|
1905 | rtx insn; |
---|
1906 | { |
---|
1907 | if (insn) |
---|
1908 | { |
---|
1909 | insn = NEXT_INSN (insn); |
---|
1910 | if (insn && GET_CODE (insn) == INSN |
---|
1911 | && GET_CODE (PATTERN (insn)) == SEQUENCE) |
---|
1912 | insn = XVECEXP (PATTERN (insn), 0, 0); |
---|
1913 | } |
---|
1914 | |
---|
1915 | return insn; |
---|
1916 | } |
---|
1917 | |
---|
1918 | /* Return the previous insn. If it is a SEQUENCE, return the last insn |
---|
1919 | of the sequence. */ |
---|
1920 | |
---|
1921 | rtx |
---|
1922 | previous_insn (insn) |
---|
1923 | rtx insn; |
---|
1924 | { |
---|
1925 | if (insn) |
---|
1926 | { |
---|
1927 | insn = PREV_INSN (insn); |
---|
1928 | if (insn && GET_CODE (insn) == INSN |
---|
1929 | && GET_CODE (PATTERN (insn)) == SEQUENCE) |
---|
1930 | insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1); |
---|
1931 | } |
---|
1932 | |
---|
1933 | return insn; |
---|
1934 | } |
---|
1935 | |
---|
1936 | /* Return the next insn after INSN that is not a NOTE. This routine does not |
---|
1937 | look inside SEQUENCEs. */ |
---|
1938 | |
---|
1939 | rtx |
---|
1940 | next_nonnote_insn (insn) |
---|
1941 | rtx insn; |
---|
1942 | { |
---|
1943 | while (insn) |
---|
1944 | { |
---|
1945 | insn = NEXT_INSN (insn); |
---|
1946 | if (insn == 0 || GET_CODE (insn) != NOTE) |
---|
1947 | break; |
---|
1948 | } |
---|
1949 | |
---|
1950 | return insn; |
---|
1951 | } |
---|
1952 | |
---|
1953 | /* Return the previous insn before INSN that is not a NOTE. This routine does |
---|
1954 | not look inside SEQUENCEs. */ |
---|
1955 | |
---|
1956 | rtx |
---|
1957 | prev_nonnote_insn (insn) |
---|
1958 | rtx insn; |
---|
1959 | { |
---|
1960 | while (insn) |
---|
1961 | { |
---|
1962 | insn = PREV_INSN (insn); |
---|
1963 | if (insn == 0 || GET_CODE (insn) != NOTE) |
---|
1964 | break; |
---|
1965 | } |
---|
1966 | |
---|
1967 | return insn; |
---|
1968 | } |
---|
1969 | |
---|
1970 | /* Return the next INSN, CALL_INSN or JUMP_INSN after INSN; |
---|
1971 | or 0, if there is none. This routine does not look inside |
---|
1972 | SEQUENCEs. */ |
---|
1973 | |
---|
1974 | rtx |
---|
1975 | next_real_insn (insn) |
---|
1976 | rtx insn; |
---|
1977 | { |
---|
1978 | while (insn) |
---|
1979 | { |
---|
1980 | insn = NEXT_INSN (insn); |
---|
1981 | if (insn == 0 || GET_CODE (insn) == INSN |
---|
1982 | || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN) |
---|
1983 | break; |
---|
1984 | } |
---|
1985 | |
---|
1986 | return insn; |
---|
1987 | } |
---|
1988 | |
---|
1989 | /* Return the last INSN, CALL_INSN or JUMP_INSN before INSN; |
---|
1990 | or 0, if there is none. This routine does not look inside |
---|
1991 | SEQUENCEs. */ |
---|
1992 | |
---|
1993 | rtx |
---|
1994 | prev_real_insn (insn) |
---|
1995 | rtx insn; |
---|
1996 | { |
---|
1997 | while (insn) |
---|
1998 | { |
---|
1999 | insn = PREV_INSN (insn); |
---|
2000 | if (insn == 0 || GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN |
---|
2001 | || GET_CODE (insn) == JUMP_INSN) |
---|
2002 | break; |
---|
2003 | } |
---|
2004 | |
---|
2005 | return insn; |
---|
2006 | } |
---|
2007 | |
---|
2008 | /* Find the next insn after INSN that really does something. This routine |
---|
2009 | does not look inside SEQUENCEs. Until reload has completed, this is the |
---|
2010 | same as next_real_insn. */ |
---|
2011 | |
---|
2012 | rtx |
---|
2013 | next_active_insn (insn) |
---|
2014 | rtx insn; |
---|
2015 | { |
---|
2016 | while (insn) |
---|
2017 | { |
---|
2018 | insn = NEXT_INSN (insn); |
---|
2019 | if (insn == 0 |
---|
2020 | || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN |
---|
2021 | || (GET_CODE (insn) == INSN |
---|
2022 | && (! reload_completed |
---|
2023 | || (GET_CODE (PATTERN (insn)) != USE |
---|
2024 | && GET_CODE (PATTERN (insn)) != CLOBBER)))) |
---|
2025 | break; |
---|
2026 | } |
---|
2027 | |
---|
2028 | return insn; |
---|
2029 | } |
---|
2030 | |
---|
2031 | /* Find the last insn before INSN that really does something. This routine |
---|
2032 | does not look inside SEQUENCEs. Until reload has completed, this is the |
---|
2033 | same as prev_real_insn. */ |
---|
2034 | |
---|
2035 | rtx |
---|
2036 | prev_active_insn (insn) |
---|
2037 | rtx insn; |
---|
2038 | { |
---|
2039 | while (insn) |
---|
2040 | { |
---|
2041 | insn = PREV_INSN (insn); |
---|
2042 | if (insn == 0 |
---|
2043 | || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN |
---|
2044 | || (GET_CODE (insn) == INSN |
---|
2045 | && (! reload_completed |
---|
2046 | || (GET_CODE (PATTERN (insn)) != USE |
---|
2047 | && GET_CODE (PATTERN (insn)) != CLOBBER)))) |
---|
2048 | break; |
---|
2049 | } |
---|
2050 | |
---|
2051 | return insn; |
---|
2052 | } |
---|
2053 | |
---|
2054 | /* Return the next CODE_LABEL after the insn INSN, or 0 if there is none. */ |
---|
2055 | |
---|
2056 | rtx |
---|
2057 | next_label (insn) |
---|
2058 | rtx insn; |
---|
2059 | { |
---|
2060 | while (insn) |
---|
2061 | { |
---|
2062 | insn = NEXT_INSN (insn); |
---|
2063 | if (insn == 0 || GET_CODE (insn) == CODE_LABEL) |
---|
2064 | break; |
---|
2065 | } |
---|
2066 | |
---|
2067 | return insn; |
---|
2068 | } |
---|
2069 | |
---|
2070 | /* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */ |
---|
2071 | |
---|
2072 | rtx |
---|
2073 | prev_label (insn) |
---|
2074 | rtx insn; |
---|
2075 | { |
---|
2076 | while (insn) |
---|
2077 | { |
---|
2078 | insn = PREV_INSN (insn); |
---|
2079 | if (insn == 0 || GET_CODE (insn) == CODE_LABEL) |
---|
2080 | break; |
---|
2081 | } |
---|
2082 | |
---|
2083 | return insn; |
---|
2084 | } |
---|
2085 | |
---|
2086 | #ifdef HAVE_cc0 |
---|
2087 | /* INSN uses CC0 and is being moved into a delay slot. Set up REG_CC_SETTER |
---|
2088 | and REG_CC_USER notes so we can find it. */ |
---|
2089 | |
---|
2090 | void |
---|
2091 | link_cc0_insns (insn) |
---|
2092 | rtx insn; |
---|
2093 | { |
---|
2094 | rtx user = next_nonnote_insn (insn); |
---|
2095 | |
---|
2096 | if (GET_CODE (user) == INSN && GET_CODE (PATTERN (user)) == SEQUENCE) |
---|
2097 | user = XVECEXP (PATTERN (user), 0, 0); |
---|
2098 | |
---|
2099 | REG_NOTES (user) = gen_rtx (INSN_LIST, REG_CC_SETTER, insn, |
---|
2100 | REG_NOTES (user)); |
---|
2101 | REG_NOTES (insn) = gen_rtx (INSN_LIST, REG_CC_USER, user, REG_NOTES (insn)); |
---|
2102 | } |
---|
2103 | |
---|
2104 | /* Return the next insn that uses CC0 after INSN, which is assumed to |
---|
2105 | set it. This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter |
---|
2106 | applied to the result of this function should yield INSN). |
---|
2107 | |
---|
2108 | Normally, this is simply the next insn. However, if a REG_CC_USER note |
---|
2109 | is present, it contains the insn that uses CC0. |
---|
2110 | |
---|
2111 | Return 0 if we can't find the insn. */ |
---|
2112 | |
---|
2113 | rtx |
---|
2114 | next_cc0_user (insn) |
---|
2115 | rtx insn; |
---|
2116 | { |
---|
2117 | rtx note = find_reg_note (insn, REG_CC_USER, NULL_RTX); |
---|
2118 | |
---|
2119 | if (note) |
---|
2120 | return XEXP (note, 0); |
---|
2121 | |
---|
2122 | insn = next_nonnote_insn (insn); |
---|
2123 | if (insn && GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE) |
---|
2124 | insn = XVECEXP (PATTERN (insn), 0, 0); |
---|
2125 | |
---|
2126 | if (insn && GET_RTX_CLASS (GET_CODE (insn)) == 'i' |
---|
2127 | && reg_mentioned_p (cc0_rtx, PATTERN (insn))) |
---|
2128 | return insn; |
---|
2129 | |
---|
2130 | return 0; |
---|
2131 | } |
---|
2132 | |
---|
2133 | /* Find the insn that set CC0 for INSN. Unless INSN has a REG_CC_SETTER |
---|
2134 | note, it is the previous insn. */ |
---|
2135 | |
---|
2136 | rtx |
---|
2137 | prev_cc0_setter (insn) |
---|
2138 | rtx insn; |
---|
2139 | { |
---|
2140 | rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX); |
---|
2141 | rtx link; |
---|
2142 | |
---|
2143 | if (note) |
---|
2144 | return XEXP (note, 0); |
---|
2145 | |
---|
2146 | insn = prev_nonnote_insn (insn); |
---|
2147 | if (! sets_cc0_p (PATTERN (insn))) |
---|
2148 | abort (); |
---|
2149 | |
---|
2150 | return insn; |
---|
2151 | } |
---|
2152 | #endif |
---|
2153 | |
---|
2154 | /* Try splitting insns that can be split for better scheduling. |
---|
2155 | PAT is the pattern which might split. |
---|
2156 | TRIAL is the insn providing PAT. |
---|
2157 | LAST is non-zero if we should return the last insn of the sequence produced. |
---|
2158 | |
---|
2159 | If this routine succeeds in splitting, it returns the first or last |
---|
2160 | replacement insn depending on the value of LAST. Otherwise, it |
---|
2161 | returns TRIAL. If the insn to be returned can be split, it will be. */ |
---|
2162 | |
---|
2163 | rtx |
---|
2164 | try_split (pat, trial, last) |
---|
2165 | rtx pat, trial; |
---|
2166 | int last; |
---|
2167 | { |
---|
2168 | rtx before = PREV_INSN (trial); |
---|
2169 | rtx after = NEXT_INSN (trial); |
---|
2170 | rtx seq = split_insns (pat, trial); |
---|
2171 | int has_barrier = 0; |
---|
2172 | rtx tem; |
---|
2173 | |
---|
2174 | /* If we are splitting a JUMP_INSN, it might be followed by a BARRIER. |
---|
2175 | We may need to handle this specially. */ |
---|
2176 | if (after && GET_CODE (after) == BARRIER) |
---|
2177 | { |
---|
2178 | has_barrier = 1; |
---|
2179 | after = NEXT_INSN (after); |
---|
2180 | } |
---|
2181 | |
---|
2182 | if (seq) |
---|
2183 | { |
---|
2184 | /* SEQ can either be a SEQUENCE or the pattern of a single insn. |
---|
2185 | The latter case will normally arise only when being done so that |
---|
2186 | it, in turn, will be split (SFmode on the 29k is an example). */ |
---|
2187 | if (GET_CODE (seq) == SEQUENCE) |
---|
2188 | { |
---|
2189 | /* If we are splitting a JUMP_INSN, look for the JUMP_INSN in |
---|
2190 | SEQ and copy our JUMP_LABEL to it. If JUMP_LABEL is non-zero, |
---|
2191 | increment the usage count so we don't delete the label. */ |
---|
2192 | int i; |
---|
2193 | |
---|
2194 | if (GET_CODE (trial) == JUMP_INSN) |
---|
2195 | for (i = XVECLEN (seq, 0) - 1; i >= 0; i--) |
---|
2196 | if (GET_CODE (XVECEXP (seq, 0, i)) == JUMP_INSN) |
---|
2197 | { |
---|
2198 | JUMP_LABEL (XVECEXP (seq, 0, i)) = JUMP_LABEL (trial); |
---|
2199 | |
---|
2200 | if (JUMP_LABEL (trial)) |
---|
2201 | LABEL_NUSES (JUMP_LABEL (trial))++; |
---|
2202 | } |
---|
2203 | |
---|
2204 | tem = emit_insn_after (seq, before); |
---|
2205 | |
---|
2206 | delete_insn (trial); |
---|
2207 | if (has_barrier) |
---|
2208 | emit_barrier_after (tem); |
---|
2209 | |
---|
2210 | /* Recursively call try_split for each new insn created; by the |
---|
2211 | time control returns here that insn will be fully split, so |
---|
2212 | set LAST and continue from the insn after the one returned. |
---|
2213 | We can't use next_active_insn here since AFTER may be a note. |
---|
2214 | Ignore deleted insns, which can be occur if not optimizing. */ |
---|
2215 | for (tem = NEXT_INSN (before); tem != after; |
---|
2216 | tem = NEXT_INSN (tem)) |
---|
2217 | if (! INSN_DELETED_P (tem)) |
---|
2218 | tem = try_split (PATTERN (tem), tem, 1); |
---|
2219 | } |
---|
2220 | /* Avoid infinite loop if the result matches the original pattern. */ |
---|
2221 | else if (rtx_equal_p (seq, pat)) |
---|
2222 | return trial; |
---|
2223 | else |
---|
2224 | { |
---|
2225 | PATTERN (trial) = seq; |
---|
2226 | INSN_CODE (trial) = -1; |
---|
2227 | try_split (seq, trial, last); |
---|
2228 | } |
---|
2229 | |
---|
2230 | /* Return either the first or the last insn, depending on which was |
---|
2231 | requested. */ |
---|
2232 | return last ? prev_active_insn (after) : next_active_insn (before); |
---|
2233 | } |
---|
2234 | |
---|
2235 | return trial; |
---|
2236 | } |
---|
2237 | |
---|
2238 | /* Make and return an INSN rtx, initializing all its slots. |
---|
2239 | Store PATTERN in the pattern slots. */ |
---|
2240 | |
---|
2241 | rtx |
---|
2242 | make_insn_raw (pattern) |
---|
2243 | rtx pattern; |
---|
2244 | { |
---|
2245 | register rtx insn; |
---|
2246 | |
---|
2247 | /* If in RTL generation phase, see if FREE_INSN can be used. */ |
---|
2248 | if (free_insn != 0 && rtx_equal_function_value_matters) |
---|
2249 | { |
---|
2250 | insn = free_insn; |
---|
2251 | free_insn = NEXT_INSN (free_insn); |
---|
2252 | PUT_CODE (insn, INSN); |
---|
2253 | } |
---|
2254 | else |
---|
2255 | insn = rtx_alloc (INSN); |
---|
2256 | |
---|
2257 | INSN_UID (insn) = cur_insn_uid++; |
---|
2258 | PATTERN (insn) = pattern; |
---|
2259 | INSN_CODE (insn) = -1; |
---|
2260 | LOG_LINKS (insn) = NULL; |
---|
2261 | REG_NOTES (insn) = NULL; |
---|
2262 | |
---|
2263 | return insn; |
---|
2264 | } |
---|
2265 | |
---|
2266 | /* Like `make_insn' but make a JUMP_INSN instead of an insn. */ |
---|
2267 | |
---|
2268 | static rtx |
---|
2269 | make_jump_insn_raw (pattern) |
---|
2270 | rtx pattern; |
---|
2271 | { |
---|
2272 | register rtx insn; |
---|
2273 | |
---|
2274 | insn = rtx_alloc (JUMP_INSN); |
---|
2275 | INSN_UID (insn) = cur_insn_uid++; |
---|
2276 | |
---|
2277 | PATTERN (insn) = pattern; |
---|
2278 | INSN_CODE (insn) = -1; |
---|
2279 | LOG_LINKS (insn) = NULL; |
---|
2280 | REG_NOTES (insn) = NULL; |
---|
2281 | JUMP_LABEL (insn) = NULL; |
---|
2282 | |
---|
2283 | return insn; |
---|
2284 | } |
---|
2285 | |
---|
2286 | /* Like `make_insn' but make a CALL_INSN instead of an insn. */ |
---|
2287 | |
---|
2288 | static rtx |
---|
2289 | make_call_insn_raw (pattern) |
---|
2290 | rtx pattern; |
---|
2291 | { |
---|
2292 | register rtx insn; |
---|
2293 | |
---|
2294 | insn = rtx_alloc (CALL_INSN); |
---|
2295 | INSN_UID (insn) = cur_insn_uid++; |
---|
2296 | |
---|
2297 | PATTERN (insn) = pattern; |
---|
2298 | INSN_CODE (insn) = -1; |
---|
2299 | LOG_LINKS (insn) = NULL; |
---|
2300 | REG_NOTES (insn) = NULL; |
---|
2301 | CALL_INSN_FUNCTION_USAGE (insn) = NULL; |
---|
2302 | |
---|
2303 | return insn; |
---|
2304 | } |
---|
2305 | |
---|
2306 | /* Add INSN to the end of the doubly-linked list. |
---|
2307 | INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE. */ |
---|
2308 | |
---|
2309 | void |
---|
2310 | add_insn (insn) |
---|
2311 | register rtx insn; |
---|
2312 | { |
---|
2313 | PREV_INSN (insn) = last_insn; |
---|
2314 | NEXT_INSN (insn) = 0; |
---|
2315 | |
---|
2316 | if (NULL != last_insn) |
---|
2317 | NEXT_INSN (last_insn) = insn; |
---|
2318 | |
---|
2319 | if (NULL == first_insn) |
---|
2320 | first_insn = insn; |
---|
2321 | |
---|
2322 | last_insn = insn; |
---|
2323 | } |
---|
2324 | |
---|
2325 | /* Add INSN into the doubly-linked list after insn AFTER. This and |
---|
2326 | the next should be the only functions called to insert an insn once |
---|
2327 | delay slots have been filled since only they know how to update a |
---|
2328 | SEQUENCE. */ |
---|
2329 | |
---|
2330 | void |
---|
2331 | add_insn_after (insn, after) |
---|
2332 | rtx insn, after; |
---|
2333 | { |
---|
2334 | rtx next = NEXT_INSN (after); |
---|
2335 | |
---|
2336 | if (optimize && INSN_DELETED_P (after)) |
---|
2337 | abort (); |
---|
2338 | |
---|
2339 | NEXT_INSN (insn) = next; |
---|
2340 | PREV_INSN (insn) = after; |
---|
2341 | |
---|
2342 | if (next) |
---|
2343 | { |
---|
2344 | PREV_INSN (next) = insn; |
---|
2345 | if (GET_CODE (next) == INSN && GET_CODE (PATTERN (next)) == SEQUENCE) |
---|
2346 | PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = insn; |
---|
2347 | } |
---|
2348 | else if (last_insn == after) |
---|
2349 | last_insn = insn; |
---|
2350 | else |
---|
2351 | { |
---|
2352 | struct sequence_stack *stack = sequence_stack; |
---|
2353 | /* Scan all pending sequences too. */ |
---|
2354 | for (; stack; stack = stack->next) |
---|
2355 | if (after == stack->last) |
---|
2356 | { |
---|
2357 | stack->last = insn; |
---|
2358 | break; |
---|
2359 | } |
---|
2360 | |
---|
2361 | if (stack == 0) |
---|
2362 | abort (); |
---|
2363 | } |
---|
2364 | |
---|
2365 | NEXT_INSN (after) = insn; |
---|
2366 | if (GET_CODE (after) == INSN && GET_CODE (PATTERN (after)) == SEQUENCE) |
---|
2367 | { |
---|
2368 | rtx sequence = PATTERN (after); |
---|
2369 | NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = insn; |
---|
2370 | } |
---|
2371 | } |
---|
2372 | |
---|
2373 | /* Add INSN into the doubly-linked list before insn BEFORE. This and |
---|
2374 | the previous should be the only functions called to insert an insn once |
---|
2375 | delay slots have been filled since only they know how to update a |
---|
2376 | SEQUENCE. */ |
---|
2377 | |
---|
2378 | void |
---|
2379 | add_insn_before (insn, before) |
---|
2380 | rtx insn, before; |
---|
2381 | { |
---|
2382 | rtx prev = PREV_INSN (before); |
---|
2383 | |
---|
2384 | if (optimize && INSN_DELETED_P (before)) |
---|
2385 | abort (); |
---|
2386 | |
---|
2387 | PREV_INSN (insn) = prev; |
---|
2388 | NEXT_INSN (insn) = before; |
---|
2389 | |
---|
2390 | if (prev) |
---|
2391 | { |
---|
2392 | NEXT_INSN (prev) = insn; |
---|
2393 | if (GET_CODE (prev) == INSN && GET_CODE (PATTERN (prev)) == SEQUENCE) |
---|
2394 | { |
---|
2395 | rtx sequence = PATTERN (prev); |
---|
2396 | NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = insn; |
---|
2397 | } |
---|
2398 | } |
---|
2399 | else if (first_insn == before) |
---|
2400 | first_insn = insn; |
---|
2401 | else |
---|
2402 | { |
---|
2403 | struct sequence_stack *stack = sequence_stack; |
---|
2404 | /* Scan all pending sequences too. */ |
---|
2405 | for (; stack; stack = stack->next) |
---|
2406 | if (before == stack->first) |
---|
2407 | { |
---|
2408 | stack->first = insn; |
---|
2409 | break; |
---|
2410 | } |
---|
2411 | |
---|
2412 | if (stack == 0) |
---|
2413 | abort (); |
---|
2414 | } |
---|
2415 | |
---|
2416 | PREV_INSN (before) = insn; |
---|
2417 | if (GET_CODE (before) == INSN && GET_CODE (PATTERN (before)) == SEQUENCE) |
---|
2418 | PREV_INSN (XVECEXP (PATTERN (before), 0, 0)) = insn; |
---|
2419 | } |
---|
2420 | |
---|
2421 | /* Delete all insns made since FROM. |
---|
2422 | FROM becomes the new last instruction. */ |
---|
2423 | |
---|
2424 | void |
---|
2425 | delete_insns_since (from) |
---|
2426 | rtx from; |
---|
2427 | { |
---|
2428 | if (from == 0) |
---|
2429 | first_insn = 0; |
---|
2430 | else |
---|
2431 | NEXT_INSN (from) = 0; |
---|
2432 | last_insn = from; |
---|
2433 | } |
---|
2434 | |
---|
2435 | /* This function is deprecated, please use sequences instead. |
---|
2436 | |
---|
2437 | Move a consecutive bunch of insns to a different place in the chain. |
---|
2438 | The insns to be moved are those between FROM and TO. |
---|
2439 | They are moved to a new position after the insn AFTER. |
---|
2440 | AFTER must not be FROM or TO or any insn in between. |
---|
2441 | |
---|
2442 | This function does not know about SEQUENCEs and hence should not be |
---|
2443 | called after delay-slot filling has been done. */ |
---|
2444 | |
---|
2445 | void |
---|
2446 | reorder_insns (from, to, after) |
---|
2447 | rtx from, to, after; |
---|
2448 | { |
---|
2449 | /* Splice this bunch out of where it is now. */ |
---|
2450 | if (PREV_INSN (from)) |
---|
2451 | NEXT_INSN (PREV_INSN (from)) = NEXT_INSN (to); |
---|
2452 | if (NEXT_INSN (to)) |
---|
2453 | PREV_INSN (NEXT_INSN (to)) = PREV_INSN (from); |
---|
2454 | if (last_insn == to) |
---|
2455 | last_insn = PREV_INSN (from); |
---|
2456 | if (first_insn == from) |
---|
2457 | first_insn = NEXT_INSN (to); |
---|
2458 | |
---|
2459 | /* Make the new neighbors point to it and it to them. */ |
---|
2460 | if (NEXT_INSN (after)) |
---|
2461 | PREV_INSN (NEXT_INSN (after)) = to; |
---|
2462 | |
---|
2463 | NEXT_INSN (to) = NEXT_INSN (after); |
---|
2464 | PREV_INSN (from) = after; |
---|
2465 | NEXT_INSN (after) = from; |
---|
2466 | if (after == last_insn) |
---|
2467 | last_insn = to; |
---|
2468 | } |
---|
2469 | |
---|
2470 | /* Return the line note insn preceding INSN. */ |
---|
2471 | |
---|
2472 | static rtx |
---|
2473 | find_line_note (insn) |
---|
2474 | rtx insn; |
---|
2475 | { |
---|
2476 | if (no_line_numbers) |
---|
2477 | return 0; |
---|
2478 | |
---|
2479 | for (; insn; insn = PREV_INSN (insn)) |
---|
2480 | if (GET_CODE (insn) == NOTE |
---|
2481 | && NOTE_LINE_NUMBER (insn) >= 0) |
---|
2482 | break; |
---|
2483 | |
---|
2484 | return insn; |
---|
2485 | } |
---|
2486 | |
---|
2487 | /* Like reorder_insns, but inserts line notes to preserve the line numbers |
---|
2488 | of the moved insns when debugging. This may insert a note between AFTER |
---|
2489 | and FROM, and another one after TO. */ |
---|
2490 | |
---|
2491 | void |
---|
2492 | reorder_insns_with_line_notes (from, to, after) |
---|
2493 | rtx from, to, after; |
---|
2494 | { |
---|
2495 | rtx from_line = find_line_note (from); |
---|
2496 | rtx after_line = find_line_note (after); |
---|
2497 | |
---|
2498 | reorder_insns (from, to, after); |
---|
2499 | |
---|
2500 | if (from_line == after_line) |
---|
2501 | return; |
---|
2502 | |
---|
2503 | if (from_line) |
---|
2504 | emit_line_note_after (NOTE_SOURCE_FILE (from_line), |
---|
2505 | NOTE_LINE_NUMBER (from_line), |
---|
2506 | after); |
---|
2507 | if (after_line) |
---|
2508 | emit_line_note_after (NOTE_SOURCE_FILE (after_line), |
---|
2509 | NOTE_LINE_NUMBER (after_line), |
---|
2510 | to); |
---|
2511 | } |
---|
2512 | |
---|
2513 | /* Emit an insn of given code and pattern |
---|
2514 | at a specified place within the doubly-linked list. */ |
---|
2515 | |
---|
2516 | /* Make an instruction with body PATTERN |
---|
2517 | and output it before the instruction BEFORE. */ |
---|
2518 | |
---|
2519 | rtx |
---|
2520 | emit_insn_before (pattern, before) |
---|
2521 | register rtx pattern, before; |
---|
2522 | { |
---|
2523 | register rtx insn = before; |
---|
2524 | |
---|
2525 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2526 | { |
---|
2527 | register int i; |
---|
2528 | |
---|
2529 | for (i = 0; i < XVECLEN (pattern, 0); i++) |
---|
2530 | { |
---|
2531 | insn = XVECEXP (pattern, 0, i); |
---|
2532 | add_insn_before (insn, before); |
---|
2533 | } |
---|
2534 | if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) |
---|
2535 | sequence_result[XVECLEN (pattern, 0)] = pattern; |
---|
2536 | } |
---|
2537 | else |
---|
2538 | { |
---|
2539 | insn = make_insn_raw (pattern); |
---|
2540 | add_insn_before (insn, before); |
---|
2541 | } |
---|
2542 | |
---|
2543 | return insn; |
---|
2544 | } |
---|
2545 | |
---|
2546 | /* Make an instruction with body PATTERN and code JUMP_INSN |
---|
2547 | and output it before the instruction BEFORE. */ |
---|
2548 | |
---|
2549 | rtx |
---|
2550 | emit_jump_insn_before (pattern, before) |
---|
2551 | register rtx pattern, before; |
---|
2552 | { |
---|
2553 | register rtx insn; |
---|
2554 | |
---|
2555 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2556 | insn = emit_insn_before (pattern, before); |
---|
2557 | else |
---|
2558 | { |
---|
2559 | insn = make_jump_insn_raw (pattern); |
---|
2560 | add_insn_before (insn, before); |
---|
2561 | } |
---|
2562 | |
---|
2563 | return insn; |
---|
2564 | } |
---|
2565 | |
---|
2566 | /* Make an instruction with body PATTERN and code CALL_INSN |
---|
2567 | and output it before the instruction BEFORE. */ |
---|
2568 | |
---|
2569 | rtx |
---|
2570 | emit_call_insn_before (pattern, before) |
---|
2571 | register rtx pattern, before; |
---|
2572 | { |
---|
2573 | register rtx insn; |
---|
2574 | |
---|
2575 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2576 | insn = emit_insn_before (pattern, before); |
---|
2577 | else |
---|
2578 | { |
---|
2579 | insn = make_call_insn_raw (pattern); |
---|
2580 | add_insn_before (insn, before); |
---|
2581 | PUT_CODE (insn, CALL_INSN); |
---|
2582 | } |
---|
2583 | |
---|
2584 | return insn; |
---|
2585 | } |
---|
2586 | |
---|
2587 | /* Make an insn of code BARRIER |
---|
2588 | and output it before the insn AFTER. */ |
---|
2589 | |
---|
2590 | rtx |
---|
2591 | emit_barrier_before (before) |
---|
2592 | register rtx before; |
---|
2593 | { |
---|
2594 | register rtx insn = rtx_alloc (BARRIER); |
---|
2595 | |
---|
2596 | INSN_UID (insn) = cur_insn_uid++; |
---|
2597 | |
---|
2598 | add_insn_before (insn, before); |
---|
2599 | return insn; |
---|
2600 | } |
---|
2601 | |
---|
2602 | /* Emit a note of subtype SUBTYPE before the insn BEFORE. */ |
---|
2603 | |
---|
2604 | rtx |
---|
2605 | emit_note_before (subtype, before) |
---|
2606 | int subtype; |
---|
2607 | rtx before; |
---|
2608 | { |
---|
2609 | register rtx note = rtx_alloc (NOTE); |
---|
2610 | INSN_UID (note) = cur_insn_uid++; |
---|
2611 | NOTE_SOURCE_FILE (note) = 0; |
---|
2612 | NOTE_LINE_NUMBER (note) = subtype; |
---|
2613 | |
---|
2614 | add_insn_before (note, before); |
---|
2615 | return note; |
---|
2616 | } |
---|
2617 | |
---|
2618 | /* Make an insn of code INSN with body PATTERN |
---|
2619 | and output it after the insn AFTER. */ |
---|
2620 | |
---|
2621 | rtx |
---|
2622 | emit_insn_after (pattern, after) |
---|
2623 | register rtx pattern, after; |
---|
2624 | { |
---|
2625 | register rtx insn = after; |
---|
2626 | |
---|
2627 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2628 | { |
---|
2629 | register int i; |
---|
2630 | |
---|
2631 | for (i = 0; i < XVECLEN (pattern, 0); i++) |
---|
2632 | { |
---|
2633 | insn = XVECEXP (pattern, 0, i); |
---|
2634 | add_insn_after (insn, after); |
---|
2635 | after = insn; |
---|
2636 | } |
---|
2637 | if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) |
---|
2638 | sequence_result[XVECLEN (pattern, 0)] = pattern; |
---|
2639 | } |
---|
2640 | else |
---|
2641 | { |
---|
2642 | insn = make_insn_raw (pattern); |
---|
2643 | add_insn_after (insn, after); |
---|
2644 | } |
---|
2645 | |
---|
2646 | return insn; |
---|
2647 | } |
---|
2648 | |
---|
2649 | /* Similar to emit_insn_after, except that line notes are to be inserted so |
---|
2650 | as to act as if this insn were at FROM. */ |
---|
2651 | |
---|
2652 | void |
---|
2653 | emit_insn_after_with_line_notes (pattern, after, from) |
---|
2654 | rtx pattern, after, from; |
---|
2655 | { |
---|
2656 | rtx from_line = find_line_note (from); |
---|
2657 | rtx after_line = find_line_note (after); |
---|
2658 | rtx insn = emit_insn_after (pattern, after); |
---|
2659 | |
---|
2660 | if (from_line) |
---|
2661 | emit_line_note_after (NOTE_SOURCE_FILE (from_line), |
---|
2662 | NOTE_LINE_NUMBER (from_line), |
---|
2663 | after); |
---|
2664 | |
---|
2665 | if (after_line) |
---|
2666 | emit_line_note_after (NOTE_SOURCE_FILE (after_line), |
---|
2667 | NOTE_LINE_NUMBER (after_line), |
---|
2668 | insn); |
---|
2669 | } |
---|
2670 | |
---|
2671 | /* Make an insn of code JUMP_INSN with body PATTERN |
---|
2672 | and output it after the insn AFTER. */ |
---|
2673 | |
---|
2674 | rtx |
---|
2675 | emit_jump_insn_after (pattern, after) |
---|
2676 | register rtx pattern, after; |
---|
2677 | { |
---|
2678 | register rtx insn; |
---|
2679 | |
---|
2680 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2681 | insn = emit_insn_after (pattern, after); |
---|
2682 | else |
---|
2683 | { |
---|
2684 | insn = make_jump_insn_raw (pattern); |
---|
2685 | add_insn_after (insn, after); |
---|
2686 | } |
---|
2687 | |
---|
2688 | return insn; |
---|
2689 | } |
---|
2690 | |
---|
2691 | /* Make an insn of code BARRIER |
---|
2692 | and output it after the insn AFTER. */ |
---|
2693 | |
---|
2694 | rtx |
---|
2695 | emit_barrier_after (after) |
---|
2696 | register rtx after; |
---|
2697 | { |
---|
2698 | register rtx insn = rtx_alloc (BARRIER); |
---|
2699 | |
---|
2700 | INSN_UID (insn) = cur_insn_uid++; |
---|
2701 | |
---|
2702 | add_insn_after (insn, after); |
---|
2703 | return insn; |
---|
2704 | } |
---|
2705 | |
---|
2706 | /* Emit the label LABEL after the insn AFTER. */ |
---|
2707 | |
---|
2708 | rtx |
---|
2709 | emit_label_after (label, after) |
---|
2710 | rtx label, after; |
---|
2711 | { |
---|
2712 | /* This can be called twice for the same label |
---|
2713 | as a result of the confusion that follows a syntax error! |
---|
2714 | So make it harmless. */ |
---|
2715 | if (INSN_UID (label) == 0) |
---|
2716 | { |
---|
2717 | INSN_UID (label) = cur_insn_uid++; |
---|
2718 | add_insn_after (label, after); |
---|
2719 | } |
---|
2720 | |
---|
2721 | return label; |
---|
2722 | } |
---|
2723 | |
---|
2724 | /* Emit a note of subtype SUBTYPE after the insn AFTER. */ |
---|
2725 | |
---|
2726 | rtx |
---|
2727 | emit_note_after (subtype, after) |
---|
2728 | int subtype; |
---|
2729 | rtx after; |
---|
2730 | { |
---|
2731 | register rtx note = rtx_alloc (NOTE); |
---|
2732 | INSN_UID (note) = cur_insn_uid++; |
---|
2733 | NOTE_SOURCE_FILE (note) = 0; |
---|
2734 | NOTE_LINE_NUMBER (note) = subtype; |
---|
2735 | add_insn_after (note, after); |
---|
2736 | return note; |
---|
2737 | } |
---|
2738 | |
---|
2739 | /* Emit a line note for FILE and LINE after the insn AFTER. */ |
---|
2740 | |
---|
2741 | rtx |
---|
2742 | emit_line_note_after (file, line, after) |
---|
2743 | char *file; |
---|
2744 | int line; |
---|
2745 | rtx after; |
---|
2746 | { |
---|
2747 | register rtx note; |
---|
2748 | |
---|
2749 | if (no_line_numbers && line > 0) |
---|
2750 | { |
---|
2751 | cur_insn_uid++; |
---|
2752 | return 0; |
---|
2753 | } |
---|
2754 | |
---|
2755 | note = rtx_alloc (NOTE); |
---|
2756 | INSN_UID (note) = cur_insn_uid++; |
---|
2757 | NOTE_SOURCE_FILE (note) = file; |
---|
2758 | NOTE_LINE_NUMBER (note) = line; |
---|
2759 | add_insn_after (note, after); |
---|
2760 | return note; |
---|
2761 | } |
---|
2762 | |
---|
2763 | /* Make an insn of code INSN with pattern PATTERN |
---|
2764 | and add it to the end of the doubly-linked list. |
---|
2765 | If PATTERN is a SEQUENCE, take the elements of it |
---|
2766 | and emit an insn for each element. |
---|
2767 | |
---|
2768 | Returns the last insn emitted. */ |
---|
2769 | |
---|
2770 | rtx |
---|
2771 | emit_insn (pattern) |
---|
2772 | rtx pattern; |
---|
2773 | { |
---|
2774 | rtx insn = last_insn; |
---|
2775 | |
---|
2776 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2777 | { |
---|
2778 | register int i; |
---|
2779 | |
---|
2780 | for (i = 0; i < XVECLEN (pattern, 0); i++) |
---|
2781 | { |
---|
2782 | insn = XVECEXP (pattern, 0, i); |
---|
2783 | add_insn (insn); |
---|
2784 | } |
---|
2785 | if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) |
---|
2786 | sequence_result[XVECLEN (pattern, 0)] = pattern; |
---|
2787 | } |
---|
2788 | else |
---|
2789 | { |
---|
2790 | insn = make_insn_raw (pattern); |
---|
2791 | add_insn (insn); |
---|
2792 | } |
---|
2793 | |
---|
2794 | return insn; |
---|
2795 | } |
---|
2796 | |
---|
2797 | /* Emit the insns in a chain starting with INSN. |
---|
2798 | Return the last insn emitted. */ |
---|
2799 | |
---|
2800 | rtx |
---|
2801 | emit_insns (insn) |
---|
2802 | rtx insn; |
---|
2803 | { |
---|
2804 | rtx last = 0; |
---|
2805 | |
---|
2806 | while (insn) |
---|
2807 | { |
---|
2808 | rtx next = NEXT_INSN (insn); |
---|
2809 | add_insn (insn); |
---|
2810 | last = insn; |
---|
2811 | insn = next; |
---|
2812 | } |
---|
2813 | |
---|
2814 | return last; |
---|
2815 | } |
---|
2816 | |
---|
2817 | /* Emit the insns in a chain starting with INSN and place them in front of |
---|
2818 | the insn BEFORE. Return the last insn emitted. */ |
---|
2819 | |
---|
2820 | rtx |
---|
2821 | emit_insns_before (insn, before) |
---|
2822 | rtx insn; |
---|
2823 | rtx before; |
---|
2824 | { |
---|
2825 | rtx last = 0; |
---|
2826 | |
---|
2827 | while (insn) |
---|
2828 | { |
---|
2829 | rtx next = NEXT_INSN (insn); |
---|
2830 | add_insn_before (insn, before); |
---|
2831 | last = insn; |
---|
2832 | insn = next; |
---|
2833 | } |
---|
2834 | |
---|
2835 | return last; |
---|
2836 | } |
---|
2837 | |
---|
2838 | /* Emit the insns in a chain starting with FIRST and place them in back of |
---|
2839 | the insn AFTER. Return the last insn emitted. */ |
---|
2840 | |
---|
2841 | rtx |
---|
2842 | emit_insns_after (first, after) |
---|
2843 | register rtx first; |
---|
2844 | register rtx after; |
---|
2845 | { |
---|
2846 | register rtx last; |
---|
2847 | register rtx after_after; |
---|
2848 | |
---|
2849 | if (!after) |
---|
2850 | abort (); |
---|
2851 | |
---|
2852 | if (!first) |
---|
2853 | return first; |
---|
2854 | |
---|
2855 | for (last = first; NEXT_INSN (last); last = NEXT_INSN (last)) |
---|
2856 | continue; |
---|
2857 | |
---|
2858 | after_after = NEXT_INSN (after); |
---|
2859 | |
---|
2860 | NEXT_INSN (after) = first; |
---|
2861 | PREV_INSN (first) = after; |
---|
2862 | NEXT_INSN (last) = after_after; |
---|
2863 | if (after_after) |
---|
2864 | PREV_INSN (after_after) = last; |
---|
2865 | |
---|
2866 | if (after == last_insn) |
---|
2867 | last_insn = last; |
---|
2868 | return last; |
---|
2869 | } |
---|
2870 | |
---|
2871 | /* Make an insn of code JUMP_INSN with pattern PATTERN |
---|
2872 | and add it to the end of the doubly-linked list. */ |
---|
2873 | |
---|
2874 | rtx |
---|
2875 | emit_jump_insn (pattern) |
---|
2876 | rtx pattern; |
---|
2877 | { |
---|
2878 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2879 | return emit_insn (pattern); |
---|
2880 | else |
---|
2881 | { |
---|
2882 | register rtx insn = make_jump_insn_raw (pattern); |
---|
2883 | add_insn (insn); |
---|
2884 | return insn; |
---|
2885 | } |
---|
2886 | } |
---|
2887 | |
---|
2888 | /* Make an insn of code CALL_INSN with pattern PATTERN |
---|
2889 | and add it to the end of the doubly-linked list. */ |
---|
2890 | |
---|
2891 | rtx |
---|
2892 | emit_call_insn (pattern) |
---|
2893 | rtx pattern; |
---|
2894 | { |
---|
2895 | if (GET_CODE (pattern) == SEQUENCE) |
---|
2896 | return emit_insn (pattern); |
---|
2897 | else |
---|
2898 | { |
---|
2899 | register rtx insn = make_call_insn_raw (pattern); |
---|
2900 | add_insn (insn); |
---|
2901 | PUT_CODE (insn, CALL_INSN); |
---|
2902 | return insn; |
---|
2903 | } |
---|
2904 | } |
---|
2905 | |
---|
2906 | /* Add the label LABEL to the end of the doubly-linked list. */ |
---|
2907 | |
---|
2908 | rtx |
---|
2909 | emit_label (label) |
---|
2910 | rtx label; |
---|
2911 | { |
---|
2912 | /* This can be called twice for the same label |
---|
2913 | as a result of the confusion that follows a syntax error! |
---|
2914 | So make it harmless. */ |
---|
2915 | if (INSN_UID (label) == 0) |
---|
2916 | { |
---|
2917 | INSN_UID (label) = cur_insn_uid++; |
---|
2918 | add_insn (label); |
---|
2919 | } |
---|
2920 | return label; |
---|
2921 | } |
---|
2922 | |
---|
2923 | /* Make an insn of code BARRIER |
---|
2924 | and add it to the end of the doubly-linked list. */ |
---|
2925 | |
---|
2926 | rtx |
---|
2927 | emit_barrier () |
---|
2928 | { |
---|
2929 | register rtx barrier = rtx_alloc (BARRIER); |
---|
2930 | INSN_UID (barrier) = cur_insn_uid++; |
---|
2931 | add_insn (barrier); |
---|
2932 | return barrier; |
---|
2933 | } |
---|
2934 | |
---|
2935 | /* Make an insn of code NOTE |
---|
2936 | with data-fields specified by FILE and LINE |
---|
2937 | and add it to the end of the doubly-linked list, |
---|
2938 | but only if line-numbers are desired for debugging info. */ |
---|
2939 | |
---|
2940 | rtx |
---|
2941 | emit_line_note (file, line) |
---|
2942 | char *file; |
---|
2943 | int line; |
---|
2944 | { |
---|
2945 | if (output_bytecode) |
---|
2946 | { |
---|
2947 | /* FIXME: for now we do nothing, but eventually we will have to deal with |
---|
2948 | debugging information. */ |
---|
2949 | return 0; |
---|
2950 | } |
---|
2951 | |
---|
2952 | emit_filename = file; |
---|
2953 | emit_lineno = line; |
---|
2954 | |
---|
2955 | #if 0 |
---|
2956 | if (no_line_numbers) |
---|
2957 | return 0; |
---|
2958 | #endif |
---|
2959 | |
---|
2960 | return emit_note (file, line); |
---|
2961 | } |
---|
2962 | |
---|
2963 | /* Make an insn of code NOTE |
---|
2964 | with data-fields specified by FILE and LINE |
---|
2965 | and add it to the end of the doubly-linked list. |
---|
2966 | If it is a line-number NOTE, omit it if it matches the previous one. */ |
---|
2967 | |
---|
2968 | rtx |
---|
2969 | emit_note (file, line) |
---|
2970 | char *file; |
---|
2971 | int line; |
---|
2972 | { |
---|
2973 | register rtx note; |
---|
2974 | |
---|
2975 | if (line > 0) |
---|
2976 | { |
---|
2977 | if (file && last_filename && !strcmp (file, last_filename) |
---|
2978 | && line == last_linenum) |
---|
2979 | return 0; |
---|
2980 | last_filename = file; |
---|
2981 | last_linenum = line; |
---|
2982 | } |
---|
2983 | |
---|
2984 | if (no_line_numbers && line > 0) |
---|
2985 | { |
---|
2986 | cur_insn_uid++; |
---|
2987 | return 0; |
---|
2988 | } |
---|
2989 | |
---|
2990 | note = rtx_alloc (NOTE); |
---|
2991 | INSN_UID (note) = cur_insn_uid++; |
---|
2992 | NOTE_SOURCE_FILE (note) = file; |
---|
2993 | NOTE_LINE_NUMBER (note) = line; |
---|
2994 | add_insn (note); |
---|
2995 | return note; |
---|
2996 | } |
---|
2997 | |
---|
2998 | /* Emit a NOTE, and don't omit it even if LINE it the previous note. */ |
---|
2999 | |
---|
3000 | rtx |
---|
3001 | emit_line_note_force (file, line) |
---|
3002 | char *file; |
---|
3003 | int line; |
---|
3004 | { |
---|
3005 | last_linenum = -1; |
---|
3006 | return emit_line_note (file, line); |
---|
3007 | } |
---|
3008 | |
---|
3009 | /* Cause next statement to emit a line note even if the line number |
---|
3010 | has not changed. This is used at the beginning of a function. */ |
---|
3011 | |
---|
3012 | void |
---|
3013 | force_next_line_note () |
---|
3014 | { |
---|
3015 | last_linenum = -1; |
---|
3016 | } |
---|
3017 | |
---|
3018 | /* Return an indication of which type of insn should have X as a body. |
---|
3019 | The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN. */ |
---|
3020 | |
---|
3021 | enum rtx_code |
---|
3022 | classify_insn (x) |
---|
3023 | rtx x; |
---|
3024 | { |
---|
3025 | if (GET_CODE (x) == CODE_LABEL) |
---|
3026 | return CODE_LABEL; |
---|
3027 | if (GET_CODE (x) == CALL) |
---|
3028 | return CALL_INSN; |
---|
3029 | if (GET_CODE (x) == RETURN) |
---|
3030 | return JUMP_INSN; |
---|
3031 | if (GET_CODE (x) == SET) |
---|
3032 | { |
---|
3033 | if (SET_DEST (x) == pc_rtx) |
---|
3034 | return JUMP_INSN; |
---|
3035 | else if (GET_CODE (SET_SRC (x)) == CALL) |
---|
3036 | return CALL_INSN; |
---|
3037 | else |
---|
3038 | return INSN; |
---|
3039 | } |
---|
3040 | if (GET_CODE (x) == PARALLEL) |
---|
3041 | { |
---|
3042 | register int j; |
---|
3043 | for (j = XVECLEN (x, 0) - 1; j >= 0; j--) |
---|
3044 | if (GET_CODE (XVECEXP (x, 0, j)) == CALL) |
---|
3045 | return CALL_INSN; |
---|
3046 | else if (GET_CODE (XVECEXP (x, 0, j)) == SET |
---|
3047 | && SET_DEST (XVECEXP (x, 0, j)) == pc_rtx) |
---|
3048 | return JUMP_INSN; |
---|
3049 | else if (GET_CODE (XVECEXP (x, 0, j)) == SET |
---|
3050 | && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL) |
---|
3051 | return CALL_INSN; |
---|
3052 | } |
---|
3053 | return INSN; |
---|
3054 | } |
---|
3055 | |
---|
3056 | /* Emit the rtl pattern X as an appropriate kind of insn. |
---|
3057 | If X is a label, it is simply added into the insn chain. */ |
---|
3058 | |
---|
3059 | rtx |
---|
3060 | emit (x) |
---|
3061 | rtx x; |
---|
3062 | { |
---|
3063 | enum rtx_code code = classify_insn (x); |
---|
3064 | |
---|
3065 | if (code == CODE_LABEL) |
---|
3066 | return emit_label (x); |
---|
3067 | else if (code == INSN) |
---|
3068 | return emit_insn (x); |
---|
3069 | else if (code == JUMP_INSN) |
---|
3070 | { |
---|
3071 | register rtx insn = emit_jump_insn (x); |
---|
3072 | if (simplejump_p (insn) || GET_CODE (x) == RETURN) |
---|
3073 | return emit_barrier (); |
---|
3074 | return insn; |
---|
3075 | } |
---|
3076 | else if (code == CALL_INSN) |
---|
3077 | return emit_call_insn (x); |
---|
3078 | else |
---|
3079 | abort (); |
---|
3080 | } |
---|
3081 | |
---|
3082 | /* Begin emitting insns to a sequence which can be packaged in an RTL_EXPR. */ |
---|
3083 | |
---|
3084 | void |
---|
3085 | start_sequence () |
---|
3086 | { |
---|
3087 | struct sequence_stack *tem; |
---|
3088 | |
---|
3089 | if (sequence_element_free_list) |
---|
3090 | { |
---|
3091 | /* Reuse a previously-saved struct sequence_stack. */ |
---|
3092 | tem = sequence_element_free_list; |
---|
3093 | sequence_element_free_list = tem->next; |
---|
3094 | } |
---|
3095 | else |
---|
3096 | tem = (struct sequence_stack *) permalloc (sizeof (struct sequence_stack)); |
---|
3097 | |
---|
3098 | tem->next = sequence_stack; |
---|
3099 | tem->first = first_insn; |
---|
3100 | tem->last = last_insn; |
---|
3101 | tem->sequence_rtl_expr = sequence_rtl_expr; |
---|
3102 | |
---|
3103 | sequence_stack = tem; |
---|
3104 | |
---|
3105 | first_insn = 0; |
---|
3106 | last_insn = 0; |
---|
3107 | } |
---|
3108 | |
---|
3109 | /* Similarly, but indicate that this sequence will be placed in |
---|
3110 | T, an RTL_EXPR. */ |
---|
3111 | |
---|
3112 | void |
---|
3113 | start_sequence_for_rtl_expr (t) |
---|
3114 | tree t; |
---|
3115 | { |
---|
3116 | start_sequence (); |
---|
3117 | |
---|
3118 | sequence_rtl_expr = t; |
---|
3119 | } |
---|
3120 | |
---|
3121 | /* Set up the insn chain starting with FIRST |
---|
3122 | as the current sequence, saving the previously current one. */ |
---|
3123 | |
---|
3124 | void |
---|
3125 | push_to_sequence (first) |
---|
3126 | rtx first; |
---|
3127 | { |
---|
3128 | rtx last; |
---|
3129 | |
---|
3130 | start_sequence (); |
---|
3131 | |
---|
3132 | for (last = first; last && NEXT_INSN (last); last = NEXT_INSN (last)); |
---|
3133 | |
---|
3134 | first_insn = first; |
---|
3135 | last_insn = last; |
---|
3136 | } |
---|
3137 | |
---|
3138 | /* Set up the outer-level insn chain |
---|
3139 | as the current sequence, saving the previously current one. */ |
---|
3140 | |
---|
3141 | void |
---|
3142 | push_topmost_sequence () |
---|
3143 | { |
---|
3144 | struct sequence_stack *stack, *top; |
---|
3145 | |
---|
3146 | start_sequence (); |
---|
3147 | |
---|
3148 | for (stack = sequence_stack; stack; stack = stack->next) |
---|
3149 | top = stack; |
---|
3150 | |
---|
3151 | first_insn = top->first; |
---|
3152 | last_insn = top->last; |
---|
3153 | sequence_rtl_expr = top->sequence_rtl_expr; |
---|
3154 | } |
---|
3155 | |
---|
3156 | /* After emitting to the outer-level insn chain, update the outer-level |
---|
3157 | insn chain, and restore the previous saved state. */ |
---|
3158 | |
---|
3159 | void |
---|
3160 | pop_topmost_sequence () |
---|
3161 | { |
---|
3162 | struct sequence_stack *stack, *top; |
---|
3163 | |
---|
3164 | for (stack = sequence_stack; stack; stack = stack->next) |
---|
3165 | top = stack; |
---|
3166 | |
---|
3167 | top->first = first_insn; |
---|
3168 | top->last = last_insn; |
---|
3169 | /* ??? Why don't we save sequence_rtl_expr here? */ |
---|
3170 | |
---|
3171 | end_sequence (); |
---|
3172 | } |
---|
3173 | |
---|
3174 | /* After emitting to a sequence, restore previous saved state. |
---|
3175 | |
---|
3176 | To get the contents of the sequence just made, |
---|
3177 | you must call `gen_sequence' *before* calling here. */ |
---|
3178 | |
---|
3179 | void |
---|
3180 | end_sequence () |
---|
3181 | { |
---|
3182 | struct sequence_stack *tem = sequence_stack; |
---|
3183 | |
---|
3184 | first_insn = tem->first; |
---|
3185 | last_insn = tem->last; |
---|
3186 | sequence_rtl_expr = tem->sequence_rtl_expr; |
---|
3187 | sequence_stack = tem->next; |
---|
3188 | |
---|
3189 | tem->next = sequence_element_free_list; |
---|
3190 | sequence_element_free_list = tem; |
---|
3191 | } |
---|
3192 | |
---|
3193 | /* Return 1 if currently emitting into a sequence. */ |
---|
3194 | |
---|
3195 | int |
---|
3196 | in_sequence_p () |
---|
3197 | { |
---|
3198 | return sequence_stack != 0; |
---|
3199 | } |
---|
3200 | |
---|
3201 | /* Generate a SEQUENCE rtx containing the insns already emitted |
---|
3202 | to the current sequence. |
---|
3203 | |
---|
3204 | This is how the gen_... function from a DEFINE_EXPAND |
---|
3205 | constructs the SEQUENCE that it returns. */ |
---|
3206 | |
---|
3207 | rtx |
---|
3208 | gen_sequence () |
---|
3209 | { |
---|
3210 | rtx result; |
---|
3211 | rtx tem; |
---|
3212 | int i; |
---|
3213 | int len; |
---|
3214 | |
---|
3215 | /* Count the insns in the chain. */ |
---|
3216 | len = 0; |
---|
3217 | for (tem = first_insn; tem; tem = NEXT_INSN (tem)) |
---|
3218 | len++; |
---|
3219 | |
---|
3220 | /* If only one insn, return its pattern rather than a SEQUENCE. |
---|
3221 | (Now that we cache SEQUENCE expressions, it isn't worth special-casing |
---|
3222 | the case of an empty list.) */ |
---|
3223 | if (len == 1 |
---|
3224 | && ! RTX_FRAME_RELATED_P (first_insn) |
---|
3225 | && (GET_CODE (first_insn) == INSN |
---|
3226 | || GET_CODE (first_insn) == JUMP_INSN |
---|
3227 | /* Don't discard the call usage field. */ |
---|
3228 | || (GET_CODE (first_insn) == CALL_INSN |
---|
3229 | && CALL_INSN_FUNCTION_USAGE (first_insn) == NULL_RTX))) |
---|
3230 | { |
---|
3231 | NEXT_INSN (first_insn) = free_insn; |
---|
3232 | free_insn = first_insn; |
---|
3233 | return PATTERN (first_insn); |
---|
3234 | } |
---|
3235 | |
---|
3236 | /* Put them in a vector. See if we already have a SEQUENCE of the |
---|
3237 | appropriate length around. */ |
---|
3238 | if (len < SEQUENCE_RESULT_SIZE && (result = sequence_result[len]) != 0) |
---|
3239 | sequence_result[len] = 0; |
---|
3240 | else |
---|
3241 | { |
---|
3242 | /* Ensure that this rtl goes in saveable_obstack, since we may |
---|
3243 | cache it. */ |
---|
3244 | push_obstacks_nochange (); |
---|
3245 | rtl_in_saveable_obstack (); |
---|
3246 | result = gen_rtx (SEQUENCE, VOIDmode, rtvec_alloc (len)); |
---|
3247 | pop_obstacks (); |
---|
3248 | } |
---|
3249 | |
---|
3250 | for (i = 0, tem = first_insn; tem; tem = NEXT_INSN (tem), i++) |
---|
3251 | XVECEXP (result, 0, i) = tem; |
---|
3252 | |
---|
3253 | return result; |
---|
3254 | } |
---|
3255 | |
---|
3256 | /* Initialize data structures and variables in this file |
---|
3257 | before generating rtl for each function. */ |
---|
3258 | |
---|
3259 | void |
---|
3260 | init_emit () |
---|
3261 | { |
---|
3262 | int i; |
---|
3263 | |
---|
3264 | first_insn = NULL; |
---|
3265 | last_insn = NULL; |
---|
3266 | sequence_rtl_expr = NULL; |
---|
3267 | cur_insn_uid = 1; |
---|
3268 | reg_rtx_no = LAST_VIRTUAL_REGISTER + 1; |
---|
3269 | last_linenum = 0; |
---|
3270 | last_filename = 0; |
---|
3271 | first_label_num = label_num; |
---|
3272 | last_label_num = 0; |
---|
3273 | sequence_stack = NULL; |
---|
3274 | |
---|
3275 | /* Clear the start_sequence/gen_sequence cache. */ |
---|
3276 | sequence_element_free_list = 0; |
---|
3277 | for (i = 0; i < SEQUENCE_RESULT_SIZE; i++) |
---|
3278 | sequence_result[i] = 0; |
---|
3279 | free_insn = 0; |
---|
3280 | |
---|
3281 | /* Init the tables that describe all the pseudo regs. */ |
---|
3282 | |
---|
3283 | regno_pointer_flag_length = LAST_VIRTUAL_REGISTER + 101; |
---|
3284 | |
---|
3285 | regno_pointer_flag |
---|
3286 | = (char *) savealloc (regno_pointer_flag_length); |
---|
3287 | bzero (regno_pointer_flag, regno_pointer_flag_length); |
---|
3288 | |
---|
3289 | regno_pointer_align |
---|
3290 | = (char *) savealloc (regno_pointer_flag_length); |
---|
3291 | bzero (regno_pointer_align, regno_pointer_flag_length); |
---|
3292 | |
---|
3293 | regno_reg_rtx |
---|
3294 | = (rtx *) savealloc (regno_pointer_flag_length * sizeof (rtx)); |
---|
3295 | bzero ((char *) regno_reg_rtx, regno_pointer_flag_length * sizeof (rtx)); |
---|
3296 | |
---|
3297 | /* Put copies of all the virtual register rtx into regno_reg_rtx. */ |
---|
3298 | regno_reg_rtx[VIRTUAL_INCOMING_ARGS_REGNUM] = virtual_incoming_args_rtx; |
---|
3299 | regno_reg_rtx[VIRTUAL_STACK_VARS_REGNUM] = virtual_stack_vars_rtx; |
---|
3300 | regno_reg_rtx[VIRTUAL_STACK_DYNAMIC_REGNUM] = virtual_stack_dynamic_rtx; |
---|
3301 | regno_reg_rtx[VIRTUAL_OUTGOING_ARGS_REGNUM] = virtual_outgoing_args_rtx; |
---|
3302 | |
---|
3303 | /* Indicate that the virtual registers and stack locations are |
---|
3304 | all pointers. */ |
---|
3305 | REGNO_POINTER_FLAG (STACK_POINTER_REGNUM) = 1; |
---|
3306 | REGNO_POINTER_FLAG (FRAME_POINTER_REGNUM) = 1; |
---|
3307 | REGNO_POINTER_FLAG (HARD_FRAME_POINTER_REGNUM) = 1; |
---|
3308 | REGNO_POINTER_FLAG (ARG_POINTER_REGNUM) = 1; |
---|
3309 | |
---|
3310 | REGNO_POINTER_FLAG (VIRTUAL_INCOMING_ARGS_REGNUM) = 1; |
---|
3311 | REGNO_POINTER_FLAG (VIRTUAL_STACK_VARS_REGNUM) = 1; |
---|
3312 | REGNO_POINTER_FLAG (VIRTUAL_STACK_DYNAMIC_REGNUM) = 1; |
---|
3313 | REGNO_POINTER_FLAG (VIRTUAL_OUTGOING_ARGS_REGNUM) = 1; |
---|
3314 | |
---|
3315 | #ifdef STACK_BOUNDARY |
---|
3316 | REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3317 | REGNO_POINTER_ALIGN (FRAME_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3318 | REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) |
---|
3319 | = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3320 | REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3321 | |
---|
3322 | REGNO_POINTER_ALIGN (VIRTUAL_INCOMING_ARGS_REGNUM) |
---|
3323 | = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3324 | REGNO_POINTER_ALIGN (VIRTUAL_STACK_VARS_REGNUM) |
---|
3325 | = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3326 | REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM) |
---|
3327 | = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3328 | REGNO_POINTER_ALIGN (VIRTUAL_OUTGOING_ARGS_REGNUM) |
---|
3329 | = STACK_BOUNDARY / BITS_PER_UNIT; |
---|
3330 | #endif |
---|
3331 | |
---|
3332 | #ifdef INIT_EXPANDERS |
---|
3333 | INIT_EXPANDERS; |
---|
3334 | #endif |
---|
3335 | } |
---|
3336 | |
---|
3337 | /* Create some permanent unique rtl objects shared between all functions. |
---|
3338 | LINE_NUMBERS is nonzero if line numbers are to be generated. */ |
---|
3339 | |
---|
3340 | void |
---|
3341 | init_emit_once (line_numbers) |
---|
3342 | int line_numbers; |
---|
3343 | { |
---|
3344 | int i; |
---|
3345 | enum machine_mode mode; |
---|
3346 | |
---|
3347 | no_line_numbers = ! line_numbers; |
---|
3348 | |
---|
3349 | sequence_stack = NULL; |
---|
3350 | |
---|
3351 | /* Compute the word and byte modes. */ |
---|
3352 | |
---|
3353 | byte_mode = VOIDmode; |
---|
3354 | word_mode = VOIDmode; |
---|
3355 | |
---|
3356 | for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode; |
---|
3357 | mode = GET_MODE_WIDER_MODE (mode)) |
---|
3358 | { |
---|
3359 | if (GET_MODE_BITSIZE (mode) == BITS_PER_UNIT |
---|
3360 | && byte_mode == VOIDmode) |
---|
3361 | byte_mode = mode; |
---|
3362 | |
---|
3363 | if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD |
---|
3364 | && word_mode == VOIDmode) |
---|
3365 | word_mode = mode; |
---|
3366 | } |
---|
3367 | |
---|
3368 | ptr_mode = mode_for_size (POINTER_SIZE, GET_MODE_CLASS (Pmode), 0); |
---|
3369 | |
---|
3370 | /* Create the unique rtx's for certain rtx codes and operand values. */ |
---|
3371 | |
---|
3372 | pc_rtx = gen_rtx (PC, VOIDmode); |
---|
3373 | cc0_rtx = gen_rtx (CC0, VOIDmode); |
---|
3374 | |
---|
3375 | /* Don't use gen_rtx here since gen_rtx in this case |
---|
3376 | tries to use these variables. */ |
---|
3377 | for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++) |
---|
3378 | { |
---|
3379 | const_int_rtx[i + MAX_SAVED_CONST_INT] = rtx_alloc (CONST_INT); |
---|
3380 | PUT_MODE (const_int_rtx[i + MAX_SAVED_CONST_INT], VOIDmode); |
---|
3381 | INTVAL (const_int_rtx[i + MAX_SAVED_CONST_INT]) = i; |
---|
3382 | } |
---|
3383 | |
---|
3384 | /* These four calls obtain some of the rtx expressions made above. */ |
---|
3385 | const0_rtx = GEN_INT (0); |
---|
3386 | const1_rtx = GEN_INT (1); |
---|
3387 | const2_rtx = GEN_INT (2); |
---|
3388 | constm1_rtx = GEN_INT (-1); |
---|
3389 | |
---|
3390 | /* This will usually be one of the above constants, but may be a new rtx. */ |
---|
3391 | const_true_rtx = GEN_INT (STORE_FLAG_VALUE); |
---|
3392 | |
---|
3393 | dconst0 = REAL_VALUE_ATOF ("0", DFmode); |
---|
3394 | dconst1 = REAL_VALUE_ATOF ("1", DFmode); |
---|
3395 | dconst2 = REAL_VALUE_ATOF ("2", DFmode); |
---|
3396 | dconstm1 = REAL_VALUE_ATOF ("-1", DFmode); |
---|
3397 | |
---|
3398 | for (i = 0; i <= 2; i++) |
---|
3399 | { |
---|
3400 | for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); mode != VOIDmode; |
---|
3401 | mode = GET_MODE_WIDER_MODE (mode)) |
---|
3402 | { |
---|
3403 | rtx tem = rtx_alloc (CONST_DOUBLE); |
---|
3404 | union real_extract u; |
---|
3405 | |
---|
3406 | bzero ((char *) &u, sizeof u); /* Zero any holes in a structure. */ |
---|
3407 | u.d = i == 0 ? dconst0 : i == 1 ? dconst1 : dconst2; |
---|
3408 | |
---|
3409 | bcopy ((char *) &u, (char *) &CONST_DOUBLE_LOW (tem), sizeof u); |
---|
3410 | CONST_DOUBLE_MEM (tem) = cc0_rtx; |
---|
3411 | PUT_MODE (tem, mode); |
---|
3412 | |
---|
3413 | const_tiny_rtx[i][(int) mode] = tem; |
---|
3414 | } |
---|
3415 | |
---|
3416 | const_tiny_rtx[i][(int) VOIDmode] = GEN_INT (i); |
---|
3417 | |
---|
3418 | for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode; |
---|
3419 | mode = GET_MODE_WIDER_MODE (mode)) |
---|
3420 | const_tiny_rtx[i][(int) mode] = GEN_INT (i); |
---|
3421 | |
---|
3422 | for (mode = GET_CLASS_NARROWEST_MODE (MODE_PARTIAL_INT); |
---|
3423 | mode != VOIDmode; |
---|
3424 | mode = GET_MODE_WIDER_MODE (mode)) |
---|
3425 | const_tiny_rtx[i][(int) mode] = GEN_INT (i); |
---|
3426 | } |
---|
3427 | |
---|
3428 | for (mode = GET_CLASS_NARROWEST_MODE (MODE_CC); mode != VOIDmode; |
---|
3429 | mode = GET_MODE_WIDER_MODE (mode)) |
---|
3430 | const_tiny_rtx[0][(int) mode] = const0_rtx; |
---|
3431 | |
---|
3432 | stack_pointer_rtx = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM); |
---|
3433 | frame_pointer_rtx = gen_rtx (REG, Pmode, FRAME_POINTER_REGNUM); |
---|
3434 | |
---|
3435 | if (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM) |
---|
3436 | hard_frame_pointer_rtx = frame_pointer_rtx; |
---|
3437 | else |
---|
3438 | hard_frame_pointer_rtx = gen_rtx (REG, Pmode, HARD_FRAME_POINTER_REGNUM); |
---|
3439 | |
---|
3440 | if (FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM) |
---|
3441 | arg_pointer_rtx = frame_pointer_rtx; |
---|
3442 | else if (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM) |
---|
3443 | arg_pointer_rtx = hard_frame_pointer_rtx; |
---|
3444 | else if (STACK_POINTER_REGNUM == ARG_POINTER_REGNUM) |
---|
3445 | arg_pointer_rtx = stack_pointer_rtx; |
---|
3446 | else |
---|
3447 | arg_pointer_rtx = gen_rtx (REG, Pmode, ARG_POINTER_REGNUM); |
---|
3448 | |
---|
3449 | #ifdef RETURN_ADDRESS_POINTER_REGNUM |
---|
3450 | return_address_pointer_rtx = gen_rtx (REG, Pmode, |
---|
3451 | RETURN_ADDRESS_POINTER_REGNUM); |
---|
3452 | #endif |
---|
3453 | |
---|
3454 | /* Create the virtual registers. Do so here since the following objects |
---|
3455 | might reference them. */ |
---|
3456 | |
---|
3457 | virtual_incoming_args_rtx = gen_rtx (REG, Pmode, |
---|
3458 | VIRTUAL_INCOMING_ARGS_REGNUM); |
---|
3459 | virtual_stack_vars_rtx = gen_rtx (REG, Pmode, |
---|
3460 | VIRTUAL_STACK_VARS_REGNUM); |
---|
3461 | virtual_stack_dynamic_rtx = gen_rtx (REG, Pmode, |
---|
3462 | VIRTUAL_STACK_DYNAMIC_REGNUM); |
---|
3463 | virtual_outgoing_args_rtx = gen_rtx (REG, Pmode, |
---|
3464 | VIRTUAL_OUTGOING_ARGS_REGNUM); |
---|
3465 | |
---|
3466 | #ifdef STRUCT_VALUE |
---|
3467 | struct_value_rtx = STRUCT_VALUE; |
---|
3468 | #else |
---|
3469 | struct_value_rtx = gen_rtx (REG, Pmode, STRUCT_VALUE_REGNUM); |
---|
3470 | #endif |
---|
3471 | |
---|
3472 | #ifdef STRUCT_VALUE_INCOMING |
---|
3473 | struct_value_incoming_rtx = STRUCT_VALUE_INCOMING; |
---|
3474 | #else |
---|
3475 | #ifdef STRUCT_VALUE_INCOMING_REGNUM |
---|
3476 | struct_value_incoming_rtx |
---|
3477 | = gen_rtx (REG, Pmode, STRUCT_VALUE_INCOMING_REGNUM); |
---|
3478 | #else |
---|
3479 | struct_value_incoming_rtx = struct_value_rtx; |
---|
3480 | #endif |
---|
3481 | #endif |
---|
3482 | |
---|
3483 | #ifdef STATIC_CHAIN_REGNUM |
---|
3484 | static_chain_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM); |
---|
3485 | |
---|
3486 | #ifdef STATIC_CHAIN_INCOMING_REGNUM |
---|
3487 | if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM) |
---|
3488 | static_chain_incoming_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_INCOMING_REGNUM); |
---|
3489 | else |
---|
3490 | #endif |
---|
3491 | static_chain_incoming_rtx = static_chain_rtx; |
---|
3492 | #endif |
---|
3493 | |
---|
3494 | #ifdef STATIC_CHAIN |
---|
3495 | static_chain_rtx = STATIC_CHAIN; |
---|
3496 | |
---|
3497 | #ifdef STATIC_CHAIN_INCOMING |
---|
3498 | static_chain_incoming_rtx = STATIC_CHAIN_INCOMING; |
---|
3499 | #else |
---|
3500 | static_chain_incoming_rtx = static_chain_rtx; |
---|
3501 | #endif |
---|
3502 | #endif |
---|
3503 | |
---|
3504 | #ifdef PIC_OFFSET_TABLE_REGNUM |
---|
3505 | pic_offset_table_rtx = gen_rtx (REG, Pmode, PIC_OFFSET_TABLE_REGNUM); |
---|
3506 | #endif |
---|
3507 | } |
---|