home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / gcc / bug / 3044 < prev    next >
Encoding:
Text File  |  1992-12-22  |  61.8 KB  |  2,244 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!isa.DE!luik
  3. From: luik@isa.DE (Andreas Luik)
  4. Subject: jump optimization may create insns with virtual_regs
  5. Message-ID: <9212221748.AA11922@einstein.isa.de>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 22 Dec 1992 19:48:52 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 2231
  12.  
  13. Program:    gcc
  14. Version:    2.3.2
  15.  
  16. Host:        sparc-sun-sunos4.1.3
  17. Target:        own (all that meet some conditions)
  18. Area:        cc1/jump-optimization
  19.  
  20. Input file:     cc.c
  21.  
  22. int compare (int a, int b)
  23. {
  24.     if (a >= b)
  25.     if (a == b)
  26.         return (0);
  27.     else
  28.         return (1);
  29.     else
  30.     return (-1);
  31. }
  32.  
  33. gcc command:    gcc -S -O cc.c
  34.  
  35. Synopsis:    jump optimization may create insns with virtual_regs
  36.  
  37. Description:
  38.  
  39.     Suppose a target description with the following properties:
  40.     
  41.     1. no setcc insns
  42.     2. PUSH_ROUNDING undefined
  43.     3. BRANCH_COST 1
  44.     4. no ashiftrt or lshiftrt insn defined, so libcall must be used
  45.     
  46.     Then jump_optimize will convert the insns as follows:
  47.     
  48.     before jump optimization: (file cc.c.rtl):
  49.     
  50.     ;; Function compare
  51.     
  52.     (note 2 0 3 "" NOTE_INSN_DELETED)
  53.     
  54.     (insn 3 2 4 (set (reg/v:SI 20)
  55.         (mem:SI (reg:SI 16))) -1 (nil)
  56.         (expr_list:REG_EQUIV (mem:SI (reg:SI 16))
  57.         (nil)))
  58.     
  59.     (insn 4 3 5 (set (reg/v:SI 21)
  60.         (mem:SI (plus:SI (reg:SI 16)
  61.             (const_int 4)))) -1 (nil)
  62.         (expr_list:REG_EQUIV (mem:SI (plus:SI (reg:SI 16)
  63.             (const_int 4)))
  64.         (nil)))
  65.     
  66.     (note 5 4 6 "" NOTE_INSN_FUNCTION_BEG)
  67.     
  68.     (note 6 5 8 "" NOTE_INSN_DELETED)
  69.     
  70.     (note 8 6 9 "" NOTE_INSN_DELETED)
  71.     
  72.     (insn 9 8 10 (set (cc0)
  73.         (compare (reg/v:SI 20)
  74.             (reg/v:SI 21))) -1 (nil)
  75.         (nil))
  76.     
  77.     (jump_insn 10 9 12 (set (pc)
  78.         (if_then_else (lt (cc0)
  79.             (const_int 0))
  80.             (label_ref 30)
  81.             (pc))) 12 {blt} (nil)
  82.         (nil))
  83.     
  84.     (insn 12 10 13 (set (cc0)
  85.         (compare (reg/v:SI 20)
  86.             (reg/v:SI 21))) -1 (nil)
  87.         (nil))
  88.     
  89.     (jump_insn 13 12 15 (set (pc)
  90.         (if_then_else (ne (cc0)
  91.             (const_int 0))
  92.             (label_ref 21)
  93.             (pc))) 9 {bne} (nil)
  94.         (nil))
  95.     
  96.     (insn 15 13 16 (set (reg/i:SI 1 R1)
  97.         (const_int 0)) -1 (nil)
  98.         (nil))
  99.     
  100.     (insn 16 15 17 (use (reg/i:SI 1 R1)) -1 (nil)
  101.         (nil))
  102.     
  103.     (jump_insn 17 16 18 (set (pc)
  104.         (label_ref 40)) -1 (nil)
  105.         (nil))
  106.     
  107.     (barrier 18 17 19)
  108.     
  109.     (jump_insn 19 18 20 (set (pc)
  110.         (label_ref 27)) -1 (nil)
  111.         (nil))
  112.     
  113.     (barrier 20 19 21)
  114.     
  115.     (code_label 21 20 23 3 "")
  116.     
  117.     (insn 23 21 24 (set (reg/i:SI 1 R1)
  118.         (const_int 1)) -1 (nil)
  119.         (nil))
  120.     
  121.     (insn 24 23 25 (use (reg/i:SI 1 R1)) -1 (nil)
  122.         (nil))
  123.     
  124.     (jump_insn 25 24 26 (set (pc)
  125.         (label_ref 40)) -1 (nil)
  126.         (nil))
  127.     
  128.     (barrier 26 25 27)
  129.     
  130.     (code_label 27 26 28 4 "")
  131.     
  132.     (jump_insn 28 27 29 (set (pc)
  133.         (label_ref 36)) -1 (nil)
  134.         (nil))
  135.     
  136.     (barrier 29 28 30)
  137.     
  138.     (code_label 30 29 32 2 "")
  139.     
  140.     (insn 32 30 33 (set (reg/i:SI 1 R1)
  141.         (const_int -1)) -1 (nil)
  142.         (nil))
  143.     
  144.     (insn 33 32 34 (use (reg/i:SI 1 R1)) -1 (nil)
  145.         (nil))
  146.     
  147.     (jump_insn 34 33 35 (set (pc)
  148.         (label_ref 40)) -1 (nil)
  149.         (nil))
  150.     
  151.     (barrier 35 34 36)
  152.     
  153.     (code_label 36 35 38 5 "")
  154.     
  155.     (note 38 36 40 "" NOTE_INSN_FUNCTION_END)
  156.     
  157.     (code_label 40 38 0 1 "")
  158.     
  159.     after jump optimization (file cc.c.jump):
  160.     
  161.     ;; Function compare
  162.     
  163.     (note 2 0 3 "" NOTE_INSN_DELETED)
  164.     
  165.     (insn 3 2 4 (set (reg/v:SI 20)
  166.         (mem:SI (reg:SI 14 R14))) -1 (nil)
  167.         (expr_list:REG_EQUIV (mem:SI (reg:SI 14 R14))
  168.         (nil)))
  169.     
  170.     (insn 4 3 5 (set (reg/v:SI 21)
  171.         (mem:SI (plus:SI (reg:SI 14 R14)
  172.             (const_int 4)))) -1 (nil)
  173.         (expr_list:REG_EQUIV (mem:SI (plus:SI (reg:SI 14 R14)
  174.             (const_int 4)))
  175.         (nil)))
  176.     
  177.     (note 5 4 6 "" NOTE_INSN_FUNCTION_BEG)
  178.     
  179.     (note 6 5 8 "" NOTE_INSN_DELETED)
  180.     
  181.     (note 8 6 9 "" NOTE_INSN_DELETED)
  182.     
  183.     (insn 9 8 10 (set (cc0)
  184.         (compare (reg/v:SI 20)
  185.             (reg/v:SI 21))) -1 (nil)
  186.         (nil))
  187.     
  188.     (jump_insn 10 9 43 (set (pc)
  189.         (if_then_else (lt (cc0)
  190.             (const_int 0))
  191.             (label_ref 30)
  192.             (pc))) 12 {blt} (nil)
  193.         (nil))
  194.     
  195.     (insn 43 10 44 (set (reg/i:SI 1 R1)
  196.         (const_int 1)) -1 (nil)
  197.         (nil))
  198.     
  199.     (insn 44 43 45 (set (reg:SI 22)
  200.         (xor:SI (reg/v:SI 20)
  201.             (reg/v:SI 21))) -1 (nil)
  202.         (nil))
  203.     
  204.     (insn 45 44 46 (set (reg:SI 23)
  205.         (neg:SI (reg:SI 22))) -1 (nil)
  206.         (nil))
  207.     
  208.     (insn 46 45 47 (set (reg:SI 24)
  209.         (ior:SI (reg:SI 23)
  210.             (reg:SI 22))) -1 (nil)
  211.         (nil))
  212.     
  213.     (insn 47 46 48 (set (reg:SI 15 R15)
  214.         (plus:SI (reg:SI 15 R15)
  215.             (const_int -8))) -1 (nil)
  216.         (insn_list:REG_LIBCALL 53 (nil)))
  217.     
  218.     (insn 48 47 49 (set (mem:SI (reg:SI 19))
  219.         (reg:SI 24)) -1 (nil)
  220.         (nil))
  221.     
  222.     (insn 49 48 51 (set (mem:SI (plus:SI (reg:SI 19)
  223.             (const_int 4)))
  224.         (const_int 31)) -1 (nil)
  225.         (nil))
  226.     
  227.     (call_insn/u 51 49 52 (set (reg:SI 1 R1)
  228.         (call (mem:SI (symbol_ref:SI ("__lshrsi3")))
  229.             (const_int 8))) -1 (nil)
  230.         (nil))
  231.     
  232.     (insn 52 51 53 (set (reg:SI 15 R15)
  233.         (plus:SI (reg:SI 15 R15)
  234.             (const_int 8))) -1 (nil)
  235.         (nil))
  236.     
  237.     (insn 53 52 54 (set (reg:SI 25)
  238.         (reg:SI 1 R1)) -1 (nil)
  239.         (insn_list:REG_RETVAL 47 (expr_list:REG_EQUAL (lshiftrt:SI (reg:SI 24)
  240.             (const_int 31))
  241.             (nil))))
  242.     
  243.     (insn 54 53 25 (set (reg/i:SI 1 R1)
  244.         (reg:SI 25)) -1 (nil)
  245.         (nil))
  246.     
  247.     (jump_insn 25 54 26 (set (pc)
  248.         (label_ref 42)) -1 (nil)
  249.         (nil))
  250.     
  251.     (barrier 26 25 30)
  252.     
  253.     (code_label 30 26 32 2 "")
  254.     
  255.     (insn 32 30 42 (set (reg/i:SI 1 R1)
  256.         (const_int -1)) -1 (nil)
  257.         (nil))
  258.     
  259.     (code_label 42 32 41 6 "")
  260.     
  261.     (insn 41 42 0 (use (reg/i:SI 1 R1)) -1 (nil)
  262.         (nil))
  263.     
  264.     Please note, that insns 48 and 49 use pseudo register 19, that is the
  265.     VIRTUAL_OUTGOING_ARGS_REGNUM (virtual_outgoing_args_rtx) returned by
  266.     push_block() and used by emit_library_call(). As these virtual
  267.     registers are resolved before jump optimization but never afterwards,
  268.     the compiler will crash in the reload phase.
  269.     
  270.     The following traceback shows the function calls down to the
  271.     push_block call returning the virtual registers:
  272.     
  273.     #0  push_block (size=0x16acc0, extra=0, below=0) at expr.c:1557
  274.     #1  0x6e3e0 in emit_library_call (__builtin_va_alist=1521800) at expr.c:2089
  275.     #2  0x8affc in expand_binop (mode=SImode, binoptab=0x174910, op0=0x16be38, 
  276.     op1=0x16ad78, target=0x16be38, unsignedp=1, methods=OPTAB_LIB_WIDEN)
  277.     at optabs.c:1078
  278.     #3  0x82920 in expand_shift (code=RSHIFT_EXPR, mode=SImode, shifted=0x16be38, 
  279.     amount=0x177148, target=0x16be38, unsignedp=1) at expmed.c:1540
  280.     #4  0x86514 in emit_store_flag (target=0x16bdb0, code=NE, op0=0x16bdb0, 
  281.     op1=0x16ac80, mode=SImode, unsignedp=0, normalizep=1) at expmed.c:3027
  282.     #5  0x85fb4 in emit_store_flag (target=0x16bdb0, code=NE, op0=0x16d8c0, 
  283.     op1=0x16d920, mode=SImode, unsignedp=0, normalizep=1) at expmed.c:2904
  284.     #6  0xafa94 in jump_optimize (f=0x16d748, cross_jump=0, noop_moves=0, 
  285.     after_regscan=1) at jump.c:1095
  286.     #7  0x3a938 in rest_of_compilation (decl=0x177060) at toplev.c:2288
  287.     #8  0x20f88 in finish_function (nested=0) at c-decl.c:6088
  288.     #9  0x896c in yyparse () at c-parse.y:269
  289.     #10 0x39790 in compile_file (name=0xf7fffac2 "../test/cc.c") at toplev.c:1803
  290.     #11 0x3d808 in main (argc=5, argv=0xf7fff9ec, envp=0xf7fffa04) at toplev.c:3285
  291.  
  292. Reproduce with:
  293.  
  294.     Unshar the following SHAR-file. It contains the following files:
  295.         risc32.md
  296.         risc32.c
  297.         risc32.h
  298.         xm-risc32.h
  299.         cc.c (the test program)
  300.  
  301.     Configure gcc as a cross-compiler with the appropriate links:
  302.         tm.h -> risc32.h
  303.         config.h -> <config file of host> e.g. config/xm-sparc.h
  304.         md -> risc32.md
  305.         tconfig.h -> xm-risc32.h
  306.         aux-output.c -> risc32.c
  307.         hconfig.h -> <config file of host> e.g. config/xm-sparc.h
  308.  
  309.     Build cc1 using "make"
  310.     Try gcc with call.c: "./gcc -B./ -O2 -da -S cc.c"
  311.     Check the dumped insn information.
  312.  
  313. Fix:
  314.  
  315.     Either the virtual registers must get instantiated again after
  316.     jump optimization using another call to
  317.     instantiate_virtual_regs(current_function_decl, get_insns ()) in
  318.     toplev.c (I tried that, it seems to work), or jump optimization
  319.     should not create library calls (which seems to make sense but may
  320.     need some additional conditions at different places, so I didn't try
  321.     that). Maybe instantiate_virtual_regs() may be called on the
  322.     sequence of insns created by jump_optimize() only.
  323.  
  324.     I finally aviod the problem by defining BRANCH_COST as 0 because then
  325.     jump optimization will not try to replace the jumps with arithmetic
  326.     computations. If you think this is the correct way to avoid the problem,
  327.     the documentation of BRANCH_COST should get updated to describe that.
  328.  
  329. #!/bin/sh
  330. # This is a shell archive (produced by shar 3.49)
  331. # To extract the files from this archive, save it to a file, remove
  332. # everything above the "!/bin/sh" line above, and type "sh file_name".
  333. #
  334. # made 12/21/1992 19:17 UTC by luik@ramses
  335. # Source directory /tmp/shar
  336. #
  337. # existing files will NOT be overwritten unless -c is specified
  338. #
  339. # This shar contains:
  340. # length  mode       name
  341. # ------ ---------- ------------------------------------------
  342. #    123 -rw-rw-r-- cc.c
  343. #  14894 -rw-rw-r-- risc32.c
  344. #  20416 -rw-rw-r-- risc32.h
  345. #  13802 -rw-rw-r-- risc32.md
  346. #   1657 -rw-rw-r-- xm-risc32.h
  347. #
  348. # ============= cc.c ==============
  349. if test -f 'cc.c' -a X"$1" != X"-c"; then
  350.     echo 'x - skipping cc.c (File already exists)'
  351. else
  352. echo 'x - extracting cc.c (Text)'
  353. sed 's/^X//' << 'SHAR_EOF' > 'cc.c' &&
  354. int compare (int a, int b)
  355. {
  356. X    if (a >= b)
  357. X    if (a == b)
  358. X        return (0);
  359. X    else
  360. X        return (1);
  361. X    else
  362. X    return (-1);
  363. }
  364. SHAR_EOF
  365. chmod 0664 cc.c ||
  366. echo 'restore of cc.c failed'
  367. Wc_c="`wc -c < 'cc.c'`"
  368. test 123 -eq "$Wc_c" ||
  369.     echo 'cc.c: original size 123, current size' "$Wc_c"
  370. fi
  371. # ============= risc32.c ==============
  372. if test -f 'risc32.c' -a X"$1" != X"-c"; then
  373.     echo 'x - skipping risc32.c (File already exists)'
  374. else
  375. echo 'x - extracting risc32.c (Text)'
  376. sed 's/^X//' << 'SHAR_EOF' > 'risc32.c' &&
  377. /* Subroutines for insn-output.c for IMS RISC32 controller.
  378. X   Copyright (C) 1992 Andreas Luik <luik@isa.de>.
  379. X
  380. This file is part of GNU CC.
  381. X
  382. GNU CC is free software; you can redistribute it and/or modify
  383. it under the terms of the GNU General Public License as published by
  384. the Free Software Foundation; either version 2, or (at your option)
  385. any later version.
  386. X
  387. GNU CC is distributed in the hope that it will be useful,
  388. but WITHOUT ANY WARRANTY; without even the implied warranty of
  389. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  390. GNU General Public License for more details.
  391. X
  392. You should have received a copy of the GNU General Public License
  393. along with GNU CC; see the file COPYING.  If not, write to
  394. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  395. X
  396. #include <assert.h>
  397. #include <stdio.h>
  398. #include "config.h"
  399. #include "rtl.h"
  400. #include "regs.h"
  401. #include "hard-reg-set.h"
  402. #include "insn-config.h"
  403. #include "conditions.h"
  404. #include "output.h"
  405. #include "flags.h"
  406. X
  407. X
  408. char *risc32_inline_shift_limit_cp;
  409. int risc32_inline_shift_limit = 6;
  410. X
  411. extern char call_used_regs[];
  412. X
  413. X
  414. X
  415. /*
  416. **  const_to_logical_const computes an immediate operand for any of the logical
  417. **  operations (XOR, OR, AND) of the RISC32. The constant used in the instruction
  418. **  specifies the number of the bit to be manipulated (the bit is either set
  419. **  or cleared). The functions returns 0 if the bit_value does not match.
  420. */
  421. X
  422. int const_to_logical_const (bit_value, inst_value)
  423. int bit_value;            /* constant to be checked */
  424. int *inst_value;        /* RETURN: constant to be used in assembler */
  425. {
  426. X    register int i;
  427. X    register int b;
  428. X    int dummy;
  429. X
  430. X    if (inst_value == NULL)
  431. X    inst_value = &dummy;
  432. X
  433. X    for (i = 0, b = 1; i < BITS_PER_WORD; i++, b <<= 1) {
  434. X    if (bit_value == b) {
  435. X        *inst_value = i;
  436. X        return (1);
  437. X    }
  438. X    if (~bit_value == b) {
  439. X        *inst_value = i | (1 << 4);
  440. X        return (1);
  441. X    }
  442. X    }
  443. X    return (0);
  444. }
  445. X
  446. X
  447. /*
  448. **  operand_to_logical_operand returns the CONST_INT rtx with the value
  449. **  const_to_logical_const() of the parameter op if its mode is CONST_INT.
  450. */
  451. X
  452. rtx operand_to_logical_operand (op)
  453. rtx op;
  454. {
  455. X    if (GET_CODE (op) == CONST_INT) {
  456. X    int immediate;
  457. X        if (const_to_logical_const (INTVAL (op), &immediate))
  458. X            return (GEN_INT (immediate));
  459. X    abort ();
  460. X    /*NOTREACHED*/
  461. X    }
  462. X    return op;
  463. }
  464. X
  465. X
  466. X
  467. /*
  468. **  notice_update_cc is called by the final phase for each insn (exp is the
  469. **  insn pattern). It is used to eliminate spurious test and compare insns.
  470. **  It must set the value1 and value2 fields in cc_status to the rtls
  471. **  representing the current condition codes settings as well as the flags
  472. **  field (the flags and cc_status is defined in conditions.h).
  473. **
  474. **  Currently only some easy cases are handled: 
  475. **  1. none of the jump insn change the condition codes
  476. **  2. insns that explicitly set CC0 (test and compare) are handled properly
  477. **  3. all other insn initialize cc_status.
  478. **
  479. **  These cases at least optimize the code generated for case statements.
  480. */
  481. X
  482. void notice_update_cc (exp, insn)
  483. rtx exp;
  484. rtx insn;
  485. {
  486. X    if (GET_CODE (insn) == JUMP_INSN)
  487. X    return;
  488. X
  489. X    if ((GET_CODE (exp) == SET
  490. X     && GET_CODE (SET_DEST (exp)) == CC0)) {
  491. X    cc_status.flags = 0;
  492. X    cc_status.value1 = XEXP (exp, 0);
  493. X    cc_status.value2 = XEXP (exp, 1);
  494. X    return;
  495. X    }
  496. X
  497. X    if ((GET_CODE (exp) == PARALLEL
  498. X     && GET_CODE (XVECEXP (exp, 0, 0)) == SET
  499. X     && GET_CODE (XEXP (XVECEXP (exp, 0, 0), 0)) == CC0)) {
  500. X    cc_status.flags = 0;
  501. X    cc_status.value1 = XEXP (XVECEXP (exp, 0, 0), 0);
  502. X    cc_status.value2 = XEXP (XVECEXP (exp, 0, 0), 1);
  503. X    return;
  504. X    }
  505. X
  506. X    CC_STATUS_INIT;
  507. }
  508. X
  509. X
  510. X
  511. /*
  512. **  initial_frame_pointer_offset computes the offset between the frame pointer
  513. **  and the stack pointer immediately after the function prologue. It must
  514. **  add the frame size and the sizes of the registers that must be saved on
  515. **  the stack.
  516. */
  517. X
  518. int
  519. initial_frame_pointer_offset ()
  520. {
  521. X    int regno;
  522. X    int offset = get_frame_size() ;
  523. X
  524. X    for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  525. X    if (regs_ever_live[regno] && !call_used_regs[regno])
  526. X        if (!(frame_pointer_needed && regno == FRAME_POINTER_REGNUM))
  527. X        offset += UNITS_PER_WORD;
  528. X
  529. X    return (offset);
  530. }
  531. X
  532. X
  533. X
  534. /*
  535. **  output_function_prologue writes to the file f the assembler statements
  536. **  for the start of an assembler procedure. It sets up the stack frame,
  537. **  initializes the frame pointer, saves registers used in the function
  538. **  and allocates size additional bytes on the stack.
  539. */
  540. X
  541. void
  542. output_function_prologue (f, size)
  543. FILE *f;
  544. int size;            /* bytes to allocate on stack */
  545. {
  546. X    register int regno;
  547. X    int num_saved_regs;
  548. X
  549. X    assert (size >= 0);
  550. X    if (frame_pointer_needed) {
  551. X    asm_fprintf (f, "\tPUSH\t%0R%s\n", reg_names[FRAME_POINTER_REGNUM]);
  552. X    asm_fprintf (f, "\tMOV\t%0R%s,%0R%s\n",
  553. X             reg_names[FRAME_POINTER_REGNUM],
  554. X             reg_names[STACK_POINTER_REGNUM]);
  555. X    }
  556. X    else {
  557. X    if (size > 16)        /* push SP (restore would be too expensive) */
  558. X        asm_fprintf (f, "\tPUSH\t%0R%s\n", reg_names[STACK_POINTER_REGNUM]);
  559. X    }
  560. X
  561. X    if (size) {
  562. X    if (size <= 16) {
  563. X        asm_fprintf (f, "\tADD\t%0R%s,%0R%s,%0I%d\n",
  564. X             reg_names[STACK_POINTER_REGNUM],
  565. X             reg_names[STACK_POINTER_REGNUM],
  566. X             -size);
  567. X    }
  568. X    else if (size <= 0x8000) {
  569. X        asm_fprintf (f, "\tLDI\t%0R%s,%0I%d\n",
  570. X             reg_names[FUNCTION_VALUE_REGNUM],
  571. X             -size);
  572. X        asm_fprintf (f, "\tADD\t%0R%s,%0R%s,%0R%s\n",
  573. X             reg_names[STACK_POINTER_REGNUM],
  574. X             reg_names[STACK_POINTER_REGNUM],
  575. X             reg_names[FUNCTION_VALUE_REGNUM]);
  576. X    }
  577. X    else
  578. X        error ("too many local variables");
  579. X    }
  580. X
  581. X    if (TARGET_STACK_CHECK) {
  582. X    /* XXX to be written */
  583. X    }
  584. X
  585. X    /*
  586. X    **  Save all used registers. Note that the frame pointer register needs
  587. X    **  not to be saved if it is used as a frame pointer.
  588. X    */
  589. X
  590. X    num_saved_regs = 0;
  591. X    for (regno = FIRST_PSEUDO_REGISTER - 1; regno >= 0; regno--)
  592. X    if (regs_ever_live[regno] && !call_used_regs[regno])
  593. X        if (!(frame_pointer_needed && regno == FRAME_POINTER_REGNUM)) {
  594. X        num_saved_regs++;
  595. X        asm_fprintf (f, "\tST\t%0R%s,%0R%s,%0I%d\n",
  596. X                 reg_names[regno],
  597. X                 reg_names[STACK_POINTER_REGNUM],
  598. X                 -num_saved_regs);
  599. X        }
  600. X
  601. X    if (num_saved_regs)        /* maximum value = 16 (FIRST_PSEUDO_REGISTER) */
  602. X    asm_fprintf (f, "\tADD\t%0R%s,%0R%s,%0I%d\n",
  603. X             reg_names[STACK_POINTER_REGNUM],
  604. X             reg_names[STACK_POINTER_REGNUM],
  605. X             -num_saved_regs);
  606. }
  607. X
  608. X
  609. /*
  610. **  output_function_epilogue writes the asse,bler code to exit from a function
  611. **  the the assembler file f. It must restore the register values and the
  612. **  stack pointer to their values when the function was called.
  613. **  For documentation purposes, this function outputs a comment with "RET".
  614. **  The "ENDPROC" assembler directive is written by ASM_DECLARE_FUNCTION_SIZE
  615. **  because there it is easier to get the function name.
  616. **  Note that this function should not depend on the value of the stack pointer
  617. **  register (see documentation of EXIT_IGNORE_STACK).
  618. */
  619. X
  620. void
  621. output_function_epilogue (f, size)
  622. FILE *f;
  623. int size;            /* same as for output_function_prologue */
  624. {
  625. X    register int regno;
  626. X    register int nregs;        /* number of registers saved on stack */
  627. X    int offset;            /* max offset from FP/SP to saved registers */
  628. X    int inc;
  629. X    rtx insn;
  630. X
  631. X    /*
  632. X    **  If the last insn was a BARRIER, we don't have to write any code. But
  633. X    **  lets output a no-op so that debuggers don't get confused about which
  634. X    **  function the pc is in at this address.
  635. X    */
  636. X
  637. X    insn = get_last_insn ();
  638. X    if (GET_CODE (insn) == NOTE)
  639. X    insn = prev_nonnote_insn (insn);
  640. X    if (insn && GET_CODE (insn) == BARRIER) {
  641. X    asm_fprintf (f, "\tNOP\n");
  642. X    return;
  643. X    }
  644. X
  645. X    assert (current_function_pops_args == 0);
  646. X    assert (size >= 0);
  647. X
  648. #ifdef FUNCTION_EXTRA_EPILOGUE
  649. X    FUNCTION_EXTRA_EPILOGUE (f, size);
  650. #endif
  651. X
  652. X    if (frame_pointer_needed) {
  653. X    nregs = 0;        /* get number of saved registers on stack */
  654. X    for (regno = FIRST_PSEUDO_REGISTER - 1; regno >= 0; regno--)
  655. X        if (regs_ever_live[regno] && !call_used_regs[regno])
  656. X        if (!(frame_pointer_needed && regno == FRAME_POINTER_REGNUM))
  657. X            nregs++;
  658. X
  659. X    offset = nregs + size;
  660. X
  661. X    for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  662. X        if (regs_ever_live[regno] && !call_used_regs[regno])
  663. X        if (!(regno == FRAME_POINTER_REGNUM)) {
  664. X            if (offset <= 16) {    /* may address saved value directly */
  665. X            asm_fprintf (f, "\tLD\t%0R%s,%0R%s,%0I%d\n",
  666. X                     reg_names[regno],
  667. X                     reg_names[FRAME_POINTER_REGNUM],
  668. X                     -offset);
  669. X            }
  670. X            else {    /* need to address using index register */
  671. X            assert (offset <= 0x8000);
  672. X            asm_fprintf (f, "\tLDI\t%0R%s,%0I%d\n",
  673. X                     reg_names[regno],
  674. X                     -offset);
  675. X            asm_fprintf (f, "\tLD\t%0R%s,%0R%s,%0R%s\n",
  676. X                     reg_names[regno],
  677. X                     reg_names[FRAME_POINTER_REGNUM],
  678. X                     reg_names[regno]);
  679. X            }
  680. X            offset--;
  681. X        }
  682. X
  683. X    asm_fprintf (f, "\tMOV\t%0R%s,%0R%s\n", /* restore stack pointer */
  684. X             reg_names[STACK_POINTER_REGNUM],
  685. X             reg_names[FRAME_POINTER_REGNUM]);
  686. X    asm_fprintf (f, "\tPOP\t%0R%s\n", /* restore frame pointer */
  687. X             reg_names[FRAME_POINTER_REGNUM]);
  688. X    }
  689. X    else {
  690. X    nregs = 0;
  691. X    for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  692. X        if (regs_ever_live[regno] && !call_used_regs[regno]) {
  693. X        asm_fprintf (f, "\tLD\t%0R%s,%0R%s,%0I%d\n",
  694. X                 reg_names[regno],
  695. X                 reg_names[STACK_POINTER_REGNUM],
  696. X                 nregs);
  697. X        nregs++;
  698. X        }
  699. X
  700. X    if (size <= 16) {    /* restore SP value by adding the offset value */
  701. X        offset = nregs + size; /* maximum offset value is 32 */
  702. X
  703. X        while (offset > 0) { /* should be executed at most twice */
  704. X        inc = (offset > 16) ? 16 : offset;
  705. X        asm_fprintf (f, "\tSUB\t%0R%s,%0R%s,%0I%d\n",
  706. X                 reg_names[STACK_POINTER_REGNUM],
  707. X                 reg_names[STACK_POINTER_REGNUM],
  708. X                 -inc);
  709. X        offset -= inc;
  710. X        }
  711. X    }
  712. X    else {            /* SP was pushed by prologue in this case */
  713. X        asm_fprintf (f, "\tPOP\t%0R%s\n", reg_names[STACK_POINTER_REGNUM]);
  714. X    }
  715. X    }
  716. X
  717. X    asm_fprintf (f, "\t;;; RET\n");
  718. }
  719. X
  720. X
  721. /*
  722. **  A C compound statement to output to stdio stream f the
  723. **  assembler syntax for an instruction operand op. op is an RTL
  724. **  expression.
  725. **
  726. **  letter is a value that can be used to specify one of several ways
  727. **  of printing the operand.  It is used when identical operands
  728. **  must be printed differently depending on the context.  letter
  729. **  comes from the `%' specification that was used to request
  730. **  printing of the operand.  If the specification was just `%DIGIT'
  731. **  then letter is 0; if the specification was `%LTR DIGIT' then letter
  732. **  is the ASCII letter for LTR.
  733. **
  734. **  If op is a register, this macro should print the register's name.
  735. **  The names can be found in an array `reg_names' whose type is
  736. **  `char *[]'.  `reg_names' is initialized from `REGISTER_NAMES'.
  737. **
  738. **  When the machine description has a specification `%PUNCT' (a `%'
  739. **  followed by a punctuation character), this macro is called with
  740. **  a null pointer for op and the punctuation character for letter.
  741. **
  742. **  The risc32 specific letters are:
  743. **
  744. **  '#' for an immediate operand prefix
  745. **  '%' for a register operand prefix
  746. */
  747. X
  748. void
  749. print_operand (f, op, letter)
  750. FILE *f;        /* file to write to */
  751. rtx op;            /* operand to print */
  752. int letter;        /* %<letter> or 0 */
  753. {
  754. X    switch (letter) {
  755. X      case '#':
  756. X    asm_fprintf (f, "%0I");
  757. X    break;
  758. X
  759. X      case '%':
  760. X    asm_fprintf (f, "%0R");
  761. X    break;
  762. X
  763. X      default:
  764. X    abort ();
  765. X    /*NOTREACHED*/
  766. X
  767. X      case 0:
  768. X    switch (GET_CODE (op)) {
  769. X      case REG:
  770. X        asm_fprintf (f, "%0R%s", reg_names[REGNO (op)]);
  771. X        break;
  772. X
  773. X      case MEM:
  774. X        output_address (XEXP (op, 0));
  775. X        break;
  776. X
  777. X      case CONST:
  778. X      case CONST_INT:
  779. X      case LABEL_REF:
  780. X      case SYMBOL_REF:
  781. X        asm_fprintf (f, "%0I");
  782. X        output_addr_const (f, op);
  783. X        break;
  784. X
  785. X      default:
  786. X        fprintf (stderr, "print_operand: unknown code %d\n", GET_CODE (op));
  787. X        abort ();
  788. X        /*NOTREACHED*/
  789. X    }
  790. X    }
  791. }
  792. X
  793. X
  794. /*
  795. **  A C compound statement to output to stdio stream f the
  796. **  assembler syntax for an instruction operand that is a memory
  797. **  reference whose address is addr.  addr is an RTL expression.
  798. */
  799. X
  800. void
  801. print_operand_address (f, addr)
  802. FILE *f;
  803. rtx addr;
  804. {
  805. X    rtx base;
  806. X    rtx offset = 0;
  807. X    rtx index = 0;
  808. X
  809. X    switch (GET_CODE (addr)) {
  810. X      case REG:
  811. X    asm_fprintf (f, "%0R%s", reg_names[REGNO (addr)]);
  812. X    break;
  813. X
  814. X      case PLUS:
  815. X    if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
  816. X        offset = XEXP (addr, 0), base = XEXP (addr, 1);
  817. X    else if (GET_CODE (XEXP (addr, 1)) == CONST_INT)
  818. X        offset = XEXP (addr, 1), base = XEXP (addr, 0);
  819. X    else
  820. X        index = XEXP (addr, 1), base = XEXP (addr, 0);
  821. X
  822. X    asm_fprintf (f, "%0R%s", reg_names [REGNO (base)]);
  823. X    if (index)
  824. X        asm_fprintf (f, ",%0R%s", reg_names [REGNO (index)]);
  825. X    else {
  826. X        assert (((unsigned) INTVAL (offset) + 16) < 32);
  827. X        asm_fprintf (f, ",");
  828. X        output_addr_const (f, offset);
  829. X    }
  830. X    break;
  831. X
  832. X      case CONST:
  833. X      case CONST_INT:
  834. X      case LABEL_REF:
  835. X      case SYMBOL_REF:
  836. X    output_addr_const (f, addr);
  837. X    break;
  838. X
  839. X      default:
  840. X    fprintf (stderr, "print_operand_address: unknown code %d\n", 
  841. X         GET_CODE (addr));
  842. X    abort ();
  843. X    /*NOTREACHED*/
  844. X    }
  845. }
  846. X
  847. X
  848. /*
  849. **  r32_call_operand checks whether op is a legal operand for a RISC32 CALL
  850. **  instruction. Most call operands are memory references. These are ignored
  851. **  by calling r32_call_operand recursivly with the first expression of the
  852. **  memory reference. Legal operands are CONST_INT and SYMBOL_REF.
  853. **  The mode of the operand is currently ignored. Maybe it should be compared 
  854. **  against FUNCTION_MODE.
  855. */
  856. X
  857. /*ARGSUSED*/
  858. int r32_call_operand (op, mode)
  859. rtx op;
  860. enum machine_mode mode;
  861. {
  862. X    switch (GET_CODE (op)) {
  863. X      case MEM:
  864. X    return (r32_call_operand (XEXP (op, 0), mode));
  865. X
  866. X      case CONST_INT:
  867. X      case SYMBOL_REF:
  868. X    return (1);
  869. X    }    
  870. X    return (0);
  871. }
  872. X
  873. X
  874. /*
  875. **  Function calls to absolute addresses (e.g. ((int (*)()) 0)(arg)) are
  876. **  converted to a call to a register. The constant is forced to a register
  877. **  immediately before the expansion of the call insn. To allow such constructs,
  878. **  the define_expand for a call and a call_value insn checks for register
  879. **  operands and calls r32_get_reg_value_rtx. This function checks the 
  880. **  previous non-note insn whether it is a set insn with dest = op and a
  881. **  constant src. This constant is returned if found because it's the current
  882. **  value of the register used in the call insn. Otherwise 0 is returned and the
  883. **  define_expand will treat this as an error.
  884. */
  885. X
  886. rtx r32_get_reg_value_rtx (op)
  887. rtx op;
  888. {
  889. X    rtx insn;
  890. X
  891. X    assert (GET_CODE (op) == REG);
  892. X
  893. X    insn = get_last_insn_anywhere ();
  894. X    while (insn && GET_CODE (insn) == NOTE)
  895. X    insn = previous_insn (insn);
  896. X
  897. X    if (insn && GET_CODE (insn) == INSN) {
  898. X    rtx pat = PATTERN (insn);
  899. X    if ((GET_CODE (pat) == SET
  900. X         && GET_CODE (SET_DEST (pat)) == REG
  901. X         && REGNO (SET_DEST (pat)) == REGNO (op)
  902. X         && GET_MODE (SET_DEST (pat)) == GET_MODE (op)
  903. X         && CONSTANT_P (SET_SRC (pat))))
  904. X        return (SET_SRC (pat));
  905. X    }
  906. X
  907. X    return ((rtx) 0);
  908. }
  909. X
  910. SHAR_EOF
  911. chmod 0664 risc32.c ||
  912. echo 'restore of risc32.c failed'
  913. Wc_c="`wc -c < 'risc32.c'`"
  914. test 14894 -eq "$Wc_c" ||
  915.     echo 'risc32.c: original size 14894, current size' "$Wc_c"
  916. fi
  917. # ============= risc32.h ==============
  918. if test -f 'risc32.h' -a X"$1" != X"-c"; then
  919.     echo 'x - skipping risc32.h (File already exists)'
  920. else
  921. echo 'x - extracting risc32.h (Text)'
  922. sed 's/^X//' << 'SHAR_EOF' > 'risc32.h' &&
  923. /* Definitions of target machine for GNU compiler, for IMS RISC32 controller.
  924. X   Copyright (C) 1992 Andreas Luik <luik@isa.de>.
  925. X
  926. This file is part of GNU CC.
  927. X
  928. GNU CC is free software; you can redistribute it and/or modify
  929. it under the terms of the GNU General Public License as published by
  930. the Free Software Foundation; either version 2, or (at your option)
  931. any later version.
  932. X
  933. GNU CC is distributed in the hope that it will be useful,
  934. but WITHOUT ANY WARRANTY; without even the implied warranty of
  935. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  936. GNU General Public License for more details.
  937. X
  938. You should have received a copy of the GNU General Public License
  939. along with GNU CC; see the file COPYING.  If not, write to
  940. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  941. X
  942. X
  943. /*
  944. **  External variables/functions defined in risc32.c.
  945. */
  946. X
  947. extern char *risc32_inline_shift_limit_cp;
  948. extern int risc32_inline_shift_limit;
  949. X
  950. /*
  951. **  Controlling the Compilation Driver
  952. **  ----------------------------------
  953. */
  954. X
  955. /* #define SWITCHES_TAKES_ARG(C) */
  956. /* #define WORD_SWITCH_TAKES_ARG(NAME) */
  957. /* #define SWITCHES_NEED_SPACES */
  958. #define CPP_SPEC "%{mbarrel-shifter:-D__HAVE_BARREL_SHIFTER__}"
  959. /* #define SIGNED_CHAR_SPEC */
  960. /* #define CC1_SPEC */
  961. /* #define CC1PLUS_SPEC */
  962. /* #define ASM_SPEC */
  963. /* #define ASM_FINAL_SPEC */
  964. /* #define LINK_SPEC */
  965. #define LIB_SPEC                        ""
  966. #define STARTFILE_SPEC                     "%{crt0-r32.o%s}"
  967. /* #define ENDFILE_SPEC */
  968. /* #define LINK_LIBGCC_SPECIAL */
  969. /* #define RELATIVE_PREFIX_NOT_LINKDIR */
  970. /* #define STANDARD_EXEC_PREFIX */
  971. /* #define STANDARD_STARTFILE_PREFIX */
  972. X
  973. X
  974. /*
  975. **  Run-time Target Specification
  976. **  ------------------------------
  977. */
  978. X
  979. #define CPP_PREDEFINES                     "-Drisc32"
  980. /* #define STDC_VALUE */
  981. X
  982. extern int target_flags;
  983. X
  984. #define TARGET_BARREL_SHIFTER        (target_flags & 1)
  985. #define TARGET_STACK_CHECK        (target_flags & 2)
  986. #define TARGET_ABORT_ON_NOT_IMPLEMENTED    (target_flags & 4)
  987. X
  988. #define TARGET_DEFAULT                     0x0
  989. X
  990. #define TARGET_SWITCHES     {            \
  991. X    {"barrel-shifter", 1},            \
  992. X    {"no-barrel-shifter", -1},            \
  993. X    {"stack-check", 2},                \
  994. X    {"no-stack-check", -2},            \
  995. X    {"abort-on-not-implemented", 4},    \
  996. X    {"no-abort-on-not-implemented", -4},\
  997. X    { "", TARGET_DEFAULT}}
  998. X
  999. #define TARGET_OPTIONS         {   \
  1000. X    { "inline-shift-limit-", &risc32_inline_shift_limit_cp } }
  1001. X
  1002. #define OVERRIDE_OPTIONS                                                        \
  1003. X    do {                                                                        \
  1004. X        if (profile_flag)                                                       \
  1005. X        {                                                                       \
  1006. X          warning ("`-p' option (function profile) not supported");            \
  1007. X          profile_flag = 0;                                                    \
  1008. X    }                                                                       \
  1009. X        if (risc32_inline_shift_limit_cp)                                       \
  1010. X    {                                                                       \
  1011. X            int err = FALSE;                                                    \
  1012. X            int limit;                                                            \
  1013. X        char *p;                                                             \
  1014. X                                                                                \
  1015. X        for (p = risc32_inline_shift_limit_cp; *p && !err; p++)            \
  1016. X        if (! (*p >= '0' && *p <= '9'))                                \
  1017. X                    err = TRUE;                                                    \
  1018. X                                                                                \
  1019. X        if ((limit = atoi (risc32_inline_shift_limit_cp)) <= 1)            \
  1020. X        err = TRUE;                                                     \
  1021. X            if (!err)                                                            \
  1022. X        risc32_inline_shift_limit = limit;                              \
  1023. X        else error ("Invalid option value `-minline-shift-limit-%s'",        \
  1024. X                       risc32_inline_shift_limit_cp);                            \
  1025. X    }                                                                       \
  1026. X    } while (0)
  1027. X
  1028. /* Omit frame pointer at high optimization levels.  */
  1029. #define OPTIMIZATION_OPTIONS(OPTIMIZE) \
  1030. X    do {                                          \
  1031. X        if (OPTIMIZE >= 3)                                 \
  1032. X            flag_omit_frame_pointer = 1;                        \
  1033. X    } while (0)
  1034. X
  1035. #define TARGET_VERSION             \
  1036. X    fprintf (stderr, " (IMS RISC32, ASM syntax)");
  1037. X
  1038. X
  1039. /*
  1040. **  Storage Layout
  1041. **  --------------
  1042. */
  1043. X
  1044. /* #define BITS_BIG_ENDIAN */
  1045. #define BYTES_BIG_ENDIAN        1
  1046. #define WORDS_BIG_ENDIAN        1
  1047. X
  1048. #define BITS_PER_UNIT            8
  1049. #define BITS_PER_WORD            32
  1050. #define UNITS_PER_WORD            4
  1051. #define POINTER_SIZE            32
  1052. #define PARM_BOUNDARY            8
  1053. #define FUNCTION_BOUNDARY        8
  1054. #define BIGGEST_ALIGNMENT        8
  1055. #define EMPTY_FIELD_BOUNDARY        8
  1056. #define STRICT_ALIGNMENT        1
  1057. #define MAX_FIXED_MODE_SIZE        32
  1058. /* #define CHECK_FLOAT_VALUE */                   /* floats are not supported yet */
  1059. /* #define TARGET_FLOAT_FORMAT */              /* floats are not supported yet */
  1060. X
  1061. /*
  1062. **  Layout of Source Language Data Types
  1063. **  ------------------------------------
  1064. */
  1065. X
  1066. #define INT_TYPE_SIZE            BITS_PER_WORD
  1067. #define SHORT_TYPE_SIZE            16
  1068. #define LONG_TYPE_SIZE            32
  1069. #define LONG_LONG_TYPE_SIZE        64
  1070. #define CHAR_TYPE_SIZE            BITS_PER_UNIT
  1071. #define FLOAT_TYPE_SIZE            32     /* floats are not supported yet */
  1072. #define DOUBLE_TYPE_SIZE        64     /* floats are not supported yet */
  1073. /* #define LONG_DOUBLE_TYPE_SIZE*/             /* floats are not supported yet */
  1074. X
  1075. #define DEFAULT_SIGNED_CHAR        1
  1076. X
  1077. #define SIZE_TYPE                       "unsigned int" /* XXX */
  1078. #define PTRDIFF_TYPE                       "unsigned int" /* XXX */
  1079. #define WCHAR_TYPE            "unsigned int" /* XXX */
  1080. #define WCHAR_TYPE_SIZE            32
  1081. X
  1082. #define TARGET_BELL            007
  1083. #define TARGET_BS            010
  1084. #define TARGET_TAB            011
  1085. #define TARGET_NEWLINE            012
  1086. #define TARGET_VT            013
  1087. #define TARGET_FF            014
  1088. #define TARGET_CR            015
  1089. X
  1090. X
  1091. /*
  1092. **  Register Usage
  1093. **  --------------
  1094. */
  1095. X
  1096. #define FIRST_PSEUDO_REGISTER    16
  1097. X
  1098. #define FIXED_REGISTERS            \
  1099. X    {                            \
  1100. X    1, 0, 0, 0, 0, 0, 0, 0, \
  1101. X    0, 0, 0, 0, 0, 0, 0, 1, \
  1102. X    }
  1103. X
  1104. #define CALL_USED_REGISTERS     \
  1105. X    {                            \
  1106. X    1, 1, 1, 1, 1, 0, 0, 0, \
  1107. X    0, 0, 0, 0, 0, 0, 1, 1, \
  1108. X    }
  1109. X
  1110. #define HARD_REGNO_NREGS(REGNO, MODE) \
  1111. X    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  1112. X
  1113. #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
  1114. X
  1115. #define MODES_TIEABLE_P(MODE1,MODE2)    1
  1116. X
  1117. X
  1118. /*
  1119. **  Register Classes
  1120. **  ----------------
  1121. */
  1122. X
  1123. enum reg_class { NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES };
  1124. X
  1125. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  1126. X
  1127. #define REG_CLASS_NAMES \
  1128. X    { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
  1129. X
  1130. #define REG_CLASS_CONTENTS {                 \
  1131. X        0x00000000,       /* NO_REGS */        \
  1132. X        0x0000fffe,    /* GENERAL_REGS */  \
  1133. X        0x0000ffff,    /* ALL_REGS */        \
  1134. X    }
  1135. X
  1136. #define REGNO_REG_CLASS(REGNO)        ((REGNO) == 0 ? ALL_REGS : GENERAL_REGS)
  1137. X
  1138. #define BASE_REG_CLASS            GENERAL_REGS
  1139. #define INDEX_REG_CLASS            GENERAL_REGS
  1140. X
  1141. #define REG_CLASS_FROM_LETTER(C)    NO_REGS
  1142. X
  1143. #define HARD_REGNO_OK_FOR_BASE_OR_INDEX_P(REGNO) \
  1144. X    ((REGNO) > 0 && (REGNO) < FIRST_PSEUDO_REGISTER)
  1145. X
  1146. #define REGNO_OK_FOR_BASE_P(REGNO)  \
  1147. X    (HARD_REGNO_OK_FOR_BASE_OR_INDEX_P(REGNO) \
  1148. X     || HARD_REGNO_OK_FOR_BASE_OR_INDEX_P((unsigned) reg_renumber[REGNO]))
  1149. X
  1150. #define REGNO_OK_FOR_INDEX_P(REGNO) \
  1151. X    (HARD_REGNO_OK_FOR_BASE_OR_INDEX_P(REGNO) \
  1152. X     || HARD_REGNO_OK_FOR_BASE_OR_INDEX_P((unsigned) reg_renumber[REGNO]))
  1153. X
  1154. #define PREFERRED_RELOAD_CLASS(X,CLASS)    CLASS
  1155. X
  1156. #define CLASS_MAX_NREGS(CLASS, MODE) \
  1157. X    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  1158. X
  1159. /*
  1160. **  special constraint strings:
  1161. **      I ... immediate value -16..15 for NEG/ONE_CMPL/ROT/LSHI/ASHI
  1162. **      J ... immediate value -16..16 for ADD
  1163. **      K ... immediate value with one bit set or cleared for XOR/OR/AND
  1164. */
  1165. X
  1166. #define CONST_OK_FOR_LETTER_P(VALUE,C) \
  1167. X    ((C) == 'I' ? ((VALUE) >= -16 && (VALUE) <= 15) : \
  1168. X     (C) == 'J' ? ((VALUE) >= -16 && (VALUE) <= 16) : \
  1169. X     (C) == 'K' ? const_to_logical_const ((VALUE), (int *) 0) : 0) \
  1170. X
  1171. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE,C) \
  1172. X    0
  1173. X
  1174. X
  1175. /*
  1176. **  Describing Stack Layout and Calling Conventions
  1177. **  -----------------------------------------------
  1178. */
  1179. X
  1180. #define STACK_GROWS_DOWNWARD
  1181. #define FRAME_GROWS_DOWNWARD
  1182. #define STARTING_FRAME_OFFSET        0
  1183. #define FIRST_PARM_OFFSET(FNDECL)    0
  1184. X
  1185. #define STACK_POINTER_REGNUM        15
  1186. #define FRAME_POINTER_REGNUM        14
  1187. #define ARG_POINTER_REGNUM        FRAME_POINTER_REGNUM
  1188. #define STATIC_CHAIN_REGNUM        13
  1189. X
  1190. #define FRAME_POINTER_REQUIRED        0
  1191. X
  1192. #define INITIAL_FRAME_POINTER_OFFSET(DEPTH)             \
  1193. X    (DEPTH) = initial_frame_pointer_offset ()
  1194. X
  1195. /* #define LONGJMP_RESTORE_FROM_STACK */
  1196. X
  1197. #define PROMOTE_PROTOTYPES
  1198. /* #define PUSH_ROUNDING(BYTES) */         /* we do not use a push instruction */
  1199. #define RETURN_POPS_ARGS(FUNTYPE,SIZE)    0
  1200. X
  1201. #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)    0
  1202. #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED)  0
  1203. #define CUMULATIVE_ARGS                    int
  1204. #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME)        \
  1205. X    ((CUM) = 0)
  1206. #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
  1207. X    ((CUM) += ((MODE) != BLKmode                        \
  1208. X           ? GET_MODE_SIZE (MODE)                     \
  1209. X           : int_size_in_bytes (TYPE)))
  1210. #define FUNCTION_ARG_REGNO_P(N)         0
  1211. X
  1212. #define FUNCTION_VALUE_REGNUM            1
  1213. #define FUNCTION_VALUE(VALTYPE, FUNC)     \
  1214. X    gen_rtx (REG, TYPE_MODE (VALTYPE), FUNCTION_VALUE_REGNUM)
  1215. #define LIBCALL_VALUE(MODE)              \
  1216. X    gen_rtx (REG, MODE, FUNCTION_VALUE_REGNUM)
  1217. #define FUNCTION_VALUE_REGNO_P(N)       ((N) == FUNCTION_VALUE_REGNUM)
  1218. X
  1219. #define STRUCT_VALUE_REGNUM             2
  1220. X
  1221. #define FUNCTION_PROLOGUE(FILE, SIZE)     output_function_prologue(FILE, SIZE)
  1222. #define EXIT_IGNORE_STACK 1
  1223. #define FUNCTION_EPILOGUE(FILE, SIZE)    output_function_epilogue(FILE, SIZE)
  1224. X
  1225. /* FUNCTION_PROFILER is used for -p */
  1226. #define FUNCTION_PROFILER(FILE, LABEL)                /* profiling not supported */
  1227. X
  1228. /* Block profiling is enabled with "-a", but this is optional and not supported
  1229. X   on the RISC32. */
  1230. /* #define FUNCTION_BLOCK_PROFILER(FILE, LABEL) */
  1231. /* #define BLOCK_PROFILER(FILE, BLOCK) */
  1232. X
  1233. X
  1234. /*
  1235. **  Implementing the Varargs Macro
  1236. **  ------------------------------
  1237. */
  1238. X
  1239. /*
  1240. **  The default varargs macros may be used since we pass parameters on a
  1241. **  stack
  1242. */
  1243. X
  1244. /*
  1245. **  Trampolines for Nested Functions
  1246. **  --------------------------------
  1247. */
  1248. X
  1249. #define TRAMPOLINE_TEMPLATE(FILE)                 /* trampolines not supported */
  1250. #define TRAMPOLINE_SIZE                    0
  1251. #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) /* trampolines not supported */
  1252. /* #define INSN_CACHE_SIZE */
  1253. /* #define INSN_CACHE_LINE_WIDTH */
  1254. /* #define INSN_CACHE_DEPTH */
  1255. X
  1256. /*
  1257. **  Implicit Calls to Library Routines
  1258. **  ----------------------------------
  1259. */
  1260. X
  1261. /*
  1262. **  Addressing Modes
  1263. **  ----------------
  1264. */
  1265. X
  1266. #define CONSTANT_ADDRESS_P(X)        CONSTANT_P(X) /* XXX */
  1267. X
  1268. #define MAX_REGS_PER_ADDRESS        2
  1269. X
  1270. #ifndef REG_OK_STRICT
  1271. # define REG_OK_FOR_INDEX_P(X)        FALSE
  1272. # define REG_OK_FOR_BASE_P(X)        (REGNO (X) != 0)
  1273. #else
  1274. # define REG_OK_FOR_INDEX_P(X)               (REGNO_OK_FOR_INDEX_P (REGNO (X)))
  1275. # define REG_OK_FOR_BASE_P(X)              (REGNO_OK_FOR_BASE_P (REGNO (X)))
  1276. #endif
  1277. X
  1278. #define IS_REG_OK_FOR_BASE_P(X)                    \
  1279. X    (REG_P (X) && REG_OK_FOR_BASE_P (X))
  1280. X
  1281. #define GO_IF_CONST_ADDRESS(X, ADDR)                \
  1282. X    {                                \
  1283. X        if ((CONSTANT_ADDRESS_P (X) ||                \
  1284. X         IS_REG_OK_FOR_BASE_P (X)))                     \
  1285. X        goto ADDR;                                        \
  1286. X    }
  1287. X
  1288. #define GO_IF_OFFSET_ADDRESS(X, ADDR)                \
  1289. X    {                                \
  1290. X    if ((GET_CODE (X) == PLUS &&                \
  1291. X         IS_REG_OK_FOR_BASE_P (XEXP (X, 0)) &&        \
  1292. X         GET_CODE (XEXP (X, 1)) == CONST_INT &&        \
  1293. X         ((unsigned) INTVAL (XEXP (X, 1)) + 16) < 32))  \
  1294. X        goto ADDR;                                        \
  1295. X    }
  1296. X
  1297. #define GO_IF_INDEX_ADDRESS(X, ADDR)                \
  1298. X    {                                \
  1299. X    if ((GET_CODE (X) == PLUS &&                \
  1300. X         IS_REG_OK_FOR_BASE_P (XEXP (X, 0)) &&        \
  1301. X         IS_REG_OK_FOR_BASE_P (XEXP (X, 1))))            \
  1302. X        goto ADDR;                                        \
  1303. X    }
  1304. X
  1305. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)            \
  1306. X    {                                \
  1307. X    GO_IF_CONST_ADDRESS (X, ADDR);                \
  1308. X    GO_IF_OFFSET_ADDRESS (X, ADDR);                \
  1309. X    GO_IF_INDEX_ADDRESS (X, ADDR);                \
  1310. X    }
  1311. X
  1312. #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)                {}
  1313. #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)           {}
  1314. X
  1315. #define LEGITIMATE_CONSTANT_P(X)    1
  1316. X
  1317. X
  1318. /*
  1319. **  Condition Code Status
  1320. **  ---------------------
  1321. */
  1322. X
  1323. #define NOTICE_UPDATE_CC(EXP, INSN)                         \
  1324. X    notice_update_cc(EXP, INSN)
  1325. X
  1326. X
  1327. /*
  1328. **  Describing Relative Costs of Operations
  1329. **  ---------------------------------------
  1330. */
  1331. X
  1332. #define CONST_COSTS(RTX,CODE,OUTER_CODE)            \
  1333. X  case CONST_INT:                        \
  1334. X    if (((unsigned) INTVAL (RTX)) + 16 < 32)            \
  1335. X        return 1;                        \
  1336. X    return 2;                            \
  1337. X  case CONST:                            \
  1338. X  case LABEL_REF:                        \
  1339. X  case SYMBOL_REF:                        \
  1340. X    return 1;                            \
  1341. X  case CONST_DOUBLE:                        \
  1342. X    return 8;
  1343. X
  1344. #define RTX_COSTS(X,CODE,OUTER_CODE)                \
  1345. X  case SIGN_EXTEND:                        \
  1346. X    return (COSTS_N_INSNS (TARGET_BARREL_SHIFTER ? 4 : 5)); \
  1347. X  case ASHIFT:                                                \
  1348. X  case ASHIFTRT:                                            \
  1349. X  case LSHIFT:                                                \
  1350. X  case LSHIFTRT:                                            \
  1351. X  case ROTATE:                                                \
  1352. X  case ROTATERT:                                            \
  1353. X    return (COSTS_N_INSNS (TARGET_BARREL_SHIFTER ? 1 : 6)); \
  1354. X  case MULT:                            \
  1355. X    return COSTS_N_INSNS (10); /* XXX */            \
  1356. X  case DIV:                            \
  1357. X  case UDIV:                            \
  1358. X  case MOD:                            \
  1359. X  case UMOD:                            \
  1360. X    return COSTS_N_INSNS (10); /* XXX */
  1361. X
  1362. #define SLOW_BYTE_ACCESS            0
  1363. #define NO_FUNCTION_CSE
  1364. #define NO_RECURSIVE_FUNCTION_CSE
  1365. X
  1366. X
  1367. /*
  1368. **  Dividing the Output into Sections
  1369. **  ---------------------------------
  1370. */
  1371. X
  1372. #define TEXT_SECTION_ASM_OP         ".TEXT"
  1373. #define DATA_SECTION_ASM_OP         ".DATA"
  1374. /* #define SHARED_SECTION_ASM_OP */
  1375. /* #define INIT_SECTION_ASM_OP */
  1376. #define READONLY_DATA_SECTION        data_section
  1377. X
  1378. X
  1379. /*
  1380. **  Position Independent Code
  1381. **  -------------------------
  1382. */
  1383. X
  1384. /*
  1385. **  it is not possible to implement position independent code on RISC32
  1386. */
  1387. X
  1388. X
  1389. /*
  1390. **  Defining the Output Assembler Language
  1391. **  --------------------------------------
  1392. */
  1393. X
  1394. #define ASM_FILE_START(FILE)                    \
  1395. X    fprintf (FILE, "%s", ASM_APP_OFF);                \
  1396. X    if (TARGET_BARREL_SHIFTER)                    \
  1397. X        fprintf (FILE, "\tBARREL\n");                \
  1398. X    fprintf (FILE, "\tPRG\n");
  1399. X
  1400. /* #define ASM_FILE_END(FILE) */
  1401. X
  1402. #define ASM_IDENTIFY_GCC(FILE)        fprintf (FILE, ";gcc2_compiled.:\n");
  1403. X
  1404. #define ASM_COMMENT_START           ";"
  1405. X
  1406. #define ASM_APP_ON                  ";APP\n"
  1407. #define ASM_APP_OFF                  ";NO_APP\n"
  1408. #define ASM_OUTPUT_SOURCE_FILENAME(FILE,NAME)
  1409. #define ASM_OUTPUT_SOURCE_LINE(FILE,LINE)
  1410. /* #define ASM_OUTPUT_IDENT(FILE,IDENT) */
  1411. #define OBJC_PROLOGUE
  1412. X
  1413. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  1414. X    (sorry ("double constants"),                            \
  1415. X     fprintf (FILE, "\t;DOUBLE\t0r%.20g\n", (VALUE)))
  1416. X
  1417. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                \
  1418. X    (sorry ("float constants"),                                \
  1419. X     fprintf (FILE, "\t;FLOAT\t0r%.20g\n", (VALUE)))
  1420. X
  1421. #define ASM_OUTPUT_SHORT(FILE,VALUE)                \
  1422. X    (sorry ("initialized variables"),                        \
  1423. X     fprintf (FILE, "\t;WORD\t"),                \
  1424. X     output_addr_const (FILE, (VALUE)),                \
  1425. X     fprintf (FILE, "\n"))
  1426. X
  1427. #define ASM_OUTPUT_CHAR(FILE,VALUE)                \
  1428. X    (sorry ("initialized variables"),                        \
  1429. X     fprintf (FILE, "\t;WORD\t"),                \
  1430. X     output_addr_const (FILE, (VALUE)),                \
  1431. X     fprintf (FILE, "\n"))
  1432. X
  1433. /* ASM_BYTE_OP is only used in dwarfout.c and in assemble_zeros() if 
  1434. X   ASM_NO_SKIP_IN_TEXT == 1. */
  1435. #define ASM_BYTE_OP                 ";WORD"
  1436. X
  1437. #define ASM_OUTPUT_BYTE(FILE,VALUE)                \
  1438. X    (sorry ("initialized variables"),                        \
  1439. X     fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE)))
  1440. X
  1441. #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)                \
  1442. X    sorry ("string constants");
  1443. X
  1444. #define ASM_OPEN_PAREN                "("
  1445. #define ASM_CLOSE_PAREN                ")"
  1446. X
  1447. #define ASM_OUTPUT_COMMON(FILE,NAME,SIZE,ROUNDED)        \
  1448. X    (fprintf (FILE, "\t.GLOBAL\t"),                \
  1449. X     assemble_name (FILE, (NAME)),                \
  1450. X     fprintf (FILE, "\n"),                    \
  1451. X     ASM_OUTPUT_LOCAL(FILE,NAME,SIZE,ROUNDED))
  1452. X
  1453. #define ASM_OUTPUT_LOCAL(FILE,NAME,SIZE,ROUNDED)        \
  1454. X    (fprintf (FILE, "\t.COMMON\t"),                \
  1455. X     assemble_name (FILE, (NAME)),                \
  1456. X     fprintf (FILE, ",%u\n",(ROUNDED)))                \
  1457. X
  1458. #define ASM_OUTPUT_LABEL(FILE,NAME)                \
  1459. X    (assemble_name (FILE, NAME), fputs (":\n", FILE))
  1460. X
  1461. #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL)        \
  1462. X    (assemble_name (FILE, NAME), fputs ("\tPROC\n", FILE))
  1463. X
  1464. /* ASM_DECLARE_FUNCTION_SIZE is used to output the ENDPROC assembler
  1465. X   directive. Alternatively, this may go into output_function_epilogue
  1466. X   but getting the function name is more difficult there. */
  1467. #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL)        \
  1468. X    (assemble_name (FILE, NAME), fputs ("\tENDPROC\n", FILE))
  1469. X
  1470. /* #define ASM_DECLARE_OBJECT_NAME(FILE,NAME,DECL) */
  1471. X
  1472. #define ASM_GLOBALIZE_LABEL(FILE,NAME)                \
  1473. X    (fprintf (FILE, "\t.EXPORT\t"),                \
  1474. X     assemble_name (FILE, (NAME)),                \
  1475. X     fprintf (FILE, "\n"))
  1476. X
  1477. /* #define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME) */
  1478. /* #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE,SYMREF) */
  1479. X
  1480. #define ASM_OUTPUT_LABELREF(FILE,NAME)                \
  1481. X    asm_fprintf (FILE, "%U%s", NAME)
  1482. X
  1483. /* #define ASM_OUTPUT_LABELREF_AS_INT(FILE,LABEL) */
  1484. X
  1485. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)        \
  1486. X    asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
  1487. X
  1488. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)        \
  1489. X    sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
  1490. X
  1491. #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)        \
  1492. X    ((OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),        \
  1493. X     sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
  1494. X
  1495. /* #include "aoutos.h" */
  1496. X
  1497. #define REGISTER_NAMES {                    \
  1498. X    "R0", "R1",  "R2",  "R3",  "R4",  "R5" , "R6",  "R7",   \
  1499. X    "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15" }
  1500. X
  1501. #define ADDITIONAL_REGISTER_NAMES {                \
  1502. X    { "FP", 14 },                        \
  1503. X    { "SP", 15 } }
  1504. X
  1505. /* #define ASM_OUTPUT_OPCODE(FILE,CP) */
  1506. X
  1507. #define PRINT_OPERAND(FILE, X, CODE)         print_operand (FILE, X, CODE)
  1508. X
  1509. #define PRINT_OPERAND_PUNCT_VALID_P(CODE)   ((CODE) == '#' || (CODE) == '%')
  1510. X
  1511. #define PRINT_OPERAND_ADDRESS(FILE, ADDR)   print_operand_address (FILE, ADDR)
  1512. X
  1513. #define REGISTER_PREFIX        ""    /* used for %R in asm_fprintf */
  1514. #define LOCAL_LABEL_PREFIX  ""    /* used for %L in asm_fprintf */
  1515. #define USER_LABEL_PREFIX   "_"    /* used for %U in asm_fprintf */
  1516. #define IMMEDIATE_PREFIX    ""    /* used for %I in asm_fprintf */
  1517. X
  1518. /* The next two macros (reg PUSH and POP) are only used for profiling which
  1519. X   is currently unsupported. */
  1520. #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)                \
  1521. X    asm_fprintf (FILE, "\tPUSH\t%0R%s\n", reg_names[REGNO]);
  1522. X
  1523. #define ASM_OUTPUT_REG_POP(FILE,REGNO)                \
  1524. X    asm_fprintf (FILE, "\tPOP\t%0R%s\n", reg_names[REGNO]);
  1525. X
  1526. /* Code for dispatch tables is not required because we use an (nearly)
  1527. X   infinite CASE_VALUES_THRESHOLD. */
  1528. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)          abort ()
  1529. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)                abort ()
  1530. X
  1531. #define ASM_OUTPUT_SKIP(FILE,BYTES)                                    \
  1532. X    {                                                    \
  1533. X    int i = (BYTES);                                        \
  1534. X    if (in_text_section ()) {                                               \
  1535. X        while (i--)                                                            \
  1536. X        asm_fprintf (FILE, "\tNOP\t; skip one byte (contents zero)\n");    \
  1537. X    }                                                                       \
  1538. X        else {                                                                    \
  1539. X        while (i--)                                                            \
  1540. X            ASM_OUTPUT_BYTE (FILE, 0);                            \
  1541. X    }                                                                       \
  1542. X    }
  1543. X
  1544. #define ASM_NO_SKIP_IN_TEXT                 0
  1545. X
  1546. #define ASM_OUTPUT_ALIGN(FILE,POWER)        abort ();
  1547. X
  1548. /*
  1549. **  Controlling Debbuging Information Format
  1550. **  ----------------------------------------
  1551. */
  1552. X
  1553. /*
  1554. **  Debugging informations are not supported yet. Currently no debugger is
  1555. **  available.
  1556. */
  1557. X
  1558. #define DBX_REGISTER_NUMBER(REGNO)          (REGNO)
  1559. X
  1560. X
  1561. /*
  1562. **  Cross Compilation and Floating Point Format
  1563. **  -------------------------------------------
  1564. */
  1565. X
  1566. /*
  1567. **  No floating point format was definied for the risc32 yet, so we leave this
  1568. **  section empty.
  1569. */
  1570. X
  1571. X
  1572. /*
  1573. **  Miscellaneous Parameters
  1574. **  ------------------------
  1575. */
  1576. X
  1577. #define CASE_VECTOR_MODE                        SImode
  1578. #define CASE_VALUES_THRESHOLD                    32767
  1579. #define EASY_DIV_EXPR                             TRUNC_DIV_EXPR
  1580. #define MOVE_MAX                                1
  1581. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)     1
  1582. #define STORE_FLAG_VALUE                        -1 /* XXX */
  1583. #define Pmode                                    SImode
  1584. #define FUNCTION_MODE                             SImode
  1585. X
  1586. X
  1587. /*
  1588. **  Declare functions defined in risc32.c and used in templates.
  1589. */
  1590. X
  1591. SHAR_EOF
  1592. chmod 0664 risc32.h ||
  1593. echo 'restore of risc32.h failed'
  1594. Wc_c="`wc -c < 'risc32.h'`"
  1595. test 20416 -eq "$Wc_c" ||
  1596.     echo 'risc32.h: original size 20416, current size' "$Wc_c"
  1597. fi
  1598. # ============= risc32.md ==============
  1599. if test -f 'risc32.md' -a X"$1" != X"-c"; then
  1600.     echo 'x - skipping risc32.md (File already exists)'
  1601. else
  1602. echo 'x - extracting risc32.md (Text)'
  1603. sed 's/^X//' << 'SHAR_EOF' > 'risc32.md' &&
  1604. ;;- Machine description for GNU compiler
  1605. ;;- IMS RISC32 controler Version
  1606. ;;   Copyright (C) 1992 Andreas Luik <luik@isa.de>.
  1607. X
  1608. ;; This file is part of GNU CC.
  1609. X
  1610. ;; GNU CC is free software; you can redistribute it and/or modify
  1611. ;; it under the terms of the GNU General Public License as published by
  1612. ;; the Free Software Foundation; either version 2, or (at your option)
  1613. ;; any later version.
  1614. X
  1615. ;; GNU CC is distributed in the hope that it will be useful,
  1616. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  1617. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1618. ;; GNU General Public License for more details.
  1619. X
  1620. ;; You should have received a copy of the GNU General Public License
  1621. ;; along with GNU CC; see the file COPYING.  If not, write to
  1622. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  1623. X
  1624. X
  1625. ;;
  1626. ;;  Test and compare operations (PSW operations)
  1627. ;;  --------------------------------------------
  1628. ;;
  1629. X
  1630. (define_insn "tstsi"
  1631. X  [(set (cc0) (match_operand:SI 0 "register_operand" "r"))]
  1632. X  ""
  1633. X  "TST    %0")
  1634. X
  1635. (define_insn "cmpsi"
  1636. X  [(set (cc0) (compare (match_operand:SI 0 "register_operand" "r")
  1637. X               (match_operand:SI 1 "register_operand" "r")))]
  1638. X  ""
  1639. X  "CMP    %0,%1")
  1640. X
  1641. X
  1642. ;;
  1643. ;;  Unconditional jumps
  1644. ;;  -------------------
  1645. ;;
  1646. X
  1647. (define_insn "jump"
  1648. X  [(set (pc) (label_ref (match_operand 0 "" "")))]
  1649. X  ""
  1650. X  "JMP    %l0")
  1651. X
  1652. (define_insn "indirect_jump"
  1653. X  [(set (pc) (match_operand:SI 0 "general_operand" "r"))]
  1654. X  ""
  1655. X  "*
  1656. {
  1657. X    sorry (\"computed goto or goto to non-local label\");
  1658. X    return \"JMP    %0\";
  1659. }")
  1660. X
  1661. ;;
  1662. ;;  Subroutine handling and stack operations
  1663. ;;  ----------------------------------------
  1664. ;;
  1665. X
  1666. (define_expand "call"
  1667. X  [(call (mem:SI (match_operand:SI 0 "" ""))
  1668. X     (match_operand 1 "" ""))]
  1669. X  ""
  1670. X  "
  1671. {
  1672. X    rtx op0;            /* operand0 without (mem ()) */
  1673. X    extern rtx r32_get_reg_value_rtx ();
  1674. X
  1675. X    op0 = GET_CODE (operands[0]) == MEM ? XEXP (operands[0], 0) : operands[0];
  1676. X    if (GET_CODE (op0) == REG) {
  1677. X    rtx value = r32_get_reg_value_rtx (op0); /* search for register value */
  1678. X    if (value)        /* value of register found, use it */
  1679. X        op0 = value;
  1680. X    }
  1681. X
  1682. X    if (!r32_call_operand (op0, SImode)) {
  1683. X    sorry (\"pointers to functions\");
  1684. X    if (TARGET_ABORT_ON_NOT_IMPLEMENTED)
  1685. X        abort ();
  1686. X    op0 = gen_rtx (SYMBOL_REF, SImode, \"unknown\");
  1687. X    }
  1688. X
  1689. X    operands[0] = op0;        /* (mem ()) added by RTL template */
  1690. }")
  1691. X
  1692. (define_insn ""
  1693. X  [(call (match_operand:SI 0 "r32_call_operand" "m")
  1694. X     (match_operand 1 "general_operand" "g"))]
  1695. X  ;; Operand 1 not really used on the risc32.
  1696. X  ""
  1697. X  "CALL    %0")
  1698. X
  1699. X
  1700. (define_expand "call_value"
  1701. X  [(set (match_operand 0 "" "=r")
  1702. X    (call (mem:SI (match_operand:SI 1 "" ""))
  1703. X          (match_operand 2 "" "")))]
  1704. X  ""
  1705. X  "
  1706. {
  1707. X    rtx op1;            /* operand1 without (mem ()) */
  1708. X    extern rtx r32_get_reg_value_rtx ();
  1709. X
  1710. X    op1 = GET_CODE (operands[1]) == MEM ? XEXP (operands[1], 0) : operands[1];
  1711. X    if (GET_CODE (op1) == REG) {
  1712. X    rtx value = r32_get_reg_value_rtx (op1); /* search for register value */
  1713. X    if (value)        /* value of register found, use it */
  1714. X        op1 = value;
  1715. X    }
  1716. X
  1717. X    if (!r32_call_operand (op1, SImode)) {
  1718. X    sorry (\"pointers to functions\");
  1719. X    if (TARGET_ABORT_ON_NOT_IMPLEMENTED)
  1720. X        abort ();
  1721. X    op1 = gen_rtx (SYMBOL_REF, SImode, \"unknown\");
  1722. X    }
  1723. X
  1724. X    operands[1] = op1;        /* (mem ()) added by RTL template */
  1725. }")
  1726. X
  1727. (define_insn ""
  1728. X  [(set (match_operand 0 "" "=r")
  1729. X    (call (match_operand:SI 1 "r32_call_operand" "m")
  1730. X          (match_operand 2 "general_operand" "g")))]
  1731. X  ;; Operand 2 not really used on the risc32.
  1732. X  ""
  1733. X  "CALL    %1")
  1734. X
  1735. X
  1736. ;;
  1737. ;;  Conditional jumps
  1738. ;;  -----------------
  1739. ;;
  1740. X
  1741. (define_insn "beq"
  1742. X  [(set (pc) (if_then_else (eq (cc0) (const_int 0))
  1743. X               (label_ref (match_operand 0 "" ""))
  1744. X               (pc)))]
  1745. X  ""
  1746. X  "JEQ    %l0")
  1747. X
  1748. (define_insn "bne"
  1749. X  [(set (pc) (if_then_else (ne (cc0) (const_int 0))
  1750. X               (label_ref (match_operand 0 "" ""))
  1751. X               (pc)))]
  1752. X  ""
  1753. X  "JNE    %l0")
  1754. X
  1755. (define_insn "bgt"
  1756. X  [(set (pc) (if_then_else (gt (cc0) (const_int 0))
  1757. X               (label_ref (match_operand 0 "" ""))
  1758. X               (pc)))]
  1759. X  ""
  1760. X  "JGT    %l0")
  1761. X
  1762. (define_insn "bgtu"
  1763. X  [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
  1764. X               (label_ref (match_operand 0 "" ""))
  1765. X               (pc)))]
  1766. X  ""
  1767. X  "JHI    %l0")
  1768. X
  1769. (define_insn "blt"
  1770. X  [(set (pc) (if_then_else (lt (cc0) (const_int 0))
  1771. X               (label_ref (match_operand 0 "" ""))
  1772. X               (pc)))]
  1773. X  ""
  1774. X  "JLT    %l0")
  1775. X
  1776. (define_insn "bltu"
  1777. X  [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
  1778. X               (label_ref (match_operand 0 "" ""))
  1779. X               (pc)))]
  1780. X  ""
  1781. X  "JLO    %l0")
  1782. X
  1783. (define_insn "bge"
  1784. X  [(set (pc) (if_then_else (ge (cc0) (const_int 0))
  1785. X               (label_ref (match_operand 0 "" ""))
  1786. X               (pc)))]
  1787. X  ""
  1788. X  "JGE    %l0")
  1789. X
  1790. (define_insn "bgeu"
  1791. X  [(set (pc) (if_then_else (geu (cc0) (const_int 0))
  1792. X               (label_ref (match_operand 0 "" ""))
  1793. X               (pc)))]
  1794. X  ""
  1795. X  "JHS    %l0")
  1796. X
  1797. (define_insn "ble"
  1798. X  [(set (pc) (if_then_else (le (cc0) (const_int 0))
  1799. X               (label_ref (match_operand 0 "" ""))
  1800. X               (pc)))]
  1801. X  ""
  1802. X  "JLE    %l0")
  1803. X
  1804. (define_insn "bleu"
  1805. X  [(set (pc) (if_then_else (leu (cc0) (const_int 0))
  1806. X               (label_ref (match_operand 0 "" ""))
  1807. X               (pc)))]
  1808. X  ""
  1809. X  "JLS    %l0")
  1810. X
  1811. ;; reverse-conditional branches
  1812. X
  1813. (define_insn ""
  1814. X  [(set (pc) (if_then_else (eq (cc0) (const_int 0))
  1815. X               (pc)
  1816. X               (label_ref (match_operand 0 "" ""))))]
  1817. X  ""
  1818. X  "JNE    %l0")
  1819. X
  1820. (define_insn ""
  1821. X  [(set (pc) (if_then_else (ne (cc0) (const_int 0))
  1822. X               (pc)
  1823. X               (label_ref (match_operand 0 "" ""))))]
  1824. X  ""
  1825. X  "JEQ    %l0")
  1826. X
  1827. (define_insn ""
  1828. X  [(set (pc) (if_then_else (gt (cc0) (const_int 0))
  1829. X               (pc)
  1830. X               (label_ref (match_operand 0 "" ""))))]
  1831. X  ""
  1832. X  "JLE    %l0")
  1833. X
  1834. (define_insn ""
  1835. X  [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
  1836. X               (pc)
  1837. X               (label_ref (match_operand 0 "" ""))))]
  1838. X  ""
  1839. X  "JLS    %l0")
  1840. X
  1841. (define_insn ""
  1842. X  [(set (pc) (if_then_else (lt (cc0) (const_int 0))
  1843. X               (pc)
  1844. X               (label_ref (match_operand 0 "" ""))))]
  1845. X  ""
  1846. X  "JGE    %l0")
  1847. X
  1848. (define_insn ""
  1849. X  [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
  1850. X               (pc)
  1851. X               (label_ref (match_operand 0 "" ""))))]
  1852. X  ""
  1853. X  "JHS    %l0")
  1854. X
  1855. (define_insn ""
  1856. X  [(set (pc) (if_then_else (ge (cc0) (const_int 0))
  1857. X               (pc)
  1858. X               (label_ref (match_operand 0 "" ""))))]
  1859. X  ""
  1860. X  "JLT    %l0")
  1861. X
  1862. (define_insn ""
  1863. X  [(set (pc) (if_then_else (geu (cc0) (const_int 0))
  1864. X               (pc)
  1865. X               (label_ref (match_operand 0 "" ""))))]
  1866. X  ""
  1867. X  "JLO    %l0")
  1868. X
  1869. (define_insn ""
  1870. X  [(set (pc) (if_then_else (le (cc0) (const_int 0))
  1871. X               (pc)
  1872. X               (label_ref (match_operand 0 "" ""))))]
  1873. X  ""
  1874. X  "JGT    %l0")
  1875. X
  1876. (define_insn ""
  1877. X  [(set (pc) (if_then_else (leu (cc0) (const_int 0))
  1878. X               (pc)
  1879. X               (label_ref (match_operand 0 "" ""))))]
  1880. X  ""
  1881. X  "JHI    %l0")
  1882. X
  1883. X
  1884. ;;
  1885. ;;  Load and Store operations
  1886. ;;  -------------------------
  1887. ;;
  1888. X
  1889. (define_insn "movsi"
  1890. X  [(set (match_operand:SI 0 "general_operand" "=r,r,r,o")
  1891. X    (match_operand:SI 1 "general_operand" "r,o,i,r"))]
  1892. X  ""
  1893. X  "*
  1894. {
  1895. X    switch (which_alternative) {
  1896. X      case 0:
  1897. X        return \"MOV    %0,%1\";
  1898. X
  1899. X      case 1:            /* operands[1] must have code MEM */
  1900. X    switch (GET_CODE (XEXP (operands[1], 0))) {
  1901. X      case SYMBOL_REF:
  1902. X        return \"LDA    %0,%1\";
  1903. X      case REG:
  1904. X        return \"LD    %0,%1,%#0\";
  1905. X      default:
  1906. X        return \"LD    %0,%1\";
  1907. X    }
  1908. X
  1909. X      case 2:
  1910. X    if (INTVAL (operands[1]) == 0)
  1911. X        return \"CLR    %0\";
  1912. X    else
  1913. X        return \"LDI    %0,%1\";
  1914. X
  1915. X      case 3:            /* operands[0] must have code MEM */
  1916. X    switch (GET_CODE (XEXP (operands[0], 0))) {
  1917. X      case SYMBOL_REF:
  1918. X        return \"STA    %1,%0\";
  1919. X      case REG:
  1920. X        return \"ST    %1,%0,%#0\";
  1921. X      default:
  1922. X        return \"ST    %1,%0\";
  1923. X    }
  1924. X
  1925. X      default:
  1926. X    abort ();
  1927. X    /*NOTREACHED*/
  1928. X    };
  1929. }")
  1930. X
  1931. ;;
  1932. ;;  Arithmetic operations
  1933. ;;  ---------------------
  1934. ;;
  1935. X
  1936. (define_insn "addsi3"
  1937. X  [(set (match_operand:SI 0 "register_operand" "=r")
  1938. X    (plus:SI (match_operand:SI 1 "register_operand" "r")
  1939. X         (match_operand:SI 2 "general_operand" "rJ")))]
  1940. X  ""
  1941. X  "*
  1942. {
  1943. X    if (GET_CODE (operands[2]) == CONST_INT) {
  1944. X    int value = INTVAL (operands[2]);
  1945. X
  1946. X    /*
  1947. X    **  Use SUB instead of ADD for negative constants. Note that 
  1948. X    **  addition of the constant 16 is converted to subtraction of 
  1949. X    **  -16 (this saves one instruction because 16 is too big for
  1950. X    **  an immediate add operand).
  1951. X    */
  1952. X
  1953. X    if (value == 16 || (value > -16 && value < 0)) {
  1954. X        operands[2] = GEN_INT (-value);
  1955. X        return \"SUB    %0,%1,%2\";
  1956. X    }
  1957. X    }
  1958. X
  1959. X    return \"ADD    %0,%1,%2\";
  1960. }")
  1961. X
  1962. (define_insn "subsi3"
  1963. X  [(set (match_operand:SI 0 "register_operand" "=r")
  1964. X    (minus:SI (match_operand:SI 1 "register_operand" "r")
  1965. X          (match_operand:SI 2 "register_operand" "r")))]
  1966. X  ""
  1967. X  "SUB    %0,%1,%2")
  1968. X
  1969. ;;
  1970. ;;  Logical operations
  1971. ;;  ------------------
  1972. ;;
  1973. X
  1974. (define_insn "andsi3"
  1975. X  [(set (match_operand:SI 0 "register_operand" "=r")
  1976. X    (and:SI (match_operand:SI 1 "register_operand" "r")
  1977. X        (match_operand:SI 2 "general_operand" "rK")))]
  1978. X  ""
  1979. X  "*
  1980. {
  1981. X    extern rtx operand_to_logical_operand ();
  1982. X    operands[2] = operand_to_logical_operand (operands[2]);
  1983. X    return \"AND    %0,%1,%2\";
  1984. }")
  1985. X
  1986. (define_insn ""
  1987. X  [(set (match_operand:SI 0 "register_operand" "=r")
  1988. X    (ior:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
  1989. X        (not:SI (match_operand:SI 2 "general_operand" "rK"))))]
  1990. X  ""
  1991. X  "*
  1992. {
  1993. X    extern rtx operand_to_logical_operand ();
  1994. X    operands[2] = operand_to_logical_operand (operands[2]);
  1995. X    return \"NAND    %0,%1,%2\";
  1996. }")
  1997. X
  1998. (define_insn "iorsi3"
  1999. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2000. X    (ior:SI (match_operand:SI 1 "register_operand" "r")
  2001. X        (match_operand:SI 2 "general_operand" "rK")))]
  2002. X  ""
  2003. X  "*
  2004. {
  2005. X    extern rtx operand_to_logical_operand ();
  2006. X    operands[2] = operand_to_logical_operand (operands[2]);
  2007. X    return \"OR    %0,%1,%2\";
  2008. }")
  2009. X
  2010. (define_insn "xorsi3"
  2011. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2012. X    (xor:SI (match_operand:SI 1 "register_operand" "r")
  2013. X        (match_operand:SI 2 "general_operand" "rK")))]
  2014. X  ""
  2015. X  "*
  2016. {
  2017. X    extern rtx operand_to_logical_operand ();
  2018. X    operands[2] = operand_to_logical_operand (operands[2]);
  2019. X    return \"XOR    %0,%1,%2\";
  2020. }")
  2021. X
  2022. (define_insn "negsi2"
  2023. X  [(set (match_operand:SI 0 "register_operand" "=r,r")
  2024. X    (neg:SI (match_operand:SI 1 "general_operand" "r,I")))]
  2025. X  ""
  2026. X  "@
  2027. X   CPL    %0,%1
  2028. X   SUB    %0,R0,%1    ; CPL    %0,%1")
  2029. X
  2030. (define_insn "one_cmplsi2"
  2031. X  [(set (match_operand:SI 0 "register_operand" "=r,r")
  2032. X    (not:SI (match_operand:SI 1 "general_operand" "r,I")))]
  2033. X  ""
  2034. X  "@
  2035. X   NEG    %0,%1
  2036. X   NADD    %0,R0,%1    ; NEG    %0,%1")
  2037. X
  2038. ;;
  2039. ;;  Shift- and rotate operations
  2040. ;;  ----------------------------
  2041. ;;
  2042. X
  2043. ;; arithmetic shift left
  2044. (define_insn "ashlsi3"
  2045. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2046. X    (ashift:SI (match_operand:SI 1 "register_operand" "r")
  2047. X           (match_operand:SI 2 "general_operand" "rI")))]
  2048. X  "TARGET_BARREL_SHIFTER"
  2049. X  "ASHL    %0,%1,%2")
  2050. X
  2051. (define_insn ""
  2052. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2053. X    (ashift:SI (match_operand:SI 1 "register_operand" "r")
  2054. X           (match_operand:SI 2 "general_operand" "I")))]
  2055. X  "GET_CODE (operands[2]) == CONST_INT"
  2056. X  "*
  2057. {
  2058. X    int shift_count = INTVAL (operands[2]);
  2059. X    output_asm_insn (\"ASHL    %0,%1\", operands);
  2060. X    while (--shift_count)
  2061. X        output_asm_insn (\"ASHL    %0,%0\", operands);
  2062. }")
  2063. X
  2064. ;; arithmetic shift right
  2065. (define_insn "ashrsi3"
  2066. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2067. X    (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
  2068. X             (match_operand:SI 2 "general_operand" "rI")))]
  2069. X  "TARGET_BARREL_SHIFTER"
  2070. X  "ASHR    %0,%1,%2")
  2071. X
  2072. (define_insn ""
  2073. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2074. X    (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
  2075. X             (match_operand:SI 2 "general_operand" "I")))]
  2076. X  "GET_CODE (operands[2]) == CONST_INT"
  2077. X  "*
  2078. {
  2079. X    int shift_count = INTVAL (operands[2]);
  2080. X    output_asm_insn (\"ASHR    %0,%1\", operands);
  2081. X    while (--shift_count)
  2082. X        output_asm_insn (\"ASHR    %0,%0\", operands);
  2083. }")
  2084. X
  2085. ;; logical shift right
  2086. (define_insn "lshrsi3"
  2087. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2088. X    (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
  2089. X             (match_operand:SI 2 "general_operand" "rI")))]
  2090. X  "TARGET_BARREL_SHIFTER"
  2091. X  "LSHR    %0,%1,%2")
  2092. X
  2093. (define_insn ""
  2094. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2095. X    (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
  2096. X             (match_operand:SI 2 "general_operand" "I")))]
  2097. X  "GET_CODE (operands[2]) == CONST_INT"
  2098. X  "*
  2099. {
  2100. X    int shift_count = INTVAL (operands[2]);
  2101. X    output_asm_insn (\"LSHR    %0,%1\", operands);
  2102. X    while (--shift_count)
  2103. X        output_asm_insn (\"LSHR    %0,%0\", operands);
  2104. }")
  2105. X
  2106. ;; rotate left
  2107. (define_insn "rotlsi3"
  2108. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2109. X    (rotate:SI (match_operand:SI 1 "register_operand" "r")
  2110. X           (match_operand:SI 2 "general_operand" "rI")))]
  2111. X  "TARGET_BARREL_SHIFTER"
  2112. X  "ROL    %0,%1,%2")
  2113. X
  2114. (define_insn ""
  2115. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2116. X    (rotate:SI (match_operand:SI 1 "register_operand" "r")
  2117. X           (match_operand:SI 2 "general_operand" "I")))]
  2118. X  "GET_CODE (operands[2]) == CONST_INT"
  2119. X  "*
  2120. {
  2121. X    int shift_count = INTVAL (operands[2]);
  2122. X    output_asm_insn (\"ROL    %0,%1\", operands);
  2123. X    while (--shift_count)
  2124. X        output_asm_insn (\"ROL    %0,%0\", operands);
  2125. }")
  2126. X
  2127. ;; rotate right
  2128. (define_insn "rotrsi3"
  2129. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2130. X    (rotatert:SI (match_operand:SI 1 "register_operand" "r")
  2131. X             (match_operand:SI 2 "general_operand" "rI")))]
  2132. X  "TARGET_BARREL_SHIFTER"
  2133. X  "ROR    %0,%1,%2")
  2134. X
  2135. (define_insn ""
  2136. X  [(set (match_operand:SI 0 "register_operand" "=r")
  2137. X    (rotatert:SI (match_operand:SI 1 "register_operand" "r")
  2138. X             (match_operand:SI 2 "general_operand" "I")))]
  2139. X  "GET_CODE (operands[2]) == CONST_INT"
  2140. X  "*
  2141. {
  2142. X    int shift_count = INTVAL (operands[2]);
  2143. X    output_asm_insn (\"ROR    %0,%1\", operands);
  2144. X    while (--shift_count)
  2145. X        output_asm_insn (\"ROR    %0,%0\", operands);
  2146. }")
  2147. X
  2148. ;;
  2149. ;;  Misc operations
  2150. ;;  ---------------
  2151. ;;
  2152. X
  2153. (define_insn "nop"
  2154. X  [(const_int 0)]
  2155. X  ""
  2156. X  "NOP")
  2157. X
  2158. X
  2159. ;;- Local variables:
  2160. ;;- mode:emacs-lisp
  2161. ;;- comment-start: ";;- "
  2162. ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
  2163. ;;- eval: (modify-syntax-entry ?[ "(]")
  2164. ;;- eval: (modify-syntax-entry ?] ")[")
  2165. ;;- eval: (modify-syntax-entry ?{ "(}")
  2166. ;;- eval: (modify-syntax-entry ?} "){")
  2167. ;;- End:
  2168. SHAR_EOF
  2169. chmod 0664 risc32.md ||
  2170. echo 'restore of risc32.md failed'
  2171. Wc_c="`wc -c < 'risc32.md'`"
  2172. test 13802 -eq "$Wc_c" ||
  2173.     echo 'risc32.md: original size 13802, current size' "$Wc_c"
  2174. fi
  2175. # ============= xm-risc32.h ==============
  2176. if test -f 'xm-risc32.h' -a X"$1" != X"-c"; then
  2177.     echo 'x - skipping xm-risc32.h (File already exists)'
  2178. else
  2179. echo 'x - extracting xm-risc32.h (Text)'
  2180. sed 's/^X//' << 'SHAR_EOF' > 'xm-risc32.h' &&
  2181. /* Configuration for GNU C-compiler for IMS RISC32 controller.
  2182. X   Copyright (C) 1992 Andreas Luik <luik@isa.de>.
  2183. X
  2184. This file is part of GNU CC.
  2185. X
  2186. GNU CC is free software; you can redistribute it and/or modify
  2187. it under the terms of the GNU General Public License as published by
  2188. the Free Software Foundation; either version 2, or (at your option)
  2189. any later version.
  2190. X
  2191. GNU CC is distributed in the hope that it will be useful,
  2192. but WITHOUT ANY WARRANTY; without even the implied warranty of
  2193. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2194. GNU General Public License for more details.
  2195. X
  2196. You should have received a copy of the GNU General Public License
  2197. along with GNU CC; see the file COPYING.  If not, write to
  2198. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  2199. X
  2200. X
  2201. /* #defines that need visibility everywhere.  */
  2202. #define FALSE 0
  2203. #define TRUE 1
  2204. X
  2205. /* Arguments to use with `exit'.  */
  2206. #define SUCCESS_EXIT_CODE 0
  2207. #define FATAL_EXIT_CODE 33
  2208. X
  2209. /* Doubles are stored in memory with the high order word first.  This
  2210. X   matters when cross-compiling.  */
  2211. #define HOST_WORDS_BIG_ENDIAN
  2212. X
  2213. /* This describes the machine the compiler is hosted on.  */
  2214. #define HOST_BITS_PER_CHAR 16
  2215. #define HOST_BITS_PER_SHORT 16
  2216. #define HOST_BITS_PER_INT 32
  2217. #define HOST_BITS_PER_LONG 32
  2218. #define HOST_BITS_PER_LONGLONG 64
  2219. X
  2220. /* target machine dependencies.
  2221. X   tm.h is a symbolic link to the actual target specific file.   */
  2222. #include "tm.h"
  2223. X
  2224. /* If compiled with GNU C, use the built-in alloca.  */
  2225. #ifdef __GNUC__
  2226. /* Use an arg in this macro because that's what some other
  2227. X   system does--let's avoid conflict.  */
  2228. #define alloca(x) __builtin_alloca(x)
  2229. #endif
  2230. SHAR_EOF
  2231. chmod 0664 xm-risc32.h ||
  2232. echo 'restore of xm-risc32.h failed'
  2233. Wc_c="`wc -c < 'xm-risc32.h'`"
  2234. test 1657 -eq "$Wc_c" ||
  2235.     echo 'xm-risc32.h: original size 1657, current size' "$Wc_c"
  2236. fi
  2237. exit 0
  2238.  
  2239. -- 
  2240. Andreas Luik                E-Mail: luik@isa.de
  2241. (postmaster@isa.de)         UUCP:   ...!{uunet!unido,pyramid}!isaak!luik
  2242.  
  2243.  
  2244.