tm-vax.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999
  1. /* Definitions of target machine for GNU compiler. Vax version.
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GNU CC.
  4. GNU CC is distributed in the hope that it will be useful,
  5. but WITHOUT ANY WARRANTY. No author or distributor
  6. accepts responsibility to anyone for the consequences of using it
  7. or for whether it serves any particular purpose or works at all,
  8. unless he says so in writing. Refer to the GNU CC General Public
  9. License for full details.
  10. Everyone is granted permission to copy, modify and redistribute
  11. GNU CC, but only under the conditions described in the
  12. GNU CC General Public License. A copy of this license is
  13. supposed to have been given to you along with GNU CC so you
  14. can know your rights and responsibilities. It should be in a
  15. file named COPYING. Among other things, the copyright notice
  16. and this notice must be preserved on all copies. */
  17. /* Names to predefine in the preprocessor for this target machine. */
  18. #define CPP_PREDEFINES "-Dvax -Dunix"
  19. /* Print subsidiary information on the compiler version in use. */
  20. #define TARGET_VERSION printf ("(vax)");
  21. /* Run-time compilation parameters selecting different hardware subsets. */
  22. extern int target_flags;
  23. /* Macros used in the machine description to test the flags. */
  24. /* Nonzero if compiling code that Unix assembler can assemble. */
  25. #define TARGET_UNIX_ASM (target_flags & 1)
  26. /* Nonzero if compiling with VAX-11 "C" style structure alignment */
  27. #define TARGET_VAXC_ALIGNMENT (target_flags & 2)
  28. /* Macro to define tables used to set the flags.
  29. This is a list in braces of pairs in braces,
  30. each pair being { "NAME", VALUE }
  31. where VALUE is the bits to set or minus the bits to clear.
  32. An empty string NAME is used to identify the default VALUE. */
  33. #define TARGET_SWITCHES \
  34. { {"unix", 1}, \
  35. {"gnu", -1}, \
  36. {"vaxc-alignment", 2}, \
  37. { "", TARGET_DEFAULT}}
  38. /* Default target_flags if no switches specified. */
  39. #define TARGET_DEFAULT 1
  40. /* Target machine storage layout */
  41. /* Define this if most significant bit is lowest numbered
  42. in instructions that operate on numbered bit-fields.
  43. This is not true on the vax. */
  44. /* #define BITS_BIG_ENDIAN */
  45. /* Define this if most significant byte of a word is the lowest numbered. */
  46. /* That is not true on the vax. */
  47. /* #define BYTES_BIG_ENDIAN */
  48. /* Define this if most significant word of a multiword number is numbered. */
  49. /* This is not true on the vax. */
  50. /* #define WORDS_BIG_ENDIAN */
  51. /* Number of bits in an addressible storage unit */
  52. #define BITS_PER_UNIT 8
  53. /* Width in bits of a "word", which is the contents of a machine register.
  54. Note that this is not necessarily the width of data type `int';
  55. if using 16-bit ints on a 68000, this would still be 32.
  56. But on a machine with 16-bit registers, this would be 16. */
  57. #define BITS_PER_WORD 32
  58. /* Width of a word, in units (bytes). */
  59. #define UNITS_PER_WORD 4
  60. /* Width in bits of a pointer.
  61. See also the macro `Pmode' defined below. */
  62. #define POINTER_SIZE 32
  63. /* Allocation boundary (in *bits*) for storing pointers in memory. */
  64. #define POINTER_BOUNDARY (TARGET_VAXC_ALIGNMENT ? 8 : 32)
  65. /* Allocation boundary (in *bits*) for storing arguments in argument list. */
  66. #define PARM_BOUNDARY 32
  67. /* Allocation boundary (in *bits*) for the code of a function. */
  68. #define FUNCTION_BOUNDARY 16
  69. /* Alignment of field after `int : 0' in a structure. */
  70. #define EMPTY_FIELD_BOUNDARY (TARGET_VAXC_ALIGNMENT ? 8 : 32)
  71. /* Every structure's size must be a multiple of this. */
  72. #define STRUCTURE_SIZE_BOUNDARY 8
  73. /* No data type wants to be aligned rounder than this. */
  74. #define BIGGEST_ALIGNMENT (TARGET_VAXC_ALIGNMENT ? 8 : 32)
  75. /* Define this if move instructions will actually fail to work
  76. when given unaligned data. */
  77. /* #define STRICT_ALIGNMENT */
  78. /* Standard register usage. */
  79. /* Number of actual hardware registers.
  80. The hardware registers are assigned numbers for the compiler
  81. from 0 to just below FIRST_PSEUDO_REGISTER.
  82. All registers that the compiler knows about must be given numbers,
  83. even those that are not normally considered general registers. */
  84. #define FIRST_PSEUDO_REGISTER 16
  85. /* 1 for registers that have pervasive standard uses
  86. and are not available for the register allocator.
  87. On the vax, these are the AP, FP, SP and PC. */
  88. #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
  89. /* 1 for registers not available across function calls.
  90. These must include the FIXED_REGISTERS and also any
  91. registers that can be used without being saved.
  92. The latter must include the registers where values are returned
  93. and the register where structure-value addresses are passed.
  94. Aside from that, you can include as many other registers as you like. */
  95. #define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
  96. /* Return number of consecutive hard regs needed starting at reg REGNO
  97. to hold something of mode MODE.
  98. This is ordinarily the length in words of a value of mode MODE
  99. but can be less for certain modes in special long registers.
  100. On the vax, all registers are one word long. */
  101. #define HARD_REGNO_NREGS(REGNO, MODE) \
  102. ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  103. /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
  104. On the vax, all registers can hold all modes. */
  105. #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
  106. /* Value is 1 if it is a good idea to tie two pseudo registers
  107. when one has mode MODE1 and one has mode MODE2.
  108. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  109. for any hard reg, then this must be 0 for correct output. */
  110. #define MODES_TIEABLE_P(MODE1, MODE2) 1
  111. /* Specify the registers used for certain standard purposes.
  112. The values of these macros are register numbers. */
  113. /* Vax pc is overloaded on a register. */
  114. #define PC_REGNUM 15
  115. /* Register to use for pushing function arguments. */
  116. #define STACK_POINTER_REGNUM 14
  117. /* Base register for access to local variables of the function. */
  118. #define FRAME_POINTER_REGNUM 13
  119. /* Value should be nonzero if functions must have frame pointers.
  120. Zero means the frame pointer need not be set up (and parms
  121. may be accessed via the stack pointer) in functions that seem suitable.
  122. This is computed in `reload', in reload1.c. */
  123. #define FRAME_POINTER_REQUIRED 1
  124. /* Base register for access to arguments of the function. */
  125. #define ARG_POINTER_REGNUM 12
  126. /* Register in which static-chain is passed to a function. */
  127. #define STATIC_CHAIN_REGNUM 0
  128. /* Register in which address to store a structure value
  129. is passed to a function. */
  130. #define STRUCT_VALUE_REGNUM 1
  131. /* Define the classes of registers for register constraints in the
  132. machine description. Also define ranges of constants.
  133. One of the classes must always be named ALL_REGS and include all hard regs.
  134. If there is more than one class, another class must be named NO_REGS
  135. and contain no registers.
  136. The name GENERAL_REGS must be the name of a class (or an alias for
  137. another name such as ALL_REGS). This is the class of registers
  138. that is allowed by "g" or "r" in a register constraint.
  139. Also, registers outside this class are allocated only when
  140. instructions express preferences for them.
  141. The classes must be numbered in nondecreasing order; that is,
  142. a larger-numbered class must never be contained completely
  143. in a smaller-numbered class.
  144. For any two classes, it is very desirable that there be another
  145. class that represents their union. */
  146. /* The vax has only one kind of registers, so NO_REGS and ALL_REGS
  147. are the only classes. */
  148. enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
  149. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  150. /* Since GENERAL_REGS is the same class as ALL_REGS,
  151. don't give it a different class number; just make it an alias. */
  152. #define GENERAL_REGS ALL_REGS
  153. /* Give names of register classes as strings for dump file. */
  154. #define REG_CLASS_NAMES \
  155. {"NO_REGS", "ALL_REGS" }
  156. /* Define which registers fit in which classes.
  157. This is an initializer for a vector of HARD_REG_SET
  158. of length N_REG_CLASSES. */
  159. #define REG_CLASS_CONTENTS {0, 0xffff}
  160. /* The same information, inverted:
  161. Return the class number of the smallest class containing
  162. reg number REGNO. This could be a conditional expression
  163. or could index an array. */
  164. #define REGNO_REG_CLASS(REGNO) ALL_REGS
  165. /* The class value for index registers, and the one for base regs. */
  166. #define INDEX_REG_CLASS ALL_REGS
  167. #define BASE_REG_CLASS ALL_REGS
  168. /* Get reg_class from a letter such as appears in the machine description. */
  169. #define REG_CLASS_FROM_LETTER(C) NO_REGS
  170. /* The letters I, J, K, L and M in a register constraint string
  171. can be used to stand for particular ranges of immediate operands.
  172. This macro defines what the ranges are.
  173. C is the letter, and VALUE is a constant value.
  174. Return 1 if VALUE is in the range specified by C. */
  175. #define CONST_OK_FOR_LETTER_P(VALUE, C) 0
  176. /* Similar, but for floating constants, and defining letters G and H.
  177. Here VALUE is the CONST_DOUBLE rtx itself. */
  178. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
  179. /* Given an rtx X being reloaded into a reg required to be
  180. in class CLASS, return the class of reg to actually use.
  181. In general this is just CLASS; but on some machines
  182. in some cases it is preferable to use a more restrictive class. */
  183. #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
  184. /* Return the maximum number of consecutive registers
  185. needed to represent mode MODE in a register of class CLASS. */
  186. /* On the vax, this is always the size of MODE in words,
  187. since all registers are the same size. */
  188. #define CLASS_MAX_NREGS(CLASS, MODE) \
  189. ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  190. /* Stack layout; function entry, exit and calling. */
  191. /* Define this if pushing a word on the stack
  192. makes the stack pointer a smaller address. */
  193. #define STACK_GROWS_DOWNWARD
  194. /* Define this if the nominal address of the stack frame
  195. is at the high-address end of the local variables;
  196. that is, each additional local variable allocated
  197. goes at a more negative offset in the frame. */
  198. #define FRAME_GROWS_DOWNWARD
  199. /* Offset within stack frame to start allocating local variables at.
  200. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  201. first local allocated. Otherwise, it is the offset to the BEGINNING
  202. of the first local allocated. */
  203. #define STARTING_FRAME_OFFSET 0
  204. /* If we generate an insn to push BYTES bytes,
  205. this says how many the stack pointer really advances by.
  206. On the vax, -(sp) pushes only the bytes of the operands. */
  207. #define PUSH_ROUNDING(BYTES) (BYTES)
  208. /* Offset of first parameter from the argument pointer register value. */
  209. #define FIRST_PARM_OFFSET 4
  210. /* Value is 1 if returning from a function call automatically
  211. pops the arguments described by the number-of-args field in the call.
  212. FUNTYPE is the data type of the function (as a tree),
  213. or for a library call it is an identifier node for the subroutine name.
  214. On the Vax, the RET insn always pops all the args for any function. */
  215. #define RETURN_POPS_ARGS(FUNTYPE) 1
  216. /* Define how to find the value returned by a function.
  217. VALTYPE is the data type of the value (as a tree).
  218. If the precise function being called is known, FUNC is its FUNCTION_DECL;
  219. otherwise, FUNC is 0. */
  220. /* On the Vax the return value is in R0 regardless. */
  221. #define FUNCTION_VALUE(VALTYPE, FUNC) \
  222. gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
  223. /* Define how to find the value returned by a library function
  224. assuming the value has mode MODE. */
  225. /* On the Vax the return value is in R0 regardless. */
  226. #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
  227. /* 1 if N is a possible register number for a function value.
  228. On the Vax, R0 is the only register thus used. */
  229. #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
  230. /* 1 if N is a possible register number for function argument passing.
  231. On the Vax, no registers are used in this way. */
  232. #define FUNCTION_ARG_REGNO_P(N) 0
  233. /* Define a data type for recording info about an argument list
  234. during the scan of that argument list. This data type should
  235. hold all necessary information about the function itself
  236. and about the args processed so far, enough to enable macros
  237. such as FUNCTION_ARG to determine where the next arg should go.
  238. On the vax, this is a single integer, which is a number of bytes
  239. of arguments scanned so far. */
  240. #define CUMULATIVE_ARGS int
  241. /* Initialize a variable CUM of type CUMULATIVE_ARGS
  242. for a call to a function whose data type is FNTYPE.
  243. For a library call, FNTYPE is 0.
  244. On the vax, the offset starts at 0. */
  245. #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \
  246. ((CUM) = 0)
  247. /* Update the data in CUM to advance over an argument
  248. of mode MODE and data type TYPE.
  249. (TYPE is null for libcalls where that information may not be available.) */
  250. #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
  251. ((CUM) += ((MODE) != BLKmode \
  252. ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
  253. : (int_size_in_bytes (TYPE) + 3) & ~3))
  254. /* Define where to put the arguments to a function.
  255. Value is zero to push the argument on the stack,
  256. or a hard register in which to store the argument.
  257. MODE is the argument's machine mode.
  258. TYPE is the data type of the argument (as a tree).
  259. This is null for libcalls where that information may
  260. not be available.
  261. CUM is a variable of type CUMULATIVE_ARGS which gives info about
  262. the preceding args and about the function being called.
  263. NAMED is nonzero if this argument is a named parameter
  264. (otherwise it is an extra parameter matching an ellipsis). */
  265. /* On the vax all args are pushed. */
  266. #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
  267. /* This macro generates the assembly code for function entry.
  268. FILE is a stdio stream to output the code to.
  269. SIZE is an int: how many units of temporary storage to allocate.
  270. Refer to the array `regs_ever_live' to determine which registers
  271. to save; `regs_ever_live[I]' is nonzero if register number I
  272. is ever used in the function. This macro is responsible for
  273. knowing which registers should not be saved even if used. */
  274. #define FUNCTION_PROLOGUE(FILE, SIZE) \
  275. { register int regno; \
  276. register int mask = 0; \
  277. extern char call_used_regs[]; \
  278. for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
  279. if (regs_ever_live[regno] && !call_used_regs[regno]) \
  280. mask |= 1 << regno; \
  281. fprintf (FILE, "\t.word 0x%x\n", mask); \
  282. MAYBE_VMS_FUNCTION_PROLOGUE(FILE) \
  283. if ((SIZE) >= 64) fprintf (FILE, "\tmovab %d(sp),sp\n", -SIZE);\
  284. else if (SIZE) fprintf (FILE, "\tsubl2 $%d,sp\n", (SIZE)); }
  285. /* tm-vms.h redefines this. */
  286. #define MAYBE_VMS_FUNCTION_PROLOGUE(FILE)
  287. /* Output assembler code to FILE to increment profiler label # LABELNO
  288. for profiling a function entry. */
  289. #define FUNCTION_PROFILER(FILE, LABELNO) \
  290. fprintf (FILE, "\tmovab LP%d,r0\n\tjsb mcount\n", (LABELNO));
  291. /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
  292. the stack pointer does not matter. The value is tested only in
  293. functions that have frame pointers.
  294. No definition is equivalent to always zero. */
  295. #define EXIT_IGNORE_STACK 1
  296. /* This macro generates the assembly code for function exit,
  297. on machines that need it. If FUNCTION_EPILOGUE is not defined
  298. then individual return instructions are generated for each
  299. return statement. Args are same as for FUNCTION_PROLOGUE. */
  300. /* #define FUNCTION_EPILOGUE(FILE, SIZE) */
  301. /* If the memory address ADDR is relative to the frame pointer,
  302. correct it to be relative to the stack pointer instead.
  303. This is for when we don't use a frame pointer.
  304. ADDR should be a variable name. */
  305. #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) abort ();
  306. /* Addressing modes, and classification of registers for them. */
  307. #define HAVE_POST_INCREMENT
  308. /* #define HAVE_POST_DECREMENT */
  309. #define HAVE_PRE_DECREMENT
  310. /* #define HAVE_PRE_INCREMENT */
  311. /* Macros to check register numbers against specific register classes. */
  312. /* These assume that REGNO is a hard or pseudo reg number.
  313. They give nonzero only if REGNO is a hard reg of the suitable class
  314. or a pseudo reg currently allocated to a suitable hard reg.
  315. Since they use reg_renumber, they are safe only once reg_renumber
  316. has been allocated, which happens in local-alloc.c. */
  317. #define REGNO_OK_FOR_INDEX_P(regno) \
  318. ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
  319. #define REGNO_OK_FOR_BASE_P(regno) \
  320. ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
  321. /* Maximum number of registers that can appear in a valid memory address. */
  322. #define MAX_REGS_PER_ADDRESS 2
  323. /* 1 if X is an rtx for a constant that is a valid address. */
  324. #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
  325. /* Nonzero if the constant value X is a legitimate general operand.
  326. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
  327. #define LEGITIMATE_CONSTANT_P(X) 1
  328. /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  329. and check its validity for a certain class.
  330. We have two alternate definitions for each of them.
  331. The usual definition accepts all pseudo regs; the other rejects
  332. them unless they have been allocated suitable hard regs.
  333. The symbol REG_OK_STRICT causes the latter definition to be used.
  334. Most source files want to accept pseudo regs in the hope that
  335. they will get allocated to the class that the insn wants them to be in.
  336. Source files for reload pass need to be strict.
  337. After reload, it makes no difference, since pseudo regs have
  338. been eliminated by then. */
  339. #ifndef REG_OK_STRICT
  340. /* Nonzero if X is a hard reg that can be used as an index
  341. or if it is a pseudo reg. */
  342. #define REG_OK_FOR_INDEX_P(X) 1
  343. /* Nonzero if X is a hard reg that can be used as a base reg
  344. or if it is a pseudo reg. */
  345. #define REG_OK_FOR_BASE_P(X) 1
  346. #else
  347. /* Nonzero if X is a hard reg that can be used as an index. */
  348. #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
  349. /* Nonzero if X is a hard reg that can be used as a base reg. */
  350. #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  351. #endif
  352. /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  353. that is a valid memory address for an instruction.
  354. The MODE argument is the machine mode for the MEM expression
  355. that wants to use this address.
  356. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
  357. except for CONSTANT_ADDRESS_P which is actually machine-independent. */
  358. /* 1 if X is an address that we could indirect through. */
  359. #define INDIRECTABLE_ADDRESS_P(X) \
  360. (CONSTANT_ADDRESS_P (X) \
  361. || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
  362. || (GET_CODE (X) == PLUS \
  363. && GET_CODE (XEXP (X, 0)) == REG \
  364. && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  365. && CONSTANT_ADDRESS_P (XEXP (X, 1))))
  366. /* Go to ADDR if X is a valid address not using indexing.
  367. (This much is the easy part.) */
  368. #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
  369. { register rtx xfoob = (X); \
  370. if (GET_CODE (xfoob) == REG) goto ADDR; \
  371. if (INDIRECTABLE_ADDRESS_P (xfoob)) goto ADDR; \
  372. xfoob = XEXP (X, 0); \
  373. if (GET_CODE (X) == MEM && INDIRECTABLE_ADDRESS_P (xfoob)) \
  374. goto ADDR; \
  375. if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
  376. && GET_CODE (xfoob) == REG && REG_OK_FOR_BASE_P (xfoob)) \
  377. goto ADDR; }
  378. /* 1 if PROD is either a reg times size of mode MODE
  379. or just a reg, if MODE is just one byte.
  380. This macro's expansion uses the temporary variables xfoo0 and xfoo1
  381. that must be declared in the surrounding context. */
  382. #define INDEX_TERM_P(PROD, MODE) \
  383. (GET_MODE_SIZE (MODE) == 1 \
  384. ? (GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \
  385. : (GET_CODE (PROD) == MULT \
  386. && \
  387. (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
  388. ((GET_CODE (xfoo0) == CONST_INT \
  389. && INTVAL (xfoo0) == GET_MODE_SIZE (MODE) \
  390. && GET_CODE (xfoo1) == REG \
  391. && REG_OK_FOR_INDEX_P (xfoo1)) \
  392. || \
  393. (GET_CODE (xfoo1) == CONST_INT \
  394. && INTVAL (xfoo1) == GET_MODE_SIZE (MODE) \
  395. && GET_CODE (xfoo0) == REG \
  396. && REG_OK_FOR_INDEX_P (xfoo0))))))
  397. /* Go to ADDR if X is the sum of a register
  398. and a valid index term for mode MODE. */
  399. #define GO_IF_REG_PLUS_INDEX(X, MODE, ADDR) \
  400. { register rtx xfooa; \
  401. if (GET_CODE (X) == PLUS) \
  402. { if (GET_CODE (XEXP (X, 0)) == REG \
  403. && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  404. && (xfooa = XEXP (X, 1), \
  405. INDEX_TERM_P (xfooa, MODE))) \
  406. goto ADDR; \
  407. if (GET_CODE (XEXP (X, 1)) == REG \
  408. && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
  409. && (xfooa = XEXP (X, 0), \
  410. INDEX_TERM_P (xfooa, MODE))) \
  411. goto ADDR; } }
  412. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
  413. { register rtx xfoo, xfoo0, xfoo1; \
  414. GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
  415. if (GET_CODE (X) == PLUS) \
  416. { /* Handle <address>[index] represented with index-sum outermost */\
  417. xfoo = XEXP (X, 0); \
  418. if (INDEX_TERM_P (xfoo, MODE)) \
  419. { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 1), ADDR); } \
  420. xfoo = XEXP (X, 1); \
  421. if (INDEX_TERM_P (xfoo, MODE)) \
  422. { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 0), ADDR); } \
  423. /* Handle offset(reg)[index] with offset added outermost */ \
  424. if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \
  425. { if (GET_CODE (XEXP (X, 1)) == REG \
  426. && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
  427. goto ADDR; \
  428. GO_IF_REG_PLUS_INDEX (XEXP (X, 1), MODE, ADDR); } \
  429. if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \
  430. { if (GET_CODE (XEXP (X, 0)) == REG \
  431. && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
  432. goto ADDR; \
  433. GO_IF_REG_PLUS_INDEX (XEXP (X, 0), MODE, ADDR); } } }
  434. /* Try machine-dependent ways of modifying an illegitimate address
  435. to be legitimate. If we find one, return the new, valid address.
  436. This macro is used in only one place: `memory_address' in explow.c.
  437. OLDX is the address as it was before break_out_memory_refs was called.
  438. In some cases it is useful to look at this to decide what needs to be done.
  439. MODE and WIN are passed so that this macro can use
  440. GO_IF_LEGITIMATE_ADDRESS.
  441. It is always safe for this macro to do nothing. It exists to recognize
  442. opportunities to optimize the output.
  443. For the vax, nothing needs to be done. */
  444. #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
  445. /* Go to LABEL if ADDR (a legitimate address expression)
  446. has an effect that depends on the machine mode it is used for.
  447. On the VAX, the predecrement and postincrement address depend thus
  448. (the amount of decrement or increment being the length of the operand)
  449. and all indexed address depend thus (because the index scale factor
  450. is the length of the operand). */
  451. #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
  452. { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
  453. goto LABEL; \
  454. if (GET_CODE (ADDR) == PLUS) \
  455. { if (CONSTANT_ADDRESS_P (XEXP (ADDR, 0)) \
  456. && GET_CODE (XEXP (ADDR, 1)) == REG); \
  457. else if (CONSTANT_ADDRESS_P (XEXP (ADDR, 1)) \
  458. && GET_CODE (XEXP (ADDR, 0)) == REG); \
  459. else goto LABEL; }}
  460. /* Specify the machine mode that this machine uses
  461. for the index in the tablejump instruction. */
  462. #define CASE_VECTOR_MODE HImode
  463. /* Define this if the case instruction expects the table
  464. to contain offsets from the address of the table.
  465. Do not define this if the table should contain absolute addresses. */
  466. #define CASE_VECTOR_PC_RELATIVE
  467. /* Define this if the case instruction drops through after the table
  468. when the index is out of range. Don't define it if the case insn
  469. jumps to the default label instead. */
  470. #define CASE_DROPS_THROUGH
  471. /* Specify the tree operation to be used to convert reals to integers. */
  472. #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
  473. /* This is the kind of divide that is easiest to do in the general case. */
  474. #define EASY_DIV_EXPR TRUNC_DIV_EXPR
  475. /* Define this as 1 if `char' should by default be signed; else as 0. */
  476. #define DEFAULT_SIGNED_CHAR 1
  477. /* This flag, if defined, says the same insns that convert to a signed fixnum
  478. also convert validly to an unsigned one. */
  479. #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
  480. /* Max number of bytes we can move from memory to memory
  481. in one reasonably fast instruction. */
  482. #define MOVE_MAX 8
  483. /* Define this if zero-extension is slow (more than one real instruction). */
  484. /* #define SLOW_ZERO_EXTEND */
  485. /* Nonzero if access to memory by bytes is slow and undesirable. */
  486. #define SLOW_BYTE_ACCESS 0
  487. /* Define if shifts truncate the shift count
  488. which implies one can omit a sign-extension or zero-extension
  489. of a shift count. */
  490. /* #define SHIFT_COUNT_TRUNCATED */
  491. /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  492. is done just by pretending it is already truncated. */
  493. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  494. /* Specify the machine mode that pointers have.
  495. After generation of rtl, the compiler makes no further distinction
  496. between pointers and any other objects of this machine mode. */
  497. #define Pmode SImode
  498. /* A function address in a call instruction
  499. is a byte address (for indexing purposes)
  500. so give the MEM rtx a byte's mode. */
  501. #define FUNCTION_MODE QImode
  502. /* Compute the cost of computing a constant rtl expression RTX
  503. whose rtx-code is CODE. The body of this macro is a portion
  504. of a switch statement. If the code is computed here,
  505. return it with a return statement. Otherwise, break from the switch. */
  506. #define CONST_COSTS(RTX,CODE) \
  507. case CONST_INT: \
  508. /* Constant zero is super cheap due to clr instruction. */ \
  509. if (RTX == const0_rtx) return 0; \
  510. if ((unsigned) INTVAL (RTX) < 077) return 1; \
  511. case CONST: \
  512. case LABEL_REF: \
  513. case SYMBOL_REF: \
  514. return 3; \
  515. case CONST_DOUBLE: \
  516. return 5;
  517. /* Tell final.c how to eliminate redundant test instructions. */
  518. /* Here we define machine-dependent flags and fields in cc_status
  519. (see `conditions.h'). No extra ones are needed for the vax. */
  520. /* Store in cc_status the expressions
  521. that the condition codes will describe
  522. after execution of an instruction whose pattern is EXP.
  523. Do not alter them if the instruction would not alter the cc's. */
  524. #define NOTICE_UPDATE_CC(EXP) \
  525. { if (GET_CODE (EXP) == SET) \
  526. { if (GET_CODE (SET_SRC (EXP)) == CALL) \
  527. CC_STATUS_INIT; \
  528. else if (GET_CODE (SET_DEST (EXP)) != PC) \
  529. { cc_status.flags = 0; \
  530. cc_status.value1 = SET_DEST (EXP); \
  531. cc_status.value2 = SET_SRC (EXP); } } \
  532. else if (GET_CODE (EXP) == PARALLEL \
  533. && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
  534. { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) != PC) \
  535. { cc_status.flags = 0; \
  536. cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
  537. cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); } } \
  538. else CC_STATUS_INIT; \
  539. if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
  540. && cc_status.value2 \
  541. && reg_mentioned_p (cc_status.value1, cc_status.value2)) \
  542. cc_status.value2 = 0; \
  543. if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM \
  544. && cc_status.value2 \
  545. && GET_CODE (cc_status.value2) == MEM) \
  546. cc_status.value2 = 0; }
  547. /* Actual condition, one line up, should be that value2's address
  548. depends on value1, but that is too much of a pain. */
  549. #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
  550. { if (cc_status.flags & CC_NO_OVERFLOW) \
  551. return NO_OV; \
  552. return NORMAL; }
  553. /* Control the assembler format that we output. */
  554. /* Output at beginning of assembler file. */
  555. #define ASM_FILE_START "#NO_APP\n"
  556. /* Output to assembler file text saying following lines
  557. may contain character constants, extra white space, comments, etc. */
  558. #define ASM_APP_ON "#APP\n"
  559. /* Output to assembler file text saying following lines
  560. no longer contain unusual constructs. */
  561. #define ASM_APP_OFF "#NO_APP\n"
  562. /* Output before read-only data. */
  563. #define TEXT_SECTION_ASM_OP ".text"
  564. /* Output before writable data. */
  565. #define DATA_SECTION_ASM_OP ".data"
  566. /* How to refer to registers in assembler output.
  567. This sequence is indexed by compiler's hard-register-number (see above). */
  568. #define REGISTER_NAMES \
  569. {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
  570. "r9", "r10", "r11", "ap", "fp", "sp", "pc"}
  571. /* How to renumber registers for dbx and gdb.
  572. Vax needs no change in the numeration. */
  573. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  574. /* Do not break .stabs pseudos into continuations. */
  575. #define DBX_CONTIN_LENGTH 0
  576. /* This is the char to use for continuation (in case we need to turn
  577. continuation back on). */
  578. #define DBX_CONTIN_CHAR '?'
  579. /* Don't use the `xsfoo;' construct in DBX output; this system
  580. doesn't support it. */
  581. #define DBX_NO_XREFS
  582. /* This is how to output the definition of a user-level label named NAME,
  583. such as the label on a static function or variable NAME. */
  584. #define ASM_OUTPUT_LABEL(FILE,NAME) \
  585. do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
  586. /* This is how to output a command to make the user-level label named NAME
  587. defined for reference from other files. */
  588. #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
  589. do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
  590. /* This is how to output a reference to a user-level label named NAME. */
  591. #define ASM_OUTPUT_LABELREF(FILE,NAME) \
  592. fprintf (FILE, "_%s", NAME)
  593. /* This is how to output an internal numbered label where
  594. PREFIX is the class of label and NUM is the number within the class. */
  595. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
  596. fprintf (FILE, "%s%d:\n", PREFIX, NUM)
  597. /* This is how to store into the string LABEL
  598. the symbol_ref name of an internal numbered label where
  599. PREFIX is the class of label and NUM is the number within the class.
  600. This is suitable for output with `assemble_name'. */
  601. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
  602. sprintf (LABEL, "*%s%d", PREFIX, NUM)
  603. /* This is how to output an assembler line defining a `double' constant. */
  604. #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
  605. fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
  606. /* This is how to output an assembler line defining a `float' constant. */
  607. #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
  608. fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
  609. /* This is how to output an assembler line defining an `int' constant. */
  610. #define ASM_OUTPUT_INT(FILE,VALUE) \
  611. ( fprintf (FILE, "\t.long "), \
  612. output_addr_const (FILE, (VALUE)), \
  613. fprintf (FILE, "\n"))
  614. /* Likewise for `char' and `short' constants. */
  615. #define ASM_OUTPUT_SHORT(FILE,VALUE) \
  616. ( fprintf (FILE, "\t.word "), \
  617. output_addr_const (FILE, (VALUE)), \
  618. fprintf (FILE, "\n"))
  619. #define ASM_OUTPUT_CHAR(FILE,VALUE) \
  620. ( fprintf (FILE, "\t.byte "), \
  621. output_addr_const (FILE, (VALUE)), \
  622. fprintf (FILE, "\n"))
  623. /* This is how to output an assembler line for a numeric constant byte. */
  624. #define ASM_OUTPUT_BYTE(FILE,VALUE) \
  625. fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
  626. /* This is how to output an element of a case-vector that is absolute.
  627. (The Vax does not use such vectors,
  628. but we must define this macro anyway.) */
  629. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
  630. fprintf (FILE, "\t.long L%d\n", VALUE)
  631. /* This is how to output an element of a case-vector that is relative. */
  632. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
  633. fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
  634. /* This is how to output an assembler line
  635. that says to advance the location counter
  636. to a multiple of 2**LOG bytes. */
  637. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  638. fprintf (FILE, "\t.align %d\n", (LOG))
  639. #define ASM_OUTPUT_SKIP(FILE,SIZE) \
  640. fprintf (FILE, "\t.space %d\n", (SIZE))
  641. /* This says how to output an assembler line
  642. to define a global common symbol. */
  643. #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE) \
  644. ( fputs (".comm ", (FILE)), \
  645. assemble_name ((FILE), (NAME)), \
  646. fprintf ((FILE), ",%d\n", (SIZE)))
  647. /* This says how to output an assembler line
  648. to define a local common symbol. */
  649. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE) \
  650. ( fputs (".lcomm ", (FILE)), \
  651. assemble_name ((FILE), (NAME)), \
  652. fprintf ((FILE), ",%d\n", (SIZE)))
  653. /* Store in OUTPUT a string (made with alloca) containing
  654. an assembler-name for a local static variable named NAME.
  655. LABELNO is an integer which is different for each call. */
  656. #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
  657. ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
  658. sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
  659. /* Define the parentheses used to group arithmetic operations
  660. in assembler code. */
  661. #define ASM_OPEN_PAREN "("
  662. #define ASM_CLOSE_PAREN ")"
  663. /* Define results of standard character escape sequences. */
  664. #define TARGET_BELL 007
  665. #define TARGET_BS 010
  666. #define TARGET_TAB 011
  667. #define TARGET_NEWLINE 012
  668. #define TARGET_VT 013
  669. #define TARGET_FF 014
  670. #define TARGET_CR 015
  671. /* Print an instruction operand X on file FILE.
  672. CODE is the code from the %-spec that requested printing this operand;
  673. if `%z3' was used to print operand 3, then CODE is 'z'.
  674. On the Vax, CODE is not used. */
  675. #define PRINT_OPERAND(FILE, X, CODE) \
  676. { if (GET_CODE (X) == REG) \
  677. fprintf (FILE, "%s", reg_name [REGNO (X)]); \
  678. else if (GET_CODE (X) == MEM) \
  679. output_address (XEXP (X, 0)); \
  680. else if (GET_CODE (X) == CONST_DOUBLE) \
  681. { union { double d; int i[2]; } u; \
  682. u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
  683. fprintf (FILE, "$0d%.20e", u.d); } \
  684. else { putc ('$', FILE); output_addr_const (FILE, X); }}
  685. /* Print a memory operand whose address is X, on file FILE. */
  686. #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
  687. { register rtx reg1, reg2, breg, ireg; \
  688. register rtx addr = ADDR; \
  689. rtx offset; \
  690. retry: \
  691. switch (GET_CODE (addr)) \
  692. { \
  693. case MEM: \
  694. fprintf (FILE, "*"); \
  695. addr = XEXP (addr, 0); \
  696. goto retry; \
  697. case REG: \
  698. fprintf (FILE, "(%s)", reg_name [REGNO (addr)]); \
  699. break; \
  700. case PRE_DEC: \
  701. fprintf (FILE, "-(%s)", reg_name [REGNO (XEXP (addr, 0))]); \
  702. break; \
  703. case POST_INC: \
  704. fprintf (FILE, "(%s)+", reg_name [REGNO (XEXP (addr, 0))]); \
  705. break; \
  706. case PLUS: \
  707. reg1 = 0; reg2 = 0; \
  708. ireg = 0; breg = 0; \
  709. offset = 0; \
  710. if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \
  711. || GET_CODE (XEXP (addr, 0)) == MEM) \
  712. { \
  713. offset = XEXP (addr, 0); \
  714. addr = XEXP (addr, 1); \
  715. } \
  716. else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \
  717. || GET_CODE (XEXP (addr, 1)) == MEM) \
  718. { \
  719. offset = XEXP (addr, 1); \
  720. addr = XEXP (addr, 0); \
  721. } \
  722. if (GET_CODE (addr) != PLUS) ; \
  723. else if (GET_CODE (XEXP (addr, 0)) == MULT) \
  724. { \
  725. reg1 = XEXP (addr, 0); \
  726. addr = XEXP (addr, 1); \
  727. } \
  728. else if (GET_CODE (XEXP (addr, 1)) == MULT) \
  729. { \
  730. reg1 = XEXP (addr, 1); \
  731. addr = XEXP (addr, 0); \
  732. } \
  733. else if (GET_CODE (XEXP (addr, 0)) == REG) \
  734. { \
  735. reg1 = XEXP (addr, 0); \
  736. addr = XEXP (addr, 1); \
  737. } \
  738. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  739. { \
  740. reg1 = XEXP (addr, 1); \
  741. addr = XEXP (addr, 0); \
  742. } \
  743. if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) \
  744. { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
  745. if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
  746. if (reg1 != 0 && GET_CODE (reg1) == MULT) \
  747. { breg = reg2; ireg = reg1; } \
  748. else if (reg2 != 0 && GET_CODE (reg2) == MULT) \
  749. { breg = reg1; ireg = reg2; } \
  750. else if (reg2 != 0 || GET_CODE (addr) == MEM) \
  751. { breg = reg2; ireg = reg1; } \
  752. else \
  753. { breg = reg1; ireg = reg2; } \
  754. if (addr != 0) \
  755. output_address (offset); \
  756. if (breg != 0) \
  757. { if (GET_CODE (breg) != REG) abort (); \
  758. fprintf (FILE, "(%s)", reg_name[REGNO (breg)]); } \
  759. if (ireg != 0) \
  760. { if (GET_CODE (ireg) == MULT) ireg = XEXP (ireg, 0); \
  761. if (GET_CODE (ireg) != REG) abort (); \
  762. fprintf (FILE, "[%s]", reg_name[REGNO (ireg)]); } \
  763. break; \
  764. default: \
  765. output_addr_const (FILE, addr); \
  766. }}