tm-m68000.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. /* Definitions of target machine for GNU compiler. Sun 68000/68020 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 "-Dmc68000 -Dsun"
  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. #define TARGET_68020 (target_flags & 1)
  23. #define TARGET_68881 (target_flags & 2)
  24. #define TARGET_BITFIELD (target_flags & 4)
  25. #define TARGET_DEFER_POP (target_flags & 040)
  26. /* Macro to define tables used to set the flags.
  27. This is a list in braces of pairs in braces,
  28. each pair being { "NAME", VALUE }
  29. where VALUE is the bits to set or minus the bits to clear.
  30. An empty string NAME is used to identify the default VALUE. */
  31. #define TARGET_SWITCHES \
  32. { { "68020", 5}, \
  33. { "68881", 2}, \
  34. { "bitfield", 4}, \
  35. { "68000", -5}, \
  36. { "soft-float", -2}, \
  37. { "nobitfield", -4}, \
  38. { "defer-pop", 040}, \
  39. { "", 067}}
  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 true for 68020 insns such as bfins and bfexts.
  44. We make it true always by avoiding using the single-bit insns
  45. except in special cases with constant bit numbers. */
  46. #define BITS_BIG_ENDIAN
  47. /* Define this if most significant byte of a word is the lowest numbered. */
  48. /* That is true on the 68000. */
  49. #define BYTES_BIG_ENDIAN
  50. /* Define this if most significant word of a multiword number is numbered. */
  51. /* For 68000 we can decide arbitrarily
  52. since there are no machine instructions for them. */
  53. /* #define WORDS_BIG_ENDIAN */
  54. /* number of bits in an addressible storage unit */
  55. #define BITS_PER_UNIT 8
  56. /* Width in bits of a "word", which is the contents of a machine register.
  57. Note that this is not necessarily the width of data type `int';
  58. if using 16-bit ints on a 68000, this would still be 32.
  59. But on a machine with 16-bit registers, this would be 16. */
  60. #define BITS_PER_WORD 32
  61. /* Width of a word, in units (bytes). */
  62. #define UNITS_PER_WORD 4
  63. /* Width in bits of a pointer.
  64. See also the macro `Pmode' defined below. */
  65. #define POINTER_SIZE 32
  66. /* Allocation boundary (in *bits*) for storing pointers in memory. */
  67. #define POINTER_BOUNDARY 16
  68. /* Allocation boundary (in *bits*) for storing arguments in argument list. */
  69. #define PARM_BOUNDARY 32
  70. /* Allocation boundary (in *bits*) for the code of a function. */
  71. #define FUNCTION_BOUNDARY 16
  72. /* There is no point aligning anything to a rounder boundary than this. */
  73. #define BIGGEST_ALIGNMENT 16
  74. /* Define this if move instructions will actually fail to work
  75. when given unaligned data. */
  76. #define STRICT_ALIGNMENT
  77. /* Standard register usage. */
  78. /* Number of actual hardware registers.
  79. The hardware registers are assigned numbers for the compiler
  80. from 0 to just below FIRST_PSEUDO_REGISTER.
  81. All registers that the compiler knows about must be given numbers,
  82. even those that are not normally considered general registers.
  83. For the 68000, we give the data registers numbers 0-7,
  84. the address registers numbers 010-017,
  85. and the 68881 floating point registers numbers 020-027. */
  86. #define FIRST_PSEUDO_REGISTER 24
  87. /* 1 for registers that have pervasive standard uses
  88. and are not available for the register allocator.
  89. On the 68000, these are the stack pointer and frame pointer. */
  90. #define FIXED_REGISTERS \
  91. {0, 0, 0, 0, 0, 0, 0, 0, \
  92. 0, 0, 0, 0, 0, 0, 1, 1, \
  93. 0, 0, 0, 0, 0, 0, 0, 0}
  94. /* 1 for registers not available across function calls.
  95. These must include the FIXED_REGISTERS and also any
  96. registers that can be used without being saved.
  97. The latter must include the registers where values are returned
  98. and the register where structure-value addresses are passed.
  99. Aside from that, you can include as many other registers as you like. */
  100. #define CALL_USED_REGISTERS \
  101. {1, 1, 0, 0, 0, 0, 0, 0, \
  102. 1, 1, 0, 0, 0, 0, 1, 1, \
  103. 1, 1, 0, 0, 0, 0, 0, 0}
  104. /* Return number of consecutive hard regs needed starting at reg REGNO
  105. to hold something of mode MODE.
  106. This is ordinarily the length in words of a value of mode MODE
  107. but can be less for certain modes in special long registers.
  108. On the 68000, ordinary registers hold 32 bits worth;
  109. for the 68881 registers, a single register is always enough for
  110. anything that can be stored in them at all. */
  111. #define HARD_REGNO_NREGS(REGNO, MODE) \
  112. ((REGNO) >= 16 ? 1 \
  113. : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
  114. /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
  115. On the 68000, the cpu registers can hold any mode but the 68881 registers
  116. can hold only SFmode or DFmode. And the 68881 registers can't hold anything
  117. if 68881 use is disabled. */
  118. #define HARD_REGNO_MODE_OK(REGNO, MODE) \
  119. ((REGNO) < 16 || (TARGET_68881 && ((MODE) == SFmode || (MODE) == DFmode)))
  120. /* Value is 1 if it is a good idea to tie two pseudo registers
  121. when one has mode MODE1 and one has mode MODE2.
  122. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  123. for any hard reg, then this must be 0 for correct output. */
  124. #define MODES_TIEABLE_P(MODE1, MODE2) \
  125. (((MODE1) == SFmode || (MODE1) == DFmode) \
  126. == ((MODE2) == SFmode || (MODE2) == DFmode))
  127. /* Specify the registers used for certain standard purposes.
  128. The values of these macros are register numbers. */
  129. /* m68000 pc isn't overloaded on a register. */
  130. /* #define PC_REGNUM */
  131. /* Register to use for pushing function arguments. */
  132. #define STACK_POINTER_REGNUM 15
  133. /* Base register for access to local variables of the function. */
  134. #define FRAME_POINTER_REGNUM 14
  135. /* Base register for access to arguments of the function. */
  136. #define ARG_POINTER_REGNUM 14
  137. /* Register in which static-chain is passed to a function. */
  138. #define STATIC_CHAIN_REGNUM 8
  139. /* Register in which function's value is returned.
  140. Actually, multiple registers starting with this one may be used
  141. depending on the machine mode of the value. */
  142. #define FUNCTION_VALUE_REGNUM 0
  143. /* Register in which address to store a structure value
  144. is passed to a function. */
  145. #define STRUCT_VALUE_REGNUM 9
  146. /* Define the classes of registers for register constraints in the
  147. machine description. Also define ranges of constants.
  148. One of the classes must always be named ALL_REGS and include all hard regs.
  149. If there is more than one class, another class must be named NO_REGS
  150. and contain no registers.
  151. The name GENERAL_REGS must be the name of a class (or an alias for
  152. another name such as ALL_REGS). This is the class of registers
  153. that is allowed by "g" or "r" in a register constraint.
  154. Also, registers outside this class are allocated only when
  155. instructions express preferences for them.
  156. The classes must be numbered in nondecreasing order; that is,
  157. a larger-numbered class must never be contained completely
  158. in a smaller-numbered class.
  159. For any two classes, it is very desirable that there be another
  160. class that represents their union. */
  161. /* The 68000 has three kinds of registers, so eight classes would be
  162. a complete set. One of them is not needed. */
  163. enum reg_class { NO_REGS, DATA_REGS, ADDR_REGS, GENERAL_REGS, FP_REGS, FP_OR_DATA_REGS, ALL_REGS, LIM_REG_CLASSES };
  164. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  165. /* Give names of register classes as strings for dump file. */
  166. #define REG_CLASS_NAMES \
  167. {"NO_REGS", "DATA_REGS", "ADDR_REGS", "GENERAL_REGS", \
  168. "FP_REGS", "FP_OR_DATA_REGS", "ALL_REGS" }
  169. /* Define which registers fit in which classes.
  170. This is an initializer for a vector of HARD_REG_SET
  171. of length N_REG_CLASSES. */
  172. #define REG_CLASS_CONTENTS {0, 0xff, 0xff00, 0xffff, 0xff0000, 0xff00ff, 0xffffff}
  173. /* The same information, inverted:
  174. Return the class number of the smallest class containing
  175. reg number REGNO. This could be a conditional expression
  176. or could index an array. */
  177. #define REGNO_REG_CLASS(REGNO) \
  178. ((REGNO) >= 16 ? FP_REGS : (REGNO) < 8 ? DATA_REGS : ADDR_REGS)
  179. /* Define a table that lets us find quickly all the reg classes
  180. containing a given one. This is the initializer for an
  181. N_REG_CLASSES x N_REG_CLASSES array of reg class codes.
  182. Row N is a sequence containing all the class codes for
  183. classes that contain all the regs in class N. Each row
  184. contains no duplicates, and is terminated by LIM_REG_CLASSES. */
  185. /* We give just a dummy for the first element, which is for NO_REGS. */
  186. #define REG_CLASS_SUPERCLASSES \
  187. {{LIM_REG_CLASSES}, \
  188. {GENERAL_REGS, FP_OR_DATA_REGS, ALL_REGS, LIM_REG_CLASSES}, \
  189. {GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES}, \
  190. {ALL_REGS, LIM_REG_CLASSES}, \
  191. {FP_OR_DATA_REGS, ALL_REGS, LIM_REG_CLASSES}, \
  192. {ALL_REGS, LIM_REG_CLASSES}, \
  193. {LIM_REG_CLASSES}}
  194. /* The inverse relationship:
  195. for each class, a list of all reg classes contained in it. */
  196. #define REG_CLASS_SUBCLASSES \
  197. {{LIM_REG_CLASSES}, \
  198. {LIM_REG_CLASSES}, \
  199. {LIM_REG_CLASSES}, \
  200. {DATA_REGS, ADDR_REGS, LIM_REG_CLASSES}, \
  201. {LIM_REG_CLASSES}, \
  202. {DATA_REGS, FP_REGS, LIM_REG_CLASSES}, \
  203. {DATA_REGS, ADDR_REGS, FP_REGS, GENERAL_REGS, FP_OR_DATA_REGS, LIM_REG_CLASSES}}
  204. /* Define a table that lets us find quickly the class
  205. for the subunion of any two classes.
  206. We say "subunion" because the result need not be exactly
  207. the union; it may instead be a subclass of the union
  208. (though the closer to the union, the better).
  209. But if it contains anything beyond union of the two classes,
  210. you will lose!
  211. This is an initializer for an N_REG_CLASSES x N_REG_CLASSES
  212. array of reg class codes. The subunion of classes C1 and C2
  213. is just element [C1, C2]. */
  214. #define REG_CLASS_SUBUNION \
  215. {{NO_REGS, DATA_REGS, ADDR_REGS, GENERAL_REGS, FP_REGS, FP_OR_DATA_REGS, ALL_REGS}, \
  216. {DATA_REGS, DATA_REGS, GENERAL_REGS, GENERAL_REGS, FP_OR_DATA_REGS, FP_OR_DATA_REGS, ALL_REGS}, \
  217. {ADDR_REGS, GENERAL_REGS, ADDR_REGS, GENERAL_REGS, ADDR_REGS, ADDR_REGS, ALL_REGS}, \
  218. {GENERAL_REGS, GENERAL_REGS, GENERAL_REGS, GENERAL_REGS, ALL_REGS, ALL_REGS, ALL_REGS},\
  219. {FP_REGS, FP_OR_DATA_REGS, FP_REGS, FP_OR_DATA_REGS, FP_REGS, FP_OR_DATA_REGS, ALL_REGS}, \
  220. {FP_OR_DATA_REGS, FP_OR_DATA_REGS, FP_OR_DATA_REGS, ALL_REGS, FP_OR_DATA_REGS, FP_OR_DATA_REGS, ALL_REGS}, \
  221. {ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS}}
  222. /* The class value for index registers, and the one for base regs. */
  223. #define INDEX_REG_CLASS GENERAL_REGS
  224. #define BASE_REG_CLASS ADDR_REGS
  225. /* Get reg_class from a letter such as appears in the machine description. */
  226. #define REG_CLASS_FROM_LETTER(C) \
  227. ((C) == 'a' ? ADDR_REGS : ((C) == 'd' ? DATA_REGS : ((C) == 'f' ? FP_REGS : NO_REGS)))
  228. /* The letters I, J, K, L and M in a register constraint string
  229. can be used to stand for particular ranges of immediate operands.
  230. This macro defines what the ranges are.
  231. C is the letter, and VALUE is a constant value.
  232. Return 1 if VALUE is in the range specified by C.
  233. For the 68000, `I' is used for the range 1 to 8
  234. allowed as immediate shift counts and in addq.
  235. `J' is used for the range of signed numbers that fit in 16 bits.
  236. `K' is for numbers that moveq can't handle.
  237. `L' is for range -8 to -1, range of values that can be added with subq. */
  238. #define CONST_OK_FOR_LETTER_P(VALUE, C) \
  239. ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
  240. (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
  241. (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
  242. (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : 0)
  243. /* Similar, but for floating constants, and defining letters G and H.
  244. Here VALUE is the CONST_DOUBLE rtx itself. */
  245. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
  246. ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 1)
  247. /* Given an rtx X being reloaded into a reg required to be
  248. in class CLASS, return the class of reg to actually use.
  249. In general this is just CLASS; but on some machines
  250. in some cases it is preferable to use a more restrictive class.
  251. On the 68000 series, use a data reg if possible when the
  252. value is a constant in the range where moveq could be used. */
  253. #define PREFERRED_RELOAD_CLASS(X,CLASS) \
  254. ((GET_CODE (X) == CONST_INT \
  255. && (unsigned) (INTVAL (X) + 0x80) < 0x100 \
  256. && (CLASS) != ADDR_REGS) \
  257. ? DATA_REGS : (CLASS))
  258. /* Stack layout; function entry, exit and calling. */
  259. /* Define this if pushing a word on the stack
  260. makes the stack pointer a smaller address. */
  261. #define STACK_GROWS_DOWNWARD
  262. /* Define this if the nominal address of the stack frame
  263. is at the high-address end of the local variables;
  264. that is, each additional local variable allocated
  265. goes at a more negative offset in the frame. */
  266. #define FRAME_GROWS_DOWNWARD
  267. /* Offset within stack frame to start allocating local variables at.
  268. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  269. first local allocated. Otherwise, it is the offset to the BEGINNING
  270. of the first local allocated. */
  271. #define STARTING_FRAME_OFFSET 0
  272. /* If we generate an insn to push BYTES bytes,
  273. this says how many the stack pointer really advances by.
  274. On the 68000, sp@- in a byte insn really pushes a word. */
  275. #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  276. /* Offset of first parameter from the argument pointer register value. */
  277. #define FIRST_PARM_OFFSET 8
  278. /* Define if returning from a function call automatically
  279. pops the arguments described by the number-of-args field in the call. */
  280. /* #define RETURN_POPS_ARGS On the 68000, the caller must pop them. */
  281. /* This macro generates the assembly code for function entry.
  282. FILE is a stdio stream to output the code to.
  283. SIZE is an int: how many units of temporary storage to allocate.
  284. Refer to the array `regs_ever_live' to determine which registers
  285. to save; `regs_ever_live[I]' is nonzero if register number I
  286. is ever used in the function. This macro is responsible for
  287. knowing which registers should not be saved even if used. */
  288. #define FUNCTION_PROLOGUE(FILE, SIZE) \
  289. { register int regno; \
  290. register int mask = 0; \
  291. static char dont_save_regs[] = CALL_USED_REGISTERS; \
  292. static char *reg_names[] = REGISTER_NAMES; \
  293. fprintf (FILE, "\tlink a6,#%d\n", (SIZE)); \
  294. for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
  295. if (regs_ever_live[regno] && ! dont_save_regs[regno]) \
  296. mask |= 1 << (23 - regno); \
  297. if (mask & 0xff) \
  298. fprintf (FILE, "\tfmovem #0x%x,sp@-\n", mask & 0xff); \
  299. mask >>= 8; \
  300. if (exact_log2 (mask) >= 0) \
  301. fprintf (FILE, "\tmovl %s,sp@-\n", reg_names[15 - exact_log2 (mask)]); \
  302. else if (mask) fprintf (FILE, "\tmoveml #0x%x,sp@-\n", mask); }
  303. /* This macro generates the assembly code for function exit,
  304. on machines that need it. If FUNCTION_EPILOGUE is not defined
  305. then individual return instructions are generated for each
  306. return statement. Args are same as for FUNCTION_PROLOGUE.
  307. The function epilogue should not depend on the current stack pointer!
  308. It should use the frame pointer only. This is mandatory because
  309. of alloca; we also take advantage of it to omit stack adjustments
  310. before returning. */
  311. #define FUNCTION_EPILOGUE(FILE, SIZE) \
  312. { register int regno; \
  313. register int mask; \
  314. register int nregs; \
  315. int offset; \
  316. static char dont_save_regs[] = CALL_USED_REGISTERS; \
  317. static char *reg_names[] = REGISTER_NAMES; \
  318. nregs = 0; mask = 0; \
  319. for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
  320. if (regs_ever_live[regno] && ! dont_save_regs[regno]) \
  321. { nregs++; mask |= 1 << (regno - 16); } \
  322. offset = nregs * 12; \
  323. if (mask) \
  324. fprintf (FILE, "\tfmovem a6@(-%d),#0x%x\n", \
  325. offset - (SIZE), mask); \
  326. nregs = 0; mask = 0; \
  327. for (regno = 0; regno < 16; regno++) \
  328. if (regs_ever_live[regno] && ! dont_save_regs[regno]) \
  329. { nregs++; mask |= 1 << regno; } \
  330. offset += nregs * 4; \
  331. if (exact_log2 (mask) >= 0) \
  332. fprintf (FILE, "\tmovl a6@(-%d),%s\n", \
  333. offset - (SIZE), reg_names[exact_log2 (mask)]); \
  334. else if (mask) \
  335. fprintf (FILE, "\tmoveml a6@(-%d),#0x%x\n", \
  336. offset - (SIZE), mask); \
  337. fprintf (FILE, "\tunlk a6\n\trts\n"); }
  338. /* Addressing modes, and classification of registers for them. */
  339. #define HAVE_POST_INCREMENT
  340. /* #define HAVE_POST_DECREMENT */
  341. #define HAVE_PRE_DECREMENT
  342. /* #define HAVE_PRE_INCREMENT */
  343. /* These assume that REGNO is a hard or pseudo reg number.
  344. They give nonzero only if REGNO is a hard reg of the suitable class
  345. or a pseudo reg currently allocated to a suitable hard reg.
  346. These definitions are NOT overridden anywhere. */
  347. #define REGNO_OK_FOR_INDEX_P(REGNO) \
  348. ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
  349. #define REGNO_OK_FOR_BASE_P(REGNO) \
  350. (((REGNO) ^ 010) < 8 || ((unsigned) reg_renumber[REGNO] ^ 010) < 8)
  351. #define REGNO_OK_FOR_DATA_P(REGNO) \
  352. ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
  353. #define REGNO_OK_FOR_FP_P(REGNO) \
  354. (((REGNO) ^ 020) < 8 || ((unsigned) reg_renumber[REGNO] ^ 020) < 8)
  355. /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  356. that is a valid memory address for an instruction.
  357. The MODE argument is the machine mode for the MEM expression
  358. that wants to use this address.
  359. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
  360. except for CONSTANT_ADDRESS_P which is actually machine-independent. */
  361. #define MAX_REGS_PER_ADDRESS 2
  362. /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  363. and check its validity for a certain class.
  364. We have two alternate definitions for each of them.
  365. The usual definition accepts all pseudo regs; the other rejects them all.
  366. The symbol REG_OK_STRICT causes the latter definition to be used.
  367. Most source files want to accept pseudo regs in the hope that
  368. they will get allocated to the class that the insn wants them to be in.
  369. Some source files that are used after register allocation
  370. need to be strict. */
  371. #ifndef REG_OK_STRICT
  372. /* Nonzero if X is a hard reg that can be used as an index or if
  373. it is a pseudo reg. */
  374. #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
  375. /* Nonzero if X is a hard reg that can be used as a base reg
  376. of if it is a pseudo reg. */
  377. #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
  378. /* Nonzero if X is a data reg or a pseudo reg. */
  379. #define REG_OK_FOR_DATA_P(X) ((unsigned) (REGNO (X) - 8) >= 16)
  380. /* Nonzero if X is a floating point reg or a pseudo reg. */
  381. #define REG_OK_FOR_FP_P(X) (REGNO (X) >= 16)
  382. #else
  383. /* Nonzero if X is a hard reg that can be used as an index. */
  384. #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
  385. /* Nonzero if X is a hard reg that can be used as a base reg. */
  386. #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  387. /* Nonzero if X is a data reg. */
  388. #define REG_OK_FOR_DATA_P(X) REGNO_OK_FOR_DATA_P (REGNO (X))
  389. /* Nonzero if X is a floating point reg. */
  390. #define REG_OK_FOR_FP_P(X) REGNO_OK_FOR_FP_P (REGNO (X))
  391. #endif
  392. #define REG_OK_FOR_CLASS_P(X, C) \
  393. (((C) == 'd' && REG_OK_FOR_DATA_P(X)) \
  394. || (C) == 'a' && REG_OK_FOR_BASE_P(X) \
  395. || (C) == 'f' && REG_OK_FOR_FP_P(X))
  396. #define REGNO_OK_FOR_CLASS_P(X, C) \
  397. (((C) == 'd' && REGNO_OK_FOR_DATA_P(X)) \
  398. || (C) == 'a' && REGNO_OK_FOR_BASE_P(X) \
  399. || (C) == 'f' && REGNO_OK_FOR_FP_P(X))
  400. #define CONSTANT_ADDRESS_P(X) \
  401. (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
  402. || GET_CODE (X) == CONST_INT \
  403. || GET_CODE (X) == CONST)
  404. #define REG_P(X) \
  405. (GET_CODE (X) == REG)
  406. #define DATA_REG_P(X) \
  407. (GET_CODE (X) == REG && REGNO_OK_FOR_DATA_P (REGNO (X)))
  408. #define FP_REG_P(X) \
  409. (GET_CODE (X) == REG && REGNO_OK_FOR_FP_P (REGNO (X)))
  410. #define ADDRESS_REG_P(X) \
  411. (GET_CODE (X) == REG && REGNO_OK_FOR_BASE_P (REGNO (X)))
  412. #define INDIRECTABLE_1_ADDRESS_P(X) \
  413. (CONSTANT_ADDRESS_P (X) \
  414. || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
  415. || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
  416. && REG_P (XEXP (X, 0)) \
  417. && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
  418. || (GET_CODE (X) == PLUS \
  419. && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  420. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  421. && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))
  422. #if 0
  423. /* This should replace the last two lines
  424. except that Sun's assembler does not seem to handle such operands. */
  425. && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1)) \
  426. : (GET_CODE (XEXP (X, 1)) == CONST_INT \
  427. && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))))
  428. #endif
  429. #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
  430. { if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
  431. #define GO_IF_INDEXABLE_BASE(X, ADDR) \
  432. { if (GET_CODE (X) == LABEL_REF) goto ADDR; \
  433. if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; }
  434. #define GO_IF_INDEXING(X, ADDR) \
  435. { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
  436. { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \
  437. if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
  438. { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
  439. #define GO_IF_INDEXED_ADDRESS(X, ADDR) \
  440. { GO_IF_INDEXING (X, ADDR); \
  441. if (GET_CODE (X) == PLUS) \
  442. { if (GET_CODE (XEXP (X, 1)) == CONST_INT \
  443. && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100) \
  444. GO_IF_INDEXING (XEXP (X, 0), ADDR); \
  445. if (GET_CODE (XEXP (X, 0)) == CONST_INT \
  446. && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100) \
  447. GO_IF_INDEXING (XEXP (X, 1), ADDR); } }
  448. #if 0
  449. /* Note we allow a constant address here if it is a LABEL_REF.
  450. That is not strictly correct, since the CODE_LABEL has to be less than
  451. 2**7 bytes away from this insn. But that is true in the only cases
  452. that matter, which occur in switch statements. */
  453. #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
  454. { if (GET_CODE (X) == LABEL_REF) goto ADDR; \
  455. if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; \
  456. if (GET_CODE (X) == PLUS && \
  457. ((REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  458. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  459. && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100) \
  460. || \
  461. (REG_P (XEXP (X, 1)) && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
  462. && GET_CODE (XEXP (X, 0)) == CONST_INT \
  463. && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100))) \
  464. goto ADDR; }
  465. #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
  466. { if (GET_CODE (X) == LABEL_REF) goto ADDR; \
  467. if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; \
  468. if (GET_CODE (X) == PLUS && \
  469. ((REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  470. && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1)) \
  471. : (GET_CODE (XEXP (X, 1)) == CONST_INT \
  472. && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100))) \
  473. || \
  474. (REG_P (XEXP (X, 1)) && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
  475. && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 0)) \
  476. : (GET_CODE (XEXP (X, 0)) == CONST_INT \
  477. && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100))))) \
  478. goto ADDR; }
  479. #endif
  480. #define LEGITIMATE_INDEX_REG_P(X) \
  481. ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
  482. || (GET_CODE (X) == SIGN_EXTEND \
  483. && GET_CODE (XEXP (X, 0)) == REG \
  484. && GET_MODE (XEXP (X, 0)) == HImode \
  485. && REG_OK_FOR_INDEX_P (XEXP (X, 0))))
  486. #define LEGITIMATE_INDEX_P(X) \
  487. (LEGITIMATE_INDEX_REG_P (X) \
  488. || (TARGET_68020 && GET_CODE (X) == MULT \
  489. && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \
  490. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  491. && (INTVAL (XEXP (X, 1)) == 2 \
  492. || INTVAL (XEXP (X, 1)) == 4 \
  493. || INTVAL (XEXP (X, 1)) == 8)))
  494. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
  495. { GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
  496. GO_IF_INDEXED_ADDRESS (X, ADDR); }
  497. #if 0
  498. if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
  499. { GO_IF_INDEXABLE_ADDRESS (XEXP (X, 1), ADDR); } \
  500. if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
  501. { GO_IF_INDEXABLE_ADDRESS (XEXP (X, 0), ADDR); } }
  502. #endif
  503. /* Try machine-dependent ways of modifying an illegitimate address
  504. to be legitimate. If we find one, return the new, valid address.
  505. This macro is used in only one place: `memory_address' in explow.c.
  506. OLDX is the address as it was before break_out_memory_refs was called.
  507. In some cases it is useful to look at this to decide what needs to be done.
  508. MODE and WIN are passed so that this macro can use
  509. GO_IF_LEGITIMATE_ADDRESS.
  510. It is always safe for this macro to do nothing. It exists to recognize
  511. opportunities to optimize the output.
  512. For the 68000, we handle X+REG by loading X into a register R and
  513. using R+REG. R will go in an address reg and indexing will be used.
  514. However, if REG is a broken-out memory address or multiplication,
  515. nothing needs to be done because REG can certainly go in an address reg. */
  516. #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
  517. { register int ch = (X) != (OLDX); \
  518. if (GET_CODE (X) == PLUS) \
  519. { if (GET_CODE (XEXP (X, 0)) == MULT) \
  520. ch = 1, XEXP (X, 0) = force_operand (XEXP (X, 0), 0); \
  521. if (GET_CODE (XEXP (X, 1)) == MULT) \
  522. ch = 1, XEXP (X, 1) = force_operand (XEXP (X, 1), 0); \
  523. if (ch && GET_CODE (XEXP (X, 1)) == REG \
  524. && GET_CODE (XEXP (X, 0)) == REG) \
  525. return X; \
  526. if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
  527. if (GET_CODE (XEXP (X, 0)) == REG \
  528. || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
  529. && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
  530. && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
  531. { register rtx temp = gen_reg_rtx (Pmode); \
  532. register rtx val = force_operand (XEXP (X, 1), temp); \
  533. if (val != temp) emit_move_insn (temp, val, 0); \
  534. XEXP (X, 1) = temp; \
  535. return X; } \
  536. else if (GET_CODE (XEXP (X, 1)) == REG \
  537. || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
  538. && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
  539. && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
  540. { register rtx temp = gen_reg_rtx (Pmode); \
  541. register rtx val = force_operand (XEXP (X, 0), temp); \
  542. if (val != temp) emit_move_insn (temp, val, 0); \
  543. XEXP (X, 0) = temp; \
  544. return X; }}}
  545. /* Specify the machine mode that this machine uses
  546. for the index in the tablejump instruction. */
  547. #define CASE_VECTOR_MODE HImode
  548. /* Define this if the tablejump instruction expects the table
  549. to contain offsets from the address of the table.
  550. Do not define this if the table should contain absolute addresses. */
  551. #define CASE_VECTOR_PC_RELATIVE
  552. /* Specify the tree operation to be used to convert reals to integers. */
  553. #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
  554. /* This is the kind of divide that is easiest to do in the general case. */
  555. #define EASY_DIV_EXPR TRUNC_DIV_EXPR
  556. /* Max number of bytes we can move from memory to memory
  557. in one reasonably fast instruction. */
  558. #define MOVE_MAX 4
  559. /* Define this if zero-extension is slow (more than one real instruction). */
  560. #define SLOW_ZERO_EXTEND
  561. /* Define if shifts truncate the shift count
  562. which implies one can omit a sign-extension or zero-extension
  563. of a shift count. */
  564. #define SHIFT_COUNT_TRUNCATED
  565. /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  566. is done just by pretending it is already truncated. */
  567. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  568. /* Specify the machine mode that pointers have.
  569. After generation of rtl, the compiler makes no further distinction
  570. between pointers and any other objects of this machine mode. */
  571. #define Pmode SImode
  572. /* A function address in a call instruction
  573. is a byte address (for indexing purposes)
  574. so give the MEM rtx a byte's mode. */
  575. #define FUNCTION_MODE QImode
  576. /* Compute the cost of computing a constant rtl expression RTX
  577. whose rtx-code is CODE. The body of this macro is a portion
  578. of a switch statement. If the code is computed here,
  579. return it with a return statement. Otherwise, break from the switch. */
  580. #define CONST_COSTS(RTX,CODE) \
  581. case CONST_INT: \
  582. /* Constant zero is super cheap due to clr instruction. */ \
  583. if (RTX == const0_rtx) return 0; \
  584. if ((unsigned) INTVAL (RTX) < 077) return 1; \
  585. case CONST: \
  586. case LABEL_REF: \
  587. case SYMBOL_REF: \
  588. return 3; \
  589. case CONST_DOUBLE: \
  590. return 5;
  591. /* Tell final.c how to eliminate redundant test instructions. */
  592. /* Here we define machine-dependent flags and fields in cc_status
  593. (see `conditions.h'). */
  594. /* Set if the cc value is actually in the 68881, so a floating point
  595. conditional branch must be output. */
  596. #define CC_IN_68881 040
  597. /* Store in cc_status the expressions
  598. that the condition codes will describe
  599. after execution of an instruction whose pattern is EXP.
  600. Do not alter them if the instruction would not alter the cc's. */
  601. /* On the 68000, all the insns to store in an address register
  602. fail to set the cc's. However, in some cases these instructions
  603. can make it possibly invalid to use the saved cc's. In those
  604. cases we clear out some or all of the saved cc's so they won't be used. */
  605. #define NOTICE_UPDATE_CC(EXP) \
  606. { if (GET_CODE (EXP) == SET) \
  607. { if (ADDRESS_REG_P (XEXP (EXP, 0))) \
  608. { if (cc_status.value1 \
  609. && reg_mentioned_p (XEXP (EXP, 0), cc_status.value1)) \
  610. cc_status.value1 = 0; \
  611. if (cc_status.value2 \
  612. && reg_mentioned_p (XEXP (EXP, 0), cc_status.value2)) \
  613. cc_status.value2 = 0; } \
  614. else if (XEXP (EXP, 0) != pc_rtx) \
  615. { cc_status.flags = 0; \
  616. cc_status.value1 = XEXP (EXP, 0); \
  617. cc_status.value2 = XEXP (EXP, 1); } } \
  618. else if (GET_CODE (EXP) == PARALLEL \
  619. && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
  620. { if (ADDRESS_REG_P (XEXP (XVECEXP (EXP, 0, 0), 0))) \
  621. CC_STATUS_INIT; \
  622. else if (XEXP (XVECEXP (EXP, 0, 0), 0) != pc_rtx) \
  623. { cc_status.flags = 0; \
  624. cc_status.value1 = XEXP (XVECEXP (EXP, 0, 0), 0); \
  625. cc_status.value2 = XEXP (XVECEXP (EXP, 0, 0), 1); } } \
  626. else CC_STATUS_INIT; \
  627. if (cc_status.value2 != 0 \
  628. && ADDRESS_REG_P (cc_status.value2) \
  629. && GET_MODE (cc_status.value2) == QImode) \
  630. CC_STATUS_INIT; \
  631. if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
  632. && cc_status.value2 \
  633. && reg_mentioned_p (cc_status.value1, cc_status.value2)) \
  634. cc_status.value2 = 0; \
  635. if ((cc_status.value1 && FP_REG_P (cc_status.value1)) \
  636. || (cc_status.value2 && FP_REG_P (cc_status.value2))) \
  637. cc_status.flags = CC_IN_68881; \
  638. if (cc_status.value2 != 0) \
  639. switch (GET_CODE (cc_status.value2)) \
  640. { case PLUS: case MINUS: case MULT: case UMULT: \
  641. case DIV: case UDIV: case ASHIFT: case LSHIFT: \
  642. case NEG: \
  643. if (GET_MODE (cc_status.value2) != VOIDmode) \
  644. cc_status.flags |= CC_NO_OVERFLOW; }}
  645. #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
  646. { if (cc_status.flags & CC_IN_68881) \
  647. return FLOAT; \
  648. if (cc_status.flags & CC_NO_OVERFLOW) \
  649. return NO_OV; \
  650. return NORMAL; }
  651. /* Control the assembler format that we output. */
  652. #define TEXT_SECTION_ASM_OP ".text"
  653. #define DATA_SECTION_ASM_OP ".data"
  654. /* How to refer to registers in assembler output.
  655. This sequence is indexed by compiler's hard-register-number (see above). */
  656. #define REGISTER_NAMES \
  657. {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
  658. "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
  659. "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7"}
  660. /* How to renumber registers for dbx and gdb.
  661. On the Sun-3, the floating point registers have numbers
  662. 18 to 25, not 16 to 23 as they do in the compiler. */
  663. #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
  664. /* This is how to output an assembler line defining a `double' constant. */
  665. #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
  666. fprintf (FILE, "\t.double 0r%e\n", (VALUE))
  667. /* This is how to output an assembler line defining a `float' constant. */
  668. #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
  669. do { union { float f; long l;} tem; \
  670. tem.f = (VALUE); \
  671. fprintf (FILE, "\t.long 0x%x\n", tem.l); \
  672. } while (0)
  673. /* This is how to output an assembler line
  674. that says to advance the location counter
  675. to a multiple of 2**LOG bytes. */
  676. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  677. if ((LOG) == 1) \
  678. fprintf (FILE, "\t.even\n"); \
  679. else if ((LOG) != 0) \
  680. abort ();
  681. #define ASM_OUTPUT_SKIP(FILE,SIZE) \
  682. fprintf (FILE, "\t.skip %d\n", (SIZE))
  683. /* Define the parentheses used to group arithmetic operations
  684. in assembler code. */
  685. #define ASM_OPEN_PAREN "("
  686. #define ASM_CLOSE_PAREN ")"
  687. /* Specify what to precede various sizes of constant with
  688. in the output file. */
  689. #define ASM_INT_OP ".long "
  690. #define ASM_SHORT_OP ".word "
  691. #define ASM_CHAR_OP ".byte "
  692. /* Define results of standard character escape sequences. */
  693. #define TARGET_BELL 007
  694. #define TARGET_BS 010
  695. #define TARGET_TAB 011
  696. #define TARGET_NEWLINE 012
  697. #define TARGET_VT 013
  698. #define TARGET_FF 014
  699. #define TARGET_CR 015
  700. #define PRINT_OPERAND(FILE, X) \
  701. { if (GET_CODE (X) == REG) \
  702. fprintf (FILE, "%s", reg_name [REGNO (X)]); \
  703. else if (GET_CODE (X) == MEM) \
  704. output_address (XEXP (X, 0)); \
  705. else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
  706. { union { double d; int i[2]; } u; \
  707. union { float f; int i; } u1; \
  708. u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
  709. u1.f = u.d; \
  710. fprintf (FILE, "#0x%x", u1.i); } \
  711. else if (GET_CODE (X) == CONST_DOUBLE) \
  712. { union { double d; int i[2]; } u; \
  713. u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
  714. fprintf (FILE, "#0r%g", u.d); } \
  715. else { putc ('#', FILE); output_addr_const (FILE, X); }}
  716. /* Note that this contains a kludge that knows that the only reason
  717. we have an address (plus (label_ref...) (reg...))
  718. is in the insn before a tablejump, and the displacement must be 6. */
  719. #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
  720. { register rtx reg1, reg2, breg, ireg; \
  721. register rtx addr = ADDR; \
  722. rtx offset; \
  723. switch (GET_CODE (addr)) \
  724. { \
  725. case REG: \
  726. fprintf (FILE, "%s@", reg_name [REGNO (addr)]); \
  727. break; \
  728. case PRE_DEC: \
  729. fprintf (FILE, "%s@-", reg_name [REGNO (XEXP (addr, 0))]); \
  730. break; \
  731. case POST_INC: \
  732. fprintf (FILE, "%s@+", reg_name [REGNO (XEXP (addr, 0))]); \
  733. break; \
  734. case PLUS: \
  735. reg1 = 0; reg2 = 0; \
  736. ireg = 0; breg = 0; \
  737. offset = 0; \
  738. if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
  739. { \
  740. offset = XEXP (addr, 0); \
  741. addr = XEXP (addr, 1); \
  742. } \
  743. else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
  744. { \
  745. offset = XEXP (addr, 1); \
  746. addr = XEXP (addr, 0); \
  747. } \
  748. if (GET_CODE (addr) != PLUS) ; \
  749. else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
  750. { \
  751. reg1 = XEXP (addr, 0); \
  752. addr = XEXP (addr, 1); \
  753. } \
  754. else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
  755. { \
  756. reg1 = XEXP (addr, 1); \
  757. addr = XEXP (addr, 0); \
  758. } \
  759. else if (GET_CODE (XEXP (addr, 0)) == MULT) \
  760. { \
  761. reg1 = XEXP (addr, 0); \
  762. addr = XEXP (addr, 1); \
  763. } \
  764. else if (GET_CODE (XEXP (addr, 1)) == MULT) \
  765. { \
  766. reg1 = XEXP (addr, 1); \
  767. addr = XEXP (addr, 0); \
  768. } \
  769. else if (GET_CODE (XEXP (addr, 0)) == REG) \
  770. { \
  771. reg1 = XEXP (addr, 0); \
  772. addr = XEXP (addr, 1); \
  773. } \
  774. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  775. { \
  776. reg1 = XEXP (addr, 1); \
  777. addr = XEXP (addr, 0); \
  778. } \
  779. if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
  780. || GET_CODE (addr) == SIGN_EXTEND) \
  781. { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
  782. /* for OLD_INDEXING \
  783. else if (GET_CODE (addr) == PLUS) \
  784. { \
  785. if (GET_CODE (XEXP (addr, 0)) == REG) \
  786. { \
  787. reg2 = XEXP (addr, 0); \
  788. addr = XEXP (addr, 1); \
  789. } \
  790. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  791. { \
  792. reg2 = XEXP (addr, 1); \
  793. addr = XEXP (addr, 0); \
  794. } \
  795. } \
  796. */ \
  797. if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
  798. if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
  799. || GET_CODE (reg1) == MULT)) \
  800. || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
  801. { breg = reg2; ireg = reg1; } \
  802. else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
  803. { breg = reg1; ireg = reg2; } \
  804. if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
  805. { int scale = 1; \
  806. if (GET_CODE (ireg) == MULT) \
  807. { scale = INTVAL (XEXP (ireg, 1)); \
  808. ireg = XEXP (ireg, 0); } \
  809. if (GET_CODE (ireg) == SIGN_EXTEND) \
  810. fprintf (FILE, "pc@(6,%s:w", reg_name[REGNO (XEXP (ireg, 0))]); \
  811. else \
  812. fprintf (FILE, "pc@(6,%s:l", reg_name[REGNO (ireg)]); \
  813. if (scale != 1) fprintf (FILE, ":%d", scale); \
  814. putc (')', FILE); \
  815. break; } \
  816. if (ireg != 0 || breg != 0) \
  817. { int scale = 1; \
  818. if (breg == 0) \
  819. abort (); \
  820. fprintf (FILE, "%s@(", reg_name[REGNO (breg)]); \
  821. if (addr != 0) \
  822. output_addr_const (FILE, addr); \
  823. if (addr != 0 && ireg != 0) \
  824. putc (',', FILE); \
  825. if (ireg != 0 && GET_CODE (ireg) == MULT) \
  826. { scale = INTVAL (XEXP (ireg, 1)); \
  827. ireg = XEXP (ireg, 0); } \
  828. if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
  829. fprintf (FILE, "%s:w", reg_name[REGNO (XEXP (ireg, 0))]); \
  830. else if (ireg != 0) \
  831. fprintf (FILE, "%s:l", reg_name[REGNO (ireg)]); \
  832. if (scale != 1) fprintf (FILE, ":%d", scale); \
  833. putc (')', FILE); \
  834. break; \
  835. } \
  836. else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
  837. { fprintf (FILE, "pc@(6,%s:w)", reg_name[REGNO (reg1)]); \
  838. break; } \
  839. default: \
  840. if (GET_CODE (addr) == CONST_INT \
  841. && INTVAL (addr) < 0x8000 \
  842. && INTVAL (addr) >= -0x8000) \
  843. fprintf (FILE, "%d:w", INTVAL (addr)); \
  844. else \
  845. output_addr_const (FILE, addr); \
  846. }}
  847. /*
  848. Local variables:
  849. version-control: t
  850. End:
  851. */