tm-vax.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  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"
  19. /* Run-time compilation parameters selecting different hardware subsets. */
  20. extern int target_flags;
  21. /* Macros used in the machine description to test the flags. */
  22. /* Nonzero if compiling code that Unix assembler can assemble. */
  23. #define TARGET_UNIX_ASM (target_flags & 1)
  24. /* Macro to define tables used to set the flags.
  25. This is a list in braces of pairs in braces,
  26. each pair being { "NAME", VALUE }
  27. where VALUE is the bits to set or minus the bits to clear.
  28. An empty string NAME is used to identify the default VALUE. */
  29. #define TARGET_SWITCHES \
  30. { {"unix", 1}, \
  31. { "", 0}}
  32. /* Target machine storage layout */
  33. /* Define this if most significant bit is lowest numbered
  34. in instructions that operate on numbered bit-fields.
  35. This is not true on the vax. */
  36. /* #define BITS_BIG_ENDIAN */
  37. /* Define this if most significant byte of a word is the lowest numbered. */
  38. /* That is not true on the vax. */
  39. /* #define BYTES_BIG_ENDIAN */
  40. /* Define this if most significant word of a multiword number is numbered. */
  41. /* This is not true on the vax. */
  42. /* #define WORDS_BIG_ENDIAN */
  43. /* Number of bits in an addressible storage unit */
  44. #define BITS_PER_UNIT 8
  45. /* Width in bits of a "word", which is the contents of a machine register.
  46. Note that this is not necessarily the width of data type `int';
  47. if using 16-bit ints on a 68000, this would still be 32.
  48. But on a machine with 16-bit registers, this would be 16. */
  49. #define BITS_PER_WORD 32
  50. /* Width of a word, in units (bytes). */
  51. #define UNITS_PER_WORD 4
  52. /* Width in bits of a pointer.
  53. See also the macro `Pmode' defined below. */
  54. #define POINTER_SIZE 32
  55. /* Allocation boundary (in *bits*) for storing pointers in memory. */
  56. #define POINTER_BOUNDARY 32
  57. /* Allocation boundary (in *bits*) for storing arguments in argument list. */
  58. #define PARM_BOUNDARY 32
  59. /* Allocation boundary (in *bits*) for the code of a function. */
  60. #define FUNCTION_BOUNDARY 16
  61. /* There is no point aligning anything to a rounder boundary than this. */
  62. #define BIGGEST_ALIGNMENT 32
  63. /* Define this if move instructions will actually fail to work
  64. when given unaligned data. */
  65. /* #define STRICT_ALIGNMENT */
  66. /* Standard register usage. */
  67. /* Number of actual hardware registers.
  68. The hardware registers are assigned numbers for the compiler
  69. from 0 to just below FIRST_PSEUDO_REGISTER.
  70. All registers that the compiler knows about must be given numbers,
  71. even those that are not normally considered general registers. */
  72. #define FIRST_PSEUDO_REGISTER 16
  73. /* 1 for registers that have pervasive standard uses
  74. and are not available for the register allocator.
  75. On the vax, these are the AP, FP, SP and PC. */
  76. #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
  77. /* 1 for registers not available across function calls.
  78. These must include the FIXED_REGISTERS and also any
  79. registers that can be used without being saved.
  80. The latter must include the registers where values are returned
  81. and the register where structure-value addresses are passed.
  82. Aside from that, you can include as many other registers as you like. */
  83. #define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
  84. /* Return number of consecutive hard regs needed starting at reg REGNO
  85. to hold something of mode MODE.
  86. This is ordinarily the length in words of a value of mode MODE
  87. but can be less for certain modes in special long registers.
  88. On the vax, all registers are one word long. */
  89. #define HARD_REGNO_NREGS(REGNO, MODE) \
  90. ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  91. /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
  92. On the vax, all registers can hold all modes. */
  93. #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
  94. /* Value is 1 if it is a good idea to tie two pseudo registers
  95. when one has mode MODE1 and one has mode MODE2.
  96. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  97. for any hard reg, then this must be 0 for correct output. */
  98. #define MODES_TIEABLE_P(MODE1, MODE2) 1
  99. /* Specify the registers used for certain standard purposes.
  100. The values of these macros are register numbers. */
  101. /* Vax pc is overloaded on a register. */
  102. #define PC_REGNUM 15
  103. /* Register to use for pushing function arguments. */
  104. #define STACK_POINTER_REGNUM 14
  105. /* Base register for access to local variables of the function. */
  106. #define FRAME_POINTER_REGNUM 13
  107. /* Base register for access to arguments of the function. */
  108. #define ARG_POINTER_REGNUM 12
  109. /* Register in which static-chain is passed to a function. */
  110. #define STATIC_CHAIN_REGNUM 0
  111. /* Register in which function's value is returned.
  112. Actually, multiple registers starting with this one may be used
  113. depending on the machine mode of the value. */
  114. #define FUNCTION_VALUE_REGNUM 0
  115. /* Register in which address to store a structure value
  116. is passed to a function. */
  117. #define STRUCT_VALUE_REGNUM 1
  118. /* Define the classes of registers for register constraints in the
  119. machine description. Also define ranges of constants.
  120. One of the classes must always be named ALL_REGS and include all hard regs.
  121. If there is more than one class, another class must be named NO_REGS
  122. and contain no registers.
  123. The name GENERAL_REGS must be the name of a class (or an alias for
  124. another name such as ALL_REGS). This is the class of registers
  125. that is allowed by "g" or "r" in a register constraint.
  126. Also, registers outside this class are allocated only when
  127. instructions express preferences for them.
  128. The classes must be numbered in nondecreasing order; that is,
  129. a larger-numbered class must never be contained completely
  130. in a smaller-numbered class.
  131. For any two classes, it is very desirable that there be another
  132. class that represents their union. */
  133. /* The vax has only one kind of registers, so NO_REGS and ALL_REGS
  134. are the only classes. */
  135. enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
  136. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  137. /* Since GENERAL_REGS is the same class as ALL_REGS,
  138. don't give it a different class number; just make it an alias. */
  139. #define GENERAL_REGS ALL_REGS
  140. /* Give names of register classes as strings for dump file. */
  141. #define REG_CLASS_NAMES \
  142. {"NO_REGS", "ALL_REGS" }
  143. /* Define which registers fit in which classes.
  144. This is an initializer for a vector of HARD_REG_SET
  145. of length N_REG_CLASSES. */
  146. #define REG_CLASS_CONTENTS {0, 0xffff}
  147. /* The same information, inverted:
  148. Return the class number of the smallest class containing
  149. reg number REGNO. This could be a conditional expression
  150. or could index an array. */
  151. #define REGNO_REG_CLASS(REGNO) ALL_REGS
  152. /* Define a table that lets us find quickly all the reg classes
  153. containing a given one. This is the initializer for an
  154. N_REG_CLASSES x N_REG_CLASSES array of reg class codes.
  155. Row N is a sequence containing all the class codes for
  156. classes that contain all the regs in class N. Each row
  157. contains no duplicates, and is terminated by LIM_REG_CLASSES. */
  158. /* We give just a dummy for the first element, which is for NO_REGS. */
  159. #define REG_CLASS_SUPERCLASSES \
  160. {{LIM_REG_CLASSES}, {LIM_REG_CLASSES}}
  161. /* The inverse relationship:
  162. for each class, a list of all reg classes contained in it. */
  163. #define REG_CLASS_SUBCLASSES \
  164. {{LIM_REG_CLASSES}, {LIM_REG_CLASSES}}
  165. /* Define a table that lets us find quickly the class
  166. for the subunion of any two classes.
  167. We say "subunion" because the result need not be exactly
  168. the union; it may instead be a subclass of the union
  169. (though the closer to the union, the better).
  170. But if it contains anything beyond union of the two classes,
  171. you will lose!
  172. This is an initializer for an N_REG_CLASSES x N_REG_CLASSES
  173. array of reg class codes. The subunion of classes C1 and C2
  174. is just element [C1, C2]. */
  175. #define REG_CLASS_SUBUNION \
  176. {{NO_REGS, ALL_REGS}, \
  177. {ALL_REGS, ALL_REGS}}
  178. /* The class value for index registers, and the one for base regs. */
  179. #define INDEX_REG_CLASS ALL_REGS
  180. #define BASE_REG_CLASS ALL_REGS
  181. /* Get reg_class from a letter such as appears in the machine description. */
  182. #define REG_CLASS_FROM_LETTER(C) NO_REGS
  183. /* The letters I, J, K, L and M in a register constraint string
  184. can be used to stand for particular ranges of immediate operands.
  185. This macro defines what the ranges are.
  186. C is the letter, and VALUE is a constant value.
  187. Return 1 if VALUE is in the range specified by C. */
  188. #define CONST_OK_FOR_LETTER_P(VALUE, C) 0
  189. /* Similar, but for floating constants, and defining letters G and H.
  190. Here VALUE is the CONST_DOUBLE rtx itself. */
  191. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
  192. /* Given an rtx X being reloaded into a reg required to be
  193. in class CLASS, return the class of reg to actually use.
  194. In general this is just CLASS; but on some machines
  195. in some cases it is preferable to use a more restrictive class. */
  196. #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
  197. /* Stack layout; function entry, exit and calling. */
  198. /* Define this if pushing a word on the stack
  199. makes the stack pointer a smaller address. */
  200. #define STACK_GROWS_DOWNWARD
  201. /* Define this if the nominal address of the stack frame
  202. is at the high-address end of the local variables;
  203. that is, each additional local variable allocated
  204. goes at a more negative offset in the frame. */
  205. #define FRAME_GROWS_DOWNWARD
  206. /* Offset within stack frame to start allocating local variables at.
  207. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  208. first local allocated. Otherwise, it is the offset to the BEGINNING
  209. of the first local allocated. */
  210. #define STARTING_FRAME_OFFSET 0
  211. /* If we generate an insn to push BYTES bytes,
  212. this says how many the stack pointer really advances by.
  213. On the vax, sp@- in a byte insn really pushes a word. */
  214. #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  215. /* Offset of first parameter from the argument pointer register value. */
  216. #define FIRST_PARM_OFFSET 4
  217. /* Define if returning from a function call automatically
  218. pops the arguments described by the number-of-args field in the call. */
  219. #define RETURN_POPS_ARGS
  220. /* This macro generates the assembly code for function entry.
  221. FILE is a stdio stream to output the code to.
  222. SIZE is an int: how many units of temporary storage to allocate.
  223. Refer to the array `regs_ever_live' to determine which registers
  224. to save; `regs_ever_live[I]' is nonzero if register number I
  225. is ever used in the function. This macro is responsible for
  226. knowing which registers should not be saved even if used. */
  227. #define FUNCTION_PROLOGUE(FILE, SIZE) \
  228. { register int regno; \
  229. register int mask = 0; \
  230. static char dont_save_regs[] = CALL_USED_REGISTERS; \
  231. for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
  232. if (regs_ever_live[regno] && !dont_save_regs[regno]) \
  233. mask |= 1 << regno; \
  234. fprintf (FILE, "\t.word 0x%x\n", mask & ~077); \
  235. if ((SIZE) >= 64) fprintf (FILE, "\tmovab %d(sp),sp\n", SIZE);\
  236. else if (SIZE) fprintf (FILE, "\tsubl2 $%d,sp\n", - (SIZE)); }
  237. /* This macro generates the assembly code for function exit,
  238. on machines that need it. If FUNCTION_EPILOGUE is not defined
  239. then individual return instructions are generated for each
  240. return statement. Args are same as for FUNCTION_PROLOGUE. */
  241. /* #define FUNCTION_EPILOGUE(FILE, SIZE) */
  242. /* Addressing modes, and classification of registers for them. */
  243. #define HAVE_POST_INCREMENT
  244. /* #define HAVE_POST_DECREMENT */
  245. #define HAVE_PRE_DECREMENT
  246. /* #define HAVE_PRE_INCREMENT */
  247. /* These assume that REGNO is a hard or pseudo reg number.
  248. They give nonzero only if REGNO is a hard reg of the suitable class
  249. or a pseudo reg currently allocated to a suitable hard reg.
  250. These definitions are NOT overridden anywhere. */
  251. #define REGNO_OK_FOR_INDEX_P(regno) \
  252. ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
  253. #define REGNO_OK_FOR_BASE_P(regno) \
  254. ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
  255. /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  256. and check its validity for a certain class.
  257. We have two alternate definitions for each of them.
  258. The usual definition accepts all pseudo regs; the other rejects them all.
  259. The symbol REG_OK_STRICT causes the latter definition to be used.
  260. Most source files want to accept pseudo regs in the hope that
  261. they will get allocated to the class that the insn wants them to be in.
  262. Some source files that are used after register allocation
  263. need to be strict. */
  264. #ifndef REG_OK_STRICT
  265. /* Nonzero if X is a hard reg that can be used as an index or if
  266. it is a pseudo reg. */
  267. #define REG_OK_FOR_INDEX_P(X) 1
  268. /* Nonzero if X is a hard reg that can be used as a base reg
  269. of if it is a pseudo reg. */
  270. #define REG_OK_FOR_BASE_P(X) 1
  271. #else
  272. /* Nonzero if X is a hard reg that can be used as an index. */
  273. #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
  274. /* Nonzero if X is a hard reg that can be used as a base reg. */
  275. #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  276. #endif
  277. #define REG_OK_FOR_CLASS_P(X, C) 0
  278. #define REGNO_OK_FOR_CLASS_P(X, C) 0
  279. /* Maximum number of registers that can appear in a valid memory address. */
  280. #define MAX_REGS_PER_ADDRESS 2
  281. /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  282. that is a valid memory address for an instruction.
  283. The MODE argument is the machine mode for the MEM expression
  284. that wants to use this address.
  285. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
  286. except for CONSTANT_ADDRESS_P which is actually machine-independent. */
  287. /* 1 if X is an address that we could indirect through. */
  288. #define INDIRECTABLE_ADDRESS_P(X) \
  289. (CONSTANT_ADDRESS_P (X) \
  290. || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
  291. || (GET_CODE (X) == PLUS \
  292. && GET_CODE (XEXP (X, 0)) == REG \
  293. && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  294. && CONSTANT_ADDRESS_P (XEXP (X, 1))))
  295. /* Go to ADDR if X is a valid address not using indexing.
  296. (This much is the easy part.) */
  297. #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
  298. { register rtx xfoob = (X); \
  299. if (GET_CODE (xfoob) == REG) goto ADDR; \
  300. if (INDIRECTABLE_ADDRESS_P (xfoob)) goto ADDR; \
  301. xfoob = XEXP (X, 0); \
  302. if (GET_CODE (X) == MEM && INDIRECTABLE_ADDRESS_P (xfoob)) \
  303. goto ADDR; \
  304. if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
  305. && GET_CODE (xfoob) == REG && REG_OK_FOR_BASE_P (xfoob)) \
  306. goto ADDR; }
  307. /* 1 if PROD is either a reg times size of mode MODE
  308. or just a reg, if MODE is just one byte.
  309. This macro's expansion uses the temporary variables xfoo0 and xfoo1
  310. that must be declared in the surrounding context. */
  311. #define INDEX_TERM_P(PROD, MODE) \
  312. (GET_MODE_SIZE (MODE) == 1 \
  313. ? (GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \
  314. : (GET_CODE (PROD) == MULT \
  315. && \
  316. (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
  317. ((GET_CODE (xfoo0) == CONST_INT \
  318. && INTVAL (xfoo0) == GET_MODE_SIZE (MODE) \
  319. && GET_CODE (xfoo1) == REG \
  320. && REG_OK_FOR_INDEX_P (xfoo1)) \
  321. || \
  322. (GET_CODE (xfoo1) == CONST_INT \
  323. && INTVAL (xfoo1) == GET_MODE_SIZE (MODE) \
  324. && GET_CODE (xfoo0) == REG \
  325. && REG_OK_FOR_INDEX_P (xfoo0))))))
  326. /* Go to ADDR if X is the sum of a register
  327. and a valid index term for mode MODE. */
  328. #define GO_IF_REG_PLUS_INDEX(X, MODE, ADDR) \
  329. { register rtx xfooa; \
  330. if (GET_CODE (X) == PLUS) \
  331. { if (GET_CODE (XEXP (X, 0)) == REG \
  332. && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  333. && (xfooa = XEXP (X, 1), \
  334. INDEX_TERM_P (xfooa, MODE))) \
  335. goto ADDR; \
  336. if (GET_CODE (XEXP (X, 1)) == REG \
  337. && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
  338. && (xfooa = XEXP (X, 0), \
  339. INDEX_TERM_P (xfooa, MODE))) \
  340. goto ADDR; } }
  341. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
  342. { register rtx xfoo, xfoo0, xfoo1; \
  343. GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
  344. if (GET_CODE (X) == PLUS) \
  345. { /* Handle <address>[index] represented with index-sum outermost */\
  346. xfoo = XEXP (X, 0); \
  347. if (INDEX_TERM_P (xfoo, MODE)) \
  348. { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 1), ADDR); } \
  349. xfoo = XEXP (X, 1); \
  350. if (INDEX_TERM_P (xfoo, MODE)) \
  351. { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 0), ADDR); } \
  352. /* Handle offset(reg)[index] with offset added outermost */ \
  353. if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \
  354. { if (GET_CODE (XEXP (X, 1)) == REG \
  355. && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
  356. goto ADDR; \
  357. GO_IF_REG_PLUS_INDEX (XEXP (X, 1), MODE, ADDR); } \
  358. if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \
  359. { if (GET_CODE (XEXP (X, 0)) == REG \
  360. && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
  361. goto ADDR; \
  362. GO_IF_REG_PLUS_INDEX (XEXP (X, 0), MODE, ADDR); } } }
  363. #define CONSTANT_ADDRESS_P(X) \
  364. (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
  365. || GET_CODE (X) == CONST_INT \
  366. || GET_CODE (X) == CONST)
  367. #define REG_P(X) \
  368. (GET_CODE (X) == REG)
  369. /* Try machine-dependent ways of modifying an illegitimate address
  370. to be legitimate. If we find one, return the new, valid address.
  371. This macro is used in only one place: `memory_address' in explow.c.
  372. OLDX is the address as it was before break_out_memory_refs was called.
  373. In some cases it is useful to look at this to decide what needs to be done.
  374. MODE and WIN are passed so that this macro can use
  375. GO_IF_LEGITIMATE_ADDRESS.
  376. It is always safe for this macro to do nothing. It exists to recognize
  377. opportunities to optimize the output.
  378. For the vax, nothing needs to be done. */
  379. #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
  380. /* Specify the machine mode that this machine uses
  381. for the index in the tablejump instruction. */
  382. #define CASE_VECTOR_MODE HImode
  383. /* Define this if the tablejump instruction expects the table
  384. to contain offsets from the address of the table.
  385. Do not define this if the table should contain absolute addresses. */
  386. #define CASE_VECTOR_PC_RELATIVE
  387. /* Specify the tree operation to be used to convert reals to integers. */
  388. #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
  389. /* This is the kind of divide that is easiest to do in the general case. */
  390. #define EASY_DIV_EXPR TRUNC_DIV_EXPR
  391. /* Max number of bytes we can move from memory to memory
  392. in one reasonably fast instruction. */
  393. #define MOVE_MAX 16
  394. /* Define this if zero-extension is slow (more than one real instruction). */
  395. /* #define SLOW_ZERO_EXTEND */
  396. /* Define if shifts truncate the shift count
  397. which implies one can omit a sign-extension or zero-extension
  398. of a shift count. */
  399. /* #define SHIFT_COUNT_TRUNCATED */
  400. /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  401. is done just by pretending it is already truncated. */
  402. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  403. /* Specify the machine mode that pointers have.
  404. After generation of rtl, the compiler makes no further distinction
  405. between pointers and any other objects of this machine mode. */
  406. #define Pmode SImode
  407. /* A function address in a call instruction
  408. is a byte address (for indexing purposes)
  409. so give the MEM rtx a byte's mode. */
  410. #define FUNCTION_MODE QImode
  411. /* Compute the cost of computing a constant rtl expression RTX
  412. whose rtx-code is CODE. The body of this macro is a portion
  413. of a switch statement. If the code is computed here,
  414. return it with a return statement. Otherwise, break from the switch. */
  415. #define CONST_COSTS(RTX,CODE) \
  416. case CONST_INT: \
  417. /* Constant zero is super cheap due to clr instruction. */ \
  418. if (RTX == const0_rtx) return 0; \
  419. if ((unsigned) INTVAL (RTX) < 077) return 1; \
  420. case CONST: \
  421. case LABEL_REF: \
  422. case SYMBOL_REF: \
  423. return 3; \
  424. case CONST_DOUBLE: \
  425. return 5;
  426. /* Tell final.c how to eliminate redundant test instructions. */
  427. /* Here we define machine-dependent flags and fields in cc_status
  428. (see `conditions.h'). No extra ones are needed for the vax. */
  429. /* Store in cc_status the expressions
  430. that the condition codes will describe
  431. after execution of an instruction whose pattern is EXP.
  432. Do not alter them if the instruction would not alter the cc's. */
  433. /* On the 68000, all the insns to store in an address register
  434. fail to set the cc's. However, in some cases these instructions
  435. can make it possibly invalid to use the saved cc's. In those
  436. cases we clear out some or all of the saved cc's so they won't be used. */
  437. #define NOTICE_UPDATE_CC(EXP) \
  438. { if (GET_CODE (EXP) == SET) \
  439. { if (GET_CODE (SET_DEST (EXP)) != PC) \
  440. { cc_status.flags = 0; \
  441. cc_status.value1 = SET_DEST (EXP); \
  442. cc_status.value2 = SET_SRC (EXP); } } \
  443. else if (GET_CODE (EXP) == PARALLEL \
  444. && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
  445. { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) != PC) \
  446. { cc_status.flags = 0; \
  447. cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
  448. cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); } } \
  449. else CC_STATUS_INIT; \
  450. if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
  451. && cc_status.value2 \
  452. && reg_mentioned_p (cc_status.value1, cc_status.value2)) \
  453. cc_status.value2 = 0; \
  454. if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM \
  455. && cc_status.value2 \
  456. && GET_CODE (cc_status.value2) == MEM) \
  457. cc_status.value2 = 0; }
  458. /* Actual condition, one line up, should be that value2's address
  459. depends on value1, but that is too much of a pain. */
  460. #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
  461. { if (cc_status.flags & CC_NO_OVERFLOW) \
  462. return NO_OV; \
  463. return NORMAL; }
  464. /* Control the assembler format that we output. */
  465. #define TEXT_SECTION_ASM_OP ".text"
  466. #define DATA_SECTION_ASM_OP ".data"
  467. /* How to refer to registers in assembler output.
  468. This sequence is indexed by compiler's hard-register-number (see above). */
  469. #define REGISTER_NAMES \
  470. {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
  471. "r9", "r10", "r11", "ap", "fp", "sp", "pc"}
  472. /* How to renumber registers for dbx and gdb.
  473. Vax needs no change in the numeration. */
  474. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  475. /* This is how to output an assembler line defining a `double' constant. */
  476. #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
  477. fprintf (FILE, "\t.double 0d%.12e\n", (VALUE))
  478. /* This is how to output an assembler line defining a `float' constant. */
  479. #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
  480. fprintf (FILE, "\t.float 0f%.6e\n", (VALUE))
  481. /* This is how to output an assembler line
  482. that says to advance the location counter
  483. to a multiple of 2**LOG bytes. */
  484. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  485. fprintf (FILE, "\t.align %d\n", (LOG))
  486. #define ASM_OUTPUT_SKIP(FILE,SIZE) \
  487. fprintf (FILE, "\t.space %d\n", (SIZE))
  488. /* Define the parentheses used to group arithmetic operations
  489. in assembler code. */
  490. #define ASM_OPEN_PAREN "("
  491. #define ASM_CLOSE_PAREN ")"
  492. /* Specify what to precede various sizes of constant with
  493. in the output file. */
  494. #define ASM_INT_OP ".long "
  495. #define ASM_SHORT_OP ".word "
  496. #define ASM_CHAR_OP ".byte "
  497. /* Define results of standard character escape sequences. */
  498. #define TARGET_BELL 007
  499. #define TARGET_BS 010
  500. #define TARGET_TAB 011
  501. #define TARGET_NEWLINE 012
  502. #define TARGET_VT 013
  503. #define TARGET_FF 014
  504. #define TARGET_CR 015
  505. /* Print an instruction operand X on file FILE. */
  506. #define PRINT_OPERAND(FILE, X) \
  507. { if (GET_CODE (X) == REG) \
  508. fprintf (FILE, "%s", reg_name [REGNO (X)]); \
  509. else if (GET_CODE (X) == MEM) \
  510. output_address (XEXP (X, 0)); \
  511. else if (GET_CODE (X) == CONST_DOUBLE) \
  512. { union { double d; int i[2]; } u; \
  513. u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
  514. fprintf (FILE, "$0d%.12e", u.d); } \
  515. else { putc ('$', FILE); output_addr_const (FILE, X); }}
  516. /* Print a memory operand whose address is X, on file FILE. */
  517. #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
  518. { register rtx reg1, reg2, breg, ireg; \
  519. register rtx addr = ADDR; \
  520. rtx offset; \
  521. retry: \
  522. switch (GET_CODE (addr)) \
  523. { \
  524. case MEM: \
  525. fprintf (FILE, "*"); \
  526. addr = XEXP (addr, 0); \
  527. goto retry; \
  528. case REG: \
  529. fprintf (FILE, "(%s)", reg_name [REGNO (addr)]); \
  530. break; \
  531. case PRE_DEC: \
  532. fprintf (FILE, "-(%s)", reg_name [REGNO (XEXP (addr, 0))]); \
  533. break; \
  534. case POST_INC: \
  535. fprintf (FILE, "(%s)+", reg_name [REGNO (XEXP (addr, 0))]); \
  536. break; \
  537. case PLUS: \
  538. reg1 = 0; reg2 = 0; \
  539. ireg = 0; breg = 0; \
  540. offset = 0; \
  541. if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \
  542. || GET_CODE (XEXP (addr, 0)) == MEM) \
  543. { \
  544. offset = XEXP (addr, 0); \
  545. addr = XEXP (addr, 1); \
  546. } \
  547. else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \
  548. || GET_CODE (XEXP (addr, 1)) == MEM) \
  549. { \
  550. offset = XEXP (addr, 1); \
  551. addr = XEXP (addr, 0); \
  552. } \
  553. if (GET_CODE (addr) != PLUS) ; \
  554. else if (GET_CODE (XEXP (addr, 0)) == MULT) \
  555. { \
  556. reg1 = XEXP (addr, 0); \
  557. addr = XEXP (addr, 1); \
  558. } \
  559. else if (GET_CODE (XEXP (addr, 1)) == MULT) \
  560. { \
  561. reg1 = XEXP (addr, 1); \
  562. addr = XEXP (addr, 0); \
  563. } \
  564. else if (GET_CODE (XEXP (addr, 0)) == REG) \
  565. { \
  566. reg1 = XEXP (addr, 0); \
  567. addr = XEXP (addr, 1); \
  568. } \
  569. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  570. { \
  571. reg1 = XEXP (addr, 1); \
  572. addr = XEXP (addr, 0); \
  573. } \
  574. if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) \
  575. { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
  576. if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
  577. if (reg1 != 0 && GET_CODE (reg1) == MULT) \
  578. { breg = reg2; ireg = reg1; } \
  579. else if (reg2 != 0 && GET_CODE (reg2) == MULT) \
  580. { breg = reg1; ireg = reg2; } \
  581. else if (reg2 != 0 || GET_CODE (addr) == MEM) \
  582. { breg = reg2; ireg = reg1; } \
  583. else \
  584. { breg = reg1; ireg = reg2; } \
  585. if (addr != 0) \
  586. output_address (offset); \
  587. if (breg != 0) \
  588. { if (GET_CODE (breg) != REG) abort (); \
  589. fprintf (FILE, "(%s)", reg_name[REGNO (breg)]); } \
  590. if (ireg != 0) \
  591. { if (GET_CODE (ireg) == MULT) ireg = XEXP (ireg, 0); \
  592. if (GET_CODE (ireg) != REG) abort (); \
  593. fprintf (FILE, "[%s]", reg_name[REGNO (ireg)]); } \
  594. break; \
  595. default: \
  596. output_addr_const (FILE, addr); \
  597. }}