fr30.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  1. /*{{{ Comment. */
  2. /* Definitions of FR30 target.
  3. Copyright (C) 1998-2015 Free Software Foundation, Inc.
  4. Contributed by Cygnus Solutions.
  5. This file is part of GCC.
  6. GCC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3, or (at your option)
  9. any later version.
  10. GCC is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with GCC; see the file COPYING3. If not see
  16. <http://www.gnu.org/licenses/>. */
  17. /*}}}*/
  18. /*{{{ Run-time target specifications. */
  19. #undef ASM_SPEC
  20. #define ASM_SPEC ""
  21. /* Define this to be a string constant containing `-D' options to define the
  22. predefined macros that identify this machine and system. These macros will
  23. be predefined unless the `-ansi' option is specified. */
  24. #define TARGET_CPU_CPP_BUILTINS() \
  25. do \
  26. { \
  27. builtin_define_std ("fr30"); \
  28. builtin_assert ("machine=fr30"); \
  29. } \
  30. while (0)
  31. #undef STARTFILE_SPEC
  32. #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
  33. /* Include the OS stub library, so that the code can be simulated.
  34. This is not the right way to do this. Ideally this kind of thing
  35. should be done in the linker script - but I have not worked out how
  36. to specify the location of a linker script in a gcc command line yet... */
  37. #undef ENDFILE_SPEC
  38. #define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
  39. #undef LIB_SPEC
  40. #define LIB_SPEC "-lc"
  41. #undef LINK_SPEC
  42. #define LINK_SPEC "%{h*} %{v:-V} \
  43. %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}"
  44. /*}}}*/
  45. /*{{{ Storage Layout. */
  46. #define BITS_BIG_ENDIAN 1
  47. #define BYTES_BIG_ENDIAN 1
  48. #define WORDS_BIG_ENDIAN 1
  49. #define UNITS_PER_WORD 4
  50. #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
  51. do \
  52. { \
  53. if (GET_MODE_CLASS (MODE) == MODE_INT \
  54. && GET_MODE_SIZE (MODE) < 4) \
  55. (MODE) = SImode; \
  56. } \
  57. while (0)
  58. #define PARM_BOUNDARY 32
  59. #define STACK_BOUNDARY 32
  60. #define FUNCTION_BOUNDARY 32
  61. #define BIGGEST_ALIGNMENT 32
  62. #define DATA_ALIGNMENT(TYPE, ALIGN) \
  63. (TREE_CODE (TYPE) == ARRAY_TYPE \
  64. && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
  65. && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
  66. #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
  67. (TREE_CODE (EXP) == STRING_CST \
  68. && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
  69. #define STRICT_ALIGNMENT 1
  70. #define PCC_BITFIELD_TYPE_MATTERS 1
  71. /*}}}*/
  72. /*{{{ Layout of Source Language Data Types. */
  73. #define SHORT_TYPE_SIZE 16
  74. #define INT_TYPE_SIZE 32
  75. #define LONG_TYPE_SIZE 32
  76. #define LONG_LONG_TYPE_SIZE 64
  77. #define FLOAT_TYPE_SIZE 32
  78. #define DOUBLE_TYPE_SIZE 64
  79. #define LONG_DOUBLE_TYPE_SIZE 64
  80. #define DEFAULT_SIGNED_CHAR 1
  81. #undef SIZE_TYPE
  82. #define SIZE_TYPE "unsigned int"
  83. #undef PTRDIFF_TYPE
  84. #define PTRDIFF_TYPE "int"
  85. #undef WCHAR_TYPE
  86. #define WCHAR_TYPE "long int"
  87. #undef WCHAR_TYPE_SIZE
  88. #define WCHAR_TYPE_SIZE BITS_PER_WORD
  89. /*}}}*/
  90. /*{{{ REGISTER BASICS. */
  91. /* Number of hardware registers known to the compiler. They receive numbers 0
  92. through `FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo register's number
  93. really is assigned the number `FIRST_PSEUDO_REGISTER'. */
  94. #define FIRST_PSEUDO_REGISTER 21
  95. /* Fixed register assignments: */
  96. /* Here we do a BAD THING - reserve a register for use by the machine
  97. description file. There are too many places in compiler where it
  98. assumes that it can issue a branch or jump instruction without
  99. providing a scratch register for it, and reload just cannot cope, so
  100. we keep a register back for these situations. */
  101. #define COMPILER_SCRATCH_REGISTER 0
  102. /* The register that contains the result of a function call. */
  103. #define RETURN_VALUE_REGNUM 4
  104. /* The first register that can contain the arguments to a function. */
  105. #define FIRST_ARG_REGNUM 4
  106. /* A call-used register that can be used during the function prologue. */
  107. #define PROLOGUE_TMP_REGNUM COMPILER_SCRATCH_REGISTER
  108. /* Register numbers used for passing a function's static chain pointer. If
  109. register windows are used, the register number as seen by the called
  110. function is `STATIC_CHAIN_INCOMING_REGNUM', while the register number as
  111. seen by the calling function is `STATIC_CHAIN_REGNUM'. If these registers
  112. are the same, `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
  113. The static chain register need not be a fixed register.
  114. If the static chain is passed in memory, these macros should not be defined;
  115. instead, the next two macros should be defined. */
  116. #define STATIC_CHAIN_REGNUM 12
  117. /* #define STATIC_CHAIN_INCOMING_REGNUM */
  118. /* An FR30 specific hardware register. */
  119. #define ACCUMULATOR_REGNUM 13
  120. /* The register number of the frame pointer register, which is used to access
  121. automatic variables in the stack frame. On some machines, the hardware
  122. determines which register this is. On other machines, you can choose any
  123. register you wish for this purpose. */
  124. #define FRAME_POINTER_REGNUM 14
  125. /* The register number of the stack pointer register, which must also be a
  126. fixed register according to `FIXED_REGISTERS'. On most machines, the
  127. hardware determines which register this is. */
  128. #define STACK_POINTER_REGNUM 15
  129. /* The following a fake hard registers that describe some of the dedicated
  130. registers on the FR30. */
  131. #define CONDITION_CODE_REGNUM 16
  132. #define RETURN_POINTER_REGNUM 17
  133. #define MD_HIGH_REGNUM 18
  134. #define MD_LOW_REGNUM 19
  135. /* An initializer that says which registers are used for fixed purposes all
  136. throughout the compiled code and are therefore not available for general
  137. allocation. These would include the stack pointer, the frame pointer
  138. (except on machines where that can be used as a general register when no
  139. frame pointer is needed), the program counter on machines where that is
  140. considered one of the addressable registers, and any other numbered register
  141. with a standard use.
  142. This information is expressed as a sequence of numbers, separated by commas
  143. and surrounded by braces. The Nth number is 1 if register N is fixed, 0
  144. otherwise.
  145. The table initialized from this macro, and the table initialized by the
  146. following one, may be overridden at run time either automatically, by the
  147. actions of the macro `TARGET_CONDITIONAL_REGISTER_USAGE', or by the user
  148. with the command options `-ffixed-REG', `-fcall-used-REG' and
  149. `-fcall-saved-REG'. */
  150. #define FIXED_REGISTERS \
  151. { 1, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */ \
  152. 0, 0, 0, 0, 0, 0, 0, 1, /* 8 - 15 */ \
  153. 1, 1, 1, 1, 1 } /* 16 - 20 */
  154. /* XXX - MDL and MDH set as fixed for now - this is until I can get the
  155. mul patterns working. */
  156. /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
  157. general) by function calls as well as for fixed registers. This macro
  158. therefore identifies the registers that are not available for general
  159. allocation of values that must live across function calls.
  160. If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically
  161. saves it on function entry and restores it on function exit, if the register
  162. is used within the function. */
  163. #define CALL_USED_REGISTERS \
  164. { 1, 1, 1, 1, 1, 1, 1, 1, /* 0 - 7 */ \
  165. 0, 0, 0, 0, 1, 1, 0, 1, /* 8 - 15 */ \
  166. 1, 1, 1, 1, 1 } /* 16 - 20 */
  167. /* A C initializer containing the assembler's names for the machine registers,
  168. each one as a C string constant. This is what translates register numbers
  169. in the compiler into assembler language. */
  170. #define REGISTER_NAMES \
  171. { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
  172. "r8", "r9", "r10", "r11", "r12", "ac", "fp", "sp", \
  173. "cc", "rp", "mdh", "mdl", "ap" \
  174. }
  175. /* If defined, a C initializer for an array of structures containing a name and
  176. a register number. This macro defines additional names for hard registers,
  177. thus allowing the `asm' option in declarations to refer to registers using
  178. alternate names. */
  179. #define ADDITIONAL_REGISTER_NAMES \
  180. { \
  181. {"r13", 13}, {"r14", 14}, {"r15", 15}, {"usp", 15}, {"ps", 16}\
  182. }
  183. /*}}}*/
  184. /*{{{ How Values Fit in Registers. */
  185. /* A C expression for the number of consecutive hard registers, starting at
  186. register number REGNO, required to hold a value of mode MODE. */
  187. #define HARD_REGNO_NREGS(REGNO, MODE) \
  188. ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  189. /* A C expression that is nonzero if it is permissible to store a value of mode
  190. MODE in hard register number REGNO (or in several registers starting with
  191. that one). */
  192. #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
  193. /* A C expression that is nonzero if it is desirable to choose register
  194. allocation so as to avoid move instructions between a value of mode MODE1
  195. and a value of mode MODE2.
  196. If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
  197. ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
  198. zero. */
  199. #define MODES_TIEABLE_P(MODE1, MODE2) 1
  200. /*}}}*/
  201. /*{{{ Register Classes. */
  202. /* An enumeral type that must be defined with all the register class names as
  203. enumeral values. `NO_REGS' must be first. `ALL_REGS' must be the last
  204. register class, followed by one more enumeral value, `LIM_REG_CLASSES',
  205. which is not a register class but rather tells how many classes there are.
  206. Each register class has a number, which is the value of casting the class
  207. name to type `int'. The number serves as an index in many of the tables
  208. described below. */
  209. enum reg_class
  210. {
  211. NO_REGS,
  212. MULTIPLY_32_REG, /* the MDL register as used by the MULH, MULUH insns */
  213. MULTIPLY_64_REG, /* the MDH,MDL register pair as used by MUL and MULU */
  214. LOW_REGS, /* registers 0 through 7 */
  215. HIGH_REGS, /* registers 8 through 15 */
  216. REAL_REGS, /* i.e. all the general hardware registers on the FR30 */
  217. ALL_REGS,
  218. LIM_REG_CLASSES
  219. };
  220. #define GENERAL_REGS REAL_REGS
  221. #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
  222. /* An initializer containing the names of the register classes as C string
  223. constants. These names are used in writing some of the debugging dumps. */
  224. #define REG_CLASS_NAMES \
  225. { \
  226. "NO_REGS", \
  227. "MULTIPLY_32_REG", \
  228. "MULTIPLY_64_REG", \
  229. "LOW_REGS", \
  230. "HIGH_REGS", \
  231. "REAL_REGS", \
  232. "ALL_REGS" \
  233. }
  234. /* An initializer containing the contents of the register classes, as integers
  235. which are bit masks. The Nth integer specifies the contents of class N.
  236. The way the integer MASK is interpreted is that register R is in the class
  237. if `MASK & (1 << R)' is 1.
  238. When the machine has more than 32 registers, an integer does not suffice.
  239. Then the integers are replaced by sub-initializers, braced groupings
  240. containing several integers. Each sub-initializer must be suitable as an
  241. initializer for the type `HARD_REG_SET' which is defined in
  242. `hard-reg-set.h'. */
  243. #define REG_CLASS_CONTENTS \
  244. { \
  245. { 0 }, \
  246. { 1 << MD_LOW_REGNUM }, \
  247. { (1 << MD_LOW_REGNUM) | (1 << MD_HIGH_REGNUM) }, \
  248. { (1 << 8) - 1 }, \
  249. { ((1 << 8) - 1) << 8 }, \
  250. { (1 << CONDITION_CODE_REGNUM) - 1 }, \
  251. { (1 << FIRST_PSEUDO_REGISTER) - 1 } \
  252. }
  253. /* A C expression whose value is a register class containing hard register
  254. REGNO. In general there is more than one such class; choose a class which
  255. is "minimal", meaning that no smaller class also contains the register. */
  256. #define REGNO_REG_CLASS(REGNO) \
  257. ( (REGNO) < 8 ? LOW_REGS \
  258. : (REGNO) < CONDITION_CODE_REGNUM ? HIGH_REGS \
  259. : (REGNO) == MD_LOW_REGNUM ? MULTIPLY_32_REG \
  260. : (REGNO) == MD_HIGH_REGNUM ? MULTIPLY_64_REG \
  261. : ALL_REGS)
  262. /* A macro whose definition is the name of the class to which a valid base
  263. register must belong. A base register is one used in an address which is
  264. the register value plus a displacement. */
  265. #define BASE_REG_CLASS REAL_REGS
  266. /* A macro whose definition is the name of the class to which a valid index
  267. register must belong. An index register is one used in an address where its
  268. value is either multiplied by a scale factor or added to another register
  269. (as well as added to a displacement). */
  270. #define INDEX_REG_CLASS REAL_REGS
  271. /* A C expression which is nonzero if register number NUM is suitable for use
  272. as a base register in operand addresses. It may be either a suitable hard
  273. register or a pseudo register that has been allocated such a hard register. */
  274. #define REGNO_OK_FOR_BASE_P(NUM) 1
  275. /* A C expression which is nonzero if register number NUM is suitable for use
  276. as an index register in operand addresses. It may be either a suitable hard
  277. register or a pseudo register that has been allocated such a hard register.
  278. The difference between an index register and a base register is that the
  279. index register may be scaled. If an address involves the sum of two
  280. registers, neither one of them scaled, then either one may be labeled the
  281. "base" and the other the "index"; but whichever labeling is used must fit
  282. the machine's constraints of which registers may serve in each capacity.
  283. The compiler will try both labelings, looking for one that is valid, and
  284. will reload one or both registers only if neither labeling works. */
  285. #define REGNO_OK_FOR_INDEX_P(NUM) 1
  286. /* A C expression for the maximum number of consecutive registers of
  287. class CLASS needed to hold a value of mode MODE.
  288. This is closely related to the macro `HARD_REGNO_NREGS'. In fact, the value
  289. of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be the maximum value of
  290. `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class CLASS.
  291. This macro helps control the handling of multiple-word values in
  292. the reload pass. */
  293. #define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS (0, MODE)
  294. /*}}}*/
  295. /*{{{ Basic Stack Layout. */
  296. /* Define this macro if pushing a word onto the stack moves the stack pointer
  297. to a smaller address. */
  298. #define STACK_GROWS_DOWNWARD 1
  299. /* Define this to macro nonzero if the addresses of local variable slots
  300. are at negative offsets from the frame pointer. */
  301. #define FRAME_GROWS_DOWNWARD 1
  302. /* Offset from the frame pointer to the first local variable slot to be
  303. allocated.
  304. If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the
  305. first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by
  306. adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */
  307. /* #define STARTING_FRAME_OFFSET -4 */
  308. #define STARTING_FRAME_OFFSET 0
  309. /* Offset from the stack pointer register to the first location at which
  310. outgoing arguments are placed. If not specified, the default value of zero
  311. is used. This is the proper value for most machines.
  312. If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
  313. location at which outgoing arguments are placed. */
  314. #define STACK_POINTER_OFFSET 0
  315. /* Offset from the argument pointer register to the first argument's address.
  316. On some machines it may depend on the data type of the function.
  317. If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
  318. argument's address. */
  319. #define FIRST_PARM_OFFSET(FUNDECL) 0
  320. /* A C expression whose value is RTL representing the location of the incoming
  321. return address at the beginning of any function, before the prologue. This
  322. RTL is either a `REG', indicating that the return value is saved in `REG',
  323. or a `MEM' representing a location in the stack.
  324. You only need to define this macro if you want to support call frame
  325. debugging information like that provided by DWARF 2. */
  326. #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, RETURN_POINTER_REGNUM)
  327. /*}}}*/
  328. /*{{{ Register That Address the Stack Frame. */
  329. /* The register number of the arg pointer register, which is used to access the
  330. function's argument list. On some machines, this is the same as the frame
  331. pointer register. On some machines, the hardware determines which register
  332. this is. On other machines, you can choose any register you wish for this
  333. purpose. If this is not the same register as the frame pointer register,
  334. then you must mark it as a fixed register according to `FIXED_REGISTERS', or
  335. arrange to be able to eliminate it. */
  336. #define ARG_POINTER_REGNUM 20
  337. /*}}}*/
  338. /*{{{ Eliminating the Frame Pointer and the Arg Pointer. */
  339. /* If defined, this macro specifies a table of register pairs used to eliminate
  340. unneeded registers that point into the stack frame. If it is not defined,
  341. the only elimination attempted by the compiler is to replace references to
  342. the frame pointer with references to the stack pointer.
  343. The definition of this macro is a list of structure initializations, each of
  344. which specifies an original and replacement register.
  345. On some machines, the position of the argument pointer is not known until
  346. the compilation is completed. In such a case, a separate hard register must
  347. be used for the argument pointer. This register can be eliminated by
  348. replacing it with either the frame pointer or the argument pointer,
  349. depending on whether or not the frame pointer has been eliminated.
  350. In this case, you might specify:
  351. #define ELIMINABLE_REGS \
  352. {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  353. {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  354. {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  355. Note that the elimination of the argument pointer with the stack pointer is
  356. specified first since that is the preferred elimination. */
  357. #define ELIMINABLE_REGS \
  358. { \
  359. {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  360. {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  361. {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
  362. }
  363. /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the
  364. initial difference between the specified pair of registers. This macro must
  365. be defined if `ELIMINABLE_REGS' is defined. */
  366. #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
  367. (OFFSET) = fr30_compute_frame_size (FROM, TO)
  368. /*}}}*/
  369. /*{{{ Passing Function Arguments on the Stack. */
  370. /* If defined, the maximum amount of space required for outgoing arguments will
  371. be computed and placed into the variable
  372. `crtl->outgoing_args_size'. No space will be pushed onto the
  373. stack for each call; instead, the function prologue should increase the
  374. stack frame size by this amount.
  375. Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not
  376. proper. */
  377. #define ACCUMULATE_OUTGOING_ARGS 1
  378. /*}}}*/
  379. /*{{{ Function Arguments in Registers. */
  380. /* The number of register assigned to holding function arguments. */
  381. #define FR30_NUM_ARG_REGS 4
  382. /* A C type for declaring a variable that is used as the first argument of
  383. `FUNCTION_ARG' and other related values. For some target machines, the type
  384. `int' suffices and can hold the number of bytes of argument so far.
  385. There is no need to record in `CUMULATIVE_ARGS' anything about the arguments
  386. that have been passed on the stack. The compiler has other variables to
  387. keep track of that. For target machines on which all arguments are passed
  388. on the stack, there is no need to store anything in `CUMULATIVE_ARGS';
  389. however, the data structure must exist and should not be empty, so use
  390. `int'. */
  391. /* On the FR30 this value is an accumulating count of the number of argument
  392. registers that have been filled with argument values, as opposed to say,
  393. the number of bytes of argument accumulated so far. */
  394. #define CUMULATIVE_ARGS int
  395. /* A C statement (sans semicolon) for initializing the variable CUM for the
  396. state at the beginning of the argument list. The variable has type
  397. `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node for the data type
  398. of the function which will receive the args, or 0 if the args are to a
  399. compiler support library function. The value of INDIRECT is nonzero when
  400. processing an indirect call, for example a call through a function pointer.
  401. The value of INDIRECT is zero for a call to an explicitly named function, a
  402. library function call, or when `INIT_CUMULATIVE_ARGS' is used to find
  403. arguments for the function being compiled.
  404. When processing a call to a compiler support library function, LIBNAME
  405. identifies which one. It is a `symbol_ref' rtx which contains the name of
  406. the function, as a string. LIBNAME is 0 when an ordinary C function call is
  407. being processed. Thus, each time this macro is called, either LIBNAME or
  408. FNTYPE is nonzero, but never both of them at once. */
  409. #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
  410. (CUM) = 0
  411. /* A C expression that is nonzero if REGNO is the number of a hard register in
  412. which function arguments are sometimes passed. This does *not* include
  413. implicit arguments such as the static chain and the structure-value address.
  414. On many machines, no registers can be used for this purpose since all
  415. function arguments are pushed on the stack. */
  416. #define FUNCTION_ARG_REGNO_P(REGNO) \
  417. ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) < FIRST_ARG_REGNUM + FR30_NUM_ARG_REGS))
  418. /*}}}*/
  419. /*{{{ How Large Values are Returned. */
  420. /* Define this macro to be 1 if all structure and union return values must be
  421. in memory. Since this results in slower code, this should be defined only
  422. if needed for compatibility with other compilers or with an ABI. If you
  423. define this macro to be 0, then the conventions used for structure and union
  424. return values are decided by the `TARGET_RETURN_IN_MEMORY' macro.
  425. If not defined, this defaults to the value 1. */
  426. #define DEFAULT_PCC_STRUCT_RETURN 1
  427. /*}}}*/
  428. /*{{{ Generating Code for Profiling. */
  429. /* A C statement or compound statement to output to FILE some assembler code to
  430. call the profiling subroutine `mcount'. Before calling, the assembler code
  431. must load the address of a counter variable into a register where `mcount'
  432. expects to find the address. The name of this variable is `LP' followed by
  433. the number LABELNO, so you would generate the name using `LP%d' in a
  434. `fprintf'.
  435. The details of how the address should be passed to `mcount' are determined
  436. by your operating system environment, not by GCC. To figure them out,
  437. compile a small program for profiling using the system's installed C
  438. compiler and look at the assembler code that results. */
  439. #define FUNCTION_PROFILER(FILE, LABELNO) \
  440. { \
  441. fprintf (FILE, "\t mov rp, r1\n" ); \
  442. fprintf (FILE, "\t ldi:32 mcount, r0\n" ); \
  443. fprintf (FILE, "\t call @r0\n" ); \
  444. fprintf (FILE, ".word\tLP%d\n", LABELNO); \
  445. }
  446. /*}}}*/
  447. /*{{{ Trampolines for Nested Functions. */
  448. /* A C expression for the size in bytes of the trampoline, as an integer. */
  449. #define TRAMPOLINE_SIZE 18
  450. /* We want the trampoline to be aligned on a 32bit boundary so that we can
  451. make sure the location of the static chain & target function within
  452. the trampoline is also aligned on a 32bit boundary. */
  453. #define TRAMPOLINE_ALIGNMENT 32
  454. /*}}}*/
  455. /*{{{ Addressing Modes. */
  456. /* A number, the maximum number of registers that can appear in a valid memory
  457. address. Note that it is up to you to specify a value equal to the maximum
  458. number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */
  459. #define MAX_REGS_PER_ADDRESS 1
  460. /* A C compound statement with a conditional `goto LABEL;' executed if X (an
  461. RTX) is a legitimate memory address on the target machine for a memory
  462. operand of mode MODE. */
  463. /* On the FR30 we only have one real addressing mode - an address in a
  464. register. There are three special cases however:
  465. * indexed addressing using small positive offsets from the stack pointer
  466. * indexed addressing using small signed offsets from the frame pointer
  467. * register plus register addressing using R13 as the base register.
  468. At the moment we only support the first two of these special cases. */
  469. #ifdef REG_OK_STRICT
  470. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
  471. do \
  472. { \
  473. if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
  474. goto LABEL; \
  475. if (GET_CODE (X) == PLUS \
  476. && ((MODE) == SImode || (MODE) == SFmode) \
  477. && GET_CODE (XEXP (X, 0)) == REG \
  478. && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM \
  479. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  480. && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \
  481. goto LABEL; \
  482. if (GET_CODE (X) == PLUS \
  483. && ((MODE) == SImode || (MODE) == SFmode) \
  484. && GET_CODE (XEXP (X, 0)) == REG \
  485. && REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \
  486. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  487. && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 << 9) - 4)) \
  488. goto LABEL; \
  489. } \
  490. while (0)
  491. #else
  492. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
  493. do \
  494. { \
  495. if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
  496. goto LABEL; \
  497. if (GET_CODE (X) == PLUS \
  498. && ((MODE) == SImode || (MODE) == SFmode) \
  499. && GET_CODE (XEXP (X, 0)) == REG \
  500. && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM \
  501. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  502. && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \
  503. goto LABEL; \
  504. if (GET_CODE (X) == PLUS \
  505. && ((MODE) == SImode || (MODE) == SFmode) \
  506. && GET_CODE (XEXP (X, 0)) == REG \
  507. && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \
  508. || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM) \
  509. && GET_CODE (XEXP (X, 1)) == CONST_INT \
  510. && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 << 9) - 4)) \
  511. goto LABEL; \
  512. } \
  513. while (0)
  514. #endif
  515. /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
  516. use as a base register. For hard registers, it should always accept those
  517. which the hardware permits and reject the others. Whether the macro accepts
  518. or rejects pseudo registers must be controlled by `REG_OK_STRICT' as
  519. described above. This usually requires two variant definitions, of which
  520. `REG_OK_STRICT' controls the one actually used. */
  521. #ifdef REG_OK_STRICT
  522. #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) <= STACK_POINTER_REGNUM)
  523. #else
  524. #define REG_OK_FOR_BASE_P(X) 1
  525. #endif
  526. /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
  527. use as an index register.
  528. The difference between an index register and a base register is that the
  529. index register may be scaled. If an address involves the sum of two
  530. registers, neither one of them scaled, then either one may be labeled the
  531. "base" and the other the "index"; but whichever labeling is used must fit
  532. the machine's constraints of which registers may serve in each capacity.
  533. The compiler will try both labelings, looking for one that is valid, and
  534. will reload one or both registers only if neither labeling works. */
  535. #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
  536. /*}}}*/
  537. /*{{{ Describing Relative Costs of Operations */
  538. /* Define this macro as a C expression which is nonzero if accessing less than
  539. a word of memory (i.e. a `char' or a `short') is no faster than accessing a
  540. word of memory, i.e., if such access require more than one instruction or if
  541. there is no difference in cost between byte and (aligned) word loads.
  542. When this macro is not defined, the compiler will access a field by finding
  543. the smallest containing object; when it is defined, a fullword load will be
  544. used if alignment permits. Unless bytes accesses are faster than word
  545. accesses, using word accesses is preferable since it may eliminate
  546. subsequent memory access if subsequent accesses occur to other fields in the
  547. same word of the structure, but to different bytes. */
  548. #define SLOW_BYTE_ACCESS 1
  549. /*}}}*/
  550. /*{{{ Dividing the output into sections. */
  551. /* A C expression whose value is a string containing the assembler operation
  552. that should precede instructions and read-only data. Normally `".text"' is
  553. right. */
  554. #define TEXT_SECTION_ASM_OP "\t.text"
  555. /* A C expression whose value is a string containing the assembler operation to
  556. identify the following data as writable initialized data. Normally
  557. `".data"' is right. */
  558. #define DATA_SECTION_ASM_OP "\t.data"
  559. #define BSS_SECTION_ASM_OP "\t.section .bss"
  560. /*}}}*/
  561. /*{{{ The Overall Framework of an Assembler File. */
  562. /* A C string constant describing how to begin a comment in the target
  563. assembler language. The compiler assumes that the comment will end at the
  564. end of the line. */
  565. #define ASM_COMMENT_START ";"
  566. /* A C string constant for text to be output before each `asm' statement or
  567. group of consecutive ones. Normally this is `"#APP"', which is a comment
  568. that has no effect on most assemblers but tells the GNU assembler that it
  569. must check the lines that follow for all valid assembler constructs. */
  570. #define ASM_APP_ON "#APP\n"
  571. /* A C string constant for text to be output after each `asm' statement or
  572. group of consecutive ones. Normally this is `"#NO_APP"', which tells the
  573. GNU assembler to resume making the time-saving assumptions that are valid
  574. for ordinary compiler output. */
  575. #define ASM_APP_OFF "#NO_APP\n"
  576. /*}}}*/
  577. /*{{{ Output and Generation of Labels. */
  578. /* Globalizing directive for a label. */
  579. #define GLOBAL_ASM_OP "\t.globl "
  580. /*}}}*/
  581. /*{{{ Output of Assembler Instructions. */
  582. /* A C compound statement to output to stdio stream STREAM the assembler syntax
  583. for an instruction operand X. X is an RTL expression.
  584. CODE is a value that can be used to specify one of several ways of printing
  585. the operand. It is used when identical operands must be printed differently
  586. depending on the context. CODE comes from the `%' specification that was
  587. used to request printing of the operand. If the specification was just
  588. `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is
  589. the ASCII code for LTR.
  590. If X is a register, this macro should print the register's name. The names
  591. can be found in an array `reg_names' whose type is `char *[]'. `reg_names'
  592. is initialized from `REGISTER_NAMES'.
  593. When the machine description has a specification `%PUNCT' (a `%' followed by
  594. a punctuation character), this macro is called with a null pointer for X and
  595. the punctuation character for CODE. */
  596. #define PRINT_OPERAND(STREAM, X, CODE) fr30_print_operand (STREAM, X, CODE)
  597. /* A C expression which evaluates to true if CODE is a valid punctuation
  598. character for use in the `PRINT_OPERAND' macro. If
  599. `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation
  600. characters (except for the standard one, `%') are used in this way. */
  601. #define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')
  602. /* A C compound statement to output to stdio stream STREAM the assembler syntax
  603. for an instruction operand that is a memory reference whose address is X. X
  604. is an RTL expression. */
  605. #define PRINT_OPERAND_ADDRESS(STREAM, X) fr30_print_operand_address (STREAM, X)
  606. #define REGISTER_PREFIX "%"
  607. #define LOCAL_LABEL_PREFIX "."
  608. #define USER_LABEL_PREFIX ""
  609. #define IMMEDIATE_PREFIX ""
  610. /*}}}*/
  611. /*{{{ Output of Dispatch Tables. */
  612. /* This macro should be provided on machines where the addresses in a dispatch
  613. table are relative to the table's own address.
  614. The definition should be a C statement to output to the stdio stream STREAM
  615. an assembler pseudo-instruction to generate a difference between two labels.
  616. VALUE and REL are the numbers of two internal labels. The definitions of
  617. these labels are output using `(*targetm.asm_out.internal_label)', and they must be
  618. printed in the same way here. For example,
  619. fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL) */
  620. #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
  621. fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
  622. /* This macro should be provided on machines where the addresses in a dispatch
  623. table are absolute.
  624. The definition should be a C statement to output to the stdio stream STREAM
  625. an assembler pseudo-instruction to generate a reference to a label. VALUE
  626. is the number of an internal label whose definition is output using
  627. `(*targetm.asm_out.internal_label)'. For example,
  628. fprintf (STREAM, "\t.word L%d\n", VALUE) */
  629. #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
  630. fprintf (STREAM, "\t.word .L%d\n", VALUE)
  631. /*}}}*/
  632. /*{{{ Assembler Commands for Alignment. */
  633. /* A C statement to output to the stdio stream STREAM an assembler command to
  634. advance the location counter to a multiple of 2 to the POWER bytes. POWER
  635. will be a C expression of type `int'. */
  636. #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
  637. fprintf ((STREAM), "\t.p2align %d\n", (POWER))
  638. /*}}}*/
  639. /*{{{ Miscellaneous Parameters. */
  640. /* An alias for a machine mode name. This is the machine mode that elements of
  641. a jump-table should have. */
  642. #define CASE_VECTOR_MODE SImode
  643. /* The maximum number of bytes that a single instruction can move quickly from
  644. memory to memory. */
  645. #define MOVE_MAX 8
  646. /* A C expression which is nonzero if on this machine it is safe to "convert"
  647. an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
  648. than INPREC) by merely operating on it as if it had only OUTPREC bits.
  649. On many machines, this expression can be 1.
  650. When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
  651. which `MODES_TIEABLE_P' is 0, suboptimal code can result. If this is the
  652. case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve
  653. things. */
  654. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  655. /* An alias for the machine mode for pointers. On most machines, define this
  656. to be the integer mode corresponding to the width of a hardware pointer;
  657. `SImode' on 32-bit machine or `DImode' on 64-bit machines. On some machines
  658. you must define this to be one of the partial integer modes, such as
  659. `PSImode'.
  660. The width of `Pmode' must be at least as large as the value of
  661. `POINTER_SIZE'. If it is not equal, you must define the macro
  662. `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'. */
  663. #define Pmode SImode
  664. /* An alias for the machine mode used for memory references to functions being
  665. called, in `call' RTL expressions. On most machines this should be
  666. `QImode'. */
  667. #define FUNCTION_MODE QImode
  668. /*}}}*/
  669. /* Local Variables: */
  670. /* folded-file: t */
  671. /* End: */