emit-rtl.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. /* Emit RTL for the GNU C-Compiler expander.
  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. /* Middle-to-low level generation of rtx code and insns.
  18. This file contains the functions `gen_rtx', `gen_reg_rtx'
  19. and `gen_label_rtx' that are the usual ways of creating rtl
  20. expressions for most purposes.
  21. It also has the functions for creating insns and linking
  22. them in the doubly-linked chain.
  23. The patterns of the insns are created by machine-dependent
  24. routines in insn-emit.c, which is generated automatically from
  25. the machine description. These routines use `gen_rtx' to make
  26. the individual rtx's of the pattern; what is machine dependent
  27. is the kind of rtx's they make and what arguments they use. */
  28. #include "config.h"
  29. #include <stdio.h>
  30. #include "rtl.h"
  31. #include "regs.h"
  32. #include "insn-config.h"
  33. #include "recog.h"
  34. #define max(A,B) ((A) > (B) ? (A) : (B))
  35. #define min(A,B) ((A) < (B) ? (A) : (B))
  36. /* This is reset to FIRST_PSEUDO_REGISTER at the start each function.
  37. After rtl generation, it is 1 plus the largest register number used. */
  38. int reg_rtx_no = FIRST_PSEUDO_REGISTER;
  39. /* This is *not* reset after each function. It gives each CODE_LABEL
  40. in the entire compilation a unique label number. */
  41. int label_no = 1;
  42. /* Nonzero means do not generate NOTEs for source line numbers. */
  43. static int no_line_numbers;
  44. /* Commonly used rtx's, so that we only need space for one copy.
  45. These are initialized at the start of each function. */
  46. rtx pc_rtx; /* (PC) */
  47. rtx cc0_rtx; /* (CC0 */
  48. rtx cc1_rtx; /* (CC1) */
  49. rtx const0_rtx; /* (CONST_INT 0) */
  50. rtx const1_rtx; /* (CONST_INT 1) */
  51. rtx fconst0_rtx; /* (CONST_DOUBLE:SF 0) */
  52. rtx dconst0_rtx; /* (CONST_DOUBLE:DF 0) */
  53. /* The ends of the doubly-linked chain of rtl for the current function.
  54. Both are reset to null at the start of rtl generation for the function. */
  55. static rtx first_insn = NULL;
  56. static rtx last_insn = NULL;
  57. /* INSN_UID for next insn emitted.
  58. Reset to 1 for each function compiled. */
  59. static int cur_insn_uid = 1;
  60. /* Line number and source file of the last line-number NOTE emitted.
  61. This is used to avoid generating duplicates. */
  62. static int last_linenum = 0;
  63. static char *last_filename = 0;
  64. /* A vector indexed by pseudo reg number. The allocated length
  65. of this vector is regno_pointer_flag_length. Since this
  66. vector is needed during the expansion phase when the total
  67. number of registers in the function is not yet known,
  68. it is copied and made bigger when necessary. */
  69. char *regno_pointer_flag;
  70. int regno_pointer_flag_length;
  71. /* Indexed by pseudo register number, gives the rtx for that pseudo.
  72. Allocated in parallel with regno_pointer_flag. */
  73. rtx *regno_reg_rtx;
  74. /* Chain of all CONST_DOUBLEs made for this function;
  75. so we can uniquize them. */
  76. rtx real_constant_chain;
  77. /* rtx gen_rtx (code, mode, [element1, ..., elementn])
  78. **
  79. ** This routine generates an RTX of the size specified by
  80. ** <code>, which is an RTX code. The RTX structure is initialized
  81. ** from the arguments <element1> through <elementn>, which are
  82. ** interpreted according to the specific RTX type's format. The
  83. ** special machine mode associated with the rtx (if any) is specified
  84. ** in <mode>.
  85. **
  86. ** gen_rtx() can be invoked in a way which resembles the lisp-like
  87. ** rtx it will generate. For example, the following rtx structure:
  88. **
  89. ** (plus:QI (mem:QI (reg:SI 1))
  90. ** (mem:QI (plusw:SI (reg:SI 2) (reg:SI 3))))
  91. **
  92. ** ...would be generated by the following C code:
  93. **
  94. ** gen_rtx (PLUS, QImode,
  95. ** gen_rtx (MEM, QImode,
  96. ** gen_rtx (REG, SImode, 1)),
  97. ** gen_rtx (MEM, QImode,
  98. ** gen_rtx (PLUS, SImode,
  99. ** gen_rtx (REG, SImode, 2),
  100. ** gen_rtx (REG, SImode, 3)))),
  101. */
  102. /*VARARGS2*/
  103. rtx
  104. gen_rtx (code, mode, first)
  105. enum rtx_code code; /* RTX Code... */
  106. enum machine_mode mode;
  107. int first;
  108. {
  109. register char *argp; /* Pointer to arguments... */
  110. register int i, j; /* Array indices... */
  111. register char *fmt; /* Current rtx's format... */
  112. register rtx rt_val; /* RTX to return to caller... */
  113. if (code == CONST_INT)
  114. {
  115. if (first == 0)
  116. return const0_rtx;
  117. if (first == 1)
  118. return const1_rtx;
  119. }
  120. if (code == CONST_DOUBLE)
  121. {
  122. if (first == XINT (fconst0_rtx, 0)
  123. && (&first)[1] == XINT (fconst0_rtx, 1))
  124. return (mode == DFmode ? dconst0_rtx : fconst0_rtx);
  125. }
  126. rt_val = rtx_alloc (code); /* Allocate the storage space. */
  127. rt_val->mode = mode; /* Store the machine mode... */
  128. argp = (char *) &first; /* Get a pointer to the arguments... */
  129. fmt = GET_RTX_FORMAT (code); /* Find the right format... */
  130. for (i = 0; i < GET_RTX_LENGTH (code); i++)
  131. {
  132. switch (*fmt)
  133. {
  134. case '0': /* Unused field... */
  135. break;
  136. case 'i': /* An integer? */
  137. XINT (rt_val, i) = *(int *)argp;
  138. argp += sizeof (int); /* Next argument in list... */
  139. break;
  140. case 's': /* A string? */
  141. XSTR (rt_val, i) = *(char **)argp;
  142. argp += sizeof (char *);
  143. break;
  144. case 'e': /* An expression? */
  145. case 'u': /* An insn? Same except when printing. */
  146. XEXP (rt_val, i) = *(rtx *)argp;
  147. argp += sizeof (rtx *);
  148. break;
  149. case 'E': /* An RTX vector? */
  150. XVEC (rt_val, i) = *(rtvec *)argp;
  151. argp += sizeof (rtvec *);
  152. break;
  153. default: /* Invalid format specification... */
  154. abort();
  155. } /* End switch */
  156. } /* End for */
  157. return rt_val; /* Return the new RTX... */
  158. }
  159. /* gen_rtvec (n, [rt1, ..., rtn])
  160. **
  161. ** This routine creates an rtvec and stores within it the
  162. ** pointers to rtx's which are its arguments.
  163. */
  164. /*VARARGS1*/
  165. rtvec
  166. gen_rtvec (n, first)
  167. int n;
  168. rtx first;
  169. {
  170. if (n == 0)
  171. return NULL_RTVEC; /* Don't allocate an empty rtvec... */
  172. return gen_rtvec_v (n, &first);
  173. }
  174. rtvec
  175. gen_rtvec_v (n, argp)
  176. int n;
  177. rtx *argp;
  178. {
  179. register int i;
  180. register rtvec rt_val;
  181. if (n == 0)
  182. return NULL_RTVEC; /* Don't allocate an empty rtvec... */
  183. rt_val = rtvec_alloc (n); /* Allocate an rtvec... */
  184. for (i = 0; i < n; i++)
  185. rt_val->elem[i].rtx = *argp++;
  186. return rt_val;
  187. }
  188. /* Generate a REG rtx for a new pseudo register of mode MODE.
  189. This pseudo is assigned the next sequential register number. */
  190. rtx
  191. gen_reg_rtx (mode)
  192. enum machine_mode mode;
  193. {
  194. register rtx val;
  195. /* Make sure regno_pointer_flag and regno_reg_rtx are large
  196. enough to have an element for this pseudo reg number. */
  197. if (reg_rtx_no == regno_pointer_flag_length)
  198. {
  199. rtx *new1;
  200. char *new =
  201. (char *) oballoc (regno_pointer_flag_length * 2);
  202. bzero (new, regno_pointer_flag_length * 2);
  203. bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
  204. regno_pointer_flag = new;
  205. new1 = (rtx *) oballoc (regno_pointer_flag_length * 2 * sizeof (rtx));
  206. bzero (new1, regno_pointer_flag_length * 2 * sizeof (rtx));
  207. bcopy (regno_reg_rtx, new1, regno_pointer_flag_length * sizeof (rtx));
  208. regno_reg_rtx = new1;
  209. regno_pointer_flag_length *= 2;
  210. }
  211. val = gen_rtx (REG, mode, reg_rtx_no);
  212. regno_reg_rtx[reg_rtx_no++] = val;
  213. return val;
  214. }
  215. /* Identify REG as a probable pointer register. */
  216. void
  217. mark_reg_pointer (reg)
  218. rtx reg;
  219. {
  220. REGNO_POINTER_FLAG (REGNO (reg)) = 1;
  221. }
  222. /* Return 1 plus largest pseudo reg number used in the current function. */
  223. int
  224. max_reg_num ()
  225. {
  226. return reg_rtx_no;
  227. }
  228. /* Assuming that X is an rtx (MEM or REG) for a fixed-point number,
  229. return a MEM or SUBREG rtx that refers to the least-significant part of X.
  230. If X is a MEM whose address is a QUEUED, the value may be so also. */
  231. rtx
  232. gen_lowpart (mode, x)
  233. enum machine_mode mode;
  234. register rtx x;
  235. {
  236. if (GET_CODE (x) == SUBREG)
  237. {
  238. /* The code we have is correct only under these conditions. */
  239. if (! subreg_lowpart_p (x))
  240. abort ();
  241. if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
  242. abort ();
  243. return (GET_MODE (SUBREG_REG (x)) == mode
  244. ? SUBREG_REG (x)
  245. : gen_rtx (SUBREG, mode, SUBREG_REG (x), SUBREG_WORD (x)));
  246. }
  247. if (GET_MODE (x) == mode)
  248. return x;
  249. if (GET_CODE (x) == CONST_INT)
  250. return gen_rtx (CONST_INT, VOIDmode, INTVAL (x) & GET_MODE_MASK (mode));
  251. if (GET_CODE (x) == MEM)
  252. {
  253. register int offset = 0;
  254. #ifdef WORDS_BIG_ENDIAN
  255. offset = (max (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
  256. - max (GET_MODE_SIZE (mode), UNITS_PER_WORD));
  257. #endif
  258. #ifdef BYTES_BIG_ENDIAN
  259. /* Adjust the address so that the address-after-the-data
  260. is unchanged. */
  261. offset -= (min (UNITS_PER_WORD, GET_MODE_SIZE (mode))
  262. - min (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
  263. #endif
  264. return gen_rtx (MEM, mode,
  265. memory_address (mode,
  266. plus_constant (XEXP (x, 0),
  267. offset)));
  268. }
  269. else if (GET_CODE (x) == REG)
  270. {
  271. #ifdef WORDS_BIG_ENDIAN
  272. if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  273. {
  274. return get_rtx (SUBREG, mode, x,
  275. ((GET_MODE_SIZE (GET_MODE (x))
  276. - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  277. / UNITS_PER_WORD));
  278. }
  279. #endif
  280. return gen_rtx (SUBREG, mode, x, 0);
  281. }
  282. else
  283. abort ();
  284. }
  285. /* Like `gen_lowpart', but refer to the most significant part. */
  286. rtx
  287. gen_highpart (mode, x)
  288. enum machine_mode mode;
  289. register rtx x;
  290. {
  291. if (GET_CODE (x) == MEM)
  292. {
  293. register int offset = 0;
  294. #ifndef WORDS_BIG_ENDIAN
  295. offset = (max (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
  296. - max (GET_MODE_SIZE (mode), UNITS_PER_WORD));
  297. #endif
  298. #ifndef BYTES_BIG_ENDIAN
  299. if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
  300. offset -= (GET_MODE_SIZE (mode)
  301. - min (UNITS_PER_WORD,
  302. GET_MODE_SIZE (GET_MODE (x))));
  303. #endif
  304. return gen_rtx (MEM, mode,
  305. memory_address (mode,
  306. plus_constant (XEXP (x, 0),
  307. offset)));
  308. }
  309. else if (GET_CODE (x) == REG)
  310. {
  311. #ifndef WORDS_BIG_ENDIAN
  312. if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  313. {
  314. return gen_rtx (SUBREG, mode, x,
  315. ((GET_MODE_SIZE (GET_MODE (x))
  316. - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  317. / UNITS_PER_WORD));
  318. }
  319. #endif
  320. return gen_rtx (SUBREG, mode, x, 0);
  321. }
  322. else
  323. abort ();
  324. }
  325. /* Return 1 iff X, assumed to be a SUBREG,
  326. refers to the least significant part of its containing reg.
  327. If X is not a SUBREG, always return 1 (it is its own low part!). */
  328. int
  329. subreg_lowpart_p (x)
  330. rtx x;
  331. {
  332. if (GET_CODE (x) != SUBREG)
  333. return 1;
  334. #ifdef WORDS_BIG_ENDIAN
  335. if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
  336. {
  337. register enum machine_mode mode = GET_MODE (SUBREG_REG (x));
  338. return (SUBREG_WORD (x)
  339. == ((GET_MODE_SIZE (GET_MODE (x))
  340. - max (GET_MODE_SIZE (mode), UNITS_PER_WORD))
  341. / UNITS_PER_WORD));
  342. }
  343. #endif
  344. return SUBREG_WORD (x) == 0;
  345. }
  346. /* Return a newly created CODE_LABEL rtx with a unique label number. */
  347. rtx
  348. gen_label_rtx ()
  349. {
  350. register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_no++);
  351. LABEL_NUSES (label) = 0;
  352. return label;
  353. }
  354. /* Emission of insns (adding them to the doubly-linked list). */
  355. /* Return the first insn of the current function. */
  356. rtx
  357. get_insns ()
  358. {
  359. return first_insn;
  360. }
  361. /* Return the last insn of the current function. */
  362. rtx
  363. get_last_insn ()
  364. {
  365. return last_insn;
  366. }
  367. /* Make and return an INSN rtx, initializing all its slots.
  368. Store PATTERN in the pattern slots.
  369. PAT_FORMALS is an idea that never really went anywhere. */
  370. static rtx
  371. make_insn_raw (pattern, pat_formals)
  372. rtx pattern;
  373. rtvec pat_formals;
  374. {
  375. register rtx insn;
  376. insn = rtx_alloc(INSN);
  377. INSN_UID(insn) = cur_insn_uid++;
  378. PATTERN (insn) = pattern;
  379. INSN_CODE (insn) = -1;
  380. LOG_LINKS(insn) = NULL;
  381. REG_NOTES(insn) = NULL;
  382. return insn;
  383. }
  384. /* Like `make_insn' but make a JUMP_INSN instead of an insn. */
  385. static rtx
  386. make_jump_insn_raw (pattern, pat_formals)
  387. rtx pattern;
  388. rtvec pat_formals;
  389. {
  390. register rtx insn;
  391. insn = rtx_alloc(JUMP_INSN);
  392. INSN_UID(insn) = cur_insn_uid++;
  393. PATTERN (insn) = pattern;
  394. INSN_CODE (insn) = -1;
  395. LOG_LINKS(insn) = NULL;
  396. REG_NOTES(insn) = NULL;
  397. JUMP_LABEL(insn) = NULL;
  398. return insn;
  399. }
  400. /* Add INSN to the end of the doubly-linked list.
  401. INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE. */
  402. static void
  403. add_insn (insn)
  404. register rtx insn;
  405. {
  406. PREV_INSN (insn) = last_insn;
  407. NEXT_INSN (insn) = 0;
  408. if (NULL != last_insn)
  409. NEXT_INSN (last_insn) = insn;
  410. if (NULL == first_insn)
  411. first_insn = insn;
  412. last_insn = insn;
  413. }
  414. /* Add INSN, an rtx of code INSN, into the doubly-linked list
  415. after insn AFTER. */
  416. static void
  417. add_insn_after (insn, after)
  418. rtx insn, after;
  419. {
  420. NEXT_INSN (insn) = NEXT_INSN (after);
  421. PREV_INSN (insn) = after;
  422. if (NEXT_INSN (insn))
  423. PREV_INSN (NEXT_INSN (insn)) = insn;
  424. else
  425. last_insn = insn;
  426. NEXT_INSN (after) = insn;
  427. }
  428. /* Emit an insn of given code and pattern
  429. at a specified place within the doubly-linked list. */
  430. /* Make an instruction with body PATTERN
  431. and output it before the instruction BEFORE. */
  432. rtx
  433. emit_insn_before (pattern, before)
  434. register rtx pattern, before;
  435. {
  436. register rtx insn = make_insn_raw (pattern, 0);
  437. PREV_INSN (insn) = PREV_INSN (before);
  438. NEXT_INSN (insn) = before;
  439. if (PREV_INSN (insn))
  440. NEXT_INSN (PREV_INSN (insn)) = insn;
  441. else
  442. first_insn = insn;
  443. PREV_INSN (before) = insn;
  444. return insn;
  445. }
  446. /* Make an instruction with body PATTERN and code JUMP_INSN
  447. and output it before the instruction BEFORE. */
  448. rtx
  449. emit_jump_insn_before (pattern, before)
  450. register rtx pattern, before;
  451. {
  452. register rtx insn = make_jump_insn_raw (pattern, 0);
  453. PREV_INSN (insn) = PREV_INSN (before);
  454. NEXT_INSN (insn) = before;
  455. if (PREV_INSN (insn))
  456. NEXT_INSN (PREV_INSN (insn)) = insn;
  457. else
  458. first_insn = insn;
  459. PREV_INSN (before) = insn;
  460. return insn;
  461. }
  462. /* Make an insn of code INSN with body PATTERN
  463. and output it after the insn AFTER. */
  464. rtx
  465. emit_insn_after (pattern, after)
  466. register rtx pattern, after;
  467. {
  468. register rtx insn = make_insn_raw (pattern, 0);
  469. add_insn_after (insn, after);
  470. return insn;
  471. }
  472. /* Make an insn of code BARRIER
  473. and output it after the insn AFTER. */
  474. rtx
  475. emit_barrier_after (after)
  476. register rtx after;
  477. {
  478. register rtx insn = rtx_alloc (BARRIER);
  479. INSN_UID (insn) = cur_insn_uid++;
  480. add_insn_after (insn, after);
  481. return insn;
  482. }
  483. /* Emit the label LABEL after the insn AFTER. */
  484. void
  485. emit_label_after (label, after)
  486. rtx label, after;
  487. {
  488. INSN_UID (label) = cur_insn_uid++;
  489. add_insn_after (label, after);
  490. }
  491. /* Emit an insn of given code and pattern
  492. at the end of the doubly-linked list. */
  493. /* Make an insn of code INSN with pattern PATTERN
  494. and add it to the end of the doubly-linked list. */
  495. rtx
  496. emit_insn (pattern)
  497. rtx pattern;
  498. {
  499. register rtx insn = make_insn_raw (pattern, NULL);
  500. add_insn (insn);
  501. return insn;
  502. }
  503. /* Make an insn of code JUMP_INSN with pattern PATTERN
  504. and add it to the end of the doubly-linked list. */
  505. rtx
  506. emit_jump_insn (pattern)
  507. rtx pattern;
  508. {
  509. register rtx insn = make_jump_insn_raw (pattern, NULL);
  510. add_insn (insn);
  511. return insn;
  512. }
  513. /* Make an insn of code CALL_INSN with pattern PATTERN
  514. and add it to the end of the doubly-linked list. */
  515. rtx
  516. emit_call_insn (pattern)
  517. rtx pattern;
  518. {
  519. register rtx insn = make_insn_raw (pattern, NULL);
  520. add_insn (insn);
  521. PUT_CODE (insn, CALL_INSN);
  522. return insn;
  523. }
  524. /* Add the label LABEL to the end of the doubly-linked list. */
  525. void
  526. emit_label (label)
  527. rtx label;
  528. {
  529. INSN_UID (label) = cur_insn_uid++;
  530. add_insn (label);
  531. }
  532. /* Make an insn of code BARRIER
  533. and add it to the end of the doubly-linked list. */
  534. void
  535. emit_barrier ()
  536. {
  537. register rtx barrier = rtx_alloc (BARRIER);
  538. INSN_UID (barrier) = cur_insn_uid++;
  539. add_insn (barrier);
  540. }
  541. /* Make an insn of code NOTE
  542. with data-fields specified by FILE and LINE
  543. and add it to the end of the doubly-linked list. */
  544. void
  545. emit_note (file, line)
  546. char *file;
  547. int line;
  548. {
  549. register rtx linenum;
  550. if (no_line_numbers && line > 0)
  551. return;
  552. if (line > 0)
  553. {
  554. if (file && last_filename && !strcmp (file, last_filename)
  555. && line == last_linenum)
  556. return;
  557. last_filename = file;
  558. last_linenum = line;
  559. }
  560. linenum = rtx_alloc (NOTE);
  561. INSN_UID (linenum) = cur_insn_uid++;
  562. XSTR (linenum, 3) = file;
  563. XINT (linenum, 4) = line;
  564. add_insn (linenum);
  565. }
  566. /* Initialize data structures and variables in this file
  567. before generating rtl for each function.
  568. WRITE_SYMBOLS is nonzero if any kind of debugging info
  569. is to be generated. */
  570. void
  571. init_emit (write_symbols)
  572. int write_symbols;
  573. {
  574. first_insn = NULL;
  575. last_insn = NULL;
  576. cur_insn_uid = 1;
  577. reg_rtx_no = FIRST_PSEUDO_REGISTER;
  578. last_linenum = 0;
  579. last_filename = 0;
  580. real_constant_chain = 0;
  581. no_line_numbers = ! write_symbols;
  582. /* Create the unique rtx's for certain rtx codes and operand values. */
  583. pc_rtx = gen_rtx (PC, VOIDmode);
  584. cc0_rtx = gen_rtx (CC0, VOIDmode);
  585. /* Don't use gen_rtx here since gen_rtx in this case
  586. tries to use these variables. */
  587. const0_rtx = rtx_alloc (CONST_INT);
  588. INTVAL (const0_rtx) = 0;
  589. const1_rtx = rtx_alloc (CONST_INT);
  590. INTVAL (const1_rtx) = 1;
  591. fconst0_rtx = rtx_alloc (CONST_DOUBLE);
  592. {
  593. union { double d; int i[2]; } u;
  594. u.d = 0;
  595. XINT (fconst0_rtx, 0) = u.i[0];
  596. XINT (fconst0_rtx, 1) = u.i[1];
  597. }
  598. PUT_MODE (fconst0_rtx, SFmode);
  599. dconst0_rtx = rtx_alloc (CONST_DOUBLE);
  600. {
  601. union { double d; int i[2]; } u;
  602. u.d = 0;
  603. XINT (dconst0_rtx, 0) = u.i[0];
  604. XINT (dconst0_rtx, 1) = u.i[1];
  605. }
  606. PUT_MODE (dconst0_rtx, DFmode);
  607. /* Init the tables that describe all the pseudo regs. */
  608. regno_pointer_flag_length = 100;
  609. regno_pointer_flag
  610. = (char *) oballoc (regno_pointer_flag_length);
  611. bzero (regno_pointer_flag, regno_pointer_flag_length);
  612. regno_reg_rtx
  613. = (rtx *) oballoc (regno_pointer_flag_length * sizeof (rtx));
  614. bzero (regno_reg_rtx, regno_pointer_flag_length * sizeof (rtx));
  615. }