|
| 1 | +#define IN_TARGET_CODE 1 |
| 2 | + |
| 3 | +#include "config.h" |
| 4 | +#include "system.h" |
| 5 | +#include "coretypes.h" |
| 6 | +#include "memmodel.h" |
| 7 | +#include "backend.h" |
| 8 | +#include "target.h" |
| 9 | +#include "rtl.h" |
| 10 | +#include "tree.h" |
| 11 | +#include "cfghooks.h" |
| 12 | +#include "df.h" |
| 13 | +#include "tm_p.h" |
| 14 | +#include "stringpool.h" |
| 15 | +#include "attribs.h" |
| 16 | +#include "optabs.h" |
| 17 | +#include "regs.h" |
| 18 | +#include "emit-rtl.h" |
| 19 | +#include "recog.h" |
| 20 | +#include "diagnostic.h" |
| 21 | +#include "fold-const.h" |
| 22 | +#include "varasm.h" |
| 23 | +#include "stor-layout.h" |
| 24 | +#include "calls.h" |
| 25 | +#include "output.h" |
| 26 | +#include "insn-attr.h" |
| 27 | +#include "flags.h" |
| 28 | +#include "explow.h" |
| 29 | +#include "expr.h" |
| 30 | +#include "langhooks.h" |
| 31 | +#include "tm-constrs.h" |
| 32 | +#include "cfgrtl.h" |
| 33 | +#include "tree-pass.h" |
| 34 | +#include "context.h" |
| 35 | +#include "builtins.h" |
| 36 | +#include "rtl-iter.h" |
| 37 | +#include "alias.h" |
| 38 | +#include "opts.h" |
| 39 | + |
| 40 | +/* This file should be included last. */ |
| 41 | +#include "target-def.h" |
| 42 | + |
| 43 | +/* Implement REGNO_REG_CLASS. */ |
| 44 | +const enum reg_class arc64_regno_to_regclass[FIRST_PSEUDO_REGISTER] = |
| 45 | + { |
| 46 | + AC16_REGS, AC16_REGS, AC16_REGS, AC16_REGS, |
| 47 | + HI_REGS, HI_REGS, HI_REGS, HI_REGS, |
| 48 | + HI_REGS, HI_REGS, HI_REGS, HI_REGS, |
| 49 | + AC16_REGS, AC16_REGS, AC16_REGS, AC16_REGS, |
| 50 | + HI_REGS, HI_REGS, HI_REGS, HI_REGS, |
| 51 | + HI_REGS, HI_REGS, HI_REGS, HI_REGS, |
| 52 | + HI_REGS, HI_REGS, HI_REGS, HI_REGS, |
| 53 | + NO_REGS, NO_REGS, HI_REGS, NO_REGS, |
| 54 | + |
| 55 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 56 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 57 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 58 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 59 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 60 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 61 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 62 | + NO_REGS, NO_REGS, NO_REGS, NO_REGS, |
| 63 | + |
| 64 | + NO_REGS, NO_REGS, NO_REGS, |
| 65 | + }; |
| 66 | + |
| 67 | +/* Return 1 if the register is used by the epilogue. We need to say the |
| 68 | + return register is used, but only after epilogue generation is complete. |
| 69 | + Note that in the case of sibcalls, the values "used by the epilogue" are |
| 70 | + considered live at the start of the called function. */ |
| 71 | + |
| 72 | +int |
| 73 | +arc64_epilogue_uses (int regno) |
| 74 | +{ |
| 75 | + if (epilogue_completed) |
| 76 | + if (regno == BLINK_REGNUM) |
| 77 | + return 1; |
| 78 | + |
| 79 | + return 0; |
| 80 | +} |
| 81 | + |
| 82 | +/* Implement INITIAL_ELIMINATION_OFFSET. FROM is either the frame pointer |
| 83 | + or argument pointer. TO is either the stack pointer or hard frame |
| 84 | + pointer. */ |
| 85 | + |
| 86 | +HOST_WIDE_INT |
| 87 | +arc64_initial_elimination_offset (unsigned from, unsigned to) |
| 88 | +{ |
| 89 | + return 0; |
| 90 | +} |
| 91 | + |
| 92 | +void arc64_init_expanders (void) |
| 93 | +{ |
| 94 | + /* FIXME! Not sure if I need it. */ |
| 95 | +} |
| 96 | + |
| 97 | +/* Given a comparison code (EQ, NE, etc.) and the first operand of a |
| 98 | + COMPARE, return the mode to be used for the comparison. */ |
| 99 | + |
| 100 | +machine_mode |
| 101 | +arc64_select_cc_mode (RTX_CODE op, rtx x, rtx y) |
| 102 | +{ |
| 103 | + return CC_Cmode; |
| 104 | +} |
| 105 | + |
| 106 | +/* Implement RETURN_ADDR_RTX. We do not support moving back to a |
| 107 | + previous frame. */ |
| 108 | + |
| 109 | +rtx |
| 110 | +arc64_return_addr (int count , rtx frame ATTRIBUTE_UNUSED) |
| 111 | +{ |
| 112 | + if (count != 0) |
| 113 | + return const0_rtx; |
| 114 | + return get_hard_reg_initial_val (Pmode, BLINK_REGNUM); |
| 115 | +} |
| 116 | + |
| 117 | +/* Implement REGMODE_NATURAL_SIZE. */ |
| 118 | + |
| 119 | +HOST_WIDE_INT |
| 120 | +arc64_regmode_natural_size (machine_mode mode) |
| 121 | +{ |
| 122 | + return UNITS_PER_WORD; /*FIXME! do I need it? */ |
| 123 | +} |
| 124 | + |
| 125 | +/* Given FROM and TO register numbers, say whether this elimination is allowed. |
| 126 | + Frame pointer elimination is automatically handled. |
| 127 | +
|
| 128 | + All eliminations are permissible. If we need a frame |
| 129 | + pointer, we must eliminate ARG_POINTER_REGNUM into |
| 130 | + FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */ |
| 131 | + |
| 132 | +static bool |
| 133 | +arc64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) |
| 134 | +{ |
| 135 | + return ((to == HARD_FRAME_POINTER_REGNUM) || (to == STACK_POINTER_REGNUM)); |
| 136 | +} |
| 137 | + |
| 138 | + |
| 139 | +/* Return TRUE if X is a legitimate address for accessing memory in |
| 140 | + mode MODE. */ |
| 141 | + |
| 142 | +static bool |
| 143 | +arc_legitimate_address_p (machine_mode mode, rtx x, bool strict) |
| 144 | +{ |
| 145 | + return true; |
| 146 | +} |
| 147 | + |
| 148 | +/* Implement TARGET_LEGITIMATE_CONSTANT_P hook. Return true for constants |
| 149 | + that should be rematerialized rather than spilled. */ |
| 150 | + |
| 151 | +static bool |
| 152 | +arc64_legitimate_constant_p (machine_mode mode, rtx x) |
| 153 | +{ |
| 154 | + if (CONST_INT_P (x)) |
| 155 | + return true; |
| 156 | + return false; |
| 157 | +} |
| 158 | + |
| 159 | +/* Target hooks. */ |
| 160 | + |
| 161 | +#undef TARGET_ASM_ALIGNED_DI_OP |
| 162 | +#define TARGET_ASM_ALIGNED_DI_OP "\t.xword\t" |
| 163 | + |
| 164 | +#undef TARGET_ASM_ALIGNED_HI_OP |
| 165 | +#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" |
| 166 | + |
| 167 | +#undef TARGET_ASM_ALIGNED_SI_OP |
| 168 | +#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" |
| 169 | + |
| 170 | +#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK |
| 171 | +#define TARGET_ASM_CAN_OUTPUT_MI_THUNK \ |
| 172 | + hook_bool_const_tree_hwi_hwi_const_tree_true |
| 173 | + |
| 174 | +#undef TARGET_CAN_ELIMINATE |
| 175 | +#define TARGET_CAN_ELIMINATE arc64_can_eliminate |
| 176 | + |
| 177 | +#undef TARGET_LEGITIMATE_ADDRESS_P |
| 178 | +#define TARGET_LEGITIMATE_ADDRESS_P arc64_legitimate_address_p |
| 179 | + |
| 180 | +#undef TARGET_LEGITIMATE_CONSTANT_P |
| 181 | +#define TARGET_LEGITIMATE_CONSTANT_P arc64_legitimate_constant_p |
| 182 | + |
| 183 | +struct gcc_target targetm = TARGET_INITIALIZER; |
| 184 | + |
| 185 | +#include "gt-arc64.h" |
0 commit comments