tm-m68k.h 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334
  1. /* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
  2. Copyright (C) 1987, 1988 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. /* Note that some other tm- files include this one and then override
  18. many of the definitions that relate to assembler syntax. */
  19. /* Names to predefine in the preprocessor for this target machine. */
  20. /* See tm-sun3.h, tm-sun2.h, tm-isi68.h for different CPP_PREDEFINES. */
  21. /* Print subsidiary information on the compiler version in use. */
  22. #ifdef MOTOROLA
  23. #define TARGET_VERSION printf (" (68k, Motorola syntax)");
  24. #else
  25. #define TARGET_VERSION printf (" (68k, MIT syntax)");
  26. #endif
  27. /* Run-time compilation parameters selecting different hardware subsets. */
  28. extern int target_flags;
  29. /* Macros used in the machine description to test the flags. */
  30. /* Compile for a 68020 (not a 68000 or 68010). */
  31. #define TARGET_68020 (target_flags & 1)
  32. /* Compile 68881 insns for floating point (not library calls). */
  33. #define TARGET_68881 (target_flags & 2)
  34. /* Compile using 68020 bitfield insns. */
  35. #define TARGET_BITFIELD (target_flags & 4)
  36. /* Compile using rtd insn calling sequence.
  37. This will not work unless you use prototypes at least
  38. for all functions that can take varying numbers of args. */
  39. #define TARGET_RTD (target_flags & 8)
  40. /* Compile passing first two args in regs 0 and 1.
  41. This exists only to test compiler features that will
  42. be needed for RISC chips. It is not usable
  43. and is not intended to be usable on this cpu. */
  44. #define TARGET_REGPARM (target_flags & 020)
  45. /* Compile with 16-bit `int'. */
  46. #define TARGET_SHORT (target_flags & 040)
  47. /* Macro to define tables used to set the flags.
  48. This is a list in braces of pairs in braces,
  49. each pair being { "NAME", VALUE }
  50. where VALUE is the bits to set or minus the bits to clear.
  51. An empty string NAME is used to identify the default VALUE. */
  52. #define TARGET_SWITCHES \
  53. { { "68020", 5}, \
  54. { "68881", 2}, \
  55. { "bitfield", 4}, \
  56. { "68000", -5}, \
  57. { "soft-float", -2}, \
  58. { "nobitfield", -4}, \
  59. { "rtd", 8}, \
  60. { "nortd", -8}, \
  61. { "short", 040}, \
  62. { "noshort", -040}, \
  63. { "", TARGET_DEFAULT}}
  64. /* TARGET_DEFAULT is defined in tm-sun*.h and tm-isi68.h, etc. */
  65. /* target machine storage layout */
  66. /* Define this if most significant bit is lowest numbered
  67. in instructions that operate on numbered bit-fields.
  68. This is true for 68020 insns such as bfins and bfexts.
  69. We make it true always by avoiding using the single-bit insns
  70. except in special cases with constant bit numbers. */
  71. #define BITS_BIG_ENDIAN
  72. /* Define this if most significant byte of a word is the lowest numbered. */
  73. /* That is true on the 68000. */
  74. #define BYTES_BIG_ENDIAN
  75. /* Define this if most significant word of a multiword number is numbered. */
  76. /* For 68000 we can decide arbitrarily
  77. since there are no machine instructions for them. */
  78. /* #define WORDS_BIG_ENDIAN */
  79. /* number of bits in an addressible storage unit */
  80. #define BITS_PER_UNIT 8
  81. /* Width in bits of a "word", which is the contents of a machine register.
  82. Note that this is not necessarily the width of data type `int';
  83. if using 16-bit ints on a 68000, this would still be 32.
  84. But on a machine with 16-bit registers, this would be 16. */
  85. #define BITS_PER_WORD 32
  86. /* Width of a word, in units (bytes). */
  87. #define UNITS_PER_WORD 4
  88. /* Width in bits of a pointer.
  89. See also the macro `Pmode' defined below. */
  90. #define POINTER_SIZE 32
  91. /* Allocation boundary (in *bits*) for storing pointers in memory. */
  92. #define POINTER_BOUNDARY 16
  93. /* Allocation boundary (in *bits*) for storing arguments in argument list. */
  94. #define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
  95. /* Boundary (in *bits*) on which stack pointer should be aligned. */
  96. #define STACK_BOUNDARY 16
  97. /* Allocation boundary (in *bits*) for the code of a function. */
  98. #define FUNCTION_BOUNDARY 16
  99. /* Alignment of field after `int : 0' in a structure. */
  100. #define EMPTY_FIELD_BOUNDARY (TARGET_SHORT ? 16 : 32)
  101. /* No data type wants to be aligned rounder than this. */
  102. #define BIGGEST_ALIGNMENT 16
  103. /* Define this if move instructions will actually fail to work
  104. when given unaligned data. */
  105. #define STRICT_ALIGNMENT
  106. /* Define number of bits in most basic integer type.
  107. (If undefined, default is BITS_PER_WORD). */
  108. #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
  109. /* Standard register usage. */
  110. /* Number of actual hardware registers.
  111. The hardware registers are assigned numbers for the compiler
  112. from 0 to just below FIRST_PSEUDO_REGISTER.
  113. All registers that the compiler knows about must be given numbers,
  114. even those that are not normally considered general registers.
  115. For the 68000, we give the data registers numbers 0-7,
  116. the address registers numbers 010-017,
  117. and the 68881 floating point registers numbers 020-027. */
  118. #define FIRST_PSEUDO_REGISTER 24
  119. /* 1 for registers that have pervasive standard uses
  120. and are not available for the register allocator.
  121. On the 68000, only the stack pointer is such. */
  122. #define FIXED_REGISTERS \
  123. {0, 0, 0, 0, 0, 0, 0, 0, \
  124. 0, 0, 0, 0, 0, 0, 0, 1, \
  125. 0, 0, 0, 0, 0, 0, 0, 0}
  126. /* 1 for registers not available across function calls.
  127. These must include the FIXED_REGISTERS and also any
  128. registers that can be used without being saved.
  129. The latter must include the registers where values are returned
  130. and the register where structure-value addresses are passed.
  131. Aside from that, you can include as many other registers as you like. */
  132. #define CALL_USED_REGISTERS \
  133. {1, 1, 0, 0, 0, 0, 0, 0, \
  134. 1, 1, 0, 0, 0, 0, 0, 1, \
  135. 1, 1, 0, 0, 0, 0, 0, 0}
  136. /* Return number of consecutive hard regs needed starting at reg REGNO
  137. to hold something of mode MODE.
  138. This is ordinarily the length in words of a value of mode MODE
  139. but can be less for certain modes in special long registers.
  140. On the 68000, ordinary registers hold 32 bits worth;
  141. for the 68881 registers, a single register is always enough for
  142. anything that can be stored in them at all. */
  143. #define HARD_REGNO_NREGS(REGNO, MODE) \
  144. ((REGNO) >= 16 ? 1 \
  145. : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
  146. /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
  147. On the 68000, the cpu registers can hold any mode but the 68881 registers
  148. can hold only SFmode or DFmode. And the 68881 registers can't hold anything
  149. if 68881 use is disabled. */
  150. #define HARD_REGNO_MODE_OK(REGNO, MODE) \
  151. ((REGNO) < 16 || (TARGET_68881 && ((MODE) == SFmode || (MODE) == DFmode)))
  152. /* Value is 1 if it is a good idea to tie two pseudo registers
  153. when one has mode MODE1 and one has mode MODE2.
  154. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  155. for any hard reg, then this must be 0 for correct output. */
  156. #define MODES_TIEABLE_P(MODE1, MODE2) \
  157. (((MODE1) == SFmode || (MODE1) == DFmode) \
  158. == ((MODE2) == SFmode || (MODE2) == DFmode))
  159. /* Specify the registers used for certain standard purposes.
  160. The values of these macros are register numbers. */
  161. /* m68000 pc isn't overloaded on a register. */
  162. /* #define PC_REGNUM */
  163. /* Register to use for pushing function arguments. */
  164. #define STACK_POINTER_REGNUM 15
  165. /* Base register for access to local variables of the function. */
  166. #define FRAME_POINTER_REGNUM 14
  167. /* Value should be nonzero if functions must have frame pointers.
  168. Zero means the frame pointer need not be set up (and parms
  169. may be accessed via the stack pointer) in functions that seem suitable.
  170. This is computed in `reload', in reload1.c. */
  171. #define FRAME_POINTER_REQUIRED 0
  172. /* Base register for access to arguments of the function. */
  173. #define ARG_POINTER_REGNUM 14
  174. /* Register in which static-chain is passed to a function. */
  175. #define STATIC_CHAIN_REGNUM 8
  176. /* Register in which address to store a structure value
  177. is passed to a function. */
  178. #define STRUCT_VALUE_REGNUM 9
  179. /* Define the classes of registers for register constraints in the
  180. machine description. Also define ranges of constants.
  181. One of the classes must always be named ALL_REGS and include all hard regs.
  182. If there is more than one class, another class must be named NO_REGS
  183. and contain no registers.
  184. The name GENERAL_REGS must be the name of a class (or an alias for
  185. another name such as ALL_REGS). This is the class of registers
  186. that is allowed by "g" or "r" in a register constraint.
  187. Also, registers outside this class are allocated only when
  188. instructions express preferences for them.
  189. The classes must be numbered in nondecreasing order; that is,
  190. a larger-numbered class must never be contained completely
  191. in a smaller-numbered class.
  192. For any two classes, it is very desirable that there be another
  193. class that represents their union. */
  194. /* The 68000 has three kinds of registers, so eight classes would be
  195. a complete set. One of them is not needed. */
  196. enum reg_class { NO_REGS, DATA_REGS, ADDR_REGS, GENERAL_REGS, FP_REGS, FP_OR_DATA_REGS, ALL_REGS, LIM_REG_CLASSES };
  197. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  198. /* Give names of register classes as strings for dump file. */
  199. #define REG_CLASS_NAMES \
  200. {"NO_REGS", "DATA_REGS", "ADDR_REGS", "GENERAL_REGS", \
  201. "FP_REGS", "FP_OR_DATA_REGS", "ALL_REGS" }
  202. /* Define which registers fit in which classes.
  203. This is an initializer for a vector of HARD_REG_SET
  204. of length N_REG_CLASSES. */
  205. #define REG_CLASS_CONTENTS {0, 0xff, 0xff00, 0xffff, 0xff0000, 0xff00ff, 0xffffff}
  206. /* The same information, inverted:
  207. Return the class number of the smallest class containing
  208. reg number REGNO. This could be a conditional expression
  209. or could index an array. */
  210. #define REGNO_REG_CLASS(REGNO) \
  211. ((REGNO) >= 16 ? FP_REGS : (REGNO) < 8 ? DATA_REGS : ADDR_REGS)
  212. /* The class value for index registers, and the one for base regs. */
  213. #define INDEX_REG_CLASS GENERAL_REGS
  214. #define BASE_REG_CLASS ADDR_REGS
  215. /* Get reg_class from a letter such as appears in the machine description. */
  216. #define REG_CLASS_FROM_LETTER(C) \
  217. ((C) == 'a' ? ADDR_REGS : ((C) == 'd' ? DATA_REGS : ((C) == 'f' ? FP_REGS : NO_REGS)))
  218. /* The letters I, J, K, L and M in a register constraint string
  219. can be used to stand for particular ranges of immediate operands.
  220. This macro defines what the ranges are.
  221. C is the letter, and VALUE is a constant value.
  222. Return 1 if VALUE is in the range specified by C.
  223. For the 68000, `I' is used for the range 1 to 8
  224. allowed as immediate shift counts and in addq.
  225. `J' is used for the range of signed numbers that fit in 16 bits.
  226. `K' is for numbers that moveq can't handle.
  227. `L' is for range -8 to -1, range of values that can be added with subq. */
  228. #define CONST_OK_FOR_LETTER_P(VALUE, C) \
  229. ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
  230. (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
  231. (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
  232. (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : 0)
  233. /* Similar, but for floating constants, and defining letters G and H.
  234. Here VALUE is the CONST_DOUBLE rtx itself. */
  235. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
  236. ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 1)
  237. /* Given an rtx X being reloaded into a reg required to be
  238. in class CLASS, return the class of reg to actually use.
  239. In general this is just CLASS; but on some machines
  240. in some cases it is preferable to use a more restrictive class.
  241. On the 68000 series, use a data reg if possible when the
  242. value is a constant in the range where moveq could be used. */
  243. #define PREFERRED_RELOAD_CLASS(X,CLASS) \
  244. ((GET_CODE (X) == CONST_INT \
  245. && (unsigned) (INTVAL (X) + 0x80) < 0x100 \
  246. && (CLASS) != ADDR_REGS) \
  247. ? DATA_REGS : (CLASS))
  248. /* Return the maximum number of consecutive registers
  249. needed to represent mode MODE in a register of class CLASS. */
  250. /* On the 68000, this is the size of MODE in words,
  251. except in the FP regs, where a single reg is always enough. */
  252. #define CLASS_MAX_NREGS(CLASS, MODE) \
  253. ((CLASS) == FP_REGS ? 1 \
  254. : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
  255. /* Stack layout; function entry, exit and calling. */
  256. /* Define this if pushing a word on the stack
  257. makes the stack pointer a smaller address. */
  258. #define STACK_GROWS_DOWNWARD
  259. /* Define this if the nominal address of the stack frame
  260. is at the high-address end of the local variables;
  261. that is, each additional local variable allocated
  262. goes at a more negative offset in the frame. */
  263. #define FRAME_GROWS_DOWNWARD
  264. /* Offset within stack frame to start allocating local variables at.
  265. If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  266. first local allocated. Otherwise, it is the offset to the BEGINNING
  267. of the first local allocated. */
  268. #define STARTING_FRAME_OFFSET 0
  269. /* If we generate an insn to push BYTES bytes,
  270. this says how many the stack pointer really advances by.
  271. On the 68000, sp@- in a byte insn really pushes a word. */
  272. #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  273. /* Offset of first parameter from the argument pointer register value. */
  274. #define FIRST_PARM_OFFSET 8
  275. /* Value is 1 if returning from a function call automatically
  276. pops the arguments described by the number-of-args field in the call.
  277. FUNTYPE is the data type of the function (as a tree),
  278. or for a library call it is an identifier node for the subroutine name.
  279. On the 68000, the RTS insn cannot pop anything.
  280. On the 68010, the RTD insn may be used to pop them if the number
  281. of args is fixed, but if the number is variable then the caller
  282. must pop them all. RTD can't be used for library calls now
  283. because the library is compiled with the Unix compiler.
  284. Use of RTD is a selectable option, since it is incompatible with
  285. standard Unix calling sequences. If the option is not selected,
  286. the caller must always pop the args. */
  287. #define RETURN_POPS_ARGS(FUNTYPE) \
  288. (TARGET_RTD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \
  289. && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
  290. || TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) == void_type_node))
  291. /* Define how to find the value returned by a function.
  292. VALTYPE is the data type of the value (as a tree).
  293. If the precise function being called is known, FUNC is its FUNCTION_DECL;
  294. otherwise, FUNC is 0. */
  295. /* On the 68000 the return value is in D0 regardless. */
  296. #define FUNCTION_VALUE(VALTYPE, FUNC) \
  297. gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
  298. /* Define how to find the value returned by a library function
  299. assuming the value has mode MODE. */
  300. /* On the 68000 the return value is in D0 regardless. */
  301. #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
  302. /* 1 if N is a possible register number for a function value.
  303. On the 68000, d0 is the only register thus used. */
  304. #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
  305. /* 1 if N is a possible register number for function argument passing.
  306. On the 68000, no registers are used in this way. */
  307. #define FUNCTION_ARG_REGNO_P(N) 0
  308. /* Define a data type for recording info about an argument list
  309. during the scan of that argument list. This data type should
  310. hold all necessary information about the function itself
  311. and about the args processed so far, enough to enable macros
  312. such as FUNCTION_ARG to determine where the next arg should go.
  313. On the m68k, this is a single integer, which is a number of bytes
  314. of arguments scanned so far. */
  315. #define CUMULATIVE_ARGS int
  316. /* Initialize a variable CUM of type CUMULATIVE_ARGS
  317. for a call to a function whose data type is FNTYPE.
  318. For a library call, FNTYPE is 0.
  319. On the m68k, the offset starts at 0. */
  320. #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \
  321. ((CUM) = 0)
  322. /* Update the data in CUM to advance over an argument
  323. of mode MODE and data type TYPE.
  324. (TYPE is null for libcalls where that information may not be available.) */
  325. #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
  326. ((CUM) += ((MODE) != BLKmode \
  327. ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
  328. : (int_size_in_bytes (TYPE) + 3) & ~3))
  329. /* Define where to put the arguments to a function.
  330. Value is zero to push the argument on the stack,
  331. or a hard register in which to store the argument.
  332. MODE is the argument's machine mode.
  333. TYPE is the data type of the argument (as a tree).
  334. This is null for libcalls where that information may
  335. not be available.
  336. CUM is a variable of type CUMULATIVE_ARGS which gives info about
  337. the preceding args and about the function being called.
  338. NAMED is nonzero if this argument is a named parameter
  339. (otherwise it is an extra parameter matching an ellipsis). */
  340. /* On the 68000 all args are pushed, except if -mregparm is specified
  341. then the first two words of arguments are passed in d0, d1.
  342. *NOTE* -mregparm does not work.
  343. It exists only to test register calling conventions. */
  344. #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
  345. ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
  346. /* For an arg passed partly in registers and partly in memory,
  347. this is the number of registers used.
  348. For args passed entirely in registers or entirely in memory, zero. */
  349. #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
  350. ((TARGET_REGPARM && (CUM) < 8 \
  351. && 8 < ((CUM) + ((MODE) == BLKmode \
  352. ? int_size_in_bytes (TYPE) \
  353. : GET_MODE_SIZE (MODE)))) \
  354. ? 2 - (CUM) / 4 : 0)
  355. /* This macro generates the assembly code for function entry.
  356. FILE is a stdio stream to output the code to.
  357. SIZE is an int: how many units of temporary storage to allocate.
  358. Refer to the array `regs_ever_live' to determine which registers
  359. to save; `regs_ever_live[I]' is nonzero if register number I
  360. is ever used in the function. This macro is responsible for
  361. knowing which registers should not be saved even if used. */
  362. /* Note that the order of the bit mask for fmovem is the opposite
  363. of the order for movem! */
  364. #define FUNCTION_PROLOGUE(FILE, SIZE) \
  365. { register int regno; \
  366. register int mask = 0; \
  367. static char *reg_names[] = REGISTER_NAMES; \
  368. extern char call_used_regs[]; \
  369. int fsize = (SIZE); \
  370. if (frame_pointer_needed) \
  371. { if (TARGET_68020 || fsize < 0x8000) \
  372. fprintf (FILE, "\tlink a6,#%d\n", -fsize); \
  373. else \
  374. fprintf (FILE, "\tlink a6,#0\n\tsubl #%d,sp\n", fsize); } \
  375. for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
  376. if (regs_ever_live[regno] && ! call_used_regs[regno]) \
  377. mask |= 1 << (regno - 16); \
  378. if (mask != 0) \
  379. fprintf (FILE, "\tfmovem #0x%x,sp@-\n", mask & 0xff); \
  380. mask = 0; \
  381. for (regno = 0; regno < 16; regno++) \
  382. if (regs_ever_live[regno] && ! call_used_regs[regno]) \
  383. mask |= 1 << (15 - regno); \
  384. if (frame_pointer_needed) \
  385. mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \
  386. if (exact_log2 (mask) >= 0) \
  387. fprintf (FILE, "\tmovel %s,sp@-\n", reg_names[15 - exact_log2 (mask)]); \
  388. else if (mask) fprintf (FILE, "\tmoveml #0x%x,sp@-\n", mask); }
  389. /* Output assembler code to FILE to increment profiler label # LABELNO
  390. for profiling a function entry. */
  391. #define FUNCTION_PROFILER(FILE, LABELNO) \
  392. fprintf (FILE, "\tlea LP%d,a0\n\tjsr mcount\n", (LABELNO));
  393. /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
  394. the stack pointer does not matter. The value is tested only in
  395. functions that have frame pointers.
  396. No definition is equivalent to always zero. */
  397. #define EXIT_IGNORE_STACK 1
  398. /* This macro generates the assembly code for function exit,
  399. on machines that need it. If FUNCTION_EPILOGUE is not defined
  400. then individual return instructions are generated for each
  401. return statement. Args are same as for FUNCTION_PROLOGUE.
  402. The function epilogue should not depend on the current stack pointer!
  403. It should use the frame pointer only. This is mandatory because
  404. of alloca; we also take advantage of it to omit stack adjustments
  405. before returning. */
  406. #define FUNCTION_EPILOGUE(FILE, SIZE) \
  407. { register int regno; \
  408. register int mask, fmask; \
  409. register int nregs; \
  410. int offset, foffset; \
  411. extern char call_used_regs[]; \
  412. static char *reg_names[] = REGISTER_NAMES; \
  413. extern int current_function_pops_args; \
  414. extern int current_function_args_size; \
  415. int fsize = (SIZE); \
  416. int big = 0; \
  417. nregs = 0; fmask = 0; \
  418. for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
  419. if (regs_ever_live[regno] && ! call_used_regs[regno]) \
  420. { nregs++; fmask |= 1 << (23 - regno); } \
  421. foffset = nregs * 12; \
  422. nregs = 0; mask = 0; \
  423. if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
  424. for (regno = 0; regno < 16; regno++) \
  425. if (regs_ever_live[regno] && ! call_used_regs[regno]) \
  426. { nregs++; mask |= 1 << regno; } \
  427. offset = foffset + nregs * 4; \
  428. if (offset + fsize >= 0x8000 && frame_pointer_needed && (mask || fmask)) \
  429. { fprintf (FILE, "\tmovel #%d,a0\n", -fsize); \
  430. fsize = 0, big = 1; } \
  431. if (exact_log2 (mask) >= 0) { \
  432. if (big) \
  433. fprintf (FILE, "\tmovel a6@(-%d,a0:l),%s\n", \
  434. offset + fsize, reg_names[exact_log2 (mask)]); \
  435. else if (! frame_pointer_needed) \
  436. fprintf (FILE, "\tmovel sp@+,%s\n", \
  437. reg_names[exact_log2 (mask)]); \
  438. else \
  439. fprintf (FILE, "\tmovel a6@(-%d),%s\n", \
  440. offset + fsize, reg_names[exact_log2 (mask)]); } \
  441. else if (mask) { \
  442. if (big) \
  443. fprintf (FILE, "\tmoveml a6@(-%d,a0:l),#0x%x\n", \
  444. offset + fsize, mask); \
  445. else if (! frame_pointer_needed) \
  446. fprintf (FILE, "\tmoveml sp@+,#0x%x\n", mask); \
  447. else \
  448. fprintf (FILE, "\tmoveml a6@(-%d),#0x%x\n", \
  449. offset + fsize, mask); } \
  450. if (fmask) { \
  451. if (big) \
  452. fprintf (FILE, "\tfmovem a6@(-%d,a0:l),#0x%x\n", \
  453. foffset + fsize, fmask); \
  454. else if (! frame_pointer_needed) \
  455. fprintf (FILE, "\tfmovem sp@+,#0x%x\n", fmask); \
  456. else \
  457. fprintf (FILE, "\tfmovem a6@(-%d),#0x%x\n", \
  458. foffset + fsize, fmask); } \
  459. if (frame_pointer_needed) \
  460. fprintf (FILE, "\tunlk a6\n"); \
  461. if (current_function_pops_args && current_function_args_size) \
  462. fprintf (FILE, "\trtd #%d\n", current_function_args_size); \
  463. else fprintf (FILE, "\trts\n"); }
  464. /* If the memory address ADDR is relative to the frame pointer,
  465. correct it to be relative to the stack pointer instead.
  466. This is for when we don't use a frame pointer.
  467. ADDR should be a variable name. */
  468. #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
  469. { int offset = -1; \
  470. if (ADDR == frame_pointer_rtx) \
  471. offset = 0; \
  472. else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \
  473. && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
  474. offset = INTVAL (XEXP (ADDR, 1)); \
  475. if (offset >= 0) \
  476. { int regno; \
  477. extern char call_used_regs[]; \
  478. for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
  479. if (regs_ever_live[regno] && ! call_used_regs[regno]) \
  480. offset += 12; \
  481. for (regno = 0; regno < 16; regno++) \
  482. if (regs_ever_live[regno] && ! call_used_regs[regno]) \
  483. offset += 4; \
  484. offset -= 4; \
  485. ADDR = plus_constant (stack_pointer_rtx, offset + (DEPTH)); } }
  486. /* Addressing modes, and classification of registers for them. */
  487. #define HAVE_POST_INCREMENT
  488. /* #define HAVE_POST_DECREMENT */
  489. #define HAVE_PRE_DECREMENT
  490. /* #define HAVE_PRE_INCREMENT */
  491. /* Macros to check register numbers against specific register classes. */
  492. /* These assume that REGNO is a hard or pseudo reg number.
  493. They give nonzero only if REGNO is a hard reg of the suitable class
  494. or a pseudo reg currently allocated to a suitable hard reg.
  495. Since they use reg_renumber, they are safe only once reg_renumber
  496. has been allocated, which happens in local-alloc.c. */
  497. #define REGNO_OK_FOR_INDEX_P(REGNO) \
  498. ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
  499. #define REGNO_OK_FOR_BASE_P(REGNO) \
  500. (((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
  501. #define REGNO_OK_FOR_DATA_P(REGNO) \
  502. ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
  503. #define REGNO_OK_FOR_FP_P(REGNO) \
  504. (((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
  505. /* Now macros that check whether X is a register and also,
  506. strictly, whether it is in a specified class.
  507. These macros are specific to the 68000, and may be used only
  508. in code for printing assembler insns and in conditions for
  509. define_optimization. */
  510. /* 1 if X is a data register. */
  511. #define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
  512. /* 1 if X is an fp register. */
  513. #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
  514. /* 1 if X is an address register */
  515. #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
  516. /* Maximum number of registers that can appear in a valid memory address. */
  517. #define MAX_REGS_PER_ADDRESS 2
  518. /* Recognize any constant value that is a valid address. */
  519. #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
  520. /* Nonzero if the constant value X is a legitimate general operand.
  521. It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
  522. #define LEGITIMATE_CONSTANT_P(X) 1
  523. /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  524. and check its validity for a certain class.
  525. We have two alternate definitions for each of them.
  526. The usual definition accepts all pseudo regs; the other rejects
  527. them unless they have been allocated suitable hard regs.
  528. The symbol REG_OK_STRICT causes the latter definition to be used.
  529. Most source files want to accept pseudo regs in the hope that
  530. they will get allocated to the class that the insn wants them to be in.
  531. Source files for reload pass need to be strict.
  532. After reload, it makes no difference, since pseudo regs have
  533. been eliminated by then. */
  534. #ifndef REG_OK_STRICT
  535. /* Nonzero if X is a hard reg that can be used as an index
  536. or if it is a pseudo reg. */
  537. #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
  538. /* Nonzero if X is a hard reg that can be used as a base reg
  539. or if it is a pseudo reg. */
  540. #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
  541. #else
  542. /* Nonzero if X is a hard reg that can be used as an index. */
  543. #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
  544. /* Nonzero if X is a hard reg that can be used as a base reg. */
  545. #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  546. #endif
  547. /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  548. that is a valid memory address for an instruction.
  549. The MODE argument is the machine mode for the MEM expression
  550. that wants to use this address.
  551. The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
  552. #define INDIRECTABLE_1_ADDRESS_P(X) \
  553. (CONSTANT_ADDRESS_P (X) \
  554. || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
  555. || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
  556. && REG_P (XEXP (X, 0)) \
  557. && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
  558. || (GET_CODE (X) == PLUS \
  559. && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
  560. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  561. && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))
  562. #if 0
  563. /* This should replace the last two lines
  564. except that Sun's assembler does not seem to handle such operands. */
  565. && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1)) \
  566. : (GET_CODE (XEXP (X, 1)) == CONST_INT \
  567. && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))))
  568. #endif
  569. #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
  570. { if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
  571. #define GO_IF_INDEXABLE_BASE(X, ADDR) \
  572. { if (GET_CODE (X) == LABEL_REF) goto ADDR; \
  573. if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; }
  574. #define GO_IF_INDEXING(X, ADDR) \
  575. { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
  576. { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \
  577. if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
  578. { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
  579. #define GO_IF_INDEXED_ADDRESS(X, ADDR) \
  580. { GO_IF_INDEXING (X, ADDR); \
  581. if (GET_CODE (X) == PLUS) \
  582. { if (GET_CODE (XEXP (X, 1)) == CONST_INT \
  583. && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100) \
  584. { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); } \
  585. if (GET_CODE (XEXP (X, 0)) == CONST_INT \
  586. && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100) \
  587. { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
  588. #define LEGITIMATE_INDEX_REG_P(X) \
  589. ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
  590. || (GET_CODE (X) == SIGN_EXTEND \
  591. && GET_CODE (XEXP (X, 0)) == REG \
  592. && GET_MODE (XEXP (X, 0)) == HImode \
  593. && REG_OK_FOR_INDEX_P (XEXP (X, 0))))
  594. #define LEGITIMATE_INDEX_P(X) \
  595. (LEGITIMATE_INDEX_REG_P (X) \
  596. || (TARGET_68020 && GET_CODE (X) == MULT \
  597. && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \
  598. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  599. && (INTVAL (XEXP (X, 1)) == 2 \
  600. || INTVAL (XEXP (X, 1)) == 4 \
  601. || INTVAL (XEXP (X, 1)) == 8)))
  602. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
  603. { GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
  604. GO_IF_INDEXED_ADDRESS (X, ADDR); }
  605. /* Try machine-dependent ways of modifying an illegitimate address
  606. to be legitimate. If we find one, return the new, valid address.
  607. This macro is used in only one place: `memory_address' in explow.c.
  608. OLDX is the address as it was before break_out_memory_refs was called.
  609. In some cases it is useful to look at this to decide what needs to be done.
  610. MODE and WIN are passed so that this macro can use
  611. GO_IF_LEGITIMATE_ADDRESS.
  612. It is always safe for this macro to do nothing. It exists to recognize
  613. opportunities to optimize the output.
  614. For the 68000, we handle X+REG by loading X into a register R and
  615. using R+REG. R will go in an address reg and indexing will be used.
  616. However, if REG is a broken-out memory address or multiplication,
  617. nothing needs to be done because REG can certainly go in an address reg. */
  618. #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
  619. { register int ch = (X) != (OLDX); \
  620. if (GET_CODE (X) == PLUS) \
  621. { if (GET_CODE (XEXP (X, 0)) == MULT) \
  622. ch = 1, XEXP (X, 0) = force_operand (XEXP (X, 0), 0); \
  623. if (GET_CODE (XEXP (X, 1)) == MULT) \
  624. ch = 1, XEXP (X, 1) = force_operand (XEXP (X, 1), 0); \
  625. if (ch && GET_CODE (XEXP (X, 1)) == REG \
  626. && GET_CODE (XEXP (X, 0)) == REG) \
  627. return X; \
  628. if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
  629. if (GET_CODE (XEXP (X, 0)) == REG \
  630. || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
  631. && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
  632. && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
  633. { register rtx temp = gen_reg_rtx (Pmode); \
  634. register rtx val = force_operand (XEXP (X, 1), temp); \
  635. if (val != temp) emit_move_insn (temp, val); \
  636. XEXP (X, 1) = temp; \
  637. return X; } \
  638. else if (GET_CODE (XEXP (X, 1)) == REG \
  639. || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
  640. && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
  641. && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
  642. { register rtx temp = gen_reg_rtx (Pmode); \
  643. register rtx val = force_operand (XEXP (X, 0), temp); \
  644. if (val != temp) emit_move_insn (temp, val); \
  645. XEXP (X, 0) = temp; \
  646. return X; }}}
  647. /* Go to LABEL if ADDR (a legitimate address expression)
  648. has an effect that depends on the machine mode it is used for.
  649. On the 68000, only predecrement and postincrement address depend thus
  650. (the amount of decrement or increment being the length of the operand). */
  651. #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
  652. if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
  653. /* Specify the machine mode that this machine uses
  654. for the index in the tablejump instruction. */
  655. #define CASE_VECTOR_MODE HImode
  656. /* Define this if the tablejump instruction expects the table
  657. to contain offsets from the address of the table.
  658. Do not define this if the table should contain absolute addresses. */
  659. #define CASE_VECTOR_PC_RELATIVE
  660. /* Specify the tree operation to be used to convert reals to integers. */
  661. #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
  662. /* This is the kind of divide that is easiest to do in the general case. */
  663. #define EASY_DIV_EXPR TRUNC_DIV_EXPR
  664. /* Define this as 1 if `char' should by default be signed; else as 0. */
  665. #define DEFAULT_SIGNED_CHAR 1
  666. /* Max number of bytes we can move from memory to memory
  667. in one reasonably fast instruction. */
  668. #define MOVE_MAX 4
  669. /* Define this if zero-extension is slow (more than one real instruction). */
  670. #define SLOW_ZERO_EXTEND
  671. /* Nonzero if access to memory by bytes is slow and undesirable. */
  672. #define SLOW_BYTE_ACCESS 0
  673. /* Define if shifts truncate the shift count
  674. which implies one can omit a sign-extension or zero-extension
  675. of a shift count. */
  676. #define SHIFT_COUNT_TRUNCATED
  677. /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  678. is done just by pretending it is already truncated. */
  679. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  680. /* We assume that the store-condition-codes instructions store 0 for false
  681. and some other value for true. This is the value stored for true. */
  682. #define STORE_FLAG_VALUE -1
  683. /* Specify the machine mode that pointers have.
  684. After generation of rtl, the compiler makes no further distinction
  685. between pointers and any other objects of this machine mode. */
  686. #define Pmode SImode
  687. /* A function address in a call instruction
  688. is a byte address (for indexing purposes)
  689. so give the MEM rtx a byte's mode. */
  690. #define FUNCTION_MODE QImode
  691. /* Compute the cost of computing a constant rtl expression RTX
  692. whose rtx-code is CODE. The body of this macro is a portion
  693. of a switch statement. If the code is computed here,
  694. return it with a return statement. Otherwise, break from the switch. */
  695. #define CONST_COSTS(RTX,CODE) \
  696. case CONST_INT: \
  697. /* Constant zero is super cheap due to clr instruction. */ \
  698. if (RTX == const0_rtx) return 0; \
  699. if ((unsigned) INTVAL (RTX) < 077) return 1; \
  700. case CONST: \
  701. case LABEL_REF: \
  702. case SYMBOL_REF: \
  703. return 3; \
  704. case CONST_DOUBLE: \
  705. return 5;
  706. /* Tell final.c how to eliminate redundant test instructions. */
  707. /* Here we define machine-dependent flags and fields in cc_status
  708. (see `conditions.h'). */
  709. /* Set if the cc value is actually in the 68881, so a floating point
  710. conditional branch must be output. */
  711. #define CC_IN_68881 040
  712. /* Store in cc_status the expressions
  713. that the condition codes will describe
  714. after execution of an instruction whose pattern is EXP.
  715. Do not alter them if the instruction would not alter the cc's. */
  716. /* On the 68000, all the insns to store in an address register
  717. fail to set the cc's. However, in some cases these instructions
  718. can make it possibly invalid to use the saved cc's. In those
  719. cases we clear out some or all of the saved cc's so they won't be used. */
  720. #define NOTICE_UPDATE_CC(EXP) \
  721. { if (GET_CODE (EXP) == SET) \
  722. { if (ADDRESS_REG_P (XEXP (EXP, 0))) \
  723. { if (cc_status.value1 \
  724. && reg_mentioned_p (XEXP (EXP, 0), cc_status.value1)) \
  725. cc_status.value1 = 0; \
  726. if (cc_status.value2 \
  727. && reg_mentioned_p (XEXP (EXP, 0), cc_status.value2)) \
  728. cc_status.value2 = 0; } \
  729. else if (!FP_REG_P (XEXP (EXP, 0)) \
  730. && XEXP (EXP, 0) != cc0_rtx \
  731. && (FP_REG_P (XEXP (EXP, 1)) \
  732. || GET_CODE (XEXP (EXP, 1)) == FIX \
  733. || GET_CODE (XEXP (EXP, 1)) == FLOAT_TRUNCATE \
  734. || GET_CODE (XEXP (EXP, 1)) == FLOAT_EXTEND)) \
  735. { CC_STATUS_INIT; } \
  736. else if (GET_CODE (SET_SRC (EXP)) == CALL) \
  737. { CC_STATUS_INIT; } \
  738. else if (XEXP (EXP, 0) != pc_rtx) \
  739. { cc_status.flags = 0; \
  740. cc_status.value1 = XEXP (EXP, 0); \
  741. cc_status.value2 = XEXP (EXP, 1); } } \
  742. else if (GET_CODE (EXP) == PARALLEL \
  743. && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
  744. { if (ADDRESS_REG_P (XEXP (XVECEXP (EXP, 0, 0), 0))) \
  745. CC_STATUS_INIT; \
  746. else if (XEXP (XVECEXP (EXP, 0, 0), 0) != pc_rtx) \
  747. { cc_status.flags = 0; \
  748. cc_status.value1 = XEXP (XVECEXP (EXP, 0, 0), 0); \
  749. cc_status.value2 = XEXP (XVECEXP (EXP, 0, 0), 1); } } \
  750. else CC_STATUS_INIT; \
  751. if (cc_status.value2 != 0 \
  752. && ADDRESS_REG_P (cc_status.value2) \
  753. && GET_MODE (cc_status.value2) == QImode) \
  754. CC_STATUS_INIT; \
  755. if (cc_status.value2 != 0) \
  756. switch (GET_CODE (cc_status.value2)) \
  757. { case PLUS: case MINUS: case MULT: case UMULT: \
  758. case DIV: case UDIV: case MOD: case UMOD: case NEG: \
  759. case ASHIFT: case LSHIFT: case ASHIFTRT: case LSHIFTRT: \
  760. case ROTATE: case ROTATERT: \
  761. if (GET_MODE (cc_status.value2) != VOIDmode) \
  762. cc_status.flags |= CC_NO_OVERFLOW; \
  763. break; \
  764. case ZERO_EXTEND: \
  765. /* (SET r1 (ZERO_EXTEND r2)) on this machine
  766. ends with a move insn moving r2 in r2's mode.
  767. Thus, the cc's are set for r2.
  768. This can set N bit spuriously. */ \
  769. cc_status.flags |= CC_NOT_NEGATIVE; } \
  770. if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
  771. && cc_status.value2 \
  772. && reg_mentioned_p (cc_status.value1, cc_status.value2)) \
  773. cc_status.value2 = 0; \
  774. if ((cc_status.value1 && FP_REG_P (cc_status.value1)) \
  775. || (cc_status.value2 && FP_REG_P (cc_status.value2))) \
  776. cc_status.flags = CC_IN_68881; }
  777. #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
  778. { if (cc_prev_status.flags & CC_IN_68881) \
  779. return FLOAT; \
  780. if (cc_prev_status.flags & CC_NO_OVERFLOW) \
  781. return NO_OV; \
  782. return NORMAL; }
  783. /* Control the assembler format that we output. */
  784. /* Output at beginning of assembler file. */
  785. #define ASM_FILE_START "#NO_APP\n"
  786. /* Output to assembler file text saying following lines
  787. may contain character constants, extra white space, comments, etc. */
  788. #define ASM_APP_ON "#APP\n"
  789. /* Output to assembler file text saying following lines
  790. no longer contain unusual constructs. */
  791. #define ASM_APP_OFF "#NO_APP\n"
  792. /* Output before read-only data. */
  793. #define TEXT_SECTION_ASM_OP ".text"
  794. /* Output before writable data. */
  795. #define DATA_SECTION_ASM_OP ".data"
  796. /* How to refer to registers in assembler output.
  797. This sequence is indexed by compiler's hard-register-number (see above). */
  798. #define REGISTER_NAMES \
  799. {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
  800. "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
  801. "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7"}
  802. /* How to renumber registers for dbx and gdb.
  803. On the Sun-3, the floating point registers have numbers
  804. 18 to 25, not 16 to 23 as they do in the compiler. */
  805. #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
  806. /* This is how to output the definition of a user-level label named NAME,
  807. such as the label on a static function or variable NAME. */
  808. #define ASM_OUTPUT_LABEL(FILE,NAME) \
  809. do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
  810. /* This is how to output a command to make the user-level label named NAME
  811. defined for reference from other files. */
  812. #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
  813. do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
  814. /* This is how to output a reference to a user-level label named NAME.
  815. `assemble_name' uses this. */
  816. #define ASM_OUTPUT_LABELREF(FILE,NAME) \
  817. fprintf (FILE, "_%s", NAME)
  818. /* This is how to output an internal numbered label where
  819. PREFIX is the class of label and NUM is the number within the class. */
  820. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
  821. fprintf (FILE, "%s%d:\n", PREFIX, NUM)
  822. /* This is how to store into the string LABEL
  823. the symbol_ref name of an internal numbered label where
  824. PREFIX is the class of label and NUM is the number within the class.
  825. This is suitable for output with `assemble_name'. */
  826. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
  827. sprintf (LABEL, "*%s%d", PREFIX, NUM)
  828. /* This is how to output an assembler line defining a `double' constant. */
  829. #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
  830. fprintf (FILE, "\t.double 0r%.20g\n", (VALUE))
  831. /* This is how to output an assembler line defining a `float' constant. */
  832. #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
  833. do { union { float f; long l;} tem; \
  834. tem.f = (VALUE); \
  835. fprintf (FILE, "\t.long 0x%x\n", tem.l); \
  836. } while (0)
  837. /* This is how to output an assembler line defining an `int' constant. */
  838. #define ASM_OUTPUT_INT(FILE,VALUE) \
  839. ( fprintf (FILE, "\t.long "), \
  840. output_addr_const (FILE, (VALUE)), \
  841. fprintf (FILE, "\n"))
  842. /* Likewise for `char' and `short' constants. */
  843. #define ASM_OUTPUT_SHORT(FILE,VALUE) \
  844. ( fprintf (FILE, "\t.word "), \
  845. output_addr_const (FILE, (VALUE)), \
  846. fprintf (FILE, "\n"))
  847. #define ASM_OUTPUT_CHAR(FILE,VALUE) \
  848. ( fprintf (FILE, "\t.byte "), \
  849. output_addr_const (FILE, (VALUE)), \
  850. fprintf (FILE, "\n"))
  851. /* This is how to output an assembler line for a numeric constant byte. */
  852. #define ASM_OUTPUT_BYTE(FILE,VALUE) \
  853. fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
  854. /* This is how to output an element of a case-vector that is absolute.
  855. (The 68000 does not use such vectors,
  856. but we must define this macro anyway.) */
  857. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
  858. fprintf (FILE, "\t.long L%d\n", VALUE)
  859. /* This is how to output an element of a case-vector that is relative. */
  860. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
  861. fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
  862. /* This is how to output an assembler line
  863. that says to advance the location counter
  864. to a multiple of 2**LOG bytes. */
  865. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  866. if ((LOG) == 1) \
  867. fprintf (FILE, "\t.even\n"); \
  868. else if ((LOG) != 0) \
  869. abort ();
  870. #define ASM_OUTPUT_SKIP(FILE,SIZE) \
  871. fprintf (FILE, "\t.skip %d\n", (SIZE))
  872. /* This says how to output an assembler line
  873. to define a global common symbol. */
  874. #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE) \
  875. ( fputs (".comm ", (FILE)), \
  876. assemble_name ((FILE), (NAME)), \
  877. fprintf ((FILE), ",%d\n", (SIZE)))
  878. /* This says how to output an assembler line
  879. to define a local common symbol. */
  880. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE) \
  881. ( fputs (".lcomm ", (FILE)), \
  882. assemble_name ((FILE), (NAME)), \
  883. fprintf ((FILE), ",%d\n", (SIZE)))
  884. /* Store in OUTPUT a string (made with alloca) containing
  885. an assembler-name for a local static variable named NAME.
  886. LABELNO is an integer which is different for each call. */
  887. #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
  888. ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
  889. sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
  890. /* Define the parentheses used to group arithmetic operations
  891. in assembler code. */
  892. #define ASM_OPEN_PAREN "("
  893. #define ASM_CLOSE_PAREN ")"
  894. /* Define results of standard character escape sequences. */
  895. #define TARGET_BELL 007
  896. #define TARGET_BS 010
  897. #define TARGET_TAB 011
  898. #define TARGET_NEWLINE 012
  899. #define TARGET_VT 013
  900. #define TARGET_FF 014
  901. #define TARGET_CR 015
  902. /* Print operand X (an rtx) in assembler syntax to file FILE.
  903. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
  904. For `%' followed by punctuation, CODE is the punctuation and X is null.
  905. On the 68000, we use several CODE characters:
  906. 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
  907. 'b' for byte insn (no effect, on the Sun; this is for the ISI).
  908. '.' for dot needed in Motorola-style opcode names.
  909. '-' for an operand pushing on the stack:
  910. sp@-, -(sp) or -(%sp) depending on the style of syntax.
  911. '+' for an operand pushing on the stack:
  912. sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
  913. 's' for a reference to the top word on the stack:
  914. sp@, (sp) or (%sp) depending on the style of syntax.
  915. '#' for an immediate operand prefix (# in MIT and Motorola syntax
  916. but & in SGS syntax).
  917. '!' for the cc register (used in an `and to cc' insn). */
  918. #define PRINT_OPERAND(FILE, X, CODE) \
  919. { if (CODE == '.') ; \
  920. else if (CODE == '#') fprintf (FILE, "#"); \
  921. else if (CODE == '-') fprintf (FILE, "sp@-"); \
  922. else if (CODE == '+') fprintf (FILE, "sp@+"); \
  923. else if (CODE == 's') fprintf (FILE, "sp@"); \
  924. else if (CODE == '!') fprintf (FILE, "cc"); \
  925. else if (GET_CODE (X) == REG) \
  926. fprintf (FILE, "%s", reg_name [REGNO (X)]); \
  927. else if (GET_CODE (X) == MEM) \
  928. output_address (XEXP (X, 0)); \
  929. else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
  930. { union { double d; int i[2]; } u; \
  931. union { float f; int i; } u1; \
  932. u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
  933. u1.f = u.d; \
  934. if (CODE == 'f') \
  935. fprintf (FILE, "#0r%.9g", u1.f); \
  936. else \
  937. fprintf (FILE, "#0x%x", u1.i); } \
  938. else if (GET_CODE (X) == CONST_DOUBLE) \
  939. { union { double d; int i[2]; } u; \
  940. u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
  941. fprintf (FILE, "#0r%.20g", u.d); } \
  942. else { putc ('#', FILE); output_addr_const (FILE, X); }}
  943. /* Note that this contains a kludge that knows that the only reason
  944. we have an address (plus (label_ref...) (reg...))
  945. is in the insn before a tablejump, and we know that m68k.md
  946. generates a label LInnn: on such an insn. */
  947. #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
  948. { register rtx reg1, reg2, breg, ireg; \
  949. register rtx addr = ADDR; \
  950. rtx offset; \
  951. switch (GET_CODE (addr)) \
  952. { \
  953. case REG: \
  954. fprintf (FILE, "%s@", reg_name [REGNO (addr)]); \
  955. break; \
  956. case PRE_DEC: \
  957. fprintf (FILE, "%s@-", reg_name [REGNO (XEXP (addr, 0))]); \
  958. break; \
  959. case POST_INC: \
  960. fprintf (FILE, "%s@+", reg_name [REGNO (XEXP (addr, 0))]); \
  961. break; \
  962. case PLUS: \
  963. reg1 = 0; reg2 = 0; \
  964. ireg = 0; breg = 0; \
  965. offset = 0; \
  966. if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
  967. { \
  968. offset = XEXP (addr, 0); \
  969. addr = XEXP (addr, 1); \
  970. } \
  971. else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
  972. { \
  973. offset = XEXP (addr, 1); \
  974. addr = XEXP (addr, 0); \
  975. } \
  976. if (GET_CODE (addr) != PLUS) ; \
  977. else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
  978. { \
  979. reg1 = XEXP (addr, 0); \
  980. addr = XEXP (addr, 1); \
  981. } \
  982. else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
  983. { \
  984. reg1 = XEXP (addr, 1); \
  985. addr = XEXP (addr, 0); \
  986. } \
  987. else if (GET_CODE (XEXP (addr, 0)) == MULT) \
  988. { \
  989. reg1 = XEXP (addr, 0); \
  990. addr = XEXP (addr, 1); \
  991. } \
  992. else if (GET_CODE (XEXP (addr, 1)) == MULT) \
  993. { \
  994. reg1 = XEXP (addr, 1); \
  995. addr = XEXP (addr, 0); \
  996. } \
  997. else if (GET_CODE (XEXP (addr, 0)) == REG) \
  998. { \
  999. reg1 = XEXP (addr, 0); \
  1000. addr = XEXP (addr, 1); \
  1001. } \
  1002. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  1003. { \
  1004. reg1 = XEXP (addr, 1); \
  1005. addr = XEXP (addr, 0); \
  1006. } \
  1007. if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
  1008. || GET_CODE (addr) == SIGN_EXTEND) \
  1009. { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
  1010. /* for OLD_INDEXING \
  1011. else if (GET_CODE (addr) == PLUS) \
  1012. { \
  1013. if (GET_CODE (XEXP (addr, 0)) == REG) \
  1014. { \
  1015. reg2 = XEXP (addr, 0); \
  1016. addr = XEXP (addr, 1); \
  1017. } \
  1018. else if (GET_CODE (XEXP (addr, 1)) == REG) \
  1019. { \
  1020. reg2 = XEXP (addr, 1); \
  1021. addr = XEXP (addr, 0); \
  1022. } \
  1023. } \
  1024. */ \
  1025. if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
  1026. if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
  1027. || GET_CODE (reg1) == MULT)) \
  1028. || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
  1029. { breg = reg2; ireg = reg1; } \
  1030. else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
  1031. { breg = reg1; ireg = reg2; } \
  1032. if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
  1033. { int scale = 1; \
  1034. if (GET_CODE (ireg) == MULT) \
  1035. { scale = INTVAL (XEXP (ireg, 1)); \
  1036. ireg = XEXP (ireg, 0); } \
  1037. if (GET_CODE (ireg) == SIGN_EXTEND) \
  1038. fprintf (FILE, "pc@(L%d-LI%d-2:b,%s:w", \
  1039. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  1040. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  1041. reg_name[REGNO (XEXP (ireg, 0))]); \
  1042. else \
  1043. fprintf (FILE, "pc@(L%d-LI%d-2:b,%s:l", \
  1044. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  1045. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  1046. reg_name[REGNO (ireg)]); \
  1047. if (scale != 1) fprintf (FILE, ":%d", scale); \
  1048. putc (')', FILE); \
  1049. break; } \
  1050. if (ireg != 0 || breg != 0) \
  1051. { int scale = 1; \
  1052. if (breg == 0) \
  1053. abort (); \
  1054. fprintf (FILE, "%s@(", reg_name[REGNO (breg)]); \
  1055. if (addr != 0) \
  1056. output_addr_const (FILE, addr); \
  1057. if (addr != 0 && ireg != 0) \
  1058. putc (',', FILE); \
  1059. if (ireg != 0 && GET_CODE (ireg) == MULT) \
  1060. { scale = INTVAL (XEXP (ireg, 1)); \
  1061. ireg = XEXP (ireg, 0); } \
  1062. if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
  1063. fprintf (FILE, "%s:w", reg_name[REGNO (XEXP (ireg, 0))]); \
  1064. else if (ireg != 0) \
  1065. fprintf (FILE, "%s:l", reg_name[REGNO (ireg)]); \
  1066. if (scale != 1) fprintf (FILE, ":%d", scale); \
  1067. putc (')', FILE); \
  1068. break; \
  1069. } \
  1070. else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
  1071. { fprintf (FILE, "pc@(L%d-LI%d-2:b,%s:l)", \
  1072. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  1073. CODE_LABEL_NUMBER (XEXP (addr, 0)), \
  1074. reg_name[REGNO (reg1)]); \
  1075. break; } \
  1076. default: \
  1077. if (GET_CODE (addr) == CONST_INT \
  1078. && INTVAL (addr) < 0x8000 \
  1079. && INTVAL (addr) >= -0x8000) \
  1080. fprintf (FILE, "%d:w", INTVAL (addr)); \
  1081. else \
  1082. output_addr_const (FILE, addr); \
  1083. }}
  1084. /*
  1085. Local variables:
  1086. version-control: t
  1087. End:
  1088. */