/* Register Transfer Language (RTL) definitions for GNU C-Compiler
Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
/* 1 in an INSN if it can call another function.
LINK_COST_FREE in an INSN_LIST. */
unsigned int call : 1;
- /* 1 in a MEM or REG if value of this expression will never change
- during the current function, even though it is not
- manifestly constant.
+ /* 1 in a REG if value of this expression will never change during
+ the current function, even though it is not manifestly constant.
+ 1 in a MEM if contents of memory are constant. This does not
+ necessarily mean that the value of this expression is constant.
1 in a SUBREG if it is from a promoted variable that is unsigned.
1 in a SYMBOL_REF if it addresses something in the per-function
constants pool.
together with the preceding insn. Valid only within sched.
1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
from the target of a branch. Valid from reorg until end of compilation;
- cleared before used. */
+ cleared before used.
+ 1 in an INSN if this insn is dead code. Valid only during
+ dead-code elimination phase; cleared before use. */
unsigned int in_struct : 1;
/* 1 if this rtx is used. This is used for copying shared structure.
See `unshare_all_rtl'.
either changing how we compute the frame address or saving and
restoring registers in the prologue and epilogue.
1 in a MEM if the MEM refers to a scalar, rather than a member of
- an aggregate. */
+ an aggregate.
+ 1 in a REG if the register is a pointer.
+ 1 in a SYMBOL_REF if it addresses something in the per-function
+ constant string pool. */
unsigned frame_related : 1;
/* The first element of the operands of this rtx.
/* Define macros to access the `code' field of the rtx. */
-#define GET_CODE(RTX) ((RTX)->code)
-#define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
+#define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
+#define PUT_CODE(RTX, CODE) ((RTX)->code = (ENUM_BITFIELD(rtx_code)) (CODE))
-#define GET_MODE(RTX) ((RTX)->mode)
-#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
+#define GET_MODE(RTX) ((enum machine_mode) (RTX)->mode)
+#define PUT_MODE(RTX, MODE) ((RTX)->mode = (ENUM_BITFIELD(machine_mode)) (MODE))
#define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
#define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
#define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
#define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
-/* 1 if X is a REG. */
-
+/* Predicate yielding nonzero iff X is an rtl for a register. */
#define REG_P(X) (GET_CODE (X) == REG)
+/* Predicate yielding nonzero iff X is a label insn. */
+#define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
+
+/* Predicate yielding nonzero iff X is a jump insn. */
+#define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
+
+/* Predicate yielding nonzero iff X is a note insn. */
+#define NOTE_P(X) (GET_CODE (X) == NOTE)
+
+/* Predicate yielding nonzero iff X is a barrier insn. */
+#define BARRIER_P(X) (GET_CODE (X) == BARRIER)
+
+/* Predicate yielding nonzero iff X is a data for a jump table. */
+#define JUMP_TABLE_DATA_P(INSN) \
+ (JUMP_P (INSN) && (GET_CODE (PATTERN (INSN)) == ADDR_VEC || \
+ GET_CODE (PATTERN (INSN)) == ADDR_DIFF_VEC))
+
/* 1 if X is a constant value that is an integer. */
#define CONSTANT_P(X) \
#define X0WINT(RTX, N) (RTL_CHECK1(RTX, N, '0').rtwint)
#define X0INT(RTX, N) (RTL_CHECK1(RTX, N, '0').rtint)
+#define X0UINT(RTX, N) (RTL_CHECK1(RTX, N, '0').rtuint)
#define X0STR(RTX, N) (RTL_CHECK1(RTX, N, '0').rtstr)
#define X0EXP(RTX, N) (RTL_CHECK1(RTX, N, '0').rtx)
#define X0VEC(RTX, N) (RTL_CHECK1(RTX, N, '0').rtvec)
delay slots, i.e., it is an annulled branch. */
#define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
+/* 1 if insn is a dead code. Valid only for dead-code elimination phase. */
+#define INSN_DEAD_CODE_P(INSN) ((INSN)->in_struct)
+
/* 1 if insn is in a delay slot and is from the target of the branch. If
the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
executed if the branch is taken. For annulled branches with this bit
a value which might not be used later, and if so it's OK to delete
the insn. Normally, deleting any insn in the prologue is an error.
At present the parameter is unused and set to (const_int 0). */
- REG_MAYBE_DEAD
+ REG_MAYBE_DEAD,
+
+ /* Indicates that a call does not return. */
+ REG_NORETURN,
+
+ /* Indicates that an indirect jump is a non-local goto instead of a
+ computed goto. */
+ REG_NON_LOCAL_GOTO
};
/* The base value for branch probability notes. */
extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
#define GET_NOTE_INSN_NAME(NOTE_CODE) \
- (note_insn_name[(NOTE_CODE) - NOTE_INSN_BIAS])
+ (note_insn_name[(NOTE_CODE) - (int) NOTE_INSN_BIAS])
/* The name of a label, in case it corresponds to an explicit label
in the input source code. */
#define CONTAINING_INSN(RTX) XCEXP(RTX, 2, LABEL_REF)
-/* For a REG rtx, REGNO extracts the register number. */
+/* For a REG rtx, REGNO extracts the register number. ORIGINAL_REGNO holds
+ the number the register originally had; for a pseudo register turned into
+ a hard reg this will hold the old pseudo register number. */
#define REGNO(RTX) XCUINT(RTX, 0, REG)
+#define ORIGINAL_REGNO(RTX) X0UINT(RTX, 1)
/* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
is the current function's return value. */
/* 1 in a REG rtx if it corresponds to a variable declared by the user. */
#define REG_USERVAR_P(RTX) ((RTX)->volatil)
+/* 1 in a REG rtx if the register is a pointer. */
+#define REG_POINTER(RTX) ((RTX)->frame_related)
+
/* 1 if the given register REG corresponds to a hard register. */
#define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
#define INTVAL(RTX) XCWINT(RTX, 0, CONST_INT)
+/* For a CONST_DOUBLE:
+ The usual two ints that hold the value.
+ For a DImode, that is all there are;
+ and CONST_DOUBLE_LOW is the low-order word and ..._HIGH the high-order.
+ For a float, the number of ints varies,
+ and CONST_DOUBLE_LOW is the one that should come first *in memory*.
+ So use &CONST_DOUBLE_LOW(r) as the address of an array of ints. */
+#define CONST_DOUBLE_LOW(r) XCWINT (r, 2, CONST_DOUBLE)
+#define CONST_DOUBLE_HIGH(r) XCWINT (r, 3, CONST_DOUBLE)
+
+/* Link for chain of all CONST_DOUBLEs in use in current function. */
+#define CONST_DOUBLE_CHAIN(r) XCEXP (r, 1, CONST_DOUBLE)
+/* The MEM which represents this CONST_DOUBLE's value in memory,
+ or const0_rtx if no MEM has been made for it yet,
+ or cc0_rtx if it is not on the chain. */
+#define CONST_DOUBLE_MEM(r) XCEXP (r, 0, CONST_DOUBLE)
+
/* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
SUBREG_WORD extracts the word-number. */
#define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC ((RTX), 4, ASM_OPERANDS)
#define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP ((RTX), 3, (N), ASM_OPERANDS)
#define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN ((RTX), 3, ASM_OPERANDS)
+#define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
+ XCVECEXP ((RTX), 4, (N), ASM_OPERANDS)
#define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
XSTR (XCVECEXP ((RTX), 4, (N), ASM_OPERANDS), 0)
#define ASM_OPERANDS_INPUT_MODE(RTX, N) \
/* 1 in a SYMBOL_REF if it addresses this function's constants pool. */
#define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
+/* 1 in a SYMBOL_REF if it addresses this function's string constant pool. */
+#define STRING_POOL_ADDRESS_P(RTX) ((RTX)->frame_related)
+
/* Flag in a SYMBOL_REF for machine-specific purposes. */
#define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
This is 1 until after the rtl generation pass. */
extern int rtx_equal_function_value_matters;
+/* Nonzero when we are generating CONCATs. */
+extern int generating_concat_p;
+
/* Generally useful functions. */
/* The following functions accept a wide integer argument. Rather than
extern rtvec gen_rtvec PARAMS ((int, ...));
/* In other files */
-extern char *oballoc PARAMS ((int));
extern char *permalloc PARAMS ((int));
extern rtx rtx_alloc PARAMS ((RTX_CODE));
extern rtvec rtvec_alloc PARAMS ((int));
extern enum rtx_code swap_condition PARAMS ((enum rtx_code));
extern enum rtx_code unsigned_condition PARAMS ((enum rtx_code));
extern enum rtx_code signed_condition PARAMS ((enum rtx_code));
+extern void mark_jump_label PARAMS ((rtx, rtx, int, int));
/* In reload.c */
extern rtx find_equiv_reg PARAMS ((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
extern rtx split_insns PARAMS ((rtx, rtx));
/* In simplify-rtx.c */
-extern rtx simplify_unary_operation PARAMS ((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
-extern rtx simplify_binary_operation PARAMS ((enum rtx_code, enum machine_mode, rtx, rtx));
-extern rtx simplify_ternary_operation PARAMS ((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
-extern rtx simplify_relational_operation PARAMS ((enum rtx_code, enum machine_mode, rtx, rtx));
-extern rtx simplify_gen_binary PARAMS ((enum rtx_code, enum machine_mode,
- rtx, rtx));
+extern rtx simplify_unary_operation PARAMS ((enum rtx_code,
+ enum machine_mode, rtx,
+ enum machine_mode));
+extern rtx simplify_binary_operation PARAMS ((enum rtx_code,
+ enum machine_mode, rtx,
+ rtx));
+extern rtx simplify_ternary_operation PARAMS ((enum rtx_code,
+ enum machine_mode,
+ enum machine_mode, rtx, rtx,
+ rtx));
+extern rtx simplify_relational_operation PARAMS ((enum rtx_code,
+ enum machine_mode, rtx,
+ rtx));
+extern rtx simplify_gen_binary PARAMS ((enum rtx_code,
+ enum machine_mode,
+ rtx, rtx));
+extern rtx simplify_gen_unary PARAMS ((enum rtx_code,
+ enum machine_mode, rtx,
+ enum machine_mode));
+extern rtx simplify_gen_ternary PARAMS ((enum rtx_code,
+ enum machine_mode,
+ enum machine_mode,
+ rtx, rtx, rtx));
+extern rtx simplify_gen_relational PARAMS ((enum rtx_code,
+ enum machine_mode,
+ rtx, rtx));
+extern rtx simplify_replace_rtx PARAMS ((rtx, rtx, rtx));
extern rtx simplify_rtx PARAMS ((rtx));
/* In optabs.c */
/* Functions in rtlanal.c */
+/* Single set is implemented as macro for performance reasons. */
+#define single_set(I) (INSN_P (I) \
+ ? (GET_CODE (PATTERN (I)) == SET \
+ ? PATTERN (I) : single_set_1 (I)) \
+ : NULL_RTX)
+#define single_set_1(I) single_set_2 (I, PATTERN (I))
+
+extern int rtx_addr_can_trap_p PARAMS ((rtx));
extern int rtx_unstable_p PARAMS ((rtx));
-extern int rtx_varies_p PARAMS ((rtx));
-extern int rtx_addr_varies_p PARAMS ((rtx));
+extern int rtx_varies_p PARAMS ((rtx, int));
+extern int rtx_addr_varies_p PARAMS ((rtx, int));
extern HOST_WIDE_INT get_integer_term PARAMS ((rtx));
extern rtx get_related_value PARAMS ((rtx));
extern int reg_mentioned_p PARAMS ((rtx, rtx));
extern int modified_in_p PARAMS ((rtx, rtx));
extern int insn_dependent_p PARAMS ((rtx, rtx));
extern int reg_set_p PARAMS ((rtx, rtx));
-extern rtx single_set PARAMS ((rtx));
+extern rtx single_set_2 PARAMS ((rtx, rtx));
extern int multiple_sets PARAMS ((rtx));
extern rtx find_last_value PARAMS ((rtx, rtx *, rtx, int));
extern int refers_to_regno_p PARAMS ((unsigned int, unsigned int,
rtx, rtx *));
extern int reg_overlap_mentioned_p PARAMS ((rtx, rtx));
+extern rtx set_of PARAMS ((rtx, rtx));
extern void note_stores PARAMS ((rtx,
void (*) (rtx, rtx, void *),
void *));
+extern void note_uses PARAMS ((rtx *,
+ void (*) (rtx *, void *),
+ void *));
extern rtx reg_set_last PARAMS ((rtx, rtx));
extern int dead_or_set_p PARAMS ((rtx, rtx));
extern int dead_or_set_regno_p PARAMS ((rtx, unsigned int));
extern rtx find_reg_note PARAMS ((rtx, enum reg_note, rtx));
extern rtx find_regno_note PARAMS ((rtx, enum reg_note,
unsigned int));
+extern rtx find_reg_equal_equiv_note PARAMS ((rtx));
extern int find_reg_fusage PARAMS ((rtx, enum rtx_code, rtx));
extern int find_regno_fusage PARAMS ((rtx, enum rtx_code,
unsigned int));
extern rtx gen_rtx_CONST_DOUBLE PARAMS ((enum machine_mode, rtx,
HOST_WIDE_INT, HOST_WIDE_INT));
extern rtx gen_rtx_CONST_INT PARAMS ((enum machine_mode, HOST_WIDE_INT));
+extern rtx gen_raw_REG PARAMS ((enum machine_mode, int));
extern rtx gen_rtx_REG PARAMS ((enum machine_mode, int));
extern rtx gen_rtx_MEM PARAMS ((enum machine_mode, rtx));
#define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
+/* REGNUM never really appearing in the INSN stream. */
+#define INVALID_REGNUM (~(unsigned int)0)
+
extern rtx find_next_ref PARAMS ((rtx, rtx));
extern rtx *find_single_use PARAMS ((rtx, rtx, rtx *));
-extern rtx output_constant_def PARAMS ((union tree_node *));
+extern rtx output_constant_def PARAMS ((union tree_node *, int));
extern rtx immed_real_const PARAMS ((union tree_node *));
extern union tree_node *make_tree PARAMS ((union tree_node *, rtx));
extern int rtx_to_tree_code PARAMS ((enum rtx_code));
/* In tree.c */
-extern void obfree PARAMS ((char *));
struct obstack;
extern void gcc_obstack_init PARAMS ((struct obstack *));
-extern void pop_obstacks PARAMS ((void));
-extern void push_obstacks PARAMS ((struct obstack *,
- struct obstack *));
+
/* In cse.c */
struct cse_basic_block_data;
+
+/* Return the right cost to give to an operation
+ to make the cost of the corresponding register-to-register instruction
+ N times that of a fast register-to-register instruction. */
+#define COSTS_N_INSNS(N) ((N) * 4)
+
+/* Maximum cost of a rtl expression. This value has the special meaning
+ not to use an rtx with this cost under any circumstances. */
+#define MAX_COST INT_MAX
+
extern int rtx_cost PARAMS ((rtx, enum rtx_code));
extern int address_cost PARAMS ((rtx, enum machine_mode));
extern void delete_trivially_dead_insns PARAMS ((rtx, int));
extern void thread_jumps PARAMS ((rtx, int, int));
extern int rtx_equal_for_thread_p PARAMS ((rtx, rtx, rtx));
extern int can_reverse_comparison_p PARAMS ((rtx, rtx));
+extern enum rtx_code reversed_comparison_code PARAMS ((rtx, rtx));
+extern enum rtx_code reversed_comparison_code_parts PARAMS ((enum rtx_code,
+ rtx, rtx, rtx));
extern void delete_for_peephole PARAMS ((rtx, rtx));
extern int condjump_in_parallel_p PARAMS ((rtx));
extern void never_reached_warning PARAMS ((rtx));
extern void renumber_insns PARAMS ((FILE *));
extern void remove_unnecessary_notes PARAMS ((void));
-/* In insn-emit.c */
-extern void add_clobbers PARAMS ((rtx, int));
-
/* In combine.c */
extern int combine_instructions PARAMS ((rtx, unsigned int));
extern unsigned int extended_count PARAMS ((rtx, enum machine_mode, int));
/* In sched.c. */
#ifdef BUFSIZ
extern void schedule_insns PARAMS ((FILE *));
+extern void schedule_ebbs PARAMS ((FILE *));
#endif
extern void fix_sched_param PARAMS ((const char *, const char *));
/* In print-rtl.c */
+extern const char *print_rtx_head;
extern void debug_rtx PARAMS ((rtx));
extern void debug_rtx_list PARAMS ((rtx, int));
extern void debug_rtx_range PARAMS ((rtx, rtx));
extern rtx debug_rtx_find PARAMS ((rtx, int));
#ifdef BUFSIZ
extern void print_rtl PARAMS ((FILE *, rtx));
+extern void print_simple_rtl PARAMS ((FILE *, rtx));
extern int print_rtl_single PARAMS ((FILE *, rtx));
extern void print_inline_rtx PARAMS ((FILE *, rtx, int));
#endif
extern void mark_temp_addr_taken PARAMS ((rtx));
extern void update_temp_slot_address PARAMS ((rtx, rtx));
extern void purge_addressof PARAMS ((rtx));
+extern void purge_hard_subreg_sets PARAMS ((rtx));
/* In reload.c */
extern int operands_match_p PARAMS ((rtx, rtx));
unsigned int));
/* In flow.c */
-extern void allocate_bb_life_data PARAMS ((void));
-extern void allocate_reg_life_data PARAMS ((void));
extern void recompute_reg_usage PARAMS ((rtx, int));
#ifdef BUFSIZ
extern void print_rtl_with_bb PARAMS ((FILE *, rtx));
extern void reload_cse_regs PARAMS ((rtx));
extern void init_reload PARAMS ((void));
extern void mark_home_live PARAMS ((int));
-#ifdef BUFSIZ
-extern int reload PARAMS ((rtx, int, FILE *));
-#endif
+extern int reload PARAMS ((rtx, int));
/* In caller-save.c */
extern void init_caller_save PARAMS ((void));
HOST_WIDE_INT *));
/* In calls.c */
-extern void emit_library_call PARAMS ((rtx, int, enum machine_mode,
- int, ...));
-extern rtx emit_library_call_value PARAMS ((rtx, rtx, int,
- enum machine_mode,
- int, ...));
+enum libcall_type
+{
+ LCT_NORMAL = 0,
+ LCT_CONST = 1,
+ LCT_PURE = 2,
+ LCT_CONST_MAKE_BLOCK = 3,
+ LCT_PURE_MAKE_BLOCK = 4
+};
+
+extern void emit_library_call PARAMS ((rtx, enum libcall_type,
+ enum machine_mode, int,
+ ...));
+extern rtx emit_library_call_value PARAMS ((rtx, rtx, enum libcall_type,
+ enum machine_mode, int,
+ ...));
/* In unroll.c */
extern int set_dominates_use PARAMS ((int, int, int, rtx, rtx));
/* In rtl.c */
extern void init_rtl PARAMS ((void));
-extern void rtx_free PARAMS ((rtx));
+extern void traverse_md_constants PARAMS ((int (*) (void **, void *),
+ void *));
+struct md_constant { char *name, *value; };
#ifdef BUFSIZ
extern int read_skip_spaces PARAMS ((FILE *));
/* In alias.c */
extern rtx canon_rtx PARAMS ((rtx));
extern int true_dependence PARAMS ((rtx, enum machine_mode, rtx,
- int (*)(rtx)));
+ int (*)(rtx, int)));
extern int read_dependence PARAMS ((rtx, rtx));
extern int anti_dependence PARAMS ((rtx, rtx));
extern int output_dependence PARAMS ((rtx, rtx));