tree.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. /* Front-end tree definitions for GNU compiler.
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GNU CC.
  4. GNU CC is distributed in the hope that it will be useful,
  5. but WITHOUT ANY WARRANTY. No author or distributor
  6. accepts responsibility to anyone for the consequences of using it
  7. or for whether it serves any particular purpose or works at all,
  8. unless he says so in writing. Refer to the GNU CC General Public
  9. License for full details.
  10. Everyone is granted permission to copy, modify and redistribute
  11. GNU CC, but only under the conditions described in the
  12. GNU CC General Public License. A copy of this license is
  13. supposed to have been given to you along with GNU CC so you
  14. can know your rights and responsibilities. It should be in a
  15. file named COPYING. Among other things, the copyright notice
  16. and this notice must be preserved on all copies. */
  17. /* codes of tree nodes */
  18. #define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,
  19. enum tree_code {
  20. #include "tree.def"
  21. };
  22. #undef DEFTREECODE
  23. /* Indexed by enum tree_code, contains a character which is
  24. `e' for an expression, `r' for a reference, `c' for a constant,
  25. `d' for a decl, `t' for a type, `s' for a statement,
  26. and `x' for anything else (TREE_LIST, IDENTIFIER, etc). */
  27. extern char *tree_code_type[];
  28. /* Number of argument-words in each kind of tree-node. */
  29. extern int tree_code_length[];
  30. /* Get the definition of `enum machine_mode' */
  31. #ifndef HAVE_MACHINE_MODES
  32. #define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT) SYM,
  33. enum machine_mode {
  34. #include "machmode.def"
  35. };
  36. #undef DEF_MACHMODE
  37. #define HAVE_MACHINE_MODES
  38. #endif /* not HAVE_MACHINE_MODES */
  39. #ifndef NUM_MACHINE_MODES
  40. #define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE
  41. #endif
  42. /* Codes that identify the various built in functions
  43. so that expand_call can identify them quickly. */
  44. enum built_in_function
  45. {
  46. NOT_BUILT_IN,
  47. BUILT_IN_ALLOCA,
  48. BUILT_IN_ABS,
  49. BUILT_IN_FABS,
  50. BUILT_IN_LABS,
  51. BUILT_IN_FFS,
  52. BUILT_IN_DIV,
  53. BUILT_IN_LDIV,
  54. BUILT_IN_FFLOOR,
  55. BUILT_IN_FCEIL,
  56. BUILT_IN_FMOD,
  57. BUILT_IN_FREM,
  58. BUILT_IN_MEMCPY,
  59. BUILT_IN_MEMCMP,
  60. BUILT_IN_MEMSET,
  61. BUILT_IN_FSQRT,
  62. BUILT_IN_GETEXP,
  63. BUILT_IN_GETMAN
  64. };
  65. /* The definition of tree nodes fills the next several pages. */
  66. /* A tree node can represent a data type, a variable, an expression
  67. or a statement. Each node has a TREE_CODE which says what kind of
  68. thing it represents. Some common codes are:
  69. INTEGER_TYPE -- represents a type of integers.
  70. ARRAY_TYPE -- represents a type of pointer.
  71. VAR_DECL -- represents a declared variable.
  72. INTEGER_CST -- represents a constant integer value.
  73. PLUS_EXPR -- represents a sum (an expression).
  74. As for the contents of a tree node: there are some fields
  75. that all nodes share. Each TREE_CODE has various special-purpose
  76. fields as well. The fields of a node are never accessed directly,
  77. always through accessor macros. */
  78. /* This type is used everywhere to refer to a tree node. */
  79. typedef union tree_node *tree;
  80. #define NULL_TREE (tree) NULL
  81. /* Every kind of tree node starts with this structure,
  82. so all nodes have these fields.
  83. See the accessor macros, defined below, for documentation of the fields. */
  84. struct tree_common
  85. {
  86. int uid;
  87. union tree_node *chain;
  88. union tree_node *type;
  89. enum tree_code code : 8;
  90. unsigned external_attr : 1;
  91. unsigned public_attr : 1;
  92. unsigned static_attr : 1;
  93. unsigned volatile_attr : 1;
  94. unsigned packed_attr : 1;
  95. unsigned readonly_attr : 1;
  96. unsigned literal_attr : 1;
  97. unsigned nonlocal_attr : 1;
  98. unsigned permanent_attr : 1;
  99. unsigned addressable_attr : 1;
  100. unsigned regdecl_attr : 1;
  101. unsigned this_vol_attr : 1;
  102. unsigned unsigned_attr : 1;
  103. unsigned asm_written_attr: 1;
  104. unsigned inline_attr : 1;
  105. };
  106. /* Define accessors for the fields that all tree nodes have
  107. (though some fields are not used for all kinds of nodes). */
  108. /* The unique id of a tree node distinguishes it from all other nodes
  109. in the same compiler run. */
  110. #define TREE_UID(NODE) ((NODE)->common.uid)
  111. /* The tree-code says what kind of node it is.
  112. Codes are defined in tree.def. */
  113. #define TREE_CODE(NODE) ((NODE)->common.code)
  114. #define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (VALUE))
  115. /* In all nodes that are expressions, this is the data type of the expression.
  116. In POINTER_TYPE nodes, this is the type that the pointer points to.
  117. In ARRAY_TYPE nodes, this is the type of the elements. */
  118. #define TREE_TYPE(NODE) ((NODE)->common.type)
  119. /* Nodes are chained together for many purposes.
  120. Types are chained together to record them for being output to the debugger
  121. (see the function `chain_type').
  122. Decls in the same scope are chained together to record the contents
  123. of the scope.
  124. Statement nodes for successive statements used to be chained together.
  125. Often lists of things are represented by TREE_LIST nodes thaht
  126. are chained together. */
  127. #define TREE_CHAIN(NODE) ((NODE)->common.chain)
  128. /* Define many boolean fields that all tree nodes have. */
  129. /* In a VAR_DECL or FUNCTION_DECL,
  130. nonzero means external reference:
  131. do not allocate storage, and refer to a definition elsewhere. */
  132. #define TREE_EXTERNAL(NODE) ((NODE)->common.external_attr)
  133. /* In a VAR_DECL, nonzero means allocate static storage.
  134. In a FUNCTION_DECL, currently nonzero if function has been defined. */
  135. #define TREE_STATIC(NODE) ((NODE)->common.static_attr)
  136. /* In a VAR_DECL or FUNCTION_DECL,
  137. nonzero means name is to be accessible from outside this module. */
  138. #define TREE_PUBLIC(NODE) ((NODE)->common.public_attr)
  139. /* In VAR_DECL nodes, nonzero means address of this is needed.
  140. So it cannot be in a register.
  141. In a FUNCTION_DECL, nonzero means its address is needed.
  142. So it must be compiled even if it is an inline function.
  143. In CONSTRUCTOR nodes, it means are all constants suitable
  144. for output as assembly-language initializers.
  145. In LABEL_DECL nodes, it means a goto for this label has been seen
  146. from a place outside all binding contours that restore stack levels,
  147. or that an error message about jumping into such a binding contour
  148. has been printed for this label. */
  149. #define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_attr)
  150. /* In VAR_DECL nodes, nonzero means declared `register'. */
  151. #define TREE_REGDECL(NODE) ((NODE)->common.regdecl_attr)
  152. /* In any expression, nonzero means it has side effects or reevaluation
  153. of the whole expression could produce a different value.
  154. This is set if any subexpression is a function call, a side effect
  155. or a reference to a volatile variable.
  156. In a ..._DECL, this is set only of the declaration said `volatile'.
  157. In a ..._TYPE, nonzero means the type is volatile-qualified. */
  158. #define TREE_VOLATILE(NODE) ((NODE)->common.volatile_attr)
  159. /* Nonzero means this expression is volatile in the C sense:
  160. its address should be of type `volatile WHATEVER *'.
  161. If this bit is set, so is `volatile_attr'. */
  162. #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.this_vol_attr)
  163. /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
  164. nonzero means it may not be the lhs of an assignment.
  165. In a ..._TYPE node, means this type is const-qualified. */
  166. #define TREE_READONLY(NODE) ((NODE)->common.readonly_attr)
  167. /* Nonzero in a FIELD_DECL means it is a bit-field; it may occupy
  168. less than a storage unit, and its address may not be taken, etc.
  169. This controls layout of the containing record.
  170. In a LABEL_DECL, nonzero means label was defined inside a binding
  171. contour that restored a stack level and which is now exited. */
  172. #define TREE_PACKED(NODE) ((NODE)->common.packed_attr)
  173. /* Value of expression is constant.
  174. Always appears in all ..._CST nodes.
  175. May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR
  176. if the value is constant. */
  177. #define TREE_LITERAL(NODE) ((NODE)->common.literal_attr)
  178. /* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
  179. Cannot happen in C because it does not allow nested functions, as of now.
  180. For VAR_DECL nodes, PARM_DECL nodes, and
  181. maybe FUNCTION_DECL or LABEL_DECL nodes. */
  182. #define TREE_NONLOCAL(NODE) ((NODE)->common.nonlocal_attr)
  183. /* Nonzero means permanent node;
  184. node will continue to exist for the entire compiler run.
  185. Otherwise it will be recycled at the end of the function. */
  186. #define TREE_PERMANENT(NODE) ((NODE)->common.permanent_attr)
  187. /* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
  188. In FIELD_DECL nodes, means an unsigned bit field. */
  189. #define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_attr)
  190. /* Nonzero in a VAR_DECL means assembler code has been written.
  191. Nonzero in a FUNCTION_DECL means that the function has been compiled.
  192. This is interesting in an inline function, since it might not need
  193. to be compiled separately. */
  194. #define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_attr)
  195. /* Nonzero in a FUNCTION_DECL means this function can be substituted
  196. where it is called. */
  197. #define TREE_INLINE(NODE) ((NODE)->common.inline_attr)
  198. /* Define additional fields and accessors for nodes representing constants. */
  199. /* In an INTEGER_CST node. These two together make a 64 bit integer.
  200. If the data type is signed, the value is sign-extended to 64 bits
  201. even though not all of them may really be in use.
  202. In an unsigned constant shorter than 64 bits, the extra bits are 0. */
  203. #define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low)
  204. #define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high)
  205. #define INT_CST_LT(A, B) \
  206. (TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \
  207. || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \
  208. && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B))))
  209. #define INT_CST_LT_UNSIGNED(A, B) \
  210. ((unsigned) TREE_INT_CST_HIGH (A) < (unsigned) TREE_INT_CST_HIGH (B) \
  211. || ((unsigned) TREE_INT_CST_HIGH (A) == (unsigned) TREE_INT_CST_HIGH (B) \
  212. && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B))))
  213. struct tree_int_cst
  214. {
  215. char common[sizeof (struct tree_common)];
  216. long int_cst_low;
  217. long int_cst_high;
  218. };
  219. /* In REAL_CST, STRING_CST, COMPLEX_CST nodes, and CONSTRUCTOR nodes,
  220. and generally in all kinds of constants that could
  221. be given labels (rather than being immediate). */
  222. #define TREE_CST_RTL(NODE) ((NODE)->real_cst.rtl)
  223. /* In a REAL_CST node. */
  224. #define TREE_REAL_CST(NODE) ((NODE)->real_cst.real_cst)
  225. struct tree_real_cst
  226. {
  227. char common[sizeof (struct tree_common)];
  228. struct rtx_def *rtl; /* acts as link to register transfer language
  229. (rtl) info */
  230. double real_cst;
  231. };
  232. /* In a STRING_CST */
  233. #define TREE_STRING_LENGTH(NODE) ((NODE)->string.length)
  234. #define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer)
  235. struct tree_string
  236. {
  237. char common[sizeof (struct tree_common)];
  238. struct rtx_def *rtl; /* acts as link to register transfer language
  239. (rtl) info */
  240. int length;
  241. char *pointer;
  242. };
  243. /* In a COMPLEX_CST node. */
  244. #define TREE_REALPART(NODE) ((NODE)->complex.real)
  245. #define TREE_IMAGPART(NODE) ((NODE)->complex.imag)
  246. struct tree_complex
  247. {
  248. char common[sizeof (struct tree_common)];
  249. struct rtx_def *rtl; /* acts as link to register transfer language
  250. (rtl) info */
  251. union tree_node *real;
  252. union tree_node *imag;
  253. };
  254. /* Define fields and accessors for some special-purpose tree nodes. */
  255. #define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length)
  256. #define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer)
  257. #define IDENTIFIER_GLOBAL_VALUE(NODE) ((NODE)->identifier.global_value)
  258. #define IDENTIFIER_LOCAL_VALUE(NODE) ((NODE)->identifier.local_value)
  259. #define IDENTIFIER_LABEL_VALUE(NODE) ((NODE)->identifier.label_value)
  260. #define IDENTIFIER_IMPLICIT_DECL(NODE) ((NODE)->identifier.implicit_decl)
  261. struct tree_identifier
  262. {
  263. char common[sizeof (struct tree_common)];
  264. int length;
  265. char *pointer;
  266. union tree_node *global_value;
  267. union tree_node *local_value;
  268. union tree_node *label_value;
  269. union tree_node *implicit_decl;
  270. };
  271. /* In a TREE_LIST node. */
  272. #define TREE_PURPOSE(NODE) ((NODE)->list.purpose)
  273. #define TREE_VALUE(NODE) ((NODE)->list.value)
  274. struct tree_list
  275. {
  276. char common[sizeof (struct tree_common)];
  277. union tree_node *purpose;
  278. union tree_node *value;
  279. };
  280. /* Define fields and accessors for some nodes that represent expressions. */
  281. /* In a SAVE_EXPR node. */
  282. #define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
  283. /* In a RTL_EXPR node. */
  284. #define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[0])
  285. #define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
  286. /* In a CALL_EXPR node. */
  287. #define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
  288. /* In a CONSTRUCTOR node. */
  289. #define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1)
  290. /* In expression and reference nodes. */
  291. #define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I])
  292. #define TREE_COMPLEXITY(NODE, I) ((NODE)->exp.complexity)
  293. struct tree_exp
  294. {
  295. char common[sizeof (struct tree_common)];
  296. int complexity;
  297. union tree_node *operands[1];
  298. };
  299. /* Define fields and accessors for nodes representing data types. */
  300. /* See tree.def for documentation of the use of these fields. */
  301. #define TYPE_SIZE(NODE) ((NODE)->type.size)
  302. #define TYPE_SIZE_UNIT(NODE) ((NODE)->type.size_unit)
  303. #define TYPE_MODE(NODE) ((NODE)->type.mode)
  304. #define TYPE_ALIGN(NODE) ((NODE)->type.align)
  305. #define TYPE_VALUES(NODE) ((NODE)->type.values)
  306. #define TYPE_DOMAIN(NODE) ((NODE)->type.values)
  307. #define TYPE_FIELDS(NODE) ((NODE)->type.values)
  308. #define TYPE_ARG_TYPES(NODE) ((NODE)->type.values)
  309. #define TYPE_SEP(NODE) ((NODE)->type.sep)
  310. #define TYPE_SEP_UNIT(NODE) ((NODE)->type.sep_unit)
  311. #define TYPE_POINTER_TO(NODE) ((NODE)->type.pointer_to)
  312. #define TYPE_MIN_VALUE(NODE) ((NODE)->type.sep)
  313. #define TYPE_MAX_VALUE(NODE) ((NODE)->type.max)
  314. #define TYPE_PRECISION(NODE) ((NODE)->type.sep_unit)
  315. #define TYPE_PARSE_INFO(NODE) ((NODE)->type.parse_info)
  316. #define TYPE_SYMTAB_ADDRESS(NODE) ((NODE)->type.symtab_address)
  317. #define TYPE_NAME(NODE) ((NODE)->type.name)
  318. #define TYPE_NEXT_VARIANT(NODE) ((NODE)->type.next_variant)
  319. #define TYPE_MAIN_VARIANT(NODE) ((NODE)->type.main_variant)
  320. struct tree_type
  321. {
  322. char common[sizeof (struct tree_common)];
  323. union tree_node *values;
  324. union tree_node *sep;
  325. union tree_node *size;
  326. enum machine_mode mode;
  327. unsigned char size_unit;
  328. unsigned char align;
  329. unsigned char sep_unit;
  330. enum machine_mode elt_mode; /* Unused */
  331. union tree_node *pointer_to;
  332. int parse_info;
  333. int symtab_address;
  334. union tree_node *name;
  335. union tree_node *max;
  336. union tree_node *next_variant;
  337. union tree_node *main_variant;
  338. };
  339. /* Define fields and accessors for nodes representing declared names. */
  340. #define DECL_VOFFSET(NODE) ((NODE)->decl.voffset)
  341. #define DECL_VOFFSET_UNIT(NODE) ((NODE)->decl.voffset_unit)
  342. #define DECL_OFFSET(NODE) ((NODE)->decl.offset)
  343. #define DECL_FUNCTION_CODE(NODE) ((enum built_in_function) (NODE)->decl.offset)
  344. #define DECL_SET_FUNCTION_CODE(NODE,VAL) ((NODE)->decl.offset = (int) (VAL))
  345. #define DECL_NAME(NODE) ((NODE)->decl.name)
  346. #define DECL_CONTEXT(NODE) ((NODE)->decl.context)
  347. #define DECL_ARGUMENTS(NODE) ((NODE)->decl.arguments)
  348. #define DECL_ARG_TYPE(NODE) ((NODE)->decl.arguments)
  349. #define DECL_RESULT(NODE) ((NODE)->decl.result)
  350. #define DECL_INITIAL(NODE) ((NODE)->decl.initial)
  351. #define DECL_SOURCE_FILE(NODE) ((NODE)->decl.filename)
  352. #define DECL_SOURCE_LINE(NODE) ((NODE)->decl.linenum)
  353. #define DECL_SIZE(NODE) ((NODE)->decl.size)
  354. #define DECL_SIZE_UNIT(NODE) ((NODE)->decl.size_unit)
  355. #define DECL_ALIGN(NODE) ((NODE)->decl.align)
  356. #define DECL_MODE(NODE) ((NODE)->decl.mode)
  357. #define DECL_RTL(NODE) ((NODE)->decl.rtl)
  358. #define DECL_BLOCK_SYMTAB_ADDRESS(NODE) ((NODE)->decl.block_symtab_address)
  359. #define DECL_SYMTAB_INDEX(NODE) ((NODE)->decl.block_symtab_address)
  360. #define DECL_SAVED_INSNS(NODE) ((NODE)->decl.saved_insns)
  361. #define DECL_FRAME_SIZE(NODE) ((NODE)->decl.frame_size)
  362. struct tree_decl
  363. {
  364. char common[sizeof (struct tree_common)];
  365. char *filename;
  366. int linenum;
  367. union tree_node *size;
  368. enum machine_mode mode;
  369. unsigned char size_unit;
  370. unsigned char align;
  371. unsigned char voffset_unit;
  372. union tree_node *name;
  373. union tree_node *context;
  374. int offset;
  375. union tree_node *voffset;
  376. union tree_node *arguments;
  377. union tree_node *result;
  378. union tree_node *initial;
  379. struct rtx_def *rtl; /* acts as link to register transfer language
  380. (rtl) info */
  381. int frame_size; /* For FUNCTION_DECLs: size of stack frame */
  382. struct rtx_def *saved_insns; /* For FUNCTION_DECLs: points to insn that
  383. constitute its definition on the
  384. permanent obstack. */
  385. int block_symtab_address;
  386. };
  387. /* Define fields and accessors for nodes representing statements.
  388. These are now obsolete for C, except for LET_STMT, which is used
  389. to record the structure of binding contours (and the names declared
  390. in each contour) for the sake of outputting debugging info.
  391. Perhaps they will be used once again for other languages. */
  392. /* For LABEL_STMT, GOTO_STMT, RETURN_STMT, LOOP_STMT,
  393. COMPOUND_STMT, ASM_STMT. */
  394. #define STMT_SOURCE_LINE(NODE) ((NODE)->stmt.linenum)
  395. #define STMT_SOURCE_FILE(NODE) ((NODE)->stmt.filename)
  396. #define STMT_BODY(NODE) ((NODE)->stmt.body)
  397. struct tree_stmt
  398. {
  399. char common[sizeof (struct tree_common)];
  400. char *filename;
  401. int linenum;
  402. union tree_node *body;
  403. };
  404. /* For IF_STMT. */
  405. /* #define STMT_SOURCE_LINE(NODE) */
  406. /* #define STMT_SOURCE_FILE(NODE) */
  407. #define STMT_COND(NODE) ((NODE)->if_stmt.cond)
  408. #define STMT_THEN(NODE) ((NODE)->if_stmt.thenpart)
  409. #define STMT_ELSE(NODE) ((NODE)->if_stmt.elsepart)
  410. struct tree_if_stmt
  411. {
  412. char common[sizeof (struct tree_common)];
  413. char *filename;
  414. int linenum;
  415. union tree_node *cond, *thenpart, *elsepart;
  416. };
  417. /* For LET_STMT and WITH_STMT. */
  418. /* #define STMT_SOURCE_LINE(NODE) */
  419. /* #define STMT_SOURCE_FILE(NODE) */
  420. /* #define STMT_BODY(NODE) */
  421. #define STMT_VARS(NODE) ((NODE)->bind_stmt.vars)
  422. #define STMT_SUPERCONTEXT(NODE) ((NODE)->bind_stmt.supercontext)
  423. #define STMT_BIND_SIZE(NODE) ((NODE)->bind_stmt.bind_size)
  424. #define STMT_TYPE_TAGS(NODE) ((NODE)->bind_stmt.type_tags)
  425. struct tree_bind_stmt
  426. {
  427. char common[sizeof (struct tree_common)];
  428. char *filename;
  429. int linenum;
  430. union tree_node *body, *vars, *supercontext, *bind_size, *type_tags;
  431. };
  432. /* For CASE_STMT. */
  433. #define STMT_CASE_INDEX(NODE) ((NODE)->case_stmt.index)
  434. #define STMT_CASE_LIST(NODE) ((NODE)->case_stmt.case_list)
  435. struct tree_case_stmt
  436. {
  437. char common[sizeof (struct tree_common)];
  438. char *filename;
  439. int linenum;
  440. union tree_node *index, *case_list;
  441. };
  442. /* Define the overall contents of a tree node.
  443. It may be any of the structures declared above
  444. for various types of node. */
  445. union tree_node
  446. {
  447. struct tree_common common;
  448. struct tree_int_cst int_cst;
  449. struct tree_real_cst real_cst;
  450. struct tree_string string;
  451. struct tree_complex complex;
  452. struct tree_identifier identifier;
  453. struct tree_decl decl;
  454. struct tree_type type;
  455. struct tree_list list;
  456. struct tree_exp exp;
  457. struct tree_stmt stmt;
  458. struct tree_if_stmt if_stmt;
  459. struct tree_bind_stmt bind_stmt;
  460. struct tree_case_stmt case_stmt;
  461. };
  462. extern char *oballoc ();
  463. extern char *permalloc ();
  464. /* Lowest level primitive for allocating a node.
  465. The TREE_CODE is the only argument. Contents are initialized
  466. to zero except for a few of the common fields. */
  467. extern tree make_node ();
  468. /* Make a copy of a node, with all the same contents except
  469. for TREE_UID and TREE_PERMANENT. (The copy is permanent
  470. iff nodes being made now are permanent.) */
  471. extern tree copy_node ();
  472. /* Return the (unique) IDENTIFIER_NODE node for a given name.
  473. The name is supplied as a char *. */
  474. extern tree get_identifier ();
  475. /* Construct various types of nodes. */
  476. extern tree build_int_2 ();
  477. extern tree build_real ();
  478. extern tree build_real_from_string ();
  479. extern tree build_real_from_int_cst ();
  480. extern tree build_complex ();
  481. extern tree build_string ();
  482. extern tree build ();
  483. extern tree build_nt ();
  484. extern tree build_tree_list ();
  485. extern tree build_decl ();
  486. extern tree build_let ();
  487. /* Construct various nodes representing data types. */
  488. extern tree make_signed_type ();
  489. extern tree make_unsigned_type ();
  490. extern void fixup_unsigned_type ();
  491. extern tree build_pointer_type ();
  492. extern tree build_array_type ();
  493. extern tree build_function_type ();
  494. /* Construct expressions, performing type checking. */
  495. extern tree build_binary_op ();
  496. extern tree build_indirect_ref ();
  497. extern tree build_unary_op ();
  498. /* Given a type node TYPE, and CONSTP and VOLATILEP, return a type
  499. for the same kind of data as TYPE describes.
  500. Variants point to the "main variant" (which has neither CONST nor VOLATILE)
  501. via TYPE_MAIN_VARIANT, and it points to a chain of other variants
  502. so that duplicate variants are never made.
  503. Only main variants should ever appear as types of expressions. */
  504. extern tree build_type_variant ();
  505. /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
  506. TYPE_ALIGN and TYPE_MODE fields.
  507. If called more than once on one node, does nothing except
  508. for the first time. */
  509. extern void layout_type ();
  510. /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
  511. return a canonicalized ..._TYPE node, so that duplicates are not made.
  512. How the hash code is computed is up to the caller, as long as any two
  513. callers that could hash identical-looking type nodes agree. */
  514. extern tree type_hash_canon ();
  515. /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
  516. calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
  517. fields. Call this only once for any given decl node.
  518. Second argument is the boundary that this field can be assumed to
  519. be starting at (in bits). Zero means it can be assumed aligned
  520. on any boundary that may be needed. */
  521. extern void layout_decl ();
  522. /* Fold constants as much as possible in an expression.
  523. Returns the simplified expression.
  524. Acts only on the top level of the expression;
  525. if the argument itself cannot be simplified, its
  526. subexpressions are not changed. */
  527. extern tree fold ();
  528. /* combine (tree_code, exp1, exp2) where EXP1 and EXP2 are constants
  529. returns a constant expression for the result of performing
  530. the operation specified by TREE_CODE on EXP1 and EXP2. */
  531. extern tree combine ();
  532. extern tree convert ();
  533. extern tree convert_units ();
  534. extern tree size_in_bytes ();
  535. extern tree genop ();
  536. extern tree build_int ();
  537. /* Type for sizes of data-type. */
  538. extern tree sizetype;
  539. /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
  540. by making the last node in X point to Y.
  541. Returns X, except if X is 0 returns Y. */
  542. extern tree chainon ();
  543. /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */
  544. extern tree tree_cons ();
  545. /* Return the last tree node in a chain. */
  546. extern tree tree_last ();
  547. /* Reverse the order of elements in a chain, and return the new head. */
  548. extern tree nreverse ();
  549. /* Returns the length of a chain of nodes
  550. (number of chain pointers to follow before reaching a null pointer). */
  551. extern int list_length ();
  552. /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
  553. extern int integer_zerop ();
  554. /* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */
  555. extern int integer_onep ();
  556. /* integer_all_onesp (tree x) is nonzero if X is an integer constant
  557. all of whose significant bits are 1. */
  558. extern int integer_all_onesp ();
  559. /* type_unsigned_p (tree x) is nonzero if the type X is an unsigned type
  560. (all of its possible values are >= 0).
  561. If X is a pointer type, the value is 1.
  562. If X is a real type, the value is 0. */
  563. extern int type_unsigned_p ();
  564. /* staticp (tree x) is nonzero if X is a reference to data allocated
  565. at a fixed address in memory. */
  566. extern int staticp ();
  567. /* Gets an error if argument X is not an lvalue.
  568. Also returns 1 if X is an lvalue, 0 if not. */
  569. extern int lvalue_or_else ();
  570. /* save_expr (EXP) returns an expression equivalent to EXP
  571. but it can be used multiple times within context CTX
  572. and only evaluate EXP once. */
  573. extern tree save_expr ();
  574. /* stabilize_reference (EXP) returns an reference equivalent to EXP
  575. but it can be used multiple times
  576. and only evaluate the subexpressions once. */
  577. extern tree stabilize_reference ();
  578. /* Return EXP, stripped of any conversions to wider types
  579. in such a way that the result of converting to type FOR_TYPE
  580. is the same as if EXP were converted to FOR_TYPE.
  581. If FOR_TYPE is 0, it signifies EXP's type. */
  582. extern tree get_unwidened ();
  583. /* Return OP or a simpler expression for a narrower value
  584. which can be sign-extended or zero-extended to give back OP.
  585. Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
  586. or 0 if the value should be sign-extended. */
  587. extern tree get_narrower ();
  588. /* Given PRECISION and UNSIGNEDP, return a suitable type-tree
  589. for an integer type with at least that precision.
  590. The definition of this resides in language-specific code
  591. as the repertoir of available types may vary. */
  592. extern tree type_for_size ();
  593. /* Given an integer type T, return a type like T but unsigned.
  594. If T is unsigned, the value is T.
  595. The definition of this resides in language-specific code
  596. as the repertoir of available types may vary. */
  597. extern tree unsigned_type ();
  598. /* Given an integer type T, return a type like T but signed.
  599. If T is signed, the value is T.
  600. The definition of this resides in language-specific code
  601. as the repertoir of available types may vary. */
  602. extern tree signed_type ();
  603. /* Return the floating type node for a given floating machine mode. */
  604. extern tree get_floating_type ();
  605. /* Given the FUNCTION_DECL for the current function,
  606. return zero if it is ok for this function to be inline.
  607. Otherwise return a warning message with a single %s
  608. for the function's name. */
  609. extern char *function_cannot_inline_p ();
  610. /* Declare commonly used variables for tree structure. */
  611. /* An integer constant with value 0 */
  612. extern tree integer_zero_node;
  613. /* An integer constant with value 1 */
  614. extern tree integer_one_node;
  615. /* A constant of type pointer-to-int and value 0 */
  616. extern tree null_pointer_node;
  617. /* A node of type ERROR_MARK. */
  618. extern tree error_mark_node;
  619. /* The type node for the void type. */
  620. extern tree void_type_node;
  621. /* The type node for the ordinary (signed) integer type. */
  622. extern tree integer_type_node;
  623. /* The type node for the unsigned integer type. */
  624. extern tree unsigned_type_node;
  625. /* The type node for the ordinary character type. */
  626. extern tree char_type_node;
  627. /* Points to the name of the input file from which the current input
  628. being parsed originally came (before it went into cpp). */
  629. extern char *input_filename;
  630. /* Nonzero for -pedantic switch: warn about anything
  631. that standard C forbids. */
  632. extern int pedantic;
  633. /* In stmt.c */
  634. extern tree get_last_expr ();
  635. extern void expand_expr_stmt(), clear_last_expr();
  636. extern void expand_label(), expand_goto(), expand_asm();
  637. extern void expand_start_cond(), expand_end_cond();
  638. extern void expand_start_else(), expand_end_else();
  639. extern void expand_start_loop(), expand_start_loop_continue_elsewhere();
  640. extern void expand_loop_continue_here();
  641. extern void expand_end_loop();
  642. extern int expand_continue_loop();
  643. extern int expand_exit_loop(), expand_exit_loop_if_false();
  644. extern int expand_exit_something();
  645. extern void expand_start_delayed_expr ();
  646. extern tree expand_end_delayed_expr ();
  647. extern void expand_emit_delayed_expr ();
  648. extern void expand_null_return(), expand_return();
  649. extern void expand_start_bindings(), expand_end_bindings();
  650. extern void expand_start_case(), expand_end_case();
  651. extern int pushcase();
  652. extern void expand_start_function(), expand_end_function();