annotate extra/gcc6809lw-4.6.1-1.patch @ 301:6f7fe78bb868 ccdev

Add string -> number conversion for preproc expression evaluator Q&D conversion from string to signed number. It should be noted that this really should be done during tokenization and the type of number be set by the tokenizer, including parsing floating point values. Then the preprocessor can decide what to do with non-integer numbers.
author William Astle <lost@l-w.ca>
date Sun, 15 Sep 2013 14:22:10 -0600
parents e0cc66fd0551
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
182
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1 diff -urN gcc-4.6.1-orig/config.sub gcc-4.6.1/config.sub
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2 --- gcc-4.6.1-orig/config.sub 2010-05-25 07:22:07.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3 +++ gcc-4.6.1/config.sub 2011-09-17 14:07:51.597643628 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4 @@ -313,7 +313,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5 c6x)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6 basic_machine=tic6x-unknown
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8 - m6811 | m68hc11 | m6812 | m68hc12 | picochip)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
9 + m6809 | m6811 | m68hc11 | m6812 | m68hc12 | picochip)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
10 # Motorola 68HC11/12.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
11 basic_machine=$basic_machine-unknown
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
12 os=-none
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
13 @@ -354,7 +354,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
14 | i*86-* | i860-* | i960-* | ia64-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
15 | ip2k-* | iq2000-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
16 | lm32-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
17 - | m32c-* | m32r-* | m32rle-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
18 + | m32c-* | m32r-* | m32rle-* | m6809-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
19 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
20 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
21 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
22 @@ -509,6 +509,10 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
23 basic_machine=arm-unknown
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
24 os=-cegcc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
25 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
26 + coco)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
27 + basic_machine=coco
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
28 + os=-none
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
29 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
30 convex-c1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
31 basic_machine=c1-convex
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
32 os=-bsd
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
33 diff -urN gcc-4.6.1-orig/configure gcc-4.6.1/configure
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
34 --- gcc-4.6.1-orig/configure 2011-03-16 12:27:36.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
35 +++ gcc-4.6.1/configure 2011-09-17 14:06:01.187643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
36 @@ -3441,6 +3441,9 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
37 m32r-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
38 noconfigdirs="$noconfigdirs ${libgcj}"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
39 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
40 + m6809*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
41 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
42 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
43 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
44 noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
45 libgloss_dir=m68hc11
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
46 diff -urN gcc-4.6.1-orig/configure.ac gcc-4.6.1/configure.ac
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
47 --- gcc-4.6.1-orig/configure.ac 2011-03-16 12:27:36.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
48 +++ gcc-4.6.1/configure.ac 2011-09-17 14:06:01.187643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
49 @@ -887,6 +887,9 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
50 m32r-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
51 noconfigdirs="$noconfigdirs ${libgcj}"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
52 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
53 + m6809*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
54 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
55 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
56 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
57 noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
58 libgloss_dir=m68hc11
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
59 diff -urN gcc-4.6.1-orig/gcc/calls.c gcc-4.6.1/gcc/calls.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
60 --- gcc-4.6.1-orig/gcc/calls.c 2011-06-06 05:46:14.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
61 +++ gcc-4.6.1/gcc/calls.c 2011-09-17 14:06:01.217643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
62 @@ -2434,7 +2434,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
63 call sequence.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
64 Also do the adjustments before a throwing call, otherwise
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
65 exception handling can fail; PR 19225. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
66 - if (pending_stack_adjust >= 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
67 + if (pending_stack_adjust >= 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
68 || (pending_stack_adjust > 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
69 && (flags & ECF_MAY_BE_ALLOCA))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
70 || (pending_stack_adjust > 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
71 diff -urN gcc-4.6.1-orig/gcc/config/m6809/crt0.S gcc-4.6.1/gcc/config/m6809/crt0.S
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
72 --- gcc-4.6.1-orig/gcc/config/m6809/crt0.S 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
73 +++ gcc-4.6.1/gcc/config/m6809/crt0.S 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
74 @@ -0,0 +1,180 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
75 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
76 +;;; Copyright 2006, 2007, 2008, 2009 by Brian Dominy <brian@oddchange.com>
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
77 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
78 +;;; This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
79 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
80 +;;; GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
81 +;;; it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
82 +;;; the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
83 +;;; any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
84 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
85 +;;; GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
86 +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
87 +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
88 +;;; GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
89 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
90 +;;; You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
91 +;;; along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
92 +;;; <http://www.gnu.org/licenses/>.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
93 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
94 + /* Declare external for main() */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
95 + .globl _main
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
96 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
97 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
98 +/* The startup is heavily dependent on the type of machine and
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
99 +OS environment that is available at the start point.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
100 +For the most part, the general idea is the same across machines,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
101 +but the implementation is vastly different. This is managed via
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
102 +conditional compiles throughout the startup code for each of the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
103 +supported machines. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
104 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
105 +#ifdef TARGET_COCO /* CoCo memory map */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
106 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
107 +#define COCO_RAMROM_MODE 0xFFDE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
108 +#define COCO_ALLRAM_MODE 0xFFDF
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
109 +#define COCO_PAGE1 0xFFD5
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
110 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
111 +/* SAM M1 and M0 adjusts the memory size */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
112 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
113 +#define BASIC_WARMSTART_FLAG 0x0071
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
114 +#define BASIC_START 0xA027
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
115 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
116 +#define __STACK_TOP 0x6800
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
117 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
118 +#else /* Simulator (default) memory map */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
119 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
120 +#define SIM_EXIT_REG 0xFF01
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
121 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
122 +#define __STACK_TOP 0xFE00
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
123 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
124 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
125 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
126 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
127 + /* Declare all linker sections, and combine them into a single bank */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
128 + .bank prog
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
129 + .area .text (BANK=prog)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
130 + .area .data (BANK=prog)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
131 + .area .ctors (BANK=prog)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
132 + .word 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
133 + .area .dtors (BANK=prog)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
134 + .word 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
135 + .area .bss (BANK=prog)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
136 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
137 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
138 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
139 + ;;; __exit : Exit point from the program
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
140 + ;;; For simulation, this writes to a special I/O register that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
141 + ;;; the simulator interprets as end-of-program.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
142 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
143 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
144 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
145 + .globl __exit
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
146 +__exit:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
147 +#ifdef TARGET_COCO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
148 + ;; Go back to ROM/RAM mode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
149 + sta COCO_RAMROM_MODE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
150 + clr BASIC_WARMSTART_FLAG
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
151 + jmp BASIC_START
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
152 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
153 + tfr x,d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
154 + stb SIM_EXIT_REG
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
155 + bra __exit
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
156 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
157 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
158 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
159 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
160 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
161 + ;;; __start : Entry point to the program
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
162 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
163 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
164 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
165 + .globl __start
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
166 +__start:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
167 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
168 +#ifdef HAVE_DIRECT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
169 + ;; Initialize the direct page pointer
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
170 + lda #<s_.direct
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
171 + tfr a,dp
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
172 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
173 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
174 +#ifdef TARGET_COCO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
175 + ;; Turn off interrupts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
176 + orcc #(0x10|0x40)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
177 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
178 + ;; Setup All RAM Mode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
179 + sta COCO_ALLRAM_MODE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
180 +#endif /* TARGET_COCO */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
181 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
182 + ;; Initialize the stack
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
183 + lds #__STACK_TOP - 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
184 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
185 + ;; Call any "initializer" functions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
186 + ldu #s_.ctors
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
187 +__ctors_loop:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
188 + ldy ,u++
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
189 + cmpy #0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
190 + beq __ctors_done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
191 + jsr ,y
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
192 + bra __ctors_loop
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
193 +__ctors_done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
194 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
195 + ;; Enable interrupts on the simulator
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
196 +#ifndef TARGET_COCO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
197 + andcc #~(0x10|0x40)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
198 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
199 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
200 + ;; Set up the environment
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
201 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
202 + ;; Set up argc/argv arrays
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
203 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
204 + ;; Call the main function. The exit code will
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
205 + ;; be returned in the X register, unless compiled
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
206 + ;; with -mdret, in which case it comes back in D.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
207 + jsr _main
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
208 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
209 + ;; Call any finalizer functions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
210 + ldu #s_.dtors
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
211 +__dtors_loop:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
212 + ldy ,u++
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
213 + cmpy #0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
214 + beq __dtors_done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
215 + jsr ,y
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
216 + bra __dtors_loop
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
217 +__dtors_done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
218 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
219 + ;; If main returns, then invoke _exit() to stop the program
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
220 + ;; The C library doesn't support -mdret yet, so move the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
221 + ;; argument first.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
222 +#ifdef __DRET__
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
223 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
224 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
225 + jmp _exit
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
226 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
227 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
228 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
229 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
230 + ;;; __crt0_vector : Default handler for interrupts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
231 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
232 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
233 +___crt0_vector:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
234 + ;; The default behavior is to simply ignore all
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
235 + ;; non-reset interrupts.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
236 + rti
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
237 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
238 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
239 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
240 + ;;; vector : The interrupt vector table
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
241 + ;;; The linker will ensure that this gets loaded at address 0xFFF0.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
242 + ;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
243 + .area vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
244 +vectors:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
245 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
246 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
247 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
248 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
249 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
250 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
251 + .word ___crt0_vector
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
252 + .word __start
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
253 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
254 + .end __start
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
255 diff -urN gcc-4.6.1-orig/gcc/config/m6809/libgcc1.s gcc-4.6.1/gcc/config/m6809/libgcc1.s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
256 --- gcc-4.6.1-orig/gcc/config/m6809/libgcc1.s 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
257 +++ gcc-4.6.1/gcc/config/m6809/libgcc1.s 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
258 @@ -0,0 +1,511 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
259 +/* libgcc routines for m6809
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
260 + Copyright (C) 2006 Free Software Foundation, Inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
261 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
262 +This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
263 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
264 +GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
265 +it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
266 +the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
267 +any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
268 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
269 +GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
270 +but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
271 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
272 +GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
273 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
274 +You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
275 +along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
276 +<http://www.gnu.org/licenses/>. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
277 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
278 +/* As a special exception, if you link this library with other files,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
279 + some of which are compiled with GCC, to produce an executable,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
280 + this library does not by itself cause the resulting executable
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
281 + to be covered by the GNU General Public License.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
282 + This exception does not however invalidate any other reasons why
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
283 + the executable file might be covered by the GNU General Public License. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
284 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
285 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
286 +#define SIGFPE jmp _abort
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
287 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
288 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
289 + ; Shift functions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
290 + ; On input, D is value to be shifted, and X has shift count.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
291 + ; Result is also in D.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
292 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
293 +#ifdef L_ashlhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
294 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
295 + .globl _ashlhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
296 +_ashlhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
297 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
298 +1$:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
299 + leax -1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
300 + cmpx #-1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
301 + beq 2$
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
302 + aslb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
303 + rola
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
304 + bra 1$
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
305 +2$:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
306 + puls x,pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
307 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
308 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
309 +#ifdef L_ashrhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
310 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
311 + .globl _ashrhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
312 +_ashrhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
313 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
314 +1$:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
315 + leax -1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
316 + cmpx #-1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
317 + beq 2$
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
318 + asra
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
319 + rorb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
320 + bra 1$
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
321 +2$:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
322 + puls x,pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
323 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
324 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
325 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
326 +#ifdef L_lshrhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
327 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
328 + .globl _lshrhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
329 +_lshrhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
330 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
331 +1$:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
332 + leax -1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
333 + cmpx #-1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
334 + beq 2$
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
335 + lsra
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
336 + rorb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
337 + bra 1$
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
338 +2$:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
339 + puls x,pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
340 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
341 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
342 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
343 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
344 +#ifdef L_softregs
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
345 + .area direct
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
346 + .globl m0, m1, m2, m3, m4, m5, m6, m7
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
347 + .globl m8, m9, m10, m11, m12, m13, m14, m15
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
348 +m0: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
349 +m1: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
350 +m2: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
351 +m3: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
352 +m4: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
353 +m5: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
354 +m6: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
355 +m7: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
356 +m8: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
357 +m9: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
358 +m10: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
359 +m11: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
360 +m12: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
361 +m13: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
362 +m14: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
363 +m15: .blkb 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
364 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
365 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
366 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
367 +#ifdef L_ashlsi3_one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
368 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
369 + .globl _ashlsi3_one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
370 +_ashlsi3_one:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
371 + asl 3,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
372 + rol 2,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
373 + rol 1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
374 + rol ,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
375 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
376 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
377 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
378 +#ifdef L_ashlsi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
379 + /* X points to the SImode (source/dest)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
380 + B is the count */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
381 +_ashlsi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
382 + pshs u
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
383 + cmpb #16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
384 + blt try8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
385 + subb #16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
386 + ; Shift by 16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
387 + ldu 2,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
388 + stu ,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
389 +try8:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
390 + cmpb #8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
391 + blt try_rest
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
392 + subb #8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
393 + ; Shift by 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
394 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
395 +try_rest:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
396 + tstb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
397 + beq done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
398 +do_rest:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
399 + ; Shift by 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
400 + asl 3,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
401 + rol 2,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
402 + rol 1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
403 + rol ,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
404 + decb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
405 + bne do_rest
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
406 +done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
407 + puls u,pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
408 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
409 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
410 +#ifdef L_ashrsi3_one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
411 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
412 + .globl _ashlsi3_one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
413 +_ashrsi3_one:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
414 + asr ,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
415 + ror 1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
416 + ror 2,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
417 + ror 3,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
418 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
419 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
420 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
421 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
422 +#ifdef L_lshrsi3_one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
423 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
424 + .globl _lshrsi3_one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
425 +_lshrsi3_one:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
426 + lsr ,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
427 + ror 1,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
428 + ror 2,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
429 + ror 3,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
430 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
431 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
432 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
433 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
434 +#ifdef L_clzsi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
435 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
436 + .globl ___clzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
437 + ; Input: X = 16-bit unsigned integer
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
438 + ; Output: X = number of leading zeros
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
439 + ; This function destroys the value in D.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
440 +___clzhi2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
441 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
442 + ; Find the offset of the leftmost '1' bit in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
443 + ; the left half of the word.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
444 + ;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
445 + ; Bits are numbered in the table with 1 meaning the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
446 + ; LSB and 8 meaning the MSB.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
447 + ;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
448 + ; If nonzero, then clz is 8-a.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
449 + tfr x,d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
450 + ldx #___clz_tab
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
451 + tfr a,b
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
452 + clra
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
453 + ldb d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
454 + bne upper_bit_set
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
455 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
456 +lower_bit_set:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
457 + ; If the upper byte is zero, then check the lower
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
458 + ; half of the word. Return 16-a.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
459 + puls d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
460 + clra
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
461 + ldb d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
462 + negb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
463 + addb #16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
464 + bra done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
465 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
466 +upper_bit_set:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
467 + negb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
468 + addb #8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
469 + puls x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
470 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
471 +done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
472 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
473 + puls pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
474 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
475 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
476 +#ifdef L_clzdi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
477 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
478 + .globl ___clzsi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
479 + ; Input: 32-bit unsigned integer is on the stack, just
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
480 + ; above the return address
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
481 + ; Output: X = number of leading zeros
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
482 +___clzsi2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
483 + ; Check the upper 16-bit word
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
484 + ; If it is not zero, then return clzhi2(X).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
485 + ; A branch can be used instead of a call since no
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
486 + ; postprocessing is needed. Use long branch form
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
487 + ; though since functions may not be near each other.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
488 + ldx 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
489 + lbne ___clzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
490 + ldx 4,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
491 + jsr ___clzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
492 + leax 16,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
493 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
494 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
495 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
496 +#ifdef L_ctzsi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
497 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
498 + .globl ___ctzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
499 + ; Input: X = 16-bit unsigned integer
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
500 + ; Output: X = number of trailing zeros
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
501 + ; F(x) = 15 - clzhi2(X & -x)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
502 + ; This function destroys the value in D.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
503 +___ctzhi2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
504 + tfr x,d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
505 + coma
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
506 + comb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
507 + addd #1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
508 + pshs a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
509 + pshs b
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
510 + tfr x,d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
511 + andb ,s+
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
512 + anda ,s+
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
513 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
514 + jsr ___clzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
515 + tfr x,d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
516 + subd #16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
517 + coma
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
518 + comb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
519 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
520 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
521 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
522 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
523 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
524 +#ifdef L_ctzdi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
525 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
526 + .globl ___ctzsi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
527 + ; Input: 32-bit unsigned integer is on the stack, just
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
528 + ; above the return address
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
529 + ; Output: X = number of leading zeros
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
530 +___ctzsi2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
531 + ; Check the lower 16-bit word
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
532 + ; If it is not zero, then return ctzhi2(X).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
533 + ; A branch can be used instead of a call since no
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
534 + ; postprocessing is needed. Use long branch form
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
535 + ; though since functions may not be near each other.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
536 + ldx 4,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
537 + lbne ___ctzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
538 + ldx 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
539 + jsr ___ctzhi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
540 + leax 16,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
541 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
542 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
543 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
544 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
545 +#ifdef L_mulhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
546 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
547 +;;; ___mulhi3 - signed/unsigned multiply
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
548 +;;; Called by GCC to implement 16x16 multiplication
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
549 +;;; Arguments: Two 16-bit values, one in stack, one in X.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
550 +;;; Result: 16-bit result in X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
551 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
552 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
553 + .globl _mulhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
554 +_mulhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
555 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
556 + lda 5,s ; left msb * right lsb * 256
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
557 + ldb ,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
558 + mul
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
559 + tfr b,a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
560 + clrb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
561 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
562 + ldb 1,s ; left lsb * right msb * 256
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
563 + lda 4,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
564 + mul
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
565 + tfr b,a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
566 + clrb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
567 + leax d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
568 + ldb 1,s ; left lsb * right lsb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
569 + lda 5,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
570 + mul
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
571 + leax d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
572 + puls d,pc ; kill D to remove initial push
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
573 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
574 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
575 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
576 +#ifdef L_divhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
577 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
578 +;;; ___divhi3 - signed division
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
579 +;;; Arguments: Dividend in X, divisor on the stack
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
580 +;;; Returns result in X.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
581 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
582 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
583 + .globl _divhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
584 +_divhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
585 + ldd 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
586 + bne do_div ; check dividend
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
587 + SIGFPE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
588 +do_div:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
589 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
590 + jsr _seuclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
591 + puls x,pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
592 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
593 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
594 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
595 +#ifdef L_modhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
596 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
597 +;;; ___modhi3 - signed modulo
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
598 +;;; Arguments: Dividend in X, divisor on the stack
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
599 +;;; Returns result in X.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
600 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
601 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
602 + .globl _modhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
603 +_modhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
604 + ldd 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
605 + bne do_mod ; check dividend
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
606 + SIGFPE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
607 +do_mod:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
608 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
609 + jsr _seuclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
610 + leas 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
611 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
612 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
613 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
614 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
615 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
616 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
617 +#ifdef L_udivhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
618 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
619 +;;; ___udivhi3 - unsigned division
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
620 +;;; Arguments: Dividend in X, divisor on the stack
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
621 +;;; Returns result in X.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
622 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
623 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
624 + .globl _udivhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
625 +_udivhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
626 + ldd 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
627 + bne do_udiv ; check dividend
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
628 + SIGFPE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
629 +do_udiv:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
630 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
631 + jsr _euclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
632 + puls x,pc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
633 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
634 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
635 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
636 +#ifdef L_umodhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
637 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
638 +;;; ___umodhi3 - unsigned modulo
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
639 +;;; Arguments: Dividend in X, divisor on the stack
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
640 +;;; Returns result in X.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
641 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
642 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
643 + .globl _umodhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
644 +_umodhi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
645 + ldd 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
646 + bne do_umod ; check dividend
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
647 + SIGFPE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
648 +do_umod:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
649 + pshs x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
650 + jsr _euclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
651 + leas 2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
652 + tfr d,x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
653 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
654 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
655 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
656 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
657 +#ifdef L_euclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
658 +; unsigned euclidean division
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
659 +; calling: (left / right)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
660 +; push left
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
661 +; ldd right
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
662 +; jsr _euclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
663 +; quotient on the stack (left)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
664 +; modulus in d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
665 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
666 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
667 + .globl _euclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
668 + left=5
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
669 + right=1 ; word
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
670 + count=0 ; byte
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
671 + CARRY=1 ; alias
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
672 +_euclid:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
673 + leas -3,s ; 2 local variables
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
674 + clr count,s ; prescale divisor
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
675 + inc count,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
676 + tsta
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
677 +presc:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
678 + bmi presc_done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
679 + inc count,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
680 + aslb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
681 + rola
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
682 + bra presc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
683 +presc_done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
684 + std right,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
685 + ldd left,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
686 + clr left,s ; quotient = 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
687 + clr left+1,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
688 +mod1:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
689 + subd right,s ; check subtract
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
690 + bcc mod2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
691 + addd right,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
692 + andcc #~CARRY
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
693 + bra mod3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
694 +mod2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
695 + orcc #CARRY
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
696 +mod3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
697 + rol left+1,s ; roll in carry
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
698 + rol left,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
699 + lsr right,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
700 + ror right+1,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
701 + dec count,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
702 + bne mod1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
703 + leas 3,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
704 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
705 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
706 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
707 +#ifdef L_seuclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
708 +; signed euclidean division
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
709 +; calling: (left / right)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
710 +; push left
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
711 +; ldd right
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
712 +; jsr _seuclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
713 +; quotient on the stack (left)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
714 +; modulus in d
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
715 + .area .text
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
716 + .globl _seuclid
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
717 + left=6
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
718 + right=2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
719 + quot_sign=1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
720 + mod_sign=0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
721 +_seuclid:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
722 + leas -4,s ; 3 local variables
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
723 + std right,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
724 + clr mod_sign,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
725 + clr quot_sign,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
726 + ldd left,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
727 + bge mod_abs
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
728 + inc mod_sign,s ; sign(mod) = sign(left)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
729 + inc quot_sign,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
730 + bsr negd ; abs(left) -> D
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
731 +mod_abs:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
732 + pshs b,a ; push abs(left)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
733 + ldd right+2,s ; all references shifted by 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
734 + bge quot_abs
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
735 + dec quot_sign+2,s ; sign(quot) = sign(left) XOR sign(right)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
736 + bsr negd ; abs(right) -> D
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
737 +quot_abs:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
738 + jsr _euclid ; call (unsigned) euclidean division
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
739 + std right+2,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
740 + puls a,b ; quot -> D
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
741 + tst quot_sign,s ; all references no longer shifted
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
742 + beq quot_done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
743 + bsr negd
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
744 +quot_done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
745 + std left,s ; quot -> left
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
746 + ldd right,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
747 + tst mod_sign,s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
748 + beq mod_done
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
749 + bsr negd
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
750 +mod_done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
751 + leas 4,s ; destroy stack frame
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
752 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
753 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
754 +negd: ; self-explanatory !
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
755 + nega
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
756 + negb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
757 + sbca #0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
758 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
759 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
760 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
761 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
762 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
763 +#ifdef L_pending_addsi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
764 +_addsi3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
765 + rts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
766 +#endif /* L_pending_addsi3 */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
767 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
768 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
769 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
770 diff -urN gcc-4.6.1-orig/gcc/config/m6809/m6809.c gcc-4.6.1/gcc/config/m6809/m6809.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
771 --- gcc-4.6.1-orig/gcc/config/m6809/m6809.c 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
772 +++ gcc-4.6.1/gcc/config/m6809/m6809.c 2011-09-18 19:48:42.137654855 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
773 @@ -0,0 +1,3013 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
774 +/*-------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
775 + FILE: m6809.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
776 +-------------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
777 +/* Subroutines for insn-output.c for MC6809.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
778 + Copyright (C) 1989-2007 Free Software Foundation, Inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
779 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
780 + MC6809 Version by Tom Jones (jones@sal.wisc.edu)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
781 + Space Astronomy Laboratory
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
782 + University of Wisconsin at Madison
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
783 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
784 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
785 + ( msdoerfe@informatik.uni-erlangen.de )
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
786 + also added #pragma interrupt (inspired by gcc-6811)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
787 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
788 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
789 + (ebotcazou@multimania.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
790 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
791 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
792 + (ebotcazou@multimania.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
793 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
794 + major cleanup, improvements, and upgrade to gcc 3.4 by Brian Dominy
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
795 + (brian@oddchange.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
796 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
797 + additional adjustments, etc., for gcc 4.6.1 by William Astle (lost@l-w.ca)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
798 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
799 +This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
800 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
801 +GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
802 +it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
803 +the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
804 +any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
805 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
806 +GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
807 +but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
808 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
809 +GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
810 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
811 +You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
812 +along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
813 +<http://www.gnu.org/licenses/>. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
814 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
815 +#include <string.h>
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
816 +#include <time.h>
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
817 +#include <sys/types.h>
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
818 +#include <sys/timeb.h>
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
819 +#include <stdio.h>
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
820 +#include "config.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
821 +#include "system.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
822 +#include "coretypes.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
823 +#include "tm.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
824 +#include "tree.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
825 +#include "rtl.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
826 +#include "tm_p.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
827 +#include "regs.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
828 +#include "flags.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
829 +#include "hard-reg-set.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
830 +#include "real.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
831 +#include "tree.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
832 +#include "insn-config.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
833 +#include "conditions.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
834 +#include "insn-flags.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
835 +#include "output.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
836 +#include "insn-attr.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
837 +#include "function.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
838 +#include "target.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
839 +#include "target-def.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
840 +#include "expr.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
841 +#include "recog.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
842 +#include "cpplib.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
843 +#include "c-family/c-pragma.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
844 +#include "c-family/c-common.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
845 +#include "toplev.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
846 +#include "optabs.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
847 +#include "version.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
848 +#include "df.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
849 +#include "rtlhooks-def.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
850 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
851 +/* macro to return TRUE if length of operand mode is one byte */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
852 +#define BYTE_MODE(X) ((GET_MODE_SIZE (GET_MODE (X))) == 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
853 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
854 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
855 +/* REAL_REG_P(x) is a true if the rtx 'x' represents a real CPU
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
856 +register and not a fake one that is emulated in software. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
857 +#define REAL_REG_P(x) (REG_P(x) && !M_REG_P(x))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
858 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
859 +/*-------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
860 + Target hooks, moved from target.h
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
861 +-------------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
862 +static void m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
863 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
864 +#undef TARGET_ENCODE_SECTION_INFO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
865 +#define TARGET_ENCODE_SECTION_INFO m6809_encode_section_info
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
866 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
867 +#undef TARGET_ASM_FILE_START
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
868 +#define TARGET_ASM_FILE_START m6809_asm_file_start
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
869 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
870 +#undef TARGET_ASM_ALIGNED_HI_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
871 +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
872 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
873 +#undef TARGET_ASM_ALIGNED_SI_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
874 +#define TARGET_ASM_ALIGNED_SI_OP NULL
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
875 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
876 +#undef TARGET_ASM_UNALIGNED_HI_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
877 +#define TARGET_ASM_UNALIGNED_HI_OP "\t.word\t"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
878 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
879 +#undef TARGET_ASM_UNALIGNED_SI_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
880 +#define TARGET_ASM_UNALIGNED_SI_OP NULL
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
881 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
882 +#undef TARGET_RTX_COSTS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
883 +#define TARGET_RTX_COSTS m6809_rtx_costs
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
884 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
885 +#undef TARGET_ATTRIBUTE_TABLE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
886 +#define TARGET_ATTRIBUTE_TABLE m6809_attribute_table
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
887 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
888 +#undef TARGET_INIT_BUILTINS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
889 +#define TARGET_INIT_BUILTINS m6809_init_builtins
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
890 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
891 +#undef TARGET_EXPAND_BUILTIN
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
892 +#define TARGET_EXPAND_BUILTIN m6809_expand_builtin
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
893 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
894 +#undef TARGET_DEFAULT_TARGET_FLAGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
895 +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_REG_ARGS | MASK_DIRECT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
896 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
897 +#undef TARGET_FUNCTION_OK_FOR_SIBCALL
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
898 +#define TARGET_FUNCTION_OK_FOR_SIBCALL m6809_function_ok_for_sibcall
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
899 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
900 +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
901 +#define TARGET_ASM_TRAMPOLINE_TEMPLATE m6809_asm_trampoline_template
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
902 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
903 +#undef TARGET_TRAMPOLINE_INIT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
904 +#define TARGET_TRAMPOLINE_INIT m6809_initialize_trampoline
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
905 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
906 +#undef TARGET_FRAME_POINTER_REQUIRED
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
907 +#define TARGET_FRAME_POINTER_REQUIRED m6809_frame_pointer_required
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
908 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
909 +#undef TARGET_OPTION_OVERRIDE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
910 +#define TARGET_OPTION_OVERRIDE m6809_override_options
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
911 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
912 +/* External variables used */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
913 +extern int reload_completed; /* set in toplev.c */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
914 +extern FILE *asm_out_file;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
915 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
916 +static int last_mem_size; /* operand size (bytes) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
917 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
918 +/* True if the section was recently changed and another .area
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
919 + * directive needs to be output before emitting the next label. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
920 +int section_changed = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
921 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
922 +/* Section names. The defaults here are used until an
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
923 + * __attribute__((section)) is seen that changes it. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
924 +char code_section_op[128] = "\t.area .text";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
925 +char data_section_op[128] = "\t.area .data";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
926 +char bss_section_op[128] = "\t.area .bss";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
927 +const char *code_bank_option = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
928 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
929 +/* TRUE if the direct mode prefix might be valid in this context.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
930 + * This is set by 'print_address' prior to calling output_addr_const,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
931 + * which performs into 'print_direct_prefix' to do the final checks. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
932 +static int check_direct_prefix_flag;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
933 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
934 +/* Nonzero if an address is being printed in a context which does not
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
935 + * permit any PIC modifications to the address */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
936 +static int pic_ok_for_addr_p = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
937 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
938 +/* Current code page. This supports machines which can do bank
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
939 + * switching to allow for more than 64KB of code/data. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
940 +char far_code_page[64];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
941 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
942 +/* Current bank name */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
943 +static char current_bank_name[8] = "-1";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
944 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
945 +/* Default bank name */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
946 +static char default_code_bank_name[8] = "-1";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
947 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
948 +/* Direct memory reserved as soft registers */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
949 +unsigned int m6809_soft_regs = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
950 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
951 +/* ABI version */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
952 +unsigned int m6809_abi_version = M6809_ABI_VERSION_REGS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
953 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
954 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
955 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
956 + * Called after options have been parsed.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
957 + * If overrides have been specified on the command-line, then
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
958 + * these values are copied into the main storage variables.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
959 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
960 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
961 +m6809_override_options (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
962 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
963 + /* Handle -mfar-code-page */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
964 + if (far_code_page_option == 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
965 + far_code_page_option = "__default_code_page";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
966 + strcpy (far_code_page, far_code_page_option);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
967 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
968 + /* Handle -mcode-section, -mdata-section, and -mbss-section */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
969 + if (code_section_ptr != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
970 + sprintf (code_section_op, "\t.area %s", code_section_ptr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
971 + if (data_section_ptr != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
972 + sprintf (data_section_op, "\t.area %s", data_section_ptr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
973 + if (bss_section_ptr != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
974 + sprintf (bss_section_op, "\t.area %s", bss_section_ptr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
975 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
976 + /* Handle -mcode-bank */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
977 + if (code_bank_option != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
978 + sprintf (default_code_bank_name, "%s", code_bank_option);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
979 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
980 + /* Handle -mabi-version or -mno-reg-args */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
981 + if (m6809_abi_version_ptr != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
982 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
983 + if (!strcmp (m6809_abi_version_ptr, "stack"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
984 + m6809_abi_version = M6809_ABI_VERSION_STACK;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
985 + else if (!strcmp (m6809_abi_version_ptr, "regs"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
986 + m6809_abi_version = M6809_ABI_VERSION_REGS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
987 + else if (!strcmp (m6809_abi_version_ptr, "bx"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
988 + m6809_abi_version = M6809_ABI_VERSION_BX;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
989 + else if (!strcmp (m6809_abi_version_ptr, "latest"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
990 + m6809_abi_version = M6809_ABI_VERSION_LATEST;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
991 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
992 + m6809_abi_version = atoi (m6809_abi_version_ptr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
993 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
994 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
995 + /* The older -mno-reg-args option is deprecated, and treated
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
996 + as -mabi=stack. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
997 + if (!TARGET_REG_ARGS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
998 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
999 + warning (WARNING_OPT "-mno-reg-args deprecated; use -mabi=stack instead.");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1000 + m6809_abi_version = M6809_ABI_VERSION_STACK;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1001 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1002 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1003 + /* -fexceptions is unsupported */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1004 + flag_exceptions = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1005 + flag_non_call_exceptions = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1006 + flag_unwind_tables = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1007 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1008 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1009 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1010 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1011 + * Output prefix that directs the assembler to use a direct-mode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1012 + * instruction if globally enabled, address is a symbol, and symbol
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1013 + * has been marked as in direct page. Also, never do this if
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1014 + * using the indirect mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1015 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1016 +print_direct_prefix (FILE * file, rtx addr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1017 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1018 + if (TARGET_DIRECT &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1019 + (GET_CODE (addr) == SYMBOL_REF) &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1020 + SYMBOL_REF_FLAG (addr) &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1021 + check_direct_prefix_flag)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1022 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1023 + putc ('*', file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1024 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1025 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1026 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1027 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1028 +/** Prints an operand (that is not an address) in assembly from RTL. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1029 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1030 +print_operand (FILE * file, rtx x, int code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1031 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1032 + if (REG_P (x)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1033 + /* gcc currently allocates the entire 16-bit 'd' register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1034 + * even when it only needs an 8-bit value. So here it
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1035 + * is tricked into printing only the lower 8-bit 'b'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1036 + * register into the assembly output.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1037 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1038 + * Eventually gcc should be modified to allocate a/b
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1039 + * independently and this hack can be removed.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1040 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1041 + * Occasionally, we may want to do an operation using
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1042 + * the 'a' register instead of 'b'; use the 'A' code
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1043 + * to specify that.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1044 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1045 + if (code == 'A')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1046 + fputs ("a", file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1047 + else if ((BYTE_MODE (x)) && (REGNO (x) == HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1048 + fputs ("b", file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1049 + else if (M_REG_P (x) && code == 'L')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1050 + /* Soft registers can be treated like memory and accessed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1051 + * at a particular offset. TODO : handle 'W' */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1052 + fputs (reg_names[REGNO (x)+1], file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1053 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1054 + fputs (reg_names[REGNO (x)], file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1055 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1056 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1057 + else if (MEM_P (x)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1058 + last_mem_size = GET_MODE_SIZE (GET_MODE (x));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1059 + if (code == 'L') { /* LSH of word address */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1060 + if (GET_CODE (XEXP (x, 0)) == MEM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1061 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1062 + /* Offseting an indirect addressing mode is not supported */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1063 + error ("expression too complex for 6809 (offset indirect mode)");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1064 + debug_rtx (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1065 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1066 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1067 + x = adjust_address (x, QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1068 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1069 + else if (code == 'M') { /* MSH of word address */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1070 + if (GET_CODE (XEXP (x, 0)) == MEM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1071 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1072 + /* Offseting an indirect addressing mode is not supported */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1073 + error ("expression too complex for 6809 (offset indirect mode)");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1074 + debug_rtx (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1075 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1076 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1077 + x = adjust_address (x, QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1078 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1079 + else if (code == 'W') { /* least significant half of 32-bit */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1080 + x = adjust_address (x, HImode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1081 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1082 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1083 + pic_ok_for_addr_p = (code != 'C');
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1084 + output_address (XEXP (x, 0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1085 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1086 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1087 + else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != DImode) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1088 + union { double d; int i[2]; } u;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1089 + u.i[0] = CONST_DOUBLE_LOW (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1090 + u.i[1] = CONST_DOUBLE_HIGH (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1091 + fprintf (file, "#%#9.9g", u.d);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1092 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1093 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1094 + else if (code == 'R') {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1095 + fprintf (file, "%s",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1096 + m6809_get_regs_printable (INTVAL (x)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1097 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1098 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1099 + else {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1100 + if (code == 'L') { /* LSH of word address */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1101 + x = gen_rtx_CONST_INT (VOIDmode, (INTVAL(x) & 0xff));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1102 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1103 + else if (code == 'M') { /* MSH of word address */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1104 + x = gen_rtx_CONST_INT (VOIDmode, ((INTVAL(x) >> 8) & 0xff));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1105 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1106 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1107 + putc ('#', file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1108 + output_addr_const (file, x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1109 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1110 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1111 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1112 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1113 +/** Prints an address operand to assembler from its RTL representation. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1114 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1115 +print_operand_address (FILE *file, rtx addr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1116 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1117 + register rtx base = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1118 + register rtx offset = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1119 + int regno;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1120 + int indirect_flag = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1121 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1122 + check_direct_prefix_flag = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1123 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1124 + /*** check for indirect addressing ***/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1125 + if (MEM_P (addr)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1126 + last_mem_size = GET_MODE_SIZE (GET_MODE (addr));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1127 + addr = XEXP (addr, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1128 + if (pic_ok_for_addr_p)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1129 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1130 + indirect_flag = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1131 + fprintf (file, "[");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1132 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1133 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1134 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1135 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1136 + switch (GET_CODE (addr)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1137 + case REG:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1138 + regno = REGNO (addr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1139 + fprintf (file, ",%s", reg_names[regno]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1140 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1141 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1142 + case PRE_DEC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1143 + regno = REGNO (XEXP (addr, 0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1144 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1145 + fprintf (file, "%s", reg_names[regno]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1146 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1147 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1148 + case POST_INC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1149 + regno = REGNO (XEXP (addr, 0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1150 + fprintf (file, ",%s", reg_names[regno]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1151 + fputs (((last_mem_size == 1) ? "+" : "++"), file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1152 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1153 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1154 + case PLUS:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1155 + base = XEXP (addr, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1156 + if (MEM_P (base))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1157 + base = XEXP (base, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1158 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1159 + offset = XEXP (addr, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1160 + if (MEM_P (offset))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1161 + offset = XEXP (offset, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1162 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1163 + if ((CONSTANT_ADDRESS_P (base)) && (CONSTANT_ADDRESS_P (offset))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1164 + if (!indirect_flag)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1165 + check_direct_prefix_flag = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1166 + output_addr_const (file, base);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1167 + check_direct_prefix_flag = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1168 + fputs ("+", file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1169 + output_addr_const (file, offset);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1170 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1171 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1172 + else if ((CONSTANT_ADDRESS_P (base)) && (A_REG_P (offset))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1173 + output_addr_const (file, base);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1174 + fprintf (file, ",%s", reg_names[REGNO (offset)]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1175 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1176 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1177 + else if ((CONSTANT_ADDRESS_P (offset)) && (A_REG_P (base))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1178 + output_addr_const (file, offset);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1179 + fprintf (file, ",%s", reg_names[REGNO (base)]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1180 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1181 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1182 + /*** accumulator offset ***/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1183 + else if (((D_REG_P (offset)) || (Q_REG_P (offset)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1184 + && (A_REG_P (base))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1185 + fprintf (file, "%s,%s",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1186 + reg_names[REGNO (offset)], reg_names[REGNO (base)]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1187 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1188 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1189 + else if (((D_REG_P (base)) || (Q_REG_P (base)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1190 + && (A_REG_P (offset))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1191 + fprintf (file, "%s,%s",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1192 + reg_names[REGNO (base)], reg_names[REGNO (offset)]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1193 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1194 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1195 + else if (GET_CODE (base) == PRE_DEC) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1196 + regno = REGNO (XEXP (base, 0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1197 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1198 + fprintf (file, "%s", reg_names[regno]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1199 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1200 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1201 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1202 + abort ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1203 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1204 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1205 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1206 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1207 + /* Set this global before calling output_addr_const() */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1208 + if (!indirect_flag)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1209 + check_direct_prefix_flag = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1210 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1211 + /* When printing a SYMBOL_REF in PIC mode, do not print the leading
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1212 + * '#' and follow it by ',pcr' to enable relative addressing. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1213 + if (flag_pic && pic_ok_for_addr_p && GET_CODE (addr) == SYMBOL_REF)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1214 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1215 + ASM_OUTPUT_SYMBOL_REF (file, addr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1216 + fputs (",pcr", file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1217 + pic_ok_for_addr_p = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1218 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1219 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1220 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1221 + output_addr_const (file, addr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1222 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1223 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1224 + check_direct_prefix_flag = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1225 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1226 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1227 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1228 + if (indirect_flag)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1229 + fprintf (file, "]");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1230 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1231 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1232 +/*-------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1233 + Update the CC Status
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1234 +---------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1235 + Set the cc_status for the results of an insn whose pattern is EXP.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1236 + We assume that jumps don't affect the condition codes.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1237 + All else, clobbers the condition codes, by assumption.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1238 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1239 + We assume that ALL add, minus, etc. instructions effect the condition
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1240 + codes.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1241 +-------------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1242 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1243 +notice_update_cc (rtx exp, rtx insn ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1244 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1245 + int src_code;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1246 + int dst_code;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1247 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1248 + /*** recognize SET insn's ***/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1249 + if (GET_CODE (exp) == SET)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1250 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1251 + src_code = GET_CODE (SET_SRC (exp));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1252 + dst_code = GET_CODE (SET_DEST (exp));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1253 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1254 + /* Jumps do not alter the cc's. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1255 + if (SET_DEST (exp) == pc_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1256 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1257 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1258 + /* Moving one register into another register (tfr):
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1259 + Doesn't alter the cc's. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1260 + if (REG_P (SET_DEST (exp)) && (REG_P (SET_SRC (exp))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1261 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1262 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1263 + /* Moving memory into a register (load): Sets cc's. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1264 + if (REG_P (SET_DEST (exp)) && src_code == MEM) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1265 + cc_status.value1 = SET_SRC (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1266 + cc_status.value2 = SET_DEST (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1267 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1268 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1269 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1270 + /* Moving register into memory (store): Sets cc's. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1271 + if (dst_code == MEM && REG_P (SET_SRC (exp))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1272 + cc_status.value1 = SET_SRC (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1273 + cc_status.value2 = SET_DEST (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1274 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1275 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1276 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1277 + /* Function calls clobber the cc's. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1278 + else if (GET_CODE (SET_SRC (exp)) == CALL) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1279 + CC_STATUS_INIT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1280 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1281 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1282 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1283 + /* Tests and compares set the cc's in predictable ways. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1284 + else if (SET_DEST (exp) == cc0_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1285 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1286 + cc_status.flags = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1287 + cc_status.value1 = SET_SRC (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1288 + cc_status.value2 = SET_DEST (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1289 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1290 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1291 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1292 + else if (A_REG_P (SET_DEST (exp)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1293 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1294 + CC_STATUS_INIT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1295 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1296 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1297 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1298 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1299 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1300 + /* Certain instructions affect the condition codes. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1301 + switch (src_code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1302 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1303 + case PLUS:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1304 + case MINUS:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1305 + case NEG:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1306 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1307 + /* These instructions set the condition codes,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1308 + * and may modify the V bit. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1309 + cc_status.flags |= CC_NO_OVERFLOW;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1310 + /* FALLTHRU */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1311 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1312 + case AND:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1313 + case IOR:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1314 + case XOR:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1315 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1316 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1317 + /* These instructions set the condition codes,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1318 + * but cannot overflow (V=0). */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1319 + cc_status.value1 = SET_SRC (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1320 + cc_status.value2 = SET_DEST (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1321 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1322 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1323 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1324 + /* Everything else is clobbered */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1325 + CC_STATUS_INIT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1326 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1327 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1328 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1329 + } /* SET */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1330 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1331 + else if (GET_CODE (exp) == PARALLEL
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1332 + && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1333 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1334 + if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1335 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1336 + if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1337 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1338 + CC_STATUS_INIT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1339 + cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1340 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1341 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1342 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1343 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1344 + /*** default action if we haven't recognized something
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1345 + and returned earlier ***/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1346 + CC_STATUS_INIT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1347 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1348 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1349 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1350 +/** Returns nonzero if the expression EXP can be implemented using one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1351 + * of the 6809's single operand instructions. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1352 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1353 +m6809_single_operand_operator (rtx exp)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1354 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1355 + rtx op1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1356 + HOST_WIDE_INT val;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1357 + enum rtx_code code;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1358 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1359 + debug_rtx(exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1360 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1361 + code = GET_CODE (exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1362 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1363 + /* Unary operators always qualify */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1364 + switch (code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1365 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1366 + case NEG:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1367 + case NOT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1368 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1369 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1370 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1371 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1372 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1373 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1374 + /* Binary operators can only qualify if the second
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1375 + * argument is a CONST_INT of certain value. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1376 + op1 = XEXP (exp, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1377 + if (GET_CODE (op1) != CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1378 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1379 + val = INTVAL (op1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1380 + switch (code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1381 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1382 + case PLUS:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1383 + case MINUS:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1384 + if (val == -1 || val == 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1385 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1386 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1387 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1388 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1389 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1390 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1391 + case ROTATE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1392 + case ROTATERT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1393 + if (val == 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1394 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1395 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1396 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1397 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1398 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1399 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1400 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1401 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1402 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1403 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1404 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1405 +/** Return a bitarray of the hard registers which are used by a function. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1406 +unsigned int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1407 +m6809_get_live_regs (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1408 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1409 + unsigned int regs = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1410 + int regno;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1411 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1412 + if (frame_pointer_needed)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1413 + regs |= (1 << HARD_FRAME_POINTER_REGNUM);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1414 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1415 + for (regno = HARD_X_REGNUM; regno <= HARD_U_REGNUM; regno++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1416 + if (df_regs_ever_live_p (regno) && ! call_used_regs[regno])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1417 + regs |= (1 << regno);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1418 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1419 + return regs;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1420 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1421 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1422 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1423 +/** Return a printable version of a list of hard registers, suitable
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1424 + * for use in a PSHx or PULx insn. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1425 +const char *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1426 +m6809_get_regs_printable (unsigned int regs)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1427 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1428 + static char list[64];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1429 + char *listp = list;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1430 + unsigned int regno;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1431 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1432 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1433 + if ((regs & (1 << regno)) && !S_REGNO_P (regno))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1434 + listp += sprintf (listp,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1435 + (listp == list) ? "%s" : ",%s", reg_names[regno]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1436 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1437 + return list;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1438 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1439 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1440 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1441 +/** Return the total number of bytes covered by a set of hard registers. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1442 +unsigned int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1443 +m6809_get_regs_size (unsigned int regs)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1444 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1445 + unsigned int regno;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1446 + unsigned int size = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1447 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1448 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1449 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1450 + /* Only count register in the given register set */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1451 + if (REGSET_CONTAINS_P (regno, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1452 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1453 + /* Add 1 or 2 byte, depending on the size of the register.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1454 + * Since 'D' may be in both sets, check for WORD_REGSET first. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1455 + if (REGSET_CONTAINS_P(regno, WORD_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1456 + size += 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1457 + else if (REGSET_CONTAINS_P(regno, BYTE_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1458 + size++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1459 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1460 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1461 + return size;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1462 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1463 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1464 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1465 +/* Given the target of call instruction in X,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1466 + * return the tree node that contains the function declaration for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1467 + * that target.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1468 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1469 + * If the rtx or the tree do not appear valid for any reason,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1470 + * then return NULL_TREE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1471 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1472 +static tree call_target_decl (rtx x)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1473 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1474 + tree decl;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1475 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1476 + /* Make sure the target is really a MEM. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1477 + if (!x || !MEM_P (x))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1478 + return NULL_TREE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1479 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1480 + /* Make sure the address is a SYMBOL_REF. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1481 + x = XEXP (x, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1482 + if (!x || (GET_CODE (x) != SYMBOL_REF))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1483 + return NULL_TREE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1484 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1485 + /* Get the declaration of this symbol */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1486 + decl = SYMBOL_REF_DECL (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1487 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1488 + /* Make sure the declaration is really a function. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1489 + if (!decl || (TREE_CODE(decl) != FUNCTION_DECL))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1490 + return NULL_TREE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1491 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1492 + return decl;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1493 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1494 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1495 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1496 +/** Returns nonzero if a function, whose declaration is in DECL,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1497 + * was declared to have the attribute given by ATTR_NAME. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1498 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1499 +m6809_function_has_type_attr_p (tree decl, const char *attr_name)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1500 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1501 + tree type;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1502 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1503 + type = TREE_TYPE (decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1504 + return lookup_attribute (attr_name, TYPE_ATTRIBUTES (type)) != NULL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1505 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1506 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1507 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1508 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1509 +/** Returns nonzero if the current function was declared to have the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1510 + * attribute given by ATTR_NAME. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1511 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1512 +m6809_current_function_has_type_attr_p (const char *attr_name)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1513 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1514 + return m6809_function_has_type_attr_p (current_function_decl, attr_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1515 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1516 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1517 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1518 +/** Return nonzero if the current function has no return value. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1519 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1520 +m6809_current_function_is_void (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1521 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1522 + return (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1523 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1524 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1525 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1526 +/** Get the value of a declaration's 'bank', as set by the 'bank'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1527 + * attribute. If no bank was declared, it returns NULL by default. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1528 +const char *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1529 +m6809_get_decl_bank (tree decl)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1530 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1531 + tree attr;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1532 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1533 + /* Lookup the 'bank' attribute. If it does not exist, then
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1534 + * return NULL */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1535 + attr = lookup_attribute ("bank", DECL_ATTRIBUTES (decl));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1536 + if (attr == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1537 + return NULL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1538 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1539 + /* Make sure it has a value assigned to it */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1540 + attr = TREE_VALUE (attr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1541 + if (attr == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1542 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1543 + warning (WARNING_OPT "banked function did not declare a bank number");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1544 + return NULL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1545 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1546 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1547 + /* Return the bank name */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1548 + attr = TREE_VALUE (attr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1549 + return TREE_STRING_POINTER (attr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1550 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1551 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1552 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1553 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1554 +m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1555 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1556 + /* Check the function declaration for special properties.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1557 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1558 + * If the function was declare with __attribute__((bank)), output
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1559 + * assembler definitions to force the function to go into the named
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1560 + * bank.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1561 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1562 + const char *bank_name = m6809_get_decl_bank (decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1563 + if (bank_name != NULL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1564 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1565 + /* Declare __self_bank as a local assembler value that denotes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1566 + * which bank the current function is in. This is required only
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1567 + * when the bank actually changes. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1568 + if (strcmp (bank_name, current_bank_name))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1569 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1570 + fprintf (asm_out_file, "__self_bank\t.equ %s\n", bank_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1571 + strcpy (current_bank_name, bank_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1572 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1573 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1574 + /* Declare a global assembler value that denotes which bank the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1575 + * named function is in. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1576 + fprintf (asm_out_file, "__%s_bank\t.gblequ %s\n", name, bank_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1577 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1578 + /* Force the current function into a new area */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1579 + fprintf (asm_out_file, "\t.bank bank_%s (FSFX=_%s)\n",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1580 + bank_name, bank_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1581 + fprintf (asm_out_file, "\t.area bank_%s (BANK=bank_%s)\n",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1582 + bank_name, bank_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1583 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1584 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1585 + /* Emit the label for the function's name */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1586 + ASM_OUTPUT_LABEL (asm_out_file, name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1587 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1588 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1589 +#if 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1590 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1591 + * Handle pragmas. Note that only the last branch pragma seen in the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1592 + * source has any affect on code generation.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1593 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1594 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1595 +#define BAD_PRAGMA(msgid, arg) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1596 + do { warning (WARNING_OPT msgid, arg); return -1; } while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1597 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1598 +static int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1599 +pragma_parse (const char *name, tree *sect)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1600 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1601 + tree s, x;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1602 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1603 + if (pragma_lex (&x) != CPP_OPEN_PAREN)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1604 + BAD_PRAGMA ("missing '(' after '#pragma %s' - ignored", name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1605 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1606 + if (pragma_lex (&s) != CPP_STRING)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1607 + BAD_PRAGMA ("missing section name in '#pragma %s' - ignored", name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1608 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1609 + if (pragma_lex (&x) != CPP_CLOSE_PAREN)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1610 + BAD_PRAGMA ("missing ')' for '#pragma %s' - ignored", name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1611 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1612 + if (pragma_lex (&x) != CPP_EOF)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1613 + warning (WARNING_OPT "junk at end of '#pragma %s'", name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1614 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1615 + *sect = s;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1616 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1617 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1618 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1619 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1620 +/*
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1621 + * Handle #pragma section.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1622 + * This is deprecated; code should use __attribute__(section("name"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1623 + * instead.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1624 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1625 +void pragma_section (cpp_reader *pfile ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1626 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1627 + tree sect;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1628 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1629 + if (pragma_parse ("section", &sect))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1630 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1631 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1632 + snprintf (code_section_op, 6+TREE_STRING_LENGTH (sect),
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1633 + ".area\t%s", TREE_STRING_POINTER (sect));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1634 + snprintf (data_section_op, 6+TREE_STRING_LENGTH (sect),
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1635 + ".area\t%s", TREE_STRING_POINTER (sect));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1636 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1637 + /* Mark a flag that sections have changed. Upon emitting another
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1638 + * declaration, the new .area directive will be written. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1639 + section_changed++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1640 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1641 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1642 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1643 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1644 + * Check a `double' value for validity for a particular machine mode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1645 + * Called by the CHECK_FLOAT_VALUE() machine-dependent macro.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1646 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1647 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1648 +check_float_value (enum machine_mode mode, double *d, int overflow)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1649 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1650 + if (mode == SFmode) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1651 + if (*d > 1.7014117331926443e+38) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1652 + error("magnitude of constant too large for `float'");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1653 + *d = 1.7014117331926443e+38;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1654 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1655 + else if (*d < -1.7014117331926443e+38) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1656 + error("magnitude of constant too large for `float'");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1657 + *d = -1.7014117331926443e+38;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1658 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1659 + else if ((*d > 0) && (*d < 2.9387358770557188e-39)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1660 + warning(WARNING_OPT "`float' constant truncated to zero");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1661 + *d = 0.0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1662 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1663 + else if ((*d < 0) && (*d > -2.9387358770557188e-39)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1664 + warning(WARNING_OPT "`float' constant truncated to zero");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1665 + *d = 0.0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1666 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1667 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1668 + return overflow;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1669 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1670 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1671 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1672 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1673 +/** Declare that the target supports named output sections. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1674 +bool m6809_have_named_section = (bool)1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1675 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1676 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1677 +/** Write to the assembler file a directive to place
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1678 + * subsequent objects to a different section in the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1679 + * object file. ASxxxx uses the "area" directive for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1680 + * this purpose. It does not however support generalized
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1681 + * alignment, and can only place items on an odd/even
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1682 + * boundary. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1683 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1684 +m6809_asm_named_section (
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1685 + const char *name,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1686 + unsigned int flags ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1687 + tree decl)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1688 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1689 + fprintf (asm_out_file, "\t.area\t%s\n", name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1690 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1691 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1692 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1693 +enum reg_class
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1694 +m6809_preferred_reload_class (rtx x, enum reg_class regclass)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1695 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1696 + /* Check cases based on type code of rtx */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1697 + switch (GET_CODE(x))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1698 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1699 + case CONST_INT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1700 + /* Constants that can fit into 1 byte should be
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1701 + * loaded into a Q_REGS reg */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1702 + if (((unsigned) (INTVAL(x) + 0x80) < 0x100) &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1703 + (regclass > A_REGS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1704 + return Q_REGS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1705 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1706 + /* 16-bit constants should be loaded into A_REGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1707 + * when possible. gcc may already require A_REGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1708 + * or D_REGS for certain types of instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1709 + * This case applies mostly to simple copy operations
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1710 + * to/from memory when any register will do, but
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1711 + * it's best to avoid using D register since it is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1712 + * needed for other things.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1713 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1714 + else if (((unsigned) (INTVAL(x) + 0x80) < 0x10000) &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1715 + (regclass > A_REGS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1716 + return A_REGS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1717 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1718 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1719 + case SYMBOL_REF:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1720 + case LABEL_REF:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1721 + /* Addresses should always be loaded into A_REGS */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1722 + if (regclass >= A_REGS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1723 + return (A_REGS);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1724 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1725 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1726 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1727 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1728 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1729 + /* Check cases based on mode of rtx */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1730 + if ((GET_MODE(x) == QImode) && (regclass != A_REGS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1731 + return Q_REGS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1732 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1733 + /* Default: return whatever class reload suggested */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1734 + return regclass;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1735 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1736 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1737 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1738 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1739 + * Check a new declaration for the "section" attribute.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1740 + * If it exists, and the target section is "direct", then mark
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1741 + * the declaration (in RTL) to indicate special treatment.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1742 + * When the variable is referenced later, we test for this flag
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1743 + * and can emit special asm text to force the assembler to use
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1744 + * short instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1745 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1746 +static void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1747 +m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1748 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1749 + tree attr, id;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1750 + const char *name;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1751 + const char *decl_name;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1752 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1753 + /* We only care about variable declarations, not functions */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1754 + if (TREE_CODE (decl) != VAR_DECL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1755 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1756 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1757 + /* For debugging purposes only; grab the decl's name */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1758 + decl_name = IDENTIFIER_POINTER (DECL_NAME (decl));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1759 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1760 + /* Give up if the decl doesn't have any RTL */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1761 + if (!DECL_RTL (decl))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1762 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1763 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1764 + /* See if it has a section attribute */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1765 + attr = lookup_attribute ("section", DECL_ATTRIBUTES (decl));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1766 + if (!attr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1767 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1768 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1769 + /* See if the section attribute has a value */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1770 + id = TREE_VALUE (TREE_VALUE (attr));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1771 + if (!id)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1772 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1773 + name = TREE_STRING_POINTER (id);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1774 + if (!name)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1775 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1776 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1777 + /* See if the value is 'direct'. If so, mark it. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1778 + if (!strcmp (name, "direct"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1779 + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1780 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1781 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1782 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1783 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1784 + * Output code to perform a complex shift, for which there is no
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1785 + * direct support in the instruction set.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1786 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1787 + * shift1 is an instruction pattern for performing a 1-bit modification.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1788 + * This code wraps that pattern in a loop to perform the shift N times,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1789 + * where N is given by the address register in operands[2].
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1790 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1791 + * To support 16-bit shifts, shift2 can also be provided: it is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1792 + * a second instruction to be included in the loop. 8-bit shift
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1793 + * insns will pass NULL here.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1794 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1795 + * The insn length of shift1/shift2 is assumed to be 1 byte,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1796 + * which works in all of the cases it is needed so far.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1797 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1798 +static void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1799 +m6809_gen_register_shift (
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1800 + rtx *operands,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1801 + const char *shift1,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1802 + const char *shift2 )
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1803 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1804 + char beq_pattern[32];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1805 + char bra_pattern[32];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1806 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1807 + int shiftlen = (shift1 && shift2) ? 2 : 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1808 + int cmplen = (REGNO (operands[2]) == HARD_X_REGNUM) ? 3 : 4;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1809 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1810 + int beq_offset = 2 + shiftlen + 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1811 + int bra_offset = shiftlen + 2 + cmplen + 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1812 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1813 + sprintf (beq_pattern, "beq\t.+%d", beq_offset);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1814 + sprintf (bra_pattern, "bra\t.-%d", bra_offset);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1815 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1816 + output_asm_insn ("pshs\t%2", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1817 + output_asm_insn ("lea%2\t-1,%2", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1818 + output_asm_insn ("cmp%2\t#-1", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1819 + output_asm_insn (beq_pattern, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1820 + if (shift1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1821 + output_asm_insn (shift1, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1822 + if (shift2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1823 + output_asm_insn (shift2, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1824 + output_asm_insn (bra_pattern, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1825 + output_asm_insn ("puls\t%2", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1826 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1827 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1828 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1829 +/** Generate RTL for the upper 8-bits of a 16-bit constant. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1830 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1831 +gen_rtx_const_high (rtx r)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1832 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1833 + unsigned char v = (INTVAL (r) >> 8) & 0xFF;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1834 + signed char s = (signed char)v;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1835 + return gen_int_mode (s, QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1836 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1837 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1838 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1839 +/** Generate RTL for the lower 8-bits of a 16-bit constant. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1840 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1841 +gen_rtx_const_low (rtx r)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1842 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1843 + unsigned char v = INTVAL (r) & 0xFF;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1844 + signed char s = (signed char)v;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1845 + return gen_int_mode (s, QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1846 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1847 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1848 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1849 +/** Generate RTL to allocate/free bytes on the stack.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1850 + * CODE is given as MINUS when allocating and PLUS when freeing,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1851 + * to match the semantics of a downward-growing stack. SIZE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1852 + * is always given as a positive integer.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1853 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1854 +static rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1855 +gen_rtx_stack_adjust (enum rtx_code code, int size)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1856 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1857 + if (size <= 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1858 + return NULL_RTX;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1859 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1860 + if (code == MINUS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1861 + size = -size;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1862 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1863 + return gen_rtx_SET (Pmode, stack_pointer_rtx,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1864 + gen_rtx_PLUS (Pmode, stack_pointer_rtx,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1865 + gen_int_mode (size, HImode)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1866 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1867 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1868 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1869 +/** Generate RTL to push/pop a set of registers. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1870 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1871 +gen_rtx_register_pushpop (int op, int regs)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1872 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1873 + rtx nregs = gen_int_mode (regs, QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1874 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1875 + if (op == UNSPEC_PUSH_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1876 + return gen_register_push (nregs);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1877 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1878 + return gen_register_pop (nregs);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1879 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1880 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1881 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1882 +/* Given a register set REGS, where the bit positions correspond to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1883 + * hard register numbers, return another bitmask that represents the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1884 + * order in which those registers would be pushed/popped.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1885 + * Registers that are pushed first have higher bit positions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1886 + * The pop order is just the reverse bitmask.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1887 + * These values are the same as the bitmasks actually used in the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1888 + * machine instructions. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1889 +static unsigned int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1890 +register_push_order (int regs)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1891 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1892 + unsigned int order = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1893 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1894 + if (REGSET_CONTAINS_P (HARD_PC_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1895 + order |= 0x80;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1896 + if (REGSET_CONTAINS_P (HARD_U_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1897 + order |= 0x40;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1898 + if (REGSET_CONTAINS_P (HARD_Y_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1899 + order |= 0x20;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1900 + if (REGSET_CONTAINS_P (HARD_X_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1901 + order |= 0x10;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1902 + if (REGSET_CONTAINS_P (HARD_DP_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1903 + order |= 0x8;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1904 + if (REGSET_CONTAINS_P (HARD_B_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1905 + order |= 0x4;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1906 + if (REGSET_CONTAINS_P (HARD_A_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1907 + order |= 0x2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1908 + if (REGSET_CONTAINS_P (HARD_CC_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1909 + order |= 0x1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1910 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1911 + if (REGSET_CONTAINS_P (HARD_D_REGNUM, regs))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1912 + order |= (0x4 | 0x2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1913 + return order;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1914 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1915 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1916 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1917 +/* Returns nonzero if two consecutive push or pop instructions,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1918 + * as determined by the OP, can be merged into a single instruction.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1919 + * The first instruction in the sequence pushes/pops REGS1; the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1920 + * second applies to REGS2.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1921 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1922 + * If true, the resulting instruction can use (regs1 | regs2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1923 + * safely.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1924 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1925 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1926 +m6809_can_merge_pushpop_p (int op, int regs1, int regs2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1927 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1928 + /* Register sets must not overlap */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1929 + if (regs1 & regs2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1930 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1931 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1932 + if (op == UNSPEC_PUSH_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1933 + return (register_push_order (regs1) > register_push_order (regs2));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1934 + else if (op == UNSPEC_POP_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1935 + return (register_push_order (regs1) < register_push_order (regs2));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1936 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1937 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1938 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1939 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1940 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1941 +/** Emit instructions for making a library call.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1942 + * MODE is the mode of the operation.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1943 + * NAME is the library function name.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1944 + * OPERANDS is the rtx array provided by the recognizer.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1945 + * COUNT is the number of input operands to the call, and
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1946 + * should be 1 for a unary op or 2 for a binary op.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1947 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1948 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1949 +emit_libcall_insns (enum machine_mode mode,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1950 + const char *name,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1951 + rtx *operands,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1952 + int count)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1953 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1954 + /* Generate an rtx for the call target. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1955 + rtx symbol = gen_rtx_SYMBOL_REF (Pmode, name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1956 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1957 + /* Emit the library call. Slightly different based
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1958 + on the number of operands */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1959 + if (count == 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1960 + emit_library_call (symbol, LCT_NORMAL, mode,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1961 + 2, operands[1], mode, operands[2], mode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1962 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1963 + emit_library_call (symbol, LCT_NORMAL, mode,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1964 + 1, operands[1], mode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1965 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1966 + /* The library call is expected to put its result
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1967 + in LIBCALL_VALUE, so need to copy it into the destination. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1968 + emit_move_insn (operands[0], LIBCALL_VALUE(mode));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1969 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1970 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1971 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1972 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1973 + * A small helper function that writes out a single branch instruction.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1974 + * OPCODE is the short name, e.g. "ble".
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1975 + * OPERANDS has the rtx for the target label.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1976 + * LONG_P is nonzero if we are emitting a long branch, and need to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1977 + * prepend an 'l' to the opcode name.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1978 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1979 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1980 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1981 + char pattern[64];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1982 + sprintf (pattern, "%s%s\t%%l0", long_p ? "l" : "", opcode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1983 + output_asm_insn (pattern, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1984 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1985 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1986 +/**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1987 + * Output a branch/conditional branch insn of the proper
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1988 + * length. code identifies the particular branch insn.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1989 + * operands holds the branch target in operands[0].
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1990 + * length says what the size of this insn should be.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1991 + * Based on the length, we know whether it should be a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1992 + * short (8-bit) or long (16-bit) branch.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1993 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1994 +const char *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1995 +output_branch_insn (enum rtx_code code, rtx *operands, int length)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1996 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1997 + int shortform;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1998 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
1999 + /* Decide whether or not to use the long or short form.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2000 + * Calculate automatically based on insn lengths. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2001 + shortform = ((length > 2) ? 0 : 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2002 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2003 + /* Determine the proper opcode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2004 + * Use the short (2-byte) opcode if the target is within
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2005 + * reach. Otherwise, use jmp (3-byte opcode), unless
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2006 + * compiling with -fpic, in which case we'll need to use
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2007 + * lbra (4-byte opcode).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2008 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2009 + switch (code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2010 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2011 + case LABEL_REF:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2012 + if (shortform)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2013 + output_branch_insn1 ("bra", operands, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2014 + else if (flag_pic)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2015 + output_branch_insn1 ("bra", operands, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2016 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2017 + output_branch_insn1 ("jmp", operands, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2018 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2019 + case EQ:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2020 + output_branch_insn1 ("beq", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2021 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2022 + case NE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2023 + output_branch_insn1 ("bne", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2024 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2025 + case GT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2026 + output_branch_insn1 ("bgt", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2027 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2028 + case GTU:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2029 + output_branch_insn1 ("bhi", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2030 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2031 + case LT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2032 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2033 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2034 + output_branch_insn1 ("bmi", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2035 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2036 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2037 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2038 + output_branch_insn1 ("blt", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2039 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2040 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2041 + case LTU:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2042 + output_branch_insn1 ("blo", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2043 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2044 + case GE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2045 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2046 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2047 + output_branch_insn1 ("bpl", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2048 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2049 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2050 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2051 + output_branch_insn1 ("bge", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2052 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2053 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2054 + case GEU:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2055 + output_branch_insn1 ("bhs", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2056 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2057 + case LE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2058 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2059 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2060 + output_branch_insn1 ("bmi", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2061 + output_branch_insn1 ("beq", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2062 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2063 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2064 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2065 + output_branch_insn1 ("ble", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2066 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2067 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2068 + case LEU:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2069 + output_branch_insn1 ("bls", operands, !shortform);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2070 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2071 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2072 + abort();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2073 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2074 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2075 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2076 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2077 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2078 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2079 +/** Returns the "cost" of an RTL expression.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2080 + * In general, the expression "COSTS_N_INSNS(1)" is used to represent
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2081 + * the cost of a fast 8-bit arithmetic instruction that operates on
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2082 + * a reg/mem or a reg/immed. Other costs are relative to this.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2083 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2084 + * Notes:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2085 + * - The cost of a REG is always zero; this cannot be changed.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2086 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2087 + * - On the 6809, instructions on two registers will nearly always take
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2088 + * longer than those that operate on a register and a constant/memory,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2089 + * because of the way the instruction set is structured.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2090 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2091 + * TODO: multiply HImode by 2 should be done via shifts, instead of add.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2092 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2093 +static bool
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2094 +m6809_rtx_costs (rtx X, int code, int outer_code ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2095 + int *total, bool speed)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2096 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2097 + int has_const_arg = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2098 + HOST_WIDE_INT const_arg;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2099 + enum machine_mode mode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2100 + int nargs = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2101 + rtx op0, op1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2102 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2103 + /* Data RTXs return a value between 0-3, depending on complexity.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2104 + All of these are less than COSTS_N_INSNS(1). */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2105 + switch (code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2106 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2107 + case CC0:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2108 + case PC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2109 + *total = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2110 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2111 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2112 + case CONST_INT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2113 + if (X == const0_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2114 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2115 + *total = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2116 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2117 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2118 + else if ((unsigned) INTVAL (X) < 077)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2119 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2120 + *total = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2121 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2122 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2123 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2124 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2125 + *total = 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2126 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2127 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2128 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2129 + case LABEL_REF: case CONST:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2130 + *total = 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2131 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2132 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2133 + case SYMBOL_REF:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2134 + /* References to memory are made cheaper if they have
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2135 + * the 'direct' mode attribute set */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2136 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2137 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2138 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2139 + case MEM:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2140 + /* See what form of address was given */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2141 + X = XEXP (X, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2142 + switch (GET_CODE (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2143 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2144 + case SYMBOL_REF:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2145 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2146 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2147 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2148 + case CONST_INT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2149 + *total = 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2150 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2151 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2152 + case MEM:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2153 + *total = COSTS_N_INSNS (1) + 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2154 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2155 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2156 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2157 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2158 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2159 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2160 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2161 + case CONST_DOUBLE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2162 + /* TODO : not sure about this value. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2163 + *total = 3;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2164 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2165 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2166 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2167 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2168 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2169 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2170 + /* Decode the rtx */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2171 + mode = GET_MODE (X);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2172 + op0 = XEXP (X, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2173 + op1 = XEXP (X, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2174 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2175 + /* We don't implement anything in SImode or greater. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2176 + if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2177 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2178 + *total = COSTS_N_INSNS (100);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2179 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2180 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2181 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2182 + /* Figure out if there is a constant argument, and its value. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2183 + if (GET_RTX_CLASS (code) == RTX_BIN_ARITH
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2184 + || GET_RTX_CLASS (code) == RTX_COMM_ARITH)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2185 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2186 + nargs = 2;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2187 + if (GET_CODE (op1) == CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2188 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2189 + has_const_arg = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2190 + const_arg = INTVAL (op1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2191 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2192 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2193 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2194 + /* Penalize a reg/reg operation by adding MEMORY_MOVE_COST,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2195 + * Ignore soft registers, since these are really in memory.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2196 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2197 + * TODO: penalize HImode reg/reg for most operations, except maybe
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2198 + * additions since index registers allow for that.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2199 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2200 + * TODO: shifts by constant N do not always require N instructions;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2201 + * some of this can be done cheaper. The number of actual insns can be
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2202 + * predicted well.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2203 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2204 + if (nargs == 2 && REAL_REG_P (op0) && REAL_REG_P (op1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2205 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2206 + *total = MEMORY_MOVE_COST (mode, Q_REGS, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2207 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2208 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2209 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2210 + *total = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2211 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2212 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2213 + /* Operator RTXs are counted as COSTS_N_INSNS(N), where N is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2214 + the estimated number of actual machine instructions needed to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2215 + perform the computation. Some small adjustments are made since
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2216 + some "instructions" are more complex than others. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2217 + switch (code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2218 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2219 + case PLUS: case MINUS: case COMPARE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2220 + /* 6809 handles these natively in QImode, and in HImode as long
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2221 + * as operand 1 is constant. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2222 + if (mode == QImode || (mode == HImode && has_const_arg))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2223 + *total += COSTS_N_INSNS (1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2224 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2225 + *total += COSTS_N_INSNS (GET_MODE_SIZE (mode));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2226 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2227 + /* -1, 0, and 1 can be done using inherent instructions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2228 + * for PLUS and MINUS in QImode, so don't add extra cost. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2229 + if (has_const_arg
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2230 + && (mode == QImode || mode == HImode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2231 + && (const_arg == -1 || const_arg == 0 || const_arg == 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2232 + && (code == PLUS || code == MINUS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2233 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2234 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2235 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2236 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2237 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2238 + case AND: case IOR: case XOR:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2239 + case NEG: case NOT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2240 + /* 6809 handles these natively in QImode, but requires
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2241 + * splitting in HImode. Treat these as 2 insns. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2242 + *total += COSTS_N_INSNS (1) * GET_MODE_SIZE (mode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2243 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2244 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2245 + case ASHIFT: case ASHIFTRT: case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2246 + case ROTATE: case ROTATERT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2247 + /* 6809 can do shift/rotates of a QImode by a constant in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2248 + * 1 insn times the shift count, or in HImode by a constant
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2249 + * by splitting to 2 insns.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2250 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2251 + * Shift by a nonconstant will take significantly longer
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2252 + * than any of these. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2253 + if (has_const_arg)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2254 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2255 + const_arg %= (GET_MODE_SIZE (mode) * 8);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2256 + if (const_arg == 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2257 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2258 + *total += COSTS_N_INSNS(1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2259 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2260 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2261 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2262 + /* HImode shifts greater than 8 get optimized due
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2263 + * to register transfer from b to a; this cuts down the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2264 + * cost. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2265 + if (const_arg >= 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2266 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2267 + *total += COSTS_N_INSNS (1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2268 + const_arg -= 8;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2269 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2270 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2271 + /* The computed cost is 'const_arg' 1-bit shifts, doubled
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2272 + if in HImode, minus the cost of the constant itself which
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2273 + will be added in later but really shouldn't be. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2274 + *total += COSTS_N_INSNS (const_arg) * GET_MODE_SIZE (mode) - 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2275 + return true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2276 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2277 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2278 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2279 + /* It may take up to 7 iterations of about 6-7 real
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2280 + * instructions, so make this expensive. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2281 + *total += COSTS_N_INSNS (50);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2282 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2283 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2284 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2285 + case MULT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2286 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2287 + /* Multiply is cheap when both arguments are 8-bits. They
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2288 + could be QImode, or QImode widened to HImode, or a constant
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2289 + that fits into 8-bits. As long as both operands qualify,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2290 + we can use a single mul instruction.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2291 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2292 + Assume that fast multiply can be used, and change this if we find
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2293 + differently... */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2294 + int ok_for_qihi3 = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2295 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2296 + /* Check the first operand */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2297 + switch (GET_MODE (op0))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2298 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2299 + case QImode:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2300 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2301 + case HImode:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2302 + if (GET_CODE (op0) != SIGN_EXTEND && GET_CODE (op0) != ZERO_EXTEND)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2303 + ok_for_qihi3 = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2304 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2305 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2306 + ok_for_qihi3 = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2307 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2308 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2309 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2310 + /* Likewise, check the second operand. This is where constants may appear. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2311 + switch (GET_MODE (op1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2312 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2313 + case QImode:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2314 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2315 + case HImode:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2316 + if (GET_CODE (op1) != SIGN_EXTEND && GET_CODE (op1) != ZERO_EXTEND)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2317 + ok_for_qihi3 = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2318 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2319 + case VOIDmode:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2320 + if (!CONST_OK_FOR_LETTER_P (const_arg, 'K'))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2321 + ok_for_qihi3 = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2322 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2323 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2324 + ok_for_qihi3 = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2325 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2326 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2327 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2328 + /* Fast multiply takes about 4 times as many cycles as a normal
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2329 + arithmetic operation. Otherwise, it will take an expensive libcall. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2330 + if (ok_for_qihi3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2331 + *total += COSTS_N_INSNS (4);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2332 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2333 + *total = COSTS_N_INSNS (50);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2334 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2335 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2336 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2337 + case DIV: case UDIV: case MOD: case UMOD:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2338 + /* These all require more expensive libcalls. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2339 + *total += COSTS_N_INSNS (100);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2340 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2341 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2342 + /* TODO : TRUNCATE, SIGN_EXTEND, and ZERO_EXTEND */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2343 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2344 + /* These can normally be done with autoincrement, etc., so
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2345 + * don't charge for them. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2346 + case PRE_DEC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2347 + case PRE_INC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2348 + case POST_DEC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2349 + case POST_INC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2350 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2351 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2352 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2353 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2354 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2355 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2356 + /* Always return false, and let the caller gather the costs
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2357 + * of the operands */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2358 + return false;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2359 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2360 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2361 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2362 +static tree
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2363 +m6809_handle_fntype_attribute (tree *node, tree name,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2364 + tree args ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2365 + int flags ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2366 + bool *no_add_attrs)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2367 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2368 + if (TREE_CODE (*node) != FUNCTION_TYPE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2369 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2370 + warning (WARNING_OPT "'%s' only valid for functions",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2371 + IDENTIFIER_POINTER (name));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2372 + *no_add_attrs = TRUE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2373 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2374 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2375 + return NULL_TREE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2376 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2377 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2378 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2379 +static tree
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2380 +m6809_handle_data_type_attribute (tree *node ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2381 + tree name ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2382 + tree args ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2383 + int flags ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2384 + bool *no_add_attrs ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2385 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2386 + return NULL_TREE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2387 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2388 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2389 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2390 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2391 +static tree
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2392 +m6809_handle_default_attribute (tree *node ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2393 + tree name ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2394 + tree args ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2395 + int flags ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2396 + bool *no_add_attrs ATTRIBUTE_UNUSED )
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2397 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2398 + return NULL_TREE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2399 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2400 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2401 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2402 +/* Table of valid machine attributes */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2403 +const struct attribute_spec m6809_attribute_table[] = { /*
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2404 +{ name, min, max, decl, type, fntype, handler } */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2405 +{ "interrupt", 0, 0, false, true, true, m6809_handle_fntype_attribute },
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2406 +{ "naked", 0, 0, false, true, true, m6809_handle_fntype_attribute },
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2407 +{ "far", 0, 1, false, true, true, m6809_handle_fntype_attribute },
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2408 +{ "bank", 0, 1, true, false, false, m6809_handle_default_attribute },
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2409 +{ "boolean", 0, 0, false, true, false, m6809_handle_data_type_attribute },
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2410 +{ NULL, 0, 0, false, true, false, NULL },
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2411 +};
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2412 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2413 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2414 +/** Initialize builtin routines for the 6809. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2415 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2416 +m6809_init_builtins (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2417 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2418 + /* Create type trees for each function signature required.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2419 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2420 + * void_ftype_void = void f(void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2421 + * void_ftype_uchar = void f(unsigned char)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2422 + * uchar_ftype_uchar2 = unsigned char f (unsigned char, unsigned char)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2423 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2424 + tree void_ftype_void =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2425 + build_function_type (void_type_node, void_list_node);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2426 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2427 + tree void_ftype_uchar =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2428 + build_function_type (void_type_node,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2429 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2430 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2431 + tree uchar_ftype_uchar2 =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2432 + build_function_type (unsigned_char_type_node,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2433 + tree_cons (NULL_TREE, unsigned_char_type_node,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2434 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2435 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2436 + /* Register each builtin function. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2437 + add_builtin_function ("__builtin_swi", void_ftype_void,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2438 + M6809_SWI, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2439 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2440 + add_builtin_function ("__builtin_swi2", void_ftype_void,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2441 + M6809_SWI2, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2442 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2443 + add_builtin_function ("__builtin_swi3", void_ftype_void,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2444 + M6809_SWI3, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2445 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2446 + add_builtin_function ("__builtin_cwai", void_ftype_uchar,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2447 + M6809_CWAI, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2448 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2449 + add_builtin_function ("__builtin_sync", void_ftype_void,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2450 + M6809_SYNC, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2451 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2452 + add_builtin_function ("__builtin_nop", void_ftype_void,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2453 + M6809_NOP, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2454 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2455 + add_builtin_function ("__builtin_blockage", void_ftype_void,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2456 + M6809_BLOCKAGE, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2457 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2458 + add_builtin_function ("__builtin_add_decimal", uchar_ftype_uchar2,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2459 + M6809_ADD_DECIMAL, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2460 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2461 + add_builtin_function ("__builtin_add_carry", uchar_ftype_uchar2,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2462 + M6809_ADD_CARRY, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2463 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2464 + add_builtin_function ("__builtin_sub_carry", uchar_ftype_uchar2,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2465 + M6809_SUB_CARRY, BUILT_IN_MD, NULL, NULL_TREE);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2466 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2467 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2468 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2469 +/** Used by m6809_expand_builtin, given a tree ARGLIST which
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2470 + * refers to the operands of a builtin call, return an rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2471 + * that represents the nth operand, as denoted by OPNUM, which
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2472 + * is a zero-based integer. MODE gives the expected mode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2473 + * of the operand.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2474 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2475 + * This rtx is suitable for use in the emitted RTL for the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2476 + * builtin instruction. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2477 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2478 +m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2479 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2480 + tree arg;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2481 + rtx r;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2482 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2483 + arg = CALL_EXPR_ARG (arglist, opnum);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2484 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2485 + /* Convert the tree to RTL */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2486 + r = expand_expr (arg, NULL_RTX, mode, EXPAND_NORMAL);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2487 + if (r == NULL_RTX)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2488 + return NULL_RTX;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2489 + return r;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2490 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2491 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2492 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2493 +/** Expand a builtin that was registered in init_builtins into
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2494 + * RTL. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2495 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2496 +m6809_expand_builtin (tree exp,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2497 + rtx target,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2498 + rtx subtarget ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2499 + enum machine_mode mode ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2500 + int ignore ATTRIBUTE_UNUSED )
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2501 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2502 + tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2503 + tree arglist = exp;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2504 + unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2505 + rtx r0, r1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2506 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2507 + switch (fcode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2508 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2509 + case M6809_SWI:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2510 + r0 = gen_rtx_CONST_INT (VOIDmode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2511 + emit_insn (target = gen_m6809_swi (r0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2512 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2513 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2514 + case M6809_SWI2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2515 + r0 = gen_rtx_CONST_INT (VOIDmode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2516 + emit_insn (target = gen_m6809_swi (r0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2517 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2518 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2519 + case M6809_SWI3:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2520 + r0 = gen_rtx_CONST_INT (VOIDmode, 3);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2521 + emit_insn (target = gen_m6809_swi (r0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2522 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2523 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2524 + case M6809_CWAI:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2525 + r0 = m6809_builtin_operand (arglist, QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2526 + emit_insn (target = gen_m6809_cwai (r0));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2527 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2528 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2529 + case M6809_SYNC:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2530 + emit_insn (target = gen_m6809_sync ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2531 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2532 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2533 + case M6809_ADD_CARRY:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2534 + r0 = m6809_builtin_operand (arglist, QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2535 + r1 = m6809_builtin_operand (arglist, QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2536 + if (!target)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2537 + target = gen_reg_rtx (QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2538 + emit_insn (gen_addqi3_carry (target, r0, r1));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2539 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2540 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2541 + case M6809_SUB_CARRY:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2542 + r0 = m6809_builtin_operand (arglist, QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2543 + r1 = m6809_builtin_operand (arglist, QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2544 + if (!target)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2545 + target = gen_reg_rtx (QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2546 + emit_insn (gen_subqi3_carry (target, r0, r1));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2547 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2548 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2549 + case M6809_NOP:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2550 + emit_insn (target = gen_nop ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2551 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2552 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2553 + case M6809_BLOCKAGE:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2554 + emit_insn (target = gen_blockage ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2555 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2556 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2557 + case M6809_ADD_DECIMAL:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2558 + r0 = m6809_builtin_operand (arglist, QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2559 + r1 = m6809_builtin_operand (arglist, QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2560 + if (!target)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2561 + target = gen_reg_rtx (QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2562 + emit_insn (gen_addqi3_decimal (target, r0, r1));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2563 + return target;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2564 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2565 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2566 + warning (WARNING_OPT "unknown builtin expansion ignored");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2567 + return NULL_RTX;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2568 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2569 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2570 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2571 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2572 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2573 +/* Returns nonzero if 'x' represents a function that was declared
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2574 + * as __noreturn__. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2575 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2576 +noreturn_functionp (rtx x)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2577 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2578 + tree decl = call_target_decl (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2579 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2580 + if (decl == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2581 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2582 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2583 + return TREE_THIS_VOLATILE (decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2584 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2585 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2586 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2587 +const char *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2588 +far_function_type_p (tree type)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2589 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2590 + tree attr;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2591 + const char *page;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2592 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2593 + /* Return whether or not this decl has the far attribute */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2594 + attr = lookup_attribute ("far", TYPE_ATTRIBUTES (type));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2595 + if (attr == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2596 + return NULL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2597 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2598 + /* If it is far, check for a value */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2599 + attr = TREE_VALUE (attr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2600 + if (attr == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2601 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2602 + warning (WARNING_OPT "far code page not specified, using local value");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2603 + return far_code_page;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2604 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2605 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2606 + /* We have a TREE_LIST of attribute values, get the first one.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2607 + * It should be an INTEGER_CST. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2608 + attr = TREE_VALUE (attr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2609 + page = TREE_STRING_POINTER (attr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2610 + return page;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2611 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2612 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2613 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2614 +/* For a far function, returns the identifier that states which page
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2615 + * it resides in. Otherwise, returns NULL for ordinary functions. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2616 +const char *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2617 +far_functionp (rtx x)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2618 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2619 + tree decl, decl_type;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2620 + const char *page;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2621 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2622 + /* Find the FUNCTION_DECL corresponding to the rtx being called. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2623 + decl = call_target_decl (x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2624 + if (decl == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2625 + return NULL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2626 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2627 + /* See if the function has the new 'banked' attribute. These
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2628 + * are numeric instead of text */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2629 + page = m6809_get_decl_bank (decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2630 + if (page)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2631 + return page;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2632 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2633 + /* No, lookup the type of the function and see if the type
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2634 + * specifies far or not. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2635 + decl_type = TREE_TYPE (decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2636 + if (decl_type == NULL_TREE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2637 + return NULL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2638 + return far_function_type_p (decl_type);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2639 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2640 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2641 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2642 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2643 +/** Outputs the assembly language for a far call. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2644 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2645 +output_far_call_insn (rtx *operands, int has_return)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2646 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2647 + static char page_data[64];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2648 + const char *called_page;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2649 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2650 + /* The logic is the same for functions whether or not there
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2651 + * is a return value. Skip over the return value in this
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2652 + * case, so that the call location is always operands[0]. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2653 + if (has_return)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2654 + operands++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2655 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2656 + /* Get the name of the page being called */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2657 + called_page = far_functionp (operands[0]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2658 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2659 +#if 0 /* TODO : broken logic */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2660 + /* See if the called page name is a 'bank' */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2661 + if (isdigit (*called_page))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2662 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2663 + /* New style banking */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2664 + if (!strcmp (called_page, current_bank_name))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2665 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2666 + /* Same page */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2667 + output_asm_insn ("jsr\t%0", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2668 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2669 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2670 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2671 + /* Different page */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2672 + output_asm_insn ("jsr\t__far_call_handler\t;new style", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2673 + output_asm_insn ("\t.dw\t%0", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2674 + sprintf (page_data, "\t.db\t%s", called_page);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2675 + output_asm_insn (page_data, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2676 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2677 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2678 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2679 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2680 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2681 + /* Are we calling a different page than we are running in? */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2682 + if (!strcmp (called_page, far_code_page))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2683 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2684 + /* Same page : no need to execute a far call */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2685 + if (flag_pic)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2686 + output_asm_insn ("lbsr\t%C0", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2687 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2688 + output_asm_insn ("jsr\t%0", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2689 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2690 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2691 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2692 + /* Different page : need to emit far call thunk */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2693 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2694 + /* First output a call to the thunk for making far calls. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2695 + if (flag_pic)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2696 + output_asm_insn ("lbsr\t__far_call_handler", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2697 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2698 + output_asm_insn ("jsr\t__far_call_handler\t;old style", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2699 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2700 + /* Now output the name of the call site */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2701 + output_asm_insn ("\t.dw\t%C0", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2702 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2703 + /* Finally output the page number */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2704 + sprintf (page_data, "\t.db\t%s", far_functionp (operands[0]));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2705 + output_asm_insn (page_data, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2706 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2707 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2708 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2709 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2710 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2711 +m6809_init_cumulative_args (CUMULATIVE_ARGS cum ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2712 + tree fntype,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2713 + rtx libname ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2714 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2715 + cum = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2716 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2717 + /* For far functions, the current implementation does not allow for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2718 + * stack parameters. So note whenever the called function is far
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2719 + * and in a different page than the current one; such a function
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2720 + * should give an error if a stack parameter is generated. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2721 + if (fntype)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2722 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2723 + const char *called_page = far_function_type_p (fntype);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2724 + if (called_page && strcmp (called_page, far_code_page) && !TARGET_FAR_STACK_PARAM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2725 + cum |= CUM_STACK_INVALID;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2726 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2727 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2728 + if (fntype && TYPE_ARG_TYPES (fntype) != 0 &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2729 + (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) != void_type_node))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2730 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2731 + /* has variable arguments, cannot use registers */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2732 + cum |= (CUM_X_MASK | CUM_B_MASK | CUM_STACK_ONLY);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2733 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2734 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2735 + if (m6809_abi_version == M6809_ABI_VERSION_STACK)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2736 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2737 + /* cannot use registers ; only use the stack */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2738 + cum |= (CUM_STACK_ONLY | CUM_X_MASK | CUM_B_MASK);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2739 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2740 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2741 + return cum;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2742 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2743 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2744 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2745 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2746 +m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2747 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2748 + if (*cump & CUM_STACK_INVALID)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2749 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2750 + *cump &= ~CUM_STACK_INVALID;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2751 + error ("far function needs stack, will not work");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2752 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2753 + return NULL_RTX;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2754 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2755 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2756 +void m6809_asm_trampoline_template(FILE *f)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2757 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2758 + fprintf(f, "ldy #0000\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2759 + fprintf(f, "jmp 0x0000\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2760 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2761 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2762 +/*
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2763 + * Trampoline output:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2764 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2765 + * ldu #&cxt 4 bytes --LDY- ?? ??
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2766 + * jmp fnaddr 3 bytes JMP ?? ??
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2767 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2768 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2769 +m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2770 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2771 + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2772 + /* TODO - optimize by generating the entire trampoline code here,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2773 + * and removing the template altogether, since there are only two
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2774 + * bytes there that matter. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2775 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 2)), cxt);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2776 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 5)), fnaddr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2777 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2778 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2779 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2780 +/** Echo the version of the compiler and the name of the source file
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2781 + * at the beginning of each assembler output file. asm_out_file
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2782 + * is a global FILE * pointing to the output stream. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2783 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2784 +m6809_asm_file_start (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2785 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2786 + const char *module_name;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2787 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2788 + fprintf (asm_out_file, "\n;;; gcc for m6809 : %s %s\n",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2789 + __DATE__, __TIME__);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2790 + fprintf (asm_out_file, ";;; %s\n", version_string);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2791 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2792 + fprintf (asm_out_file, ";;; ABI version %d\n", m6809_abi_version);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2793 + fprintf (asm_out_file, ";;; %s\n",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2794 + (TARGET_BYTE_INT ? "-mint8" : "-mint16"));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2795 + if (TARGET_EXPERIMENT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2796 + fprintf (asm_out_file, ";;; -mexperiment\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2797 + if (TARGET_WPC)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2798 + fprintf (asm_out_file, ";;; -mwpc\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2799 + if (TARGET_6309)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2800 + fprintf (asm_out_file, ";;; -m6309\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2801 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2802 + /* Print the name of the module, which is taken as the base name
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2803 + * of the input file.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2804 + * See the 'User-Defined Symbols' section of the assembler
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2805 + * documentation for the rules on valid symbols.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2806 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2807 + module_name = lbasename (main_input_filename);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2808 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2809 + fprintf (asm_out_file, "\t.module\t");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2810 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2811 + if (*module_name >= '0' && *module_name <= '9')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2812 + fprintf (asm_out_file, "_");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2813 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2814 + while (*module_name)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2815 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2816 + if ((*module_name >= '0' && *module_name <= '9')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2817 + || (*module_name >= 'A' && *module_name <= 'Z')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2818 + || (*module_name >= 'a' && *module_name <= 'z')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2819 + || *module_name == '$'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2820 + || *module_name == '.'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2821 + || *module_name == '_')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2822 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2823 + fprintf (asm_out_file, "%c", *module_name);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2824 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2825 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2826 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2827 + fprintf (asm_out_file, "_");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2828 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2829 + module_name++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2830 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2831 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2832 + fprintf (asm_out_file, "\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2833 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2834 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2835 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2836 +/** Returns true if prologue/epilogue code is required for the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2837 + * current function being compiled.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2838 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2839 + * This is just the inverse of whether the function is declared as
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2840 + * 'naked'.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2841 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2842 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2843 +prologue_epilogue_required (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2844 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2845 + return !m6809_current_function_has_type_attr_p ("naked")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2846 + && !m6809_current_function_has_type_attr_p ("noreturn");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2847 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2848 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2849 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2850 +/** Expand RTL for function entry */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2851 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2852 +emit_prologue_insns (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2853 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2854 + rtx insn;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2855 + unsigned int live_regs = m6809_get_live_regs ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2856 + unsigned int frame_size = get_frame_size ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2857 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2858 + /* Save all registers used, including the frame pointer */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2859 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2860 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2861 + insn = emit_insn (
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2862 + gen_rtx_register_pushpop (UNSPEC_PUSH_RS, live_regs));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2863 + RTX_FRAME_RELATED_P (insn) = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2864 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2865 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2866 + /* Allocate space for local variables */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2867 + if (frame_size != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2868 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2869 + insn = emit_insn (gen_rtx_stack_adjust (MINUS, frame_size));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2870 + RTX_FRAME_RELATED_P (insn) = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2871 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2872 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2873 + /* Set the frame pointer if it is needed */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2874 + if (frame_pointer_needed)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2875 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2876 + insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2877 + RTX_FRAME_RELATED_P (insn) = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2878 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2879 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2880 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2881 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2882 +/** Expand RTL for function exit */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2883 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2884 +emit_epilogue_insns (bool sibcall_p)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2885 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2886 + unsigned int live_regs = m6809_get_live_regs ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2887 + unsigned int frame_size = get_frame_size ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2888 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2889 + if (frame_size != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2890 + emit_insn (gen_rtx_stack_adjust (PLUS, frame_size));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2891 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2892 + if (sibcall_p)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2893 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2894 + if (live_regs)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2895 + emit_insn (gen_rtx_register_pushpop (UNSPEC_POP_RS, live_regs));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2896 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2897 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2898 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2899 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2900 + emit_insn (
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2901 + gen_rtx_register_pushpop (UNSPEC_POP_RS, PC_REGBIT | live_regs));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2902 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2903 + if (m6809_current_function_has_type_attr_p ("interrupt"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2904 + emit_jump_insn (gen_return_rti ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2905 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2906 + emit_jump_insn (gen_return_rts ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2907 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2908 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2909 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2910 +#if 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2911 +/** Predefine some preprocessor names according to the currently
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2912 + * selected compiler options */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2913 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2914 +m6809_cpu_cpp_builtins (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2915 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2916 + if (TARGET_6309)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2917 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2918 + builtin_define_std ("__M6309__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2919 + builtin_define_std ("__m6309__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2920 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2921 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2922 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2923 + builtin_define_std ("__M6809__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2924 + builtin_define_std ("__m6809__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2925 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2926 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2927 + if (TARGET_BYTE_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2928 + builtin_define_std ("__int8__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2929 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2930 + builtin_define_std ("__int16__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2931 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2932 + switch (m6809_abi_version)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2933 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2934 + case M6809_ABI_VERSION_STACK:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2935 + builtin_define_std ("__regargs__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2936 + builtin_define_std ("__ABI_STACK__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2937 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2938 + case M6809_ABI_VERSION_REGS:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2939 + builtin_define_std ("__ABI_REGS__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2940 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2941 + case M6809_ABI_VERSION_BX:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2942 + builtin_define_std ("__ABI_BX__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2943 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2944 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2945 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2946 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2947 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2948 + if (TARGET_WPC)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2949 + builtin_define_std ("__WPC__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2950 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2951 + if (TARGET_DRET)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2952 + builtin_define_std ("__DRET__");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2953 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2954 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2955 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2956 +#define MAX_ASM_ASCII_STRING 48
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2957 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2958 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2959 +m6809_output_ascii (FILE *fp, const char *str, unsigned long size)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2960 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2961 + unsigned long i;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2962 + bool use_ascii = true;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2963 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2964 + /* If the size is too large, then break this up into multiple
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2965 + outputs. The assembler can only output roughly 48 bytes at a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2966 + time. Note that if there are lots of escape sequences in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2967 + the string, this may fail. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2968 + if (size > MAX_ASM_ASCII_STRING)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2969 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2970 + m6809_output_ascii (fp, str, MAX_ASM_ASCII_STRING);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2971 + m6809_output_ascii (fp, str + MAX_ASM_ASCII_STRING,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2972 + size - MAX_ASM_ASCII_STRING);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2973 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2974 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2975 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2976 + /* Check for 8-bit codes, which cannot be embedded in an .ascii */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2977 + for (i = 0; i < size; i++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2978 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2979 + int c = str[i] & 0377;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2980 + if (c >= 0x80)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2981 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2982 + use_ascii = false;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2983 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2984 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2985 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2986 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2987 + if (use_ascii)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2988 + fprintf (fp, "\t.ascii \"");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2989 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2990 + for (i = 0; i < size; i++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2991 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2992 + int c = str[i] & 0377;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2993 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2994 + if (use_ascii)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2995 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2996 + /* Just output the plain character if it is printable,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2997 + otherwise output the escape code for the character.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2998 + The assembler recognizes the same C-style octal escape sequences,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
2999 + except that it only supports 7-bit codes. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3000 + if (c >= ' ' && c < 0177 && c != '\\' && c != '"')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3001 + putc (c, fp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3002 + else switch (c)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3003 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3004 + case '\n':
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3005 +#ifndef TARGET_COCO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3006 + fputs ("\\n", fp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3007 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3008 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3009 + /* On the CoCo, we fallthrough and treat '\n' like '\r'. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3010 + case '\r':
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3011 + fputs ("\\r", fp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3012 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3013 + case '\t':
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3014 + fputs ("\\t", fp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3015 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3016 + case '\f':
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3017 + fputs ("\\f", fp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3018 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3019 + case 0:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3020 + fputs ("\\0", fp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3021 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3022 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3023 + fprintf (fp, "\\%03o", c);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3024 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3025 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3026 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3027 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3028 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3029 + fprintf (fp, "\t.byte\t0x%02X\n", c);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3030 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3031 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3032 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3033 + if (use_ascii)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3034 + fprintf (fp, "\"\n");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3035 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3036 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3037 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3038 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3039 +m6809_output_quoted_string (FILE *asm_file, const char *string)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3040 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3041 + char c;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3042 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3043 + if (strlen (string) > MAX_ASM_ASCII_STRING)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3044 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3045 + /* The string length is too large. We'll have to truncate it.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3046 + This is only called from debugging functions, so it's usually
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3047 + not critical. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3048 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3049 + char truncated_string[MAX_ASM_ASCII_STRING+1];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3050 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3051 + /* Copy as many characters as we can. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3052 + strncpy (truncated_string, string, MAX_ASM_ASCII_STRING);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3053 + truncated_string[MAX_ASM_ASCII_STRING] = '\0';
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3054 + string = truncated_string;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3055 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3056 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3057 + /* Copied from toplev.c */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3058 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3059 + putc ('\"', asm_file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3060 + while ((c = *string++) != 0) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3061 + if (ISPRINT (c)) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3062 + if (c == '\"' || c == '\\')
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3063 + putc ('\\', asm_file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3064 + putc (c, asm_file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3065 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3066 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3067 + fprintf (asm_file, "\\%03o", (unsigned char) c);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3068 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3069 + putc ('\"', asm_file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3070 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3071 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3072 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3073 +/** Output the assembly code for a shift instruction where the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3074 + * shift count is not constant. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3075 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3076 +m6809_output_shift_insn (int rtx_code, rtx *operands)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3077 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3078 + struct shift_opcode *op;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3079 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3080 + if (GET_CODE (operands[2]) == CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3081 + abort ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3082 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3083 + if (optimize_size && GET_MODE (operands[0]) == HImode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3084 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3085 + switch (rtx_code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3086 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3087 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3088 + output_asm_insn ("jsr\t_ashlhi3", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3089 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3090 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3091 + output_asm_insn ("jsr\t_ashrhi3", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3092 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3093 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3094 + output_asm_insn ("jsr\t_lshrhi3", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3095 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3096 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3097 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3098 + else if (GET_MODE (operands[0]) == HImode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3099 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3100 + switch (rtx_code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3101 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3102 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3103 + m6809_gen_register_shift (operands, "aslb", "rola");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3104 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3105 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3106 + m6809_gen_register_shift (operands, "asra", "rorb");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3107 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3108 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3109 + m6809_gen_register_shift (operands, "lsra", "rorb");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3110 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3111 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3112 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3113 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3114 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3115 + switch (rtx_code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3116 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3117 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3118 + m6809_gen_register_shift (operands, "aslb", NULL);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3119 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3120 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3121 + m6809_gen_register_shift (operands, "asrb", NULL);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3122 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3123 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3124 + m6809_gen_register_shift (operands, "lsrb", NULL);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3125 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3126 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3127 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3128 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3129 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3130 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3131 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3132 +m6809_emit_move_insn (rtx dst, rtx src)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3133 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3134 + emit_insn (gen_rtx_SET (VOIDmode, dst, src));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3135 + if (ACC_A_REG_P (dst))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3136 + emit_insn (gen_rtx_USE (VOIDmode, dst));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3137 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3138 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3139 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3140 +/** Split a complex shift instruction into multiple CPU
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3141 + * shift instructions. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3142 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3143 +m6809_split_shift (enum rtx_code code, rtx *operands)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3144 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3145 + enum machine_mode mode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3146 + int count;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3147 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3148 + mode = GET_MODE (operands[0]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3149 + count = INTVAL (operands[2]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3150 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3151 + /* Handle a shift count outside the range of 0 .. N-1, where
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3152 + * N is the mode size in bits. We normalize the count, and
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3153 + * for negative counts we also invert the direction of the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3154 + * shift. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3155 + if ((count < 0) || (count >= 8 * GET_MODE_SIZE (mode)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3156 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3157 + if (count < 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3158 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3159 + count = -count;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3160 + code = (code == ASHIFT) ? ASHIFTRT : ASHIFT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3161 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3162 + count %= (8 * GET_MODE_SIZE (mode));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3163 + m6809_emit_move_insn (operands[0],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3164 + gen_rtx_fmt_ee (code, mode, operands[1],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3165 + gen_rtx_CONST_INT (VOIDmode, count)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3166 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3167 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3168 + /* Handle shift by zero explicitly as a no-op. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3169 + if (count == 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3170 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3171 + emit_insn (gen_nop ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3172 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3173 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3174 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3175 + /* Decompose the shift by a constant N > 8 into two
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3176 + * shifts, first by 8 and then by N-8.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3177 + * This "speeds up" the process for large shifts that would be
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3178 + * handled below, but allows for some optimization.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3179 + * In some cases shift by 8 can be implemented fast. If an
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3180 + * instruction to shift by 8 is defined, it will be used here;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3181 + * otherwise it will be further decomposed as below. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3182 + if (mode == HImode && count > 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3183 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3184 + rtx output = operands[0];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3185 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3186 + m6809_emit_move_insn (operands[0],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3187 + gen_rtx_fmt_ee (code, mode, operands[1],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3188 + gen_rtx_CONST_INT (VOIDmode, 8)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3189 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3190 + /* Unsigned shifts always produce a zero in either the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3191 + * upper or lower half of the output; then, that part
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3192 + * does not need to be shifted anymore. We modify the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3193 + * output and the subsequent instructions to operate in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3194 + * QImode only on the relevant part. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3195 + if (REG_P (output))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3196 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3197 + if (code == ASHIFT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3198 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3199 + output = gen_rtx_REG (QImode, HARD_A_REGNUM);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3200 + mode = QImode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3201 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3202 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3203 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3204 + output = gen_rtx_REG (QImode, HARD_D_REGNUM);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3205 + mode = QImode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3206 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3207 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3208 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3209 + m6809_emit_move_insn (output,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3210 + gen_rtx_fmt_ee (code, mode, copy_rtx (output),
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3211 + gen_rtx_CONST_INT (VOIDmode, count-8)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3212 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3213 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3214 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3215 + /* Rewrite the unsigned shift of an 8-bit register by a large constant N
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3216 + * (near to the maximum of 8) as a rotate and mask. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3217 + if (mode == QImode && REG_P (operands[0]) && count >= ((code == ASHIFTRT) ? 7 : 6))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3218 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3219 + unsigned int mask;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3220 + unsigned int was_signed = (code == ASHIFTRT);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3221 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3222 + code = (code == ASHIFT) ? ROTATERT : ROTATE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3223 + if (code == ROTATE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3224 + mask = (count == 6) ? 0x03 : 0x01;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3225 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3226 + mask = (count == 6) ? 0xC0 - 0x100 : 0x80 - 0x100;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3227 + count = 9 - count;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3228 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3229 + do {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3230 + m6809_emit_move_insn (operands[0],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3231 + gen_rtx_fmt_ee (code, QImode, operands[1], const1_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3232 + } while (--count != 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3233 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3234 + m6809_emit_move_insn (operands[0],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3235 + gen_rtx_fmt_ee (AND, QImode, operands[1],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3236 + gen_rtx_CONST_INT (VOIDmode, mask)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3237 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3238 + if (was_signed)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3239 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3240 + emit_insn (gen_negqi2 (operands[0], copy_rtx (operands[0])));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3241 + if (ACC_A_REG_P (operands[0]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3242 + emit_insn (gen_rtx_USE (VOIDmode, operands[0]));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3243 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3244 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3245 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3246 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3247 + /* Decompose the shift by any constant N > 1 into a sequence
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3248 + * of N shifts.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3249 + * This is done recursively, by creating a shift by 1 and a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3250 + * shift by N-1, as long as N>1. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3251 + if (count > 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3252 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3253 + m6809_emit_move_insn (operands[0],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3254 + gen_rtx_fmt_ee (code, mode, operands[1], const1_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3255 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3256 + m6809_emit_move_insn (operands[0],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3257 + gen_rtx_fmt_ee (code, mode, operands[1],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3258 + gen_rtx_CONST_INT (VOIDmode, count-1)));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3259 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3260 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3261 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3262 + /* Decompose the single shift of a 16-bit quantity into two
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3263 + * CPU instructions, one for each 8-bit half.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3264 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3265 + if (mode == HImode && count == 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3266 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3267 + rtx first, second;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3268 + enum rtx_code rotate_code;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3269 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3270 + rotate_code = (code == ASHIFT) ? ROTATE : ROTATERT;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3271 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3272 + /* Split the operand into two 8-bit entities.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3273 + * FIRST is the one that will get shifted via a regular CPU
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3274 + * instruction.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3275 + * SECOND is the one that will have the result of the first shift
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3276 + * rotated in.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3277 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3278 + * We initialize first and second as if we are doing a left shift,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3279 + * then swap the operands if it's a right shift.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3280 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3281 + if (REG_P (operands[0]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3282 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3283 + first = gen_rtx_REG (QImode, HARD_D_REGNUM); /* HARD_B_REGNUM? */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3284 + second = gen_rtx_REG (QImode, HARD_A_REGNUM);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3285 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3286 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3287 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3288 + first = adjust_address (operands[0], QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3289 + second = adjust_address (operands[0], QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3290 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3291 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3292 + if (rotate_code == ROTATERT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3293 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3294 + rtx tmp; tmp = first; first = second; second = tmp;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3295 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3296 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3297 + /* Decompose into a shift and a rotate instruction. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3298 + m6809_emit_move_insn (first,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3299 + gen_rtx_fmt_ee (code, QImode, copy_rtx (first), const1_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3300 + m6809_emit_move_insn (second,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3301 + gen_rtx_fmt_ee (rotate_code, QImode, copy_rtx (second), const1_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3302 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3303 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3304 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3305 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3306 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3307 +/** Adjust register usage based on compile-time flags. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3308 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3309 +m6809_conditional_register_usage (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3310 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3311 + unsigned int soft_regno;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3312 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3313 +#ifdef CONFIG_SOFT_REGS_ALWAYS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3314 + m6809_soft_regs = CONFIG_SOFT_REGS_ALWAYS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3315 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3316 + if (!m6809_soft_reg_count)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3317 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3318 + m6809_soft_regs = atoi (m6809_soft_reg_count);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3319 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3320 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3321 + if (m6809_soft_regs == 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3322 + return;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3323 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3324 + if (m6809_soft_regs > NUM_M_REGS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3325 + m6809_soft_regs = NUM_M_REGS;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3326 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3327 + /* Registers are marked FIXED by default. Free up if
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3328 + the user wishes. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3329 + for (soft_regno = 1; soft_regno < m6809_soft_regs; soft_regno++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3330 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3331 + fixed_regs[SOFT_M0_REGNUM + soft_regno] = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3332 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3333 + /* Mark the softregs as call-clobbered, so that they need
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3334 + * not be saved/restored on function entry/exit. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3335 + call_used_regs[SOFT_M0_REGNUM + soft_regno] = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3336 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3337 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3338 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3339 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3340 +/** Return a RTX representing how to return a value from a function.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3341 + VALTYPE gives the type of the value, FUNC identifies the function
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3342 + itself.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3343 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3344 + In general, we only care about the width of the result. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3345 +rtx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3346 +m6809_function_value (const tree valtype, const tree func ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3347 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3348 + unsigned int regno;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3349 + enum machine_mode mode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3350 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3351 + /* Get the mode (i.e. width) of the result. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3352 + mode = TYPE_MODE (valtype);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3353 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3354 + if (lookup_attribute ("boolean", TYPE_ATTRIBUTES (valtype)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3355 + regno = HARD_Z_REGNUM;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3356 + else if (mode == QImode || (TARGET_DRET && mode == HImode))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3357 + regno = HARD_D_REGNUM;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3358 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3359 + regno = HARD_X_REGNUM;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3360 + return gen_rtx_REG (mode, regno);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3361 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3362 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3363 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3364 +/** Return 1 if REGNO is possibly needed to return the result
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3365 +of a function, 0 otherwise. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3366 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3367 +m6809_function_value_regno_p (unsigned int regno)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3368 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3369 + if (regno == HARD_Z_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3370 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3371 + else if ((TARGET_BYTE_INT || TARGET_DRET) && regno == HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3372 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3373 + else if (!TARGET_DRET && regno == HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3374 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3375 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3376 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3377 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3378 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3379 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3380 +#ifdef TRACE_PEEPHOLE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3381 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3382 +m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3383 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3384 + if (stage == PEEP_END)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3385 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3386 + printf ("%s: peephole %d pattern and predicate matched\n",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3387 + main_input_filename, peephole_id);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3388 + fflush (stdout);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3389 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3390 + else if (stage == PEEP_COND)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3391 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3392 + printf ("%s: peephole %d? at least pattern matched\n",
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3393 + main_input_filename, peephole_id);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3394 + fflush (stdout);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3395 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3396 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3397 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3398 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3399 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3400 +m6809_match_peephole2 (unsigned int peephole_id ATTRIBUTE_UNUSED,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3401 + unsigned int stage ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3402 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3403 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3404 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3405 +#endif /* TRACE_PEEPHOLE */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3406 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3407 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3408 +/** Return 1 if it is OK to store a value of MODE in REGNO. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3409 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3410 +m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3411 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3412 + /* Soft registers, as they are just memory, can really hold
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3413 + values of any type. However we restrict them to values of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3414 + size HImode or QImode to prevent exhausting them for larger
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3415 + values.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3416 + Word values cannot be placed into the first soft register,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3417 + as it is the low byte that is being placed there, which
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3418 + corrupts the (non-soft) register before it. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3419 + if (M_REGNO_P (regno))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3420 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3421 + switch (GET_MODE_SIZE (mode))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3422 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3423 + case 1:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3424 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3425 + case 2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3426 + return regno != SOFT_M0_REGNUM;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3427 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3428 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3429 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3430 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3431 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3432 + /* VOIDmode can be stored anywhere */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3433 + else if (mode == VOIDmode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3434 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3435 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3436 + /* Zero is a reserved register, but problems occur if we don't
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3437 + say yes here??? */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3438 + else if (regno == 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3439 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3440 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3441 + /* For other registers, return true only if the requested size
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3442 + exactly matches the hardware size. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3443 + else if ((G_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 2))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3444 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3445 + else if ((BYTE_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3446 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3447 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3448 + return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3449 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3450 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3451 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3452 +/* exp is the call expression. DECL is the called function,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3453 + * or NULL for an indirect call */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3454 +bool
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3455 +m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3456 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3457 + tree type, arg;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3458 + const char *name;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3459 + bool result = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3460 + int argcount = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3461 + int step = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3462 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3463 + /* If there is no DECL, it is an indirect call.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3464 + * Never optimize this??? */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3465 + if (decl == NULL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3466 + goto done;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3467 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3468 + /* Never allow an interrupt handler to be optimized this way. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3469 + if (m6809_function_has_type_attr_p (decl, "interrupt"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3470 + goto done;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3471 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3472 + /* Skip sibcall if the type can't be found for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3473 + * some reason */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3474 + step++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3475 + name = IDENTIFIER_POINTER (DECL_NAME (decl));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3476 + type = TREE_TYPE (decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3477 + if (type == NULL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3478 + goto done;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3479 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3480 + /* Skip sibcall if the target is a far function */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3481 + step++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3482 + if (far_function_type_p (type) != NULL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3483 + goto done;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3484 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3485 + /* Skip sibcall if the called function's arguments are
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3486 + * variable */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3487 + step++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3488 + if (TYPE_ARG_TYPES (type) == NULL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3489 + goto done;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3490 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3491 + /* Allow sibcalls in other cases. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3492 + result = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3493 +done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3494 + /* printf ("%s ok for sibcall? %s, step %d, args %d\n", name, result ? "yes" : "no", step, argcount); */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3495 + return result;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3496 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3497 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3498 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3499 +/** Emit code for the 'casesi' pattern.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3500 + * This pattern is only used in 8-bit mode, and can be disabled
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3501 + * with -mold-case there as well. The rationale for this is to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3502 + * do a better job than the simpler but well-tested 'tablejump'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3503 + * method.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3504 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3505 + * For small jumptables, where the switch expression is an
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3506 + * 8-bit value, the lookup can be done more efficiently
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3507 + * using the "B,X" style index mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3508 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3509 +m6809_do_casesi (rtx index, rtx lower_bound, rtx range,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3510 + rtx table_label, rtx default_label)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3511 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3512 + enum machine_mode mode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3513 + rtx scaled;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3514 + rtx table_in_reg;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3515 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3516 + /* expr.c has to be patched so that it does not promote
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3517 + * the expression to SImode, but rather to HImode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3518 + * Fail now if that isn't the case. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3519 + if (GET_MODE_SIZE (GET_MODE (index)) > GET_MODE_SIZE (HImode))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3520 + error ("try_casesi promotion bug");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3521 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3522 + /* Determine whether or not we are going to work primarily in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3523 + * QImode or HImode. This depends on the size of the index
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3524 + * into the lookup table. QImode can only be used when the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3525 + * index is less than 0x40, since it will be doubled but
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3526 + * must remain unsigned. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3527 + if ((GET_CODE (range) == CONST_INT) && (INTVAL (range) < 0x40))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3528 + mode = QImode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3529 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3530 + mode = HImode;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3531 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3532 + /* Convert to QImode if necessary */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3533 + if (mode == QImode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3534 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3535 + index = gen_lowpart_general (mode, index);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3536 + lower_bound = gen_lowpart_general (mode, lower_bound);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3537 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3538 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3539 + /* Translate from case value to table index by subtraction */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3540 + if (lower_bound != const0_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3541 + index = expand_binop (mode, sub_optab, index, lower_bound,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3542 + NULL_RTX, 0, OPTAB_LIB_WIDEN);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3543 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3544 + /* Emit compare-and-jump to test for index out-of-range */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3545 + emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3546 + default_label);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3547 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3548 + /* Put the table address is in a register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3549 + table_in_reg = gen_reg_rtx (Pmode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3550 + emit_move_insn (table_in_reg, gen_rtx_LABEL_REF (Pmode, table_label));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3551 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3552 + /* Emit table lookup and jump */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3553 + if (mode == QImode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3554 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3555 + /* Scale the index */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3556 + scaled = gen_reg_rtx (QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3557 + emit_insn (gen_ashlqi3 (scaled, index, const1_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3558 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3559 + /* Emit the jump */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3560 + emit_jump_insn (gen_tablejump_short_offset (scaled, table_in_reg));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3561 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3562 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3563 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3564 + /* Scale the index */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3565 + emit_insn (gen_ashlhi3 (index, index, const1_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3566 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3567 + /* Emit the jump */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3568 + emit_jump_insn (gen_tablejump_long_offset (index, table_in_reg));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3569 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3570 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3571 + /* Copied from expr.c */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3572 + if (!CASE_VECTOR_PC_RELATIVE && !flag_pic)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3573 + emit_barrier ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3574 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3575 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3576 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3577 +/** Output the assembly code for a 32-bit add/subtract. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3578 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3579 +m6809_output_addsi3 (int rtx_code, rtx *operands)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3580 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3581 + rtx xoperands[8];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3582 + rtx dst = operands[0];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3583 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3584 + /* Prepare the operands by splitting each SImode into two HImodes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3585 + that can be operated independently. The high word of operand 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3586 + is further divided into two QImode components for use with 'adc'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3587 + style instructions. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3588 + xoperands[7] = operands[3];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3589 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3590 + xoperands[0] = adjust_address (dst, HImode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3591 + xoperands[3] = adjust_address (dst, HImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3592 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3593 +#if 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3594 + xoperands[2] = adjust_address (operands[1], HImode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3595 + xoperands[6] = adjust_address (operands[1], HImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3596 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3597 + /* Operand 2 may be a MEM or a CONST_INT */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3598 + if (GET_CODE (operands[2]) == CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3599 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3600 + xoperands[1] = gen_int_mode (INTVAL (operands[2]) & 0xFFFF, HImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3601 + xoperands[4] = gen_int_mode ((INTVAL (operands[2]) >> 24) & 0xFF, QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3602 + xoperands[5] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFF, QImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3603 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3604 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3605 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3606 + xoperands[1] = adjust_address (operands[2], HImode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3607 + xoperands[4] = adjust_address (operands[2], QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3608 + xoperands[5] = adjust_address (operands[2], QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3609 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3610 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3611 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3612 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3613 +#if 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3614 + xoperands[1] = adjust_address (operands[1], HImode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3615 + xoperands[4] = adjust_address (operands[1], QImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3616 + xoperands[5] = adjust_address (operands[1], QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3617 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3618 + /* Operand 2 may be a MEM or a CONST_INT */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3619 + if (GET_CODE (operands[2]) == CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3620 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3621 + xoperands[2] = gen_int_mode ((INTVAL (operands[2])) & 0xFFFF, HImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3622 + xoperands[6] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFFFF, HImode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3623 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3624 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3625 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3626 + xoperands[2] = adjust_address (operands[2], HImode, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3627 + xoperands[6] = adjust_address (operands[2], HImode, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3628 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3629 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3630 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3631 + /* Output the assembly code. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3632 + if (rtx_code == PLUS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3633 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3634 + output_asm_insn ("ld%7\t%2", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3635 + output_asm_insn ("add%7\t%1", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3636 + output_asm_insn ("st%7\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3637 + output_asm_insn ("ld%7\t%6", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3638 + output_asm_insn ("adcb\t%5", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3639 + output_asm_insn ("adca\t%4", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3640 + output_asm_insn ("st%7\t%3", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3641 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3642 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3643 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3644 + output_asm_insn ("ld%7\t%2", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3645 + output_asm_insn ("sub%7\t%1", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3646 + output_asm_insn ("st%7\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3647 + output_asm_insn ("ld%7\t%6", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3648 + output_asm_insn ("sbcb\t%5", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3649 + output_asm_insn ("sbca\t%4", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3650 + output_asm_insn ("st%7\t%3", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3651 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3652 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3653 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3654 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3655 +#if 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3656 +/** Output the assembly code for a 32-bit shift.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3657 +Operands 0 and 1 must be the same rtx, forced by a matching
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3658 +constraint. Operand 2 must be a CONST_INT. Operand 3 is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3659 +"d" in case a temporary reg is needed. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3660 +void
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3661 +m6809_output_shiftsi3 (int rtx_code, rtx *operands)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3662 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3663 + unsigned int count = INTVAL (operands[2]) % 32;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3664 + unsigned int size = 4; /* sizeof (SImode) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3665 + int s;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3666 + rtx xoperands[4];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3667 + int op;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3668 + int start, end, step;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3669 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3670 + /* Initialize */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3671 + if (rtx_code == ASHIFT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3672 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3673 + start = size-1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3674 + end = -1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3675 + step = -1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3676 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3677 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3678 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3679 + start = 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3680 + end = size;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3681 + step = 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3682 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3683 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3684 + xoperands[2] = operands[2];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3685 + xoperands[3] = operands[3];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3686 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3687 + if (count <= 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3688 + abort ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3689 + if (rtx_code == ROTATE || rtx_code == ROTATERT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3690 + abort ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3691 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3692 + /* Extract bit shifts over 16 bits by HImode moves. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3693 + if (count >= 16)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3694 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3695 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3696 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3697 + /* Extract bit shifts over 8 bits by QImode moves. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3698 + if (count >= 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3699 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3700 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3701 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3702 + /* Iterate over the number of bits to be shifted. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3703 + while (count > 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3704 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3705 + /* Each bit to be shifted requires 1 proper bit shift
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3706 + and 3 rotates. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3707 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3708 + /* First, do the arithmetic/logical shift. Left shifts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3709 + start from the LSB; right shifts start from the MSB. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3710 + xoperands[0] = adjust_address (operands[0], QImode, start);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3711 + switch (rtx_code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3712 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3713 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3714 + output_asm_insn ("asl\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3715 + start--;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3716 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3717 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3718 + output_asm_insn ("asr\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3719 + start++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3720 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3721 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3722 + output_asm_insn ("lsr\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3723 + start++;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3724 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3725 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3726 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3727 + /* Next, rotate the other bytes */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3728 + for (s = start; s != end; s += step)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3729 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3730 + xoperands[0] = adjust_address (operands[0], QImode, s);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3731 + switch (rtx_code)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3732 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3733 + case ASHIFT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3734 + output_asm_insn ("rol\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3735 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3736 + case ASHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3737 + case LSHIFTRT:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3738 + output_asm_insn ("ror\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3739 + break;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3740 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3741 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3742 + count--;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3743 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3744 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3745 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3746 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3747 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3748 +power_of_two_p (unsigned int n)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3749 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3750 + return (n & (n-1)) == 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3751 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3752 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3753 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3754 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3755 +m6809_can_eliminate (int from, int to)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3756 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3757 + if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3758 + return !frame_pointer_needed;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3759 + return 1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3760 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3761 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3762 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3763 +int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3764 +m6809_initial_elimination_offset (int from, int to)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3765 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3766 + switch (from)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3767 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3768 + case ARG_POINTER_REGNUM:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3769 + return get_frame_size () + m6809_get_regs_size (m6809_get_live_regs ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3770 + case FRAME_POINTER_REGNUM:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3771 + return get_frame_size ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3772 + default:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3773 + gcc_unreachable ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3774 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3775 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3776 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3777 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3778 +bool
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3779 +m6809_frame_pointer_required (void)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3780 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3781 + return false;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3782 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3783 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3784 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3785 +/* Defines the target-specific hooks structure. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3786 +struct gcc_target targetm = TARGET_INITIALIZER;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3787 diff -urN gcc-4.6.1-orig/gcc/config/m6809/m6809.h gcc-4.6.1/gcc/config/m6809/m6809.h
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3788 --- gcc-4.6.1-orig/gcc/config/m6809/m6809.h 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3789 +++ gcc-4.6.1/gcc/config/m6809/m6809.h 2011-09-18 19:47:50.207654849 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3790 @@ -0,0 +1,1352 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3791 +/* Definitions of target machine for GNU compiler. MC6809 version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3792 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3793 + MC6809 Version by Tom Jones (jones@sal.wisc.edu)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3794 + Space Astronomy Laboratory
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3795 + University of Wisconsin at Madison
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3796 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3797 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3798 + ( msdoerfe@informatik.uni-erlangen.de )
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3799 + also added #pragma interrupt (inspired by gcc-6811)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3800 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3801 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3802 + (ebotcazou@multimania.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3803 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3804 + minor changes to adapt it to egcs-1.1.2 by Eric Botcazou
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3805 + (ebotcazou@multimania.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3806 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3807 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3808 + (ebotcazou@multimania.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3809 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3810 + changes for gcc-3.1.1 by ???
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3811 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3812 + further changes for gcc-3.1.1 and beyond by Brian Dominy
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3813 + (brian@oddchange.com)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3814 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3815 + even more changes for gcc-4.6.1 by William Astle (lost@l-w.ca)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3816 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3817 +This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3818 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3819 +GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3820 +it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3821 +the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3822 +any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3823 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3824 +GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3825 +but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3826 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3827 +GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3828 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3829 +You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3830 +along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3831 +<http://www.gnu.org/licenses/>. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3832 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3833 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3834 +/* Helper macros for creating strings with macros */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3835 +#define C_STRING(x) C_STR(x)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3836 +#define C_STR(x) #x
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3837 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3838 +/* Certain parts of GCC include host-side includes, which is bad.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3839 + * Some things that get pulled in need to be undone.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3840 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3841 +#undef HAVE_GAS_HIDDEN
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3842 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3843 +/* Names to predefine in the preprocessor for this target machine. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3844 +/*#define TARGET_CPU_CPP_BUILTINS() m6809_cpu_cpp_builtins () */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3845 +#define TARGET_CPU_CPP_BUILTINS() do \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3846 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3847 + if (TARGET_6309) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3848 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3849 + builtin_define_std ("__M6309__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3850 + builtin_define_std ("__m6309__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3851 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3852 + else \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3853 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3854 + builtin_define_std ("__M6809__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3855 + builtin_define_std ("__m6809__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3856 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3857 + \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3858 + if (TARGET_BYTE_INT) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3859 + builtin_define_std ("__int8__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3860 + else \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3861 + builtin_define_std ("__int16__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3862 + \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3863 + switch (m6809_abi_version) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3864 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3865 + case M6809_ABI_VERSION_STACK: \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3866 + builtin_define_std ("__regargs__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3867 + builtin_define_std ("__ABI_STACK__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3868 + break; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3869 + case M6809_ABI_VERSION_REGS: \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3870 + builtin_define_std ("__ABI_REGS__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3871 + break; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3872 + case M6809_ABI_VERSION_BX: \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3873 + builtin_define_std ("__ABI_BX__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3874 + break; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3875 + default: \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3876 + break; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3877 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3878 + \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3879 + if (TARGET_WPC) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3880 + builtin_define_std ("__WPC__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3881 + \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3882 + if (TARGET_DRET) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3883 + builtin_define_std ("__DRET__"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3884 + } while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3885 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3886 +/* As an embedded target, we have no libc. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3887 +#ifndef inhibit_libc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3888 +#define inhibit_libc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3889 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3890 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3891 +/* Print subsidiary information on the compiler version in use. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3892 +#define TARGET_VERSION fprintf (stderr, " (MC6809)");
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3893 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3894 +/* Run-time compilation parameters selecting different hardware subsets. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3895 +/*extern int target_flags; */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3896 +extern short *reg_renumber; /* def in local_alloc.c */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3897 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3898 +/* Runtime current values of section names */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3899 +extern int section_changed;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3900 +extern char code_section_op[], data_section_op[], bss_section_op[];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3901 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3902 +#define WARNING_OPT 0,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3903 +/*extern const char *m6809_abi_version_ptr; */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3904 +extern unsigned int m6809_soft_regs;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3905 +extern unsigned int m6809_abi_version;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3906 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3907 +/* ABI versions */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3908 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3909 +#define M6809_ABI_VERSION_STACK 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3910 +#define M6809_ABI_VERSION_REGS 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3911 +#define M6809_ABI_VERSION_BX 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3912 +#define M6809_ABI_VERSION_LATEST (M6809_ABI_VERSION_BX)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3913 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3914 +/* Allow $ in identifiers */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3915 +#define DOLLARS_IN_IDENTIFIERS 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3916 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3917 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3918 + Target machine storage layout
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3919 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3920 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3921 +/* Define this if most significant bit is lowest numbered
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3922 + in instructions that operate on numbered bit-fields. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3923 +#define BITS_BIG_ENDIAN 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3924 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3925 +/* Define to 1 if most significant byte of a word is the lowest numbered. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3926 +#define BYTES_BIG_ENDIAN 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3927 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3928 +/* Define to 1 if most significant word of a multiword value is the lowest numbered. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3929 +#define WORDS_BIG_ENDIAN 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3930 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3931 +/* Number of bits in an addressible storage unit */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3932 +#define BITS_PER_UNIT 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3933 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3934 +/* Width in bits of a "word", or the contents of a machine register.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3935 + * Although the 6809 has a few byte registers, define this to 16-bits
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3936 + * since this is the natural size of most registers. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3937 +#define BITS_PER_WORD 16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3938 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3939 +/* Width of a word, in units (bytes). */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3940 +#define UNITS_PER_WORD (BITS_PER_WORD/8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3941 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3942 +/* Width in bits of a pointer. See also the macro `Pmode' defined below. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3943 +#define POINTER_SIZE 16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3944 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3945 +/* Allocation boundary (bits) for storing pointers in memory. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3946 +#define POINTER_BOUNDARY 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3947 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3948 +/* Allocation boundary (bits) for storing arguments in argument list. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3949 +/* PARM_BOUNDARY is divided by BITS_PER_WORD in expr.c -- tej */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3950 +#define PARM_BOUNDARY 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3951 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3952 +/* Boundary (bits) on which stack pointer should be aligned. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3953 +#define STACK_BOUNDARY 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3954 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3955 +/* Allocation boundary (bits) for the code of a function. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3956 +#define FUNCTION_BOUNDARY 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3957 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3958 +/* Alignment of field after `int : 0' in a structure. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3959 +#define EMPTY_FIELD_BOUNDARY 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3960 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3961 +/* Every structure's size must be a multiple of this. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3962 +#define STRUCTURE_SIZE_BOUNDARY 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3963 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3964 +/* Largest mode size to use when putting an object, including
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3965 + * a structure, into a register. By limiting this to 16, no
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3966 + * 32-bit objects will ever be allocated to a pair of hard
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3967 + * registers. This is a good thing, since there aren't that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3968 + * many of them. 32-bit objects are only needed for floats
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3969 + * and "long long"s. Larger values have been tried and did not
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3970 + * work. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3971 +#define MAX_FIXED_MODE_SIZE 16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3972 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3973 +/* No data type wants to be aligned rounder than this. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3974 +#define BIGGEST_ALIGNMENT 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3975 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3976 +/* Define this if move instructions will actually fail to work
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3977 + when given unaligned data. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3978 +#define STRICT_ALIGNMENT 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3979 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3980 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3981 + Standard register usage.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3982 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3983 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3984 +/* Register values as bitmasks.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3985 + * TODO : merge D_REGBIT and B_REGBIT, and treat this as the same
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3986 + * register. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3987 +#define RSVD1_REGBIT (1 << HARD_RSVD1_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3988 +#define D_REGBIT (1 << HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3989 +#define X_REGBIT (1 << HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3990 +#define Y_REGBIT (1 << HARD_Y_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3991 +#define U_REGBIT (1 << HARD_U_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3992 +#define S_REGBIT (1 << HARD_S_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3993 +#define PC_REGBIT (1 << HARD_PC_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3994 +#define Z_REGBIT (1 << HARD_Z_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3995 +#define A_REGBIT (1 << HARD_A_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3996 +#define B_REGBIT (1 << HARD_B_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3997 +#define CC_REGBIT (1 << HARD_CC_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3998 +#define DP_REGBIT (1 << HARD_DP_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
3999 +#define SOFT_FP_REGBIT (1 << SOFT_FP_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4000 +#define SOFT_AP_REGBIT (1 << SOFT_AP_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4001 +#define M_REGBIT(n) (1 << (SOFT_M0_REGNUM + n))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4002 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4003 +/* Macros for dealing with set of registers.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4004 + * A register set is just a bitwise-OR of all the register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4005 + * bitmask values. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4006 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4007 +/* Which registers can hold 8-bits */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4008 +#define BYTE_REGSET \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4009 + (Z_REGBIT | A_REGBIT | D_REGBIT | CC_REGBIT | DP_REGBIT | SOFT_M_REGBITS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4010 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4011 +/* Which registers can hold 16-bits.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4012 + * Note: D_REGBIT is defined as both an 8-bit and 16-bit register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4013 +#define WORD_REGSET \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4014 + (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT | SOFT_FP_REGBIT | SOFT_AP_REGBIT | RSVD1_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4015 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4016 +/* Returns nonzero if a given REGNO is in the REGSET. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4017 +#define REGSET_CONTAINS_P(regno, regset) (((1 << (regno)) & (regset)) != 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4018 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4019 +/* Defines related to the number of soft registers supported.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4020 + * The actual number used may be less depending on -msoft-reg-count.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4021 + * If you change one of these, you should change them all. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4022 +#define NUM_M_REGS 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4023 +#define M_REGS_FIXED 1, 1, 1, 1, 1, 1, 1, 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4024 +#define M_REGS_CALL_USED 1, 1, 1, 1, 1, 1, 1, 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4025 +#define HARD_M_REGNUMS \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4026 + SOFT_M0_REGNUM+0, SOFT_M0_REGNUM+1, SOFT_M0_REGNUM+2, SOFT_M0_REGNUM+3, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4027 + SOFT_M0_REGNUM+4, SOFT_M0_REGNUM+5, SOFT_M0_REGNUM+6, SOFT_M0_REGNUM+7
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4028 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4029 +#define SOFT_M_REGBITS (((1UL << NUM_M_REGS) - 1) << (SOFT_M0_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4030 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4031 +/* Number of actual hardware registers.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4032 + The hardware registers are assigned numbers for the compiler
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4033 + from 0 to just below FIRST_PSEUDO_REGISTER.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4034 + All registers that the compiler knows about must be given numbers,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4035 + even those that are not normally considered general registers.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4036 + Make sure the constant below matches the value of SOFT_M0_REGNUM;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4037 + for some reason, GCC won't compile if that name is used here directly. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4038 +#ifdef SOFT_M0_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4039 +#if (SOFT_M0_REGNUM != 14)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4040 +#error "bad register numbering"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4041 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4042 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4043 +#define FIRST_PSEUDO_REGISTER (14 + NUM_M_REGS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4044 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4045 +/* 1 for registers that have pervasive standard uses
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4046 + and are not available for the register allocator.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4047 + The psuedoregisters (M_REGS) are declared fixed here, but
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4048 + will be unfixed if -msoft-reg-count is seen later. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4049 +#define FIXED_REGISTERS \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4050 + {1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, M_REGS_FIXED, }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4051 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4052 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4053 +/* 1 for registers not available across function calls.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4054 + These must include the FIXED_REGISTERS and also any
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4055 + registers that can be used without being saved.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4056 + The latter must include the registers where values are returned
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4057 + and the register where structure-value addresses are passed.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4058 + Aside from that, you can include as many other registers as you like. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4059 +#define CALL_USED_REGISTERS \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4060 + {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, M_REGS_CALL_USED, }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4061 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4062 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4063 +/* Return number of consecutive hard regs needed starting at reg REGNO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4064 + to hold something of mode MODE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4065 + For the 6809, we distinguish between word-length and byte-length
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4066 + registers. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4067 +#define HARD_REGNO_NREGS(REGNO, MODE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4068 + (REGSET_CONTAINS_P (REGNO, WORD_REGSET) ? \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4069 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4070 + (GET_MODE_SIZE (MODE)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4071 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4072 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4073 +/* Value is 1 if hard register REGNO can hold a value
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4074 +of machine-mode MODE. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4075 +#define HARD_REGNO_MODE_OK(REGNO, MODE) m6809_hard_regno_mode_ok (REGNO, MODE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4076 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4077 +/* Value is 1 if it is a good idea to tie two pseudo registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4078 + when one has mode MODE1 and one has mode MODE2.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4079 + If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4080 + for any hard reg, then this must be 0 for correct output. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4081 +#define MODES_TIEABLE_P(MODE1, MODE2) 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4082 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4083 +/* Specify the registers used for certain standard purposes.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4084 + The values of these macros are register numbers. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4085 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4086 +/* program counter if referenced as a register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4087 +#define PC_REGNUM HARD_PC_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4088 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4089 +/* Register to use for pushing function arguments. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4090 +#define STACK_POINTER_REGNUM HARD_S_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4091 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4092 +/* Base register for access to local variables of the function.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4093 + * Before reload, FRAME_POINTER_REGNUM will be used. Later,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4094 + * the elimination pass will convert these to STACK_POINTER_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4095 + * if possible, or else HARD_FRAME_POINTER_REGNUM. The idea is to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4096 + * avoid tying up a hard register (U) for the frame pointer if
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4097 + * it can be eliminated entirely, making it available for use as
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4098 + * a general register. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4099 +#define FRAME_POINTER_REGNUM SOFT_FP_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4100 +#define HARD_FRAME_POINTER_REGNUM HARD_U_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4101 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4102 +/* Define a table of possible eliminations.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4103 + * The idea is to try to avoid using hard registers for the argument
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4104 + * and frame pointers if they can be derived from the stack pointer
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4105 + * instead, which already has a hard register reserved for it.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4106 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4107 + * The order of entries in this table will try to convert
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4108 + * ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM into stack pointer
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4109 + * references first, but if that fails, they will be converted to use
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4110 + * HARD_FRAME_POINTER_REGNUM.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4111 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4112 +#define ELIMINABLE_REGS \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4113 +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4114 + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4115 + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4116 + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4117 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4118 +/* #define CAN_ELIMINATE(FROM, TO) m6809_can_eliminate (FROM, TO) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4119 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4120 +/* Define how to offset the frame or argument pointer to turn it
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4121 + * into a stack pointer reference. This is based on the way that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4122 + * the frame is constructed in the function prologue. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4123 +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4124 + (OFFSET) = m6809_initial_elimination_offset (FROM, TO)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4125 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4126 +/* Base register for access to arguments of the function.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4127 + * This is only used prior to reload; no instructions will ever
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4128 + * be output referring to this register. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4129 +#define ARG_POINTER_REGNUM SOFT_AP_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4130 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4131 +/* Register in which static-chain is passed to a function. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4132 +#define STATIC_CHAIN_REGNUM HARD_Y_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4133 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4134 +/* #define CONDITIONAL_REGISTER_USAGE (m6809_conditional_register_usage ()) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4135 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4136 +/* Order in which hard registers are allocated to pseudos.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4137 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4138 + * Since the D register is the only valid reg for 8-bit values
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4139 + * now, avoid using it for 16-bit values by putting it after all
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4140 + * other 16-bits.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4141 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4142 + * Prefer X first since the first 16-bit function argument goes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4143 + * there. We may be able to pass in to a subroutine without
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4144 + * a copy.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4145 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4146 + * Prefer U over Y since instructions using Y take one extra
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4147 + * byte, and thus one extra cycle to execute.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4148 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4149 +#define REG_ALLOC_ORDER \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4150 + { HARD_X_REGNUM, HARD_U_REGNUM, HARD_Y_REGNUM, HARD_D_REGNUM, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4151 + HARD_M_REGNUMS, HARD_S_REGNUM, HARD_PC_REGNUM, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4152 + HARD_B_REGNUM, HARD_A_REGNUM, HARD_CC_REGNUM, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4153 + HARD_DP_REGNUM, SOFT_FP_REGNUM, SOFT_AP_REGNUM, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4154 + 6, HARD_Z_REGNUM }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4155 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4156 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4157 + classes of registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4158 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4159 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4160 +/* Define the classes of registers for register constraints in the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4161 + machine description. Also define ranges of constants.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4162 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4163 + One of the classes must always be named ALL_REGS and include all hard regs.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4164 + If there is more than one class, another class must be named NO_REGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4165 + and contain no registers.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4166 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4167 + The name GENERAL_REGS must be the name of a class (or an alias for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4168 + another name such as ALL_REGS). This is the class of registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4169 + that is allowed by "g" or "r" in a register constraint.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4170 + Also, registers outside this class are allocated only when
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4171 + instructions express preferences for them.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4172 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4173 + The classes must be numbered in nondecreasing order; that is,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4174 + a larger-numbered class must never be contained completely
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4175 + in a smaller-numbered class.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4176 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4177 + For any two classes, it is very desirable that there be another
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4178 + class that represents their union. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4179 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4180 +enum reg_class {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4181 + NO_REGS, /* The trivial class with no registers in it */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4182 + D_REGS, /* 16-bit (word (HI)) data (D) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4183 + ACC_A_REGS, /* The A register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4184 + ACC_B_REGS, /* The B register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4185 + X_REGS, /* The X register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4186 + Z_REGS, /* The Z (zero-bit) register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4187 + Q_REGS, /* 8-bit (byte (QI)) data (A,B) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4188 + M_REGS, /* 8-bit (byte (QI)) soft registers */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4189 + CC_REGS, /* 8-bit condition code register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4190 + I_REGS, /* An index register (A,B,D) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4191 + T_REGS, /* 16-bit addresses, not including stack or PC (X,Y,U) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4192 + A_REGS, /* 16-bit addresses (X,Y,U,S,PC) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4193 + S_REGS, /* 16-bit soft registers (FP, AP) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4194 + P_REGS, /* 16-bit pushable registers (D,X,Y,U); omit PC and S */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4195 + G_REGS, /* 16-bit data and address (D,X,Y,U,S,PC) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4196 + ALL_REGS, /* All registers */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4197 + LIM_REG_CLASSES
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4198 +};
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4199 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4200 +#define N_REG_CLASSES (int) LIM_REG_CLASSES
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4201 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4202 +/* Since GENERAL_REGS is a smaller class than ALL_REGS,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4203 + it is not an alias to ALL_REGS, but to G_REGS. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4204 +#define GENERAL_REGS G_REGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4205 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4206 +/* Give names of register classes as strings for dump file. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4207 +#define REG_CLASS_NAMES \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4208 + { "NO_REGS", "D_REGS", "ACC_A_REGS", "ACC_B_REGS", "X_REGS", "Z_REGS", "Q_REGS", "M_REGS", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4209 + "CC_REGS", "I_REGS", "T_REGS", "A_REGS", "S_REGS", "P_REGS", "G_REGS", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4210 + "ALL_REGS" }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4211 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4212 +/* Define which registers fit in which classes.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4213 + This is an initializer for a vector of HARD_REG_SET
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4214 + of length N_REG_CLASSES. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4215 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4216 +#define D_REGSET (D_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4217 +#define ACC_A_REGSET (A_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4218 +#define ACC_B_REGSET (D_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4219 +#define X_REGSET (X_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4220 +#define Z_REGSET (Z_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4221 +#define Q_REGSET (D_REGBIT | A_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4222 +#define M_REGSET (SOFT_M_REGBITS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4223 +#define CC_REGSET (CC_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4224 +#define I_REGSET (A_REGBIT | B_REGBIT | D_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4225 +#define T_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4226 +#define A_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4227 +#define S_REGSET (SOFT_FP_REGBIT | SOFT_AP_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4228 +#define P_REGSET (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4229 +#define G_REGSET \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4230 + (D_REGSET | Q_REGSET | I_REGSET | A_REGSET | M_REGSET | S_REGSET)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4231 +#define ALL_REGSET (G_REGSET)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4232 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4233 +#define REG_CLASS_CONTENTS { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4234 + {0}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4235 + {D_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4236 + {ACC_A_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4237 + {ACC_B_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4238 + {X_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4239 + {Z_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4240 + {Q_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4241 + {M_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4242 + {CC_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4243 + {I_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4244 + {T_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4245 + {A_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4246 + {S_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4247 + {P_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4248 + {G_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4249 + {ALL_REGSET}, \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4250 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4251 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4252 +/* The same information, inverted.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4253 + * This is defined to use the REG_CLASS_CONTENTS defines above, so that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4254 + * these two sets of definitions are always consistent. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4255 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4256 +#define REGNO_REG_CLASS(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4257 + (D_REGNO_P (REGNO) ? D_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4258 + (Z_REGNO_P (REGNO) ? Z_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4259 + (ACC_A_REGNO_P (REGNO) ? ACC_A_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4260 + (ACC_B_REGNO_P (REGNO) ? ACC_B_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4261 + (X_REGNO_P (REGNO) ? X_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4262 + (Q_REGNO_P (REGNO) ? Q_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4263 + (M_REGNO_P (REGNO) ? M_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4264 + (CC_REGNO_P (REGNO) ? CC_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4265 + (I_REGNO_P (REGNO) ? I_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4266 + (T_REGNO_P (REGNO) ? T_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4267 + (A_REGNO_P (REGNO) ? A_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4268 + (S_REGNO_P (REGNO) ? S_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4269 + (P_REGNO_P (REGNO) ? P_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4270 + (G_REGNO_P (REGNO) ? G_REGS : ALL_REGS))))))))))))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4271 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4272 +#define D_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, D_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4273 +#define ACC_A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_A_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4274 +#define ACC_B_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_B_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4275 +#define X_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, X_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4276 +#define Z_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Z_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4277 +#define Q_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Q_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4278 +#define M_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, M_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4279 +#define CC_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, CC_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4280 +#define I_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, I_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4281 +#define T_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, T_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4282 +#define A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, A_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4283 +#define S_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, S_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4284 +#define P_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, P_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4285 +#define G_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, G_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4286 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4287 +/* Macros that test an rtx 'X' to see if it's in a particular
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4288 + * register class. 'X' need not be a REG necessarily. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4289 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4290 +#define D_REG_P(X) (REG_P (X) && D_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4291 +#define ACC_A_REG_P(X) (REG_P (X) && ACC_A_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4292 +#define ACC_B_REG_P(X) (REG_P (X) && ACC_B_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4293 +#define X_REG_P(X) (REG_P (X) && X_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4294 +#define Z_REG_P(X) (REG_P (X) && Z_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4295 +#define I_REG_P(X) (REG_P (X) && I_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4296 +#define T_REG_P(X) (REG_P (X) && T_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4297 +#define A_REG_P(X) (REG_P (X) && A_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4298 +#define S_REG_P(X) (REG_P (X) && S_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4299 +#define P_REG_P(X) (REG_P (X) && P_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4300 +#define Q_REG_P(X) (REG_P (X) && Q_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4301 +#define M_REG_P(X) (REG_P (X) && M_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4302 +#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4303 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4304 +/* Redefine this in terms of BYTE_REGSET */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4305 +#define BYTE_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, BYTE_REGSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4306 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4307 +/* The class value for index registers, and the one for base regs. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4308 +#define INDEX_REG_CLASS I_REGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4309 +#define BASE_REG_CLASS A_REGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4310 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4311 +/* Get reg_class from a letter in the machine description. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4312 +#define REG_CLASS_FROM_LETTER(C) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4313 + (((C) == 'a' ? A_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4314 + ((C) == 'd' ? D_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4315 + ((C) == 'x' ? I_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4316 + ((C) == 't' ? M_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4317 + ((C) == 'c' ? CC_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4318 + ((C) == 'A' ? ACC_A_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4319 + ((C) == 'B' ? ACC_B_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4320 + ((C) == 'v' ? X_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4321 + ((C) == 'u' ? S_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4322 + ((C) == 'U' ? P_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4323 + ((C) == 'T' ? T_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4324 + ((C) == 'z' ? Z_REGS : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4325 + ((C) == 'q' ? Q_REGS : NO_REGS))))))))))))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4326 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4327 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4328 + The letters I through O in a register constraint string
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4329 + can be used to stand for particular ranges of immediate operands.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4330 + This macro defines what the ranges are.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4331 + C is the letter, and VALUE is a constant value.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4332 + Return 1 if VALUE is in the range specified by C.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4333 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4334 + For the 6809, J, K, L are used for indexed addressing.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4335 + `I' is used for the constant 1.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4336 + `J' is used for the 5-bit offsets.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4337 + `K' is used for the 8-bit offsets.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4338 + `L' is used for the range of signed numbers that fit in 16 bits.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4339 + `M' is used for the exact value '8'.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4340 + `N' is used for the constant -1.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4341 + `O' is used for the constant 0.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4342 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4343 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4344 +#define CONST_OK_FOR_LETTER_P(VALUE, C) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4345 + ((C) == 'I' ? ((VALUE) == 1) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4346 + (C) == 'J' ? ((VALUE) >= -16 && (VALUE) <= 15) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4347 + (C) == 'K' ? ((VALUE) >= -128 && (VALUE) <= 127) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4348 + (C) == 'L' ? ((VALUE) >= -32768 && (VALUE) <= 32767) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4349 + (C) == 'M' ? ((VALUE) == 8) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4350 + (C) == 'N' ? ((VALUE) == -1) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4351 + (C) == 'O' ? ((VALUE) == 0) : 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4352 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4353 +/* Similar, but for floating constants, and defining letters G and H.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4354 + No floating-point constants are valid on MC6809. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4355 +#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4356 + ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4357 + && VALUE == CONST0_RTX (GET_MODE (VALUE))) : 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4358 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4359 +/* Given an rtx X being reloaded into a reg required to be
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4360 + in class CLASS, return the class of reg to actually use.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4361 + In general this is just CLASS; but on some machines
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4362 + in some cases it is preferable to use a more restrictive class. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4363 +#define PREFERRED_RELOAD_CLASS(X,CLASS) m6809_preferred_reload_class(X,CLASS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4364 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4365 +#define SMALL_REGISTER_CLASSES 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4366 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4367 +/* Return the maximum number of consecutive registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4368 + needed to represent mode MODE in a register of class CLASS. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4369 +#define CLASS_MAX_NREGS(CLASS, MODE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4370 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4371 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4372 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4373 + Stack layout; function entry, exit and calling.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4374 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4375 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4376 +/* Define this if pushing a word on the stack
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4377 + makes the stack pointer a smaller address. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4378 +#define STACK_GROWS_DOWNWARD
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4379 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4380 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4381 +/* Define this if the nominal address of the stack frame
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4382 + is at the high-address end of the local variables;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4383 + that is, each additional local variable allocated
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4384 + goes at a more negative offset in the frame. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4385 +#define FRAME_GROWS_DOWNWARD 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4386 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4387 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4388 +/* Offset within stack frame to start allocating local variables at.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4389 + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4390 + first local allocated. Otherwise, it is the offset to the BEGINNING
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4391 + of the first local allocated. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4392 +#define STARTING_FRAME_OFFSET 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4393 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4394 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4395 +/* Always push stack arguments for now. Accumulation is not yet working. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4396 +#define PUSH_ROUNDING(BYTES) (BYTES)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4397 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4398 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4399 +/* Offset of first parameter from the argument pointer register value.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4400 + * ARG_POINTER_REGNUM is defined to point to the return address pushed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4401 + * onto the stack, so we must offset by 2 bytes to get to the arguments. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4402 +#define FIRST_PARM_OFFSET(FNDECL) 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4403 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4404 +/* Value is 1 if returning from a function call automatically
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4405 + pops the arguments described by the number-of-args field in the call.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4406 + FUNTYPE is the data type of the function (as a tree),
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4407 + or for a library call it is an identifier node for the subroutine name. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4408 +/* #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4409 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4410 +/* Define how to find the value returned by a function.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4411 + VALTYPE is the data type of the value (as a tree).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4412 + If the precise function being called is known, FUNC is its FUNCTION_DECL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4413 + otherwise, FUNC is 0. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4414 +#define FUNCTION_VALUE(VALTYPE, FUNC) m6809_function_value (VALTYPE, FUNC)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4415 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4416 +/* Define how to find the value returned by a library function
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4417 + assuming the value has mode MODE. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4418 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4419 +/* All return values are in the X-register. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4420 +#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4421 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4422 +/* Define this if using the nonreentrant convention for returning
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4423 + structure and union values. No; it is inefficient and buggy. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4424 +#undef PCC_STATIC_STRUCT_RETURN
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4425 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4426 +/* 1 if N is a possible register number for a function value. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4427 +#define FUNCTION_VALUE_REGNO_P(N) m6809_function_value_regno_p (N)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4428 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4429 +/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4430 + more than one register. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4431 +#define NEEDS_UNTYPED_CALL 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4432 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4433 +/* 1 if N is a possible register number for function argument passing. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4434 +#define FUNCTION_ARG_REGNO_P(N) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4435 + ((m6809_abi_version != M6809_ABI_VERSION_STACK) ? \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4436 + (((N) == HARD_D_REGNUM) || ((N) == HARD_X_REGNUM)) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4437 + 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4438 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4439 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4440 + Argument Lists
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4441 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4442 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4443 +/* Cumulative arguments are tracked in a single integer,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4444 + * which is the number of bytes of arguments scanned so far,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4445 + * plus which registers have already been used. The register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4446 + * info is kept in some of the upper bits */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4447 +#define CUMULATIVE_ARGS unsigned int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4448 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4449 +#define CUM_STACK_ONLY 0x80000000
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4450 +#define CUM_X_MASK 0x40000000
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4451 +#define CUM_B_MASK 0x20000000
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4452 +#define CUM_STACK_INVALID 0x10000000
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4453 +#define CUM_STACK_MASK 0xFFFFFFF
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4454 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4455 +#define CUM_ADVANCE_8BIT(cum) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4456 + (((cum) & CUM_B_MASK) ? (cum)++ : ((cum) |= CUM_B_MASK))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4457 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4458 +#define CUM_ADVANCE_16BIT(cum) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4459 + (((cum) & CUM_X_MASK) ? (cum) += 2 : ((cum) |= CUM_X_MASK))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4460 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4461 +/* Initialize a variable CUM of type CUMULATIVE_ARGS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4462 + for a call to a function whose data type is FNTYPE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4463 + For a library call, FNTYPE is 0.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4464 + N_NAMED was added in gcc 3.4 and is not used currently. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4465 +#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4466 + ((CUM) = m6809_init_cumulative_args (CUM, FNTYPE, LIBNAME))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4467 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4468 +#define FUNCTION_ARG_SIZE(MODE, TYPE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4469 + ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4470 + : (unsigned) int_size_in_bytes (TYPE))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4471 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4472 +/* Update the data in CUM to advance over an argument
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4473 + of mode MODE and data type TYPE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4474 + (TYPE is null for libcalls where that information may not be available.) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4475 +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4476 + (((MODE == QImode) && !((CUM) & CUM_STACK_ONLY)) ? \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4477 + CUM_ADVANCE_8BIT (CUM) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4478 + ((MODE == HImode) && !((CUM) & CUM_STACK_ONLY)) ? \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4479 + CUM_ADVANCE_16BIT (CUM) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4480 + ((CUM) = ((CUM) + (TYPE ? int_size_in_bytes (TYPE) : 2))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4481 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4482 +/* Define where to put the arguments to a function.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4483 + Value is zero to push the argument on the stack,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4484 + or a hard register rtx in which to store the argument.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4485 + This macro is used _before_ FUNCTION_ARG_ADVANCE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4486 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4487 + For the 6809, the first 8-bit function argument can be placed into B,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4488 + and the first 16-bit arg can go into X. All other arguments
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4489 + will be pushed onto the stack.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4490 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4491 + Command-line options can adjust this behavior somewhat.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4492 + */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4493 +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4494 + ((MODE == VOIDmode) ? NULL_RTX : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4495 + ((MODE == BLKmode) || (GET_MODE_SIZE (MODE) > 2)) ? NULL_RTX : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4496 + ((MODE == QImode) && !((CUM) & (CUM_STACK_ONLY | CUM_B_MASK))) ? \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4497 + gen_rtx_REG (QImode, HARD_D_REGNUM) : \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4498 + ((MODE == HImode) && !((CUM) & (CUM_STACK_ONLY | CUM_X_MASK))) ? \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4499 + gen_rtx_REG (HImode, HARD_X_REGNUM) : m6809_function_arg_on_stack (&CUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4500 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4501 +/* Output assembler code to FILE to increment profiler label # LABELNO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4502 + for profiling a function entry. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4503 +#define FUNCTION_PROFILER(FILE, LABELNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4504 + fprintf (FILE, "\tldd\t#LP%u\n\tjsr\tmcount\n", (LABELNO));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4505 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4506 +/* Stack pointer must be correct on function exit */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4507 +#define EXIT_IGNORE_STACK 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4508 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4509 +/*****************************************************************************
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4510 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4511 +** Trampolines for Nested Functions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4512 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4513 +*****************************************************************************/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4514 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4515 +/* Length in units of the trampoline for entering a nested function. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4516 +#define TRAMPOLINE_SIZE 7
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4517 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4518 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4519 + Addressing modes,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4520 + and classification of registers for them.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4521 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4522 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4523 +/* 6809 has postincrement and predecrement addressing modes */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4524 +#define HAVE_POST_INCREMENT 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4525 +#define HAVE_PRE_DECREMENT 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4526 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4527 +/* Whether or not to use index registers is configurable.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4528 + * Experiments show that things work better when this is off, so
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4529 + * that's the way it is for now. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4530 +#undef USE_INDEX_REGISTERS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4531 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4532 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4533 +/* Macros to check register numbers against specific register classes. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4534 +#define REG_VALID_FOR_BASE_P(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4535 + (((REGNO) < FIRST_PSEUDO_REGISTER) && A_REGNO_P (REGNO))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4536 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4537 +/* MC6809 index registers do not allow scaling, */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4538 +/* but there is "accumulator-offset" mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4539 +#ifdef USE_INDEX_REGISTERS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4540 +#define REG_VALID_FOR_INDEX_P(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4541 + (((REGNO) < FIRST_PSEUDO_REGISTER) && I_REGNO_P (REGNO))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4542 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4543 +#define REG_VALID_FOR_INDEX_P(REGNO) 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4544 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4545 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4546 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_BASE_P */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4547 +#define REGNO_OK_FOR_BASE_NONSTRICT_P(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4548 + ((REGNO) >= FIRST_PSEUDO_REGISTER \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4549 + || REG_VALID_FOR_BASE_P (REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4550 + || (REGNO) == FRAME_POINTER_REGNUM \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4551 + || (REGNO) == HARD_FRAME_POINTER_REGNUM \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4552 + || (REGNO) == ARG_POINTER_REGNUM \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4553 + || (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO])))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4554 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4555 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_INDEX_P */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4556 +#define REGNO_OK_FOR_INDEX_NONSTRICT_P(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4557 + ((REGNO) >= FIRST_PSEUDO_REGISTER \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4558 + || REG_VALID_FOR_INDEX_P (REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4559 + || (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO])))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4560 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4561 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4562 +/* Internal macro, the strict definition for REGNO_OK_FOR_BASE_P */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4563 +#define REGNO_OK_FOR_BASE_STRICT_P(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4564 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_BASE_P (REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4565 + : (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO])))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4566 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4567 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4568 +/* Internal macro, the strict definition for REGNO_OK_FOR_INDEX_P */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4569 +#define REGNO_OK_FOR_INDEX_STRICT_P(REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4570 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_INDEX_P (REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4571 + : (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO])))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4572 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4573 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4574 +#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_BASE_STRICT_P (REGNO)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4575 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4576 +#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_INDEX_STRICT_P (REGNO)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4577 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4578 +#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_STRICT_P (REGNO (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4579 +#define REG_OK_FOR_BASE_NONSTRICT_P(X) REGNO_OK_FOR_BASE_NONSTRICT_P (REGNO (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4580 +#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_STRICT_P (REGNO (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4581 +#define REG_OK_FOR_INDEX_NONSTRICT_P(X) REGNO_OK_FOR_INDEX_NONSTRICT_P (REGNO (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4582 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4583 +#ifndef REG_OK_STRICT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4584 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4585 +#ifdef USE_INDEX_REGISTERS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4586 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4587 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4588 +#define REG_OK_FOR_INDEX_P(X) 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4589 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4590 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4591 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4592 +#ifdef USE_INDEX_REGISTERS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4593 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4594 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4595 +#define REG_OK_FOR_INDEX_P(X) 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4596 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4597 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4598 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4599 +/* Maximum number of registers that can appear in a valid memory address */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4600 +#ifdef USE_INDEX_REGISTERS
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4601 +#define MAX_REGS_PER_ADDRESS 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4602 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4603 +#define MAX_REGS_PER_ADDRESS 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4604 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4605 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4606 +/* 1 if X is an rtx for a constant that is a valid address.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4607 + * We allow any constant, plus the sum of any two constants (this allows
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4608 + * offsetting a symbol ref) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4609 +#define CONSTANT_ADDRESS_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4610 + ((CONSTANT_P (X)) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4611 + || ((GET_CODE (X) == PLUS) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4612 + && (CONSTANT_P (XEXP (X, 0))) && (CONSTANT_P (XEXP (X, 1)))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4613 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4614 +/* Nonzero if the constant value X is a legitimate general operand.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4615 + It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4616 +/* Any single-word constant is ok; the only contexts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4617 + allowing general_operand of mode DI or DF are movdi and movdf. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4618 +#define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4619 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4620 +/* Nonzero if the X is a legitimate immediate operand in PIC mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4621 +#define LEGITIMATE_PIC_OPERAND_P(X) !symbolic_operand (X, VOIDmode)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4622 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4623 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4624 + Test for valid memory addresses
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4625 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4626 +/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4627 + that is a valid memory address for an instruction.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4628 + The MODE argument is the machine mode for the MEM expression
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4629 + that wants to use this address. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4630 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4631 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4632 + Valid addresses are either direct or indirect (MEM) versions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4633 + of the following forms.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4634 + constant N
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4635 + register ,X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4636 + constant indexed N,X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4637 + accumulator indexed D,X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4638 + auto_increment ,X++
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4639 + auto_decrement ,--X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4640 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4641 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4642 +#define REGISTER_ADDRESS_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4643 + (REG_P (X) && REG_OK_FOR_BASE_P (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4644 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4645 +#define EXTENDED_ADDRESS_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4646 + CONSTANT_ADDRESS_P (X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4647 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4648 +#define LEGITIMATE_BASE_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4649 + ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4650 + || (GET_CODE (X) == SIGN_EXTEND \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4651 + && GET_CODE (XEXP (X, 0)) == REG \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4652 + && GET_MODE (XEXP (X, 0)) == HImode \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4653 + && REG_OK_FOR_BASE_P (XEXP (X, 0))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4654 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4655 +#define LEGITIMATE_OFFSET_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4656 + (CONSTANT_ADDRESS_P (X) || (REG_P (X) && REG_OK_FOR_INDEX_P (X)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4657 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4658 +/* 1 if X is the sum of a base register and an offset. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4659 +#define INDEXED_ADDRESS(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4660 + ((GET_CODE (X) == PLUS \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4661 + && LEGITIMATE_BASE_P (XEXP (X, 0)) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4662 + && LEGITIMATE_OFFSET_P (XEXP (X, 1))) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4663 + || (GET_CODE (X) == PLUS \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4664 + && LEGITIMATE_BASE_P (XEXP (X, 1)) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4665 + && LEGITIMATE_OFFSET_P (XEXP (X, 0))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4666 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4667 +#define STACK_REG_P(X) (REG_P(X) && REGNO(X) == HARD_S_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4668 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4669 +#define STACK_PUSH_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4670 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == PRE_DEC && STACK_REG_P (XEXP (XEXP (X, 0), 0)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4671 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4672 +#define STACK_POP_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4673 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == POST_INC && STACK_REG_P (XEXP (XEXP (X, 0), 0)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4674 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4675 +#define PUSH_POP_ADDRESS_P(X) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4676 + (((GET_CODE (X) == PRE_DEC) || (GET_CODE (X) == POST_INC)) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4677 + && (LEGITIMATE_BASE_P (XEXP (X, 0))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4678 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4679 +/* Go to ADDR if X is a valid address. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4680 +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4681 +{ \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4682 + if (REGISTER_ADDRESS_P(X)) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4683 + if (PUSH_POP_ADDRESS_P (X)) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4684 + if (EXTENDED_ADDRESS_P (X)) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4685 + if (INDEXED_ADDRESS (X)) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4686 + if (MEM_P (X) && REGISTER_ADDRESS_P(XEXP (X, 0))) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4687 + if (MEM_P (X) && PUSH_POP_ADDRESS_P (XEXP (X, 0))) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4688 + if (MEM_P (X) && EXTENDED_ADDRESS_P (XEXP (X, 0))) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4689 + if (MEM_P (X) && INDEXED_ADDRESS (XEXP (X, 0))) goto ADDR; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4690 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4691 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4692 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4693 + Address Fix-up
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4694 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4695 +/* Go to LABEL if ADDR (a legitimate address expression)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4696 + has an effect that depends on the machine mode it is used for.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4697 + In the latest GCC, this case is already handled by the core code
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4698 + so no action is required here. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4699 +#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4700 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4701 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4702 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4703 + Miscellaneous Parameters
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4704 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4705 +/* Specify the machine mode that this machine uses
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4706 + for the index in the tablejump instruction. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4707 +#define CASE_VECTOR_MODE Pmode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4708 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4709 +/* Define this as 1 if `char' should by default be signed; else as 0. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4710 +#define DEFAULT_SIGNED_CHAR 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4711 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4712 +/* This flag, if defined, says the same insns that convert to a signed fixnum
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4713 + also convert validly to an unsigned one. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4714 +#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4715 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4716 +/* Max number of bytes we can move from memory to memory/register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4717 + in one reasonably fast instruction. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4718 +#define MOVE_MAX 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4719 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4720 +/* Int can be 8 or 16 bits (default is 16) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4721 +#define INT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4722 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4723 +/* Short is always 16 bits */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4724 +#define SHORT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4725 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4726 +/* Size (bits) of the type "long" on target machine */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4727 +#define LONG_TYPE_SIZE (TARGET_BYTE_INT ? 16 : 32)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4728 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4729 +/* Size (bits) of the type "long long" on target machine */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4730 +#define LONG_LONG_TYPE_SIZE 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4731 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4732 +/* Size (bits) of the type "char" on target machine */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4733 +#define CHAR_TYPE_SIZE 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4734 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4735 +/* Size (bits) of the type "float" on target machine */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4736 +#define FLOAT_TYPE_SIZE 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4737 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4738 +/* Size (bits) of the type "double" on target machine.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4739 + * Note that the C standard does not require that doubles
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4740 + * hold any more bits than float. Since the 6809 has so few
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4741 + * registers, we cannot really support more than 32-bits. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4742 +#define DOUBLE_TYPE_SIZE 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4743 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4744 +/* Size (bits) of the type "long double" on target machine */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4745 +#define LONG_DOUBLE_TYPE_SIZE 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4746 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4747 +/* Define the type used for "size_t". With a 64KB address space,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4748 + * only a 16-bit value here makes sense. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4749 +#define SIZE_TYPE (TARGET_BYTE_INT ? "long unsigned int" : "unsigned int")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4750 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4751 +/* Likewise, the difference between two pointers is also a 16-bit
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4752 + * signed value. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4753 +#define PTRDIFF_TYPE (TARGET_BYTE_INT ? "long int" : "int")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4754 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4755 +/* Nonzero if access to memory by bytes is slow and undesirable. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4756 +#define SLOW_BYTE_ACCESS 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4757 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4758 +/* Define if shifts truncate the shift count
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4759 + which implies one can omit a sign-extension or zero-extension
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4760 + of a shift count. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4761 +#define SHIFT_COUNT_TRUNCATED 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4762 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4763 +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4764 + is done just by pretending it is already truncated. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4765 +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4766 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4767 +/* It is as good to call a constant function address as to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4768 + call an address kept in a register. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4769 +#define NO_FUNCTION_CSE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4770 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4771 +/* Specify the machine mode that pointers have.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4772 + After generation of rtl, the compiler makes no further distinction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4773 + between pointers and any other objects of this machine mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4774 +#define Pmode HImode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4775 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4776 +/* A function address in a call instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4777 + is a byte address (for indexing purposes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4778 + so give the MEM rtx a byte's mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4779 +#define FUNCTION_MODE HImode
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4780 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4781 +/* Define the cost of moving a value from a register in CLASS1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4782 + * to CLASS2, of a given MODE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4783 + *
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4784 + * On the 6809, hard register transfers are all basically equivalent.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4785 + * But soft register moves are treated more like memory moves. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4786 +#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4787 + (((CLASS1 == M_REGS) || (CLASS2 == M_REGS)) ? 4 : 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4788 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4789 +/* Define the cost of moving a value between a register and memory. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4790 +#define MEMORY_MOVE_COST(MODE, CLASS, IN) 5
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4791 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4792 +/* Check a `double' value for validity for a particular machine mode. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4793 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4794 +#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4795 + ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4796 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4797 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4798 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4799 + machine-dependent
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4800 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4801 +/* Tell final.c how to eliminate redundant test instructions. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4802 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4803 +/* Here we define machine-dependent flags and fields in cc_status
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4804 + (see `conditions.h'). */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4805 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4806 +/* Store in cc_status the expressions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4807 + that the condition codes will describe
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4808 + after execution of an instruction whose pattern is EXP.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4809 + Do not alter them if the instruction would not alter the cc's. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4810 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4811 +/* On the 6809, most of the insns to store in an address register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4812 + fail to set the cc's. However, in some cases these instructions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4813 + can make it possibly invalid to use the saved cc's. In those
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4814 + cases we clear out some or all of the saved cc's so they won't be used. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4815 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4816 +#define NOTICE_UPDATE_CC(EXP, INSN) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4817 + notice_update_cc((EXP), (INSN))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4818 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4819 +/*****************************************************************************
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4820 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4821 +** pragma support
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4822 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4823 +*****************************************************************************/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4824 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4825 +#if 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4826 +#define REGISTER_TARGET_PRAGMAS() \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4827 +do { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4828 + extern void pragma_section PARAMS ((cpp_reader *)); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4829 + c_register_pragma (0, "section", pragma_section); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4830 +} while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4831 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4832 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4833 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4834 +/*--------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4835 + ASSEMBLER FORMAT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4836 +--------------------------------------------------------------*/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4837 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4838 +#define FMT_HOST_WIDE_INT "%ld"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4839 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4840 +/* Output to assembler file text saying following lines
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4841 + may contain character constants, extra white space, comments, etc. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4842 +#define ASM_APP_ON ";----- asm -----\n"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4843 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4844 +/* Output to assembler file text saying following lines
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4845 + no longer contain unusual constructs. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4846 +#define ASM_APP_OFF ";--- end asm ---\n"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4847 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4848 +/* Use a semicolon to begin a comment. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4849 +#define ASM_COMMENT_START "; "
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4850 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4851 +/* Output assembly directives to switch to section 'name' */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4852 +#undef TARGET_ASM_NAMED_SECTION
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4853 +#define TARGET_ASM_NAMED_SECTION m6809_asm_named_section
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4854 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4855 +#undef TARGET_HAVE_NAMED_SECTION
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4856 +#define TARGET_HAVE_NAMED_SECTION m6809_have_named_section
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4857 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4858 +/* Output before read-only data. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4859 +#define TEXT_SECTION_ASM_OP (code_section_op)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4860 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4861 +/* Output before writable data. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4862 +#define DATA_SECTION_ASM_OP (data_section_op)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4863 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4864 +/* Output before uninitialized data. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4865 +#define BSS_SECTION_ASM_OP (bss_section_op)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4866 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4867 +/* Support the ctors and dtors sections for g++. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4868 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4869 +#undef CTORS_SECTION_ASM_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4870 +#define CTORS_SECTION_ASM_OP "\t.area .ctors"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4871 +#undef DTORS_SECTION_ASM_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4872 +#define DTORS_SECTION_ASM_OP "\t.area .dtors"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4873 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4874 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4875 +#undef DO_GLOBAL_CTORS_BODY
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4876 +#undef DO_GLOBAL_DTORS_BODY
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4877 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4878 +#define HAS_INIT_SECTION
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4879 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4880 +/* This is how to output an assembler line
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4881 + that says to advance the location counter
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4882 + to a multiple of 2**LOG bytes. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4883 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4884 +#define ASM_OUTPUT_ALIGN(FILE,LOG) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4885 + if ((LOG) > 1) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4886 + fprintf (FILE, "\t.bndry %u\n", 1 << (LOG))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4887 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4888 +/* The .set foo,bar construct doesn't work by default */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4889 +#undef SET_ASM_OP
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4890 +#define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4891 + do \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4892 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4893 + fputc ('\t', FILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4894 + assemble_name (FILE, LABEL1); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4895 + fputs (" = ", FILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4896 + assemble_name (FILE, LABEL2); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4897 + fputc ('\n', FILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4898 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4899 + while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4900 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4901 +/* How to refer to registers in assembler output.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4902 + This sequence is indexed by compiler's hard-register-number (see above). */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4903 +#define MNAME(x) [SOFT_M0_REGNUM+(x)] = "*m" C_STRING(x) ,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4904 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4905 +#define REGISTER_NAMES { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4906 + [HARD_D_REGNUM]= "d", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4907 + [HARD_X_REGNUM]= "x", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4908 + [HARD_Y_REGNUM]= "y", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4909 + [HARD_U_REGNUM]= "u", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4910 + [HARD_S_REGNUM]= "s", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4911 + [HARD_PC_REGNUM]= "pc", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4912 + [HARD_A_REGNUM]= "a", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4913 + [HARD_B_REGNUM]= "b", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4914 + [HARD_CC_REGNUM]= "cc",\
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4915 + [HARD_DP_REGNUM]= "dp", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4916 + [SOFT_FP_REGNUM]= "soft_fp", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4917 + [SOFT_AP_REGNUM]= "soft_ap", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4918 + MNAME(0) MNAME(1) MNAME(2) MNAME(3) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4919 + MNAME(4) MNAME(5) MNAME(6) MNAME(7) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4920 + [HARD_RSVD1_REGNUM] = "-", \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4921 + [HARD_Z_REGNUM] = "z" /* bit 2 of CC */ }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4922 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4923 +/*****************************************************************************
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4924 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4925 +** Debug Support
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4926 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4927 +*****************************************************************************/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4928 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4929 +/* Default to DBX-style debugging */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4930 +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4931 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4932 +#define DBX_DEBUGGING_INFO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4933 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4934 +#define DEFAULT_GDB_EXTENSIONS 0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4935 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4936 +#define ASM_STABS_OP ";\t.stabs\t"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4937 +#define ASM_STABD_OP ";\t.stabd\t"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4938 +#define ASM_STABN_OP ";\t.stabn\t"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4939 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4940 +#define DBX_CONTIN_LENGTH 54
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4941 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4942 +#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(ASMFILE, FILENAME) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4943 +do { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4944 + const char *p = FILENAME; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4945 + while ((p = strchr (p, '/')) != NULL) { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4946 + p = FILENAME = p+1; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4947 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4948 + fprintf (ASMFILE, "%s", ASM_STABS_OP); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4949 + output_quoted_string (ASMFILE, FILENAME); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4950 + fprintf (ASMFILE, ",%d,0,0,", N_SO); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4951 + assemble_name (ASMFILE, ltext_label_name); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4952 + fputc ('\n', ASMFILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4953 + switch_to_section (text_section); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4954 + (*targetm.asm_out.internal_label) (ASMFILE, "Ltext", 0); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4955 +} while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4956 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4957 +/* With -g, GCC sometimes outputs string literals that are longer than
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4958 + * the assembler can handle. Without actual debug support, these are
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4959 + * not really required. Redefine the function to output strings to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4960 + * output as much as possible. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4961 +#define OUTPUT_QUOTED_STRING(FILE, STR) m6809_output_quoted_string (FILE, STR)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4962 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4963 +/*****************************************************************************
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4964 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4965 +** Output and Generation of Labels
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4966 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4967 +*****************************************************************************/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4968 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4969 +/* Prefixes for various assembly-time objects */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4970 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4971 +#define REGISTER_PREFIX ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4972 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4973 +#define LOCAL_LABEL_PREFIX ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4974 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4975 +#define USER_LABEL_PREFIX "_"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4976 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4977 +#define IMMEDIATE_PREFIX "#"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4978 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4979 +/* This is how to output the definition of a user-level label named NAME,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4980 + such as the label on a static function or variable NAME. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4981 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4982 +#define ASM_OUTPUT_LABEL(FILE,NAME) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4983 +do { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4984 + if (section_changed) { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4985 + fprintf (FILE, "\n%s\n\n", code_section_op); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4986 + section_changed = 0; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4987 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4988 + assemble_name (FILE, NAME); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4989 + fputs (":\n", FILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4990 +} while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4991 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4992 +/* This is how to output the label for a function definition. It
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4993 + invokes ASM_OUTPUT_LABEL, but may examine the DECL tree node for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4994 + other properties. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4995 +#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4996 + m6809_declare_function_name (FILE,NAME,DECL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4997 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4998 +/* This is how to output a command to make the user-level label
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
4999 + named NAME defined for reference from other files. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5000 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5001 +#define GLOBAL_ASM_OP "\t.globl "
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5002 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5003 +/* This is how to output a reference to a user label named NAME. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5004 +#define ASM_OUTPUT_LABELREF(FILE,NAME) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5005 + fprintf (FILE, "_%s", NAME)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5006 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5007 +/* This is how to output a reference to a symbol ref
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5008 + * Check to see if the symbol is in the direct page */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5009 +#define ASM_OUTPUT_SYMBOL_REF(FILE,sym) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5010 +{ \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5011 + print_direct_prefix (FILE, sym); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5012 + assemble_name (FILE, XSTR (sym, 0)); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5013 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5014 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5015 +/* External references aren't necessary, so don't emit anything */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5016 +#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5017 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5018 +/* This is how to store into the string LABEL
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5019 + the symbol_ref name of an internal numbered label where
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5020 + PREFIX is the class of label and NUM is the number within the class.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5021 + This is suitable for output with `assemble_name'. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5022 +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5023 + sprintf (LABEL, "*%s%lu", PREFIX, (unsigned long int)NUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5024 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5025 +/* This is how to output an assembler line defining an `int' constant. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5026 +#define ASM_OUTPUT_INT(FILE,VALUE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5027 +( fprintf (FILE, "\t.word "), \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5028 + output_addr_const (FILE, (VALUE)), \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5029 + fprintf (FILE, "\n"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5030 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5031 +/* Likewise for `char' and `short' constants. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5032 +#define ASM_OUTPUT_SHORT(FILE,VALUE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5033 +( fprintf (FILE, "\t.word "), \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5034 + output_addr_const (FILE, (VALUE)), \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5035 + fprintf (FILE, "\n"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5036 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5037 +/* This is how to output a string. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5038 +#define ASM_OUTPUT_ASCII(FILE,STR,SIZE) m6809_output_ascii (FILE, STR, SIZE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5039 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5040 +/* This is how to output an insn to push a register on the stack.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5041 + It need not be very fast code. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5042 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5043 +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5044 + fprintf (FILE, "\tpshs\t%s\n", reg_names[REGNO])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5045 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5046 +/* This is how to output an insn to pop a register from the stack.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5047 + It need not be very fast code. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5048 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5049 +#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5050 + fprintf (FILE, "\tpuls\t%s\n", reg_names[REGNO])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5051 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5052 +/* This is how to output an element of a case-vector that is absolute. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5053 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5054 +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5055 + fprintf (FILE, "\t.word L%u\n", VALUE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5056 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5057 +/* This is how to output an element of a case-vector that is relative. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5058 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5059 +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5060 + fprintf (FILE, "\t.word L%u-L%u\n", VALUE, REL)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5061 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5062 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5063 +/*****************************************************************************
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5064 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5065 +** Assembler Commands for Alignment
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5066 +**
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5067 +*****************************************************************************/
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5068 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5069 +/* ASM_OUTPUT_SKIP is supposed to zero initialize the data.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5070 + * So use the .byte and .word directives instead of .blkb */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5071 +#define ASM_OUTPUT_SKIP(FILE,SIZE) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5072 + do { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5073 + int __size = SIZE; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5074 + while (__size > 0) { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5075 + if (__size >= 2) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5076 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5077 + fprintf (FILE, "\t.word\t0\t;skip space %d\n", __size); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5078 + __size -= 2; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5079 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5080 + else \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5081 + { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5082 + fprintf (FILE, "\t.byte\t0\t;skip space\n"); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5083 + __size--; \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5084 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5085 + } \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5086 + } while (0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5087 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5088 +/* This says how to output an assembler line
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5089 + to define a global common symbol. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5090 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5091 +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5092 + do { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5093 + switch_to_section (bss_section); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5094 + fputs ("\t.globl\t", FILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5095 + assemble_name ((FILE), (NAME)); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5096 + fputs ("\n", FILE); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5097 + assemble_name ((FILE), (NAME)); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5098 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5099 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5100 +/* This says how to output an assembler line
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5101 + to define a local common symbol. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5102 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5103 +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5104 +do { \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5105 + switch_to_section (bss_section); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5106 + assemble_name ((FILE), (NAME)); \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5107 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5108 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5109 +/* Store in OUTPUT a string (made with alloca) containing
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5110 + an assembler-name for a local static variable named NAME.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5111 + LABELNO is an integer which is different for each call. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5112 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5113 +#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5114 +( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5115 + sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long int)(LABELNO)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5116 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5117 +/* Print an instruction operand X on file FILE.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5118 + CODE is the code from the %-spec for printing this operand.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5119 + If `%z3' was used to print operand 3, then CODE is 'z'. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5120 +#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5121 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5122 +/* Print a memory operand whose address is X, on file FILE. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5123 +#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5124 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5125 +/* Don't let stack pushes build up too much. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5126 +#define MAX_PENDING_STACK 8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5127 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5128 +/* Define values for builtin operations */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5129 +enum m6809_builtins
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5130 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5131 + M6809_SWI,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5132 + M6809_SWI2,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5133 + M6809_SWI3,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5134 + M6809_CWAI,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5135 + M6809_SYNC,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5136 + M6809_ADD_CARRY,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5137 + M6809_SUB_CARRY,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5138 + M6809_ADD_DECIMAL,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5139 + M6809_NOP,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5140 + M6809_BLOCKAGE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5141 +};
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5142 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5143 diff -urN gcc-4.6.1-orig/gcc/config/m6809/m6809.md gcc-4.6.1/gcc/config/m6809/m6809.md
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5144 --- gcc-4.6.1-orig/gcc/config/m6809/m6809.md 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5145 +++ gcc-4.6.1/gcc/config/m6809/m6809.md 2011-09-21 20:40:01.287068005 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5146 @@ -0,0 +1,2359 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5147 +;; GCC machine description for Motorola 6809
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5148 +;; Copyright (C) 1989, 2005, 2006, 2007, 2008,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5149 +;; 2009 Free Software Foundation, Inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5150 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5151 +;; Mostly by Brian Dominy (brian@oddchange.com) with substantial renovations
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5152 +;; by William Astle (lost@l-w.ca).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5153 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5154 +;; Based on earlier work by Tom Jones (jones@sal.wisc.edu) and
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5155 +;; Matthias Doerfel (msdoerfe@informatik.uni-erlangen.de)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5156 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5157 +;; This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5158 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5159 +;; GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5160 +;; it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5161 +;; the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5162 +;; any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5163 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5164 +;; GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5165 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5166 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5167 +;; GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5168 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5169 +;; You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5170 +;; along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5171 +;; <http://www.gnu.org/licenses/>.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5172 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5173 +;; General information:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5174 +;; --------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5175 +;; * This backend is mostly a rewrite from earlier (3.1.1 and before)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5176 +;; versions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5177 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5178 +;; * The 'A' and 'B' registers are treated as a single register by the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5179 +;; register allocator; hence, the instruction templates assume that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5180 +;; both can be modified if either one is available for use. No
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5181 +;; attempt is made to split instructions to refer to a particular half
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5182 +;; of the register. It is always referred to as the 'D' register, even
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5183 +;; in QImode (when it will be displayed as 'B').
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5184 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5185 +;; * There is full support for proper branch instruction generation,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5186 +;; based on instruction lengths. However, many instruction patterns
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5187 +;; are still overloaded to emit lots of real instructions, which can
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5188 +;; make the length calculation difficult; in those cases, I've tried
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5189 +;; to be pessimistic and assume the worst-case.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5190 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5191 +;; * The instruction type attributes are only defined for branch
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5192 +;; vs. non branch instructions for now, since there is seemingly no
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5193 +;; reason to define these for other types anyway.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5194 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5195 +;; * The limited number of total registers presents the greatest
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5196 +;; challenge. There are 'soft registers' -- memory locations
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5197 +;; used to simulate real regs -- which can be helpful.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5198 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5199 +;; * Position-independent code (PIC) is supported and has been tested
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5200 +;; but not to the extent of absolute code generation.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5201 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5202 +;; * All of the 6809 special opcodes, e.g. SWI and SYNC, are defined
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5203 +;; as UNSPEC instructions, and can be accessed from C code using
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5204 +;; __builtin_xxxx() style functions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5205 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5206 +;; What still needs to be done:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5207 +;; ----------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5208 +;; * Replace remaining instances of (define_peephole) with
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5209 +;; (define_peephole2), or remove them completely if they are not
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5210 +;; matching anyway. Add more peepholes for things actually encountered.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5211 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5212 +;; * Indexing addressing can lead to crashes in complex functions when
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5213 +;; register pressure is high. Only the 'D' register can actually be
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5214 +;; used as an index register, and its demand by other instructions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5215 +;; can sometimes mean that it is impossible to satisfy constraints.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5216 +;; Currently, indexing is completely disabled to avoid these types
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5217 +;; of problems, although code is slightly more inefficient in some
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5218 +;; working cases.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5219 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5220 +;; * 32-bit math is terribly inefficient.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5221 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5222 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5223 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5224 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5225 +;;- Constants
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5226 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5227 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5228 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5229 +; Define constants for hard register numbers.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5230 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5231 +(define_constants [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5232 + (HARD_RSVD1_REGNUM 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5233 + (HARD_X_REGNUM 1) (HARD_Y_REGNUM 2) (HARD_U_REGNUM 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5234 + (HARD_S_REGNUM 4) (HARD_PC_REGNUM 5) (HARD_D_REGNUM 6)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5235 + (HARD_Z_REGNUM 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5236 + (HARD_A_REGNUM 8) (HARD_B_REGNUM 9)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5237 + (HARD_CC_REGNUM 10) (HARD_DP_REGNUM 11)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5238 + (SOFT_FP_REGNUM 12) (SOFT_AP_REGNUM 13)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5239 + (SOFT_M0_REGNUM 14) (SOFT_M1_REGNUM 15)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5240 + (SOFT_M2_REGNUM 16) (SOFT_M3_REGNUM 17)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5241 +])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5242 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5243 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5244 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5245 +; The range in which a short branch insn can be used.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5246 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5247 +(define_constants [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5248 + (MIN_SHORT_BRANCH_OFFSET -127)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5249 + (MAX_SHORT_BRANCH_OFFSET 128)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5250 +])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5251 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5252 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5253 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5254 +; The lengths of various types of real 6809 instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5255 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5256 +; By default, ordinary insns are 4 bytes long. This is often not
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5257 +; right, and the insn patterns below will redefine this to the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5258 +; correct value.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5259 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5260 +; Branch instruction lengths (conditional and unconditionals) are
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5261 +; well known and declared here. The short insns are used when the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5262 +; offset is within the range declared above (between MIN_SHORT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5263 +; and MAX_SHORT) ; otherwise the long form is used.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5264 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5265 +(define_constants [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5266 + (DEFAULT_INSN_LENGTH 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5267 + (SHORT_CBRANCH_LENGTH 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5268 + (LONG_CBRANCH_LENGTH 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5269 + (SHORT_BRANCH_LENGTH 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5270 + (LONG_BRANCH_LENGTH 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5271 +])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5272 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5273 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5274 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5275 +; Constants for insn cycle counts.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5276 +; Note that these counts all assume 1-byte opcodes. 2-byte
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5277 +; opcodes require 1 extra cycles for fetching the extra byte.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5278 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5279 +(define_constants [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5280 + ;; The default insn length, when it cannot be calculated.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5281 + ;; Take a conservative approach and estimate high.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5282 + (DEFAULT_INSN_CYCLES 10)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5283 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5284 + ;; Cycle counts for ALU and load operations.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5285 + (ALU_INHERENT_CYCLES 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5286 + (ALU_IMMED_CYCLES 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5287 + (ALU_DIRECT_CYCLES 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5288 + (ALU_INDEXED_BASE_CYCLES 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5289 + (ALU_EXTENDED_CYCLES 5)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5290 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5291 + ;; If an ALU operation is on a 16-bit register (D), then
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5292 + ;; add this number of cycles to the total count.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5293 + (ALU_16BIT_CYCLES 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5294 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5295 + ;; A load of a 16-bit register incurs this extra amount.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5296 + (LOAD_16BIT_CYCLES 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5297 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5298 + ;; Cycle counts for memory-only operations (bit shifts, clear, test)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5299 + (MEM_DIRECT_CYCLES 6)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5300 + (MEM_INDEXED_BASE_CYCLES 6)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5301 + (MEM_EXTENDED_CYCLES 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5302 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5303 + ;; Cycle count for any reg-reg transfer (regardless of size)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5304 + (EXG_CYCLES 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5305 + (TFR_CYCLES 6)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5306 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5307 + ;; Cycle count for a condition code update (andcc/orcc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5308 + (CC_CYCLES 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5309 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5310 + (JMP_DIRECT_CYCLES 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5311 + (JMP_INDEXED_BASE_CYCLES 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5312 + (JMP_EXTENDED_CYCLES 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5313 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5314 + (JSR_DIRECT_CYCLES 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5315 + (JSR_INDEXED_BASE_CYCLES 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5316 + (JSR_EXTENDED_CYCLES 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5317 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5318 + (LEA_BASE_CYCLES 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5319 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5320 + ;; Cycle count for a psh/pul operations. Add to this the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5321 + ;; total number of bytes moved for the correct count.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5322 + (PSH_PUL_CYCLES 5)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5323 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5324 + ;; Miscellaneous cycle counts
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5325 + (CWAI_CYCLES 20)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5326 + (MUL_CYCLES 11)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5327 + (NOP_CYCLES 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5328 + (RTI_CYCLES 15)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5329 + (RTS_CYCLES 5)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5330 + (SWI_CYCLES 20)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5331 + (SYNC_CYCLES 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5332 +])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5333 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5334 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5335 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5336 +; An enumeration of values for each "unspec"; i.e. unspecified
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5337 +; instruction. These represent insns that are meaningful on the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5338 +; 6809 but which have no intrinsic meaning to GCC itself.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5339 +; These insns can be generated explicitly using the __builtin_xxx
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5340 +; syntax; they are also implicitly generated by the backend
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5341 +; as needed to implement other insns.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5342 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5343 +(define_constants [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5344 + (UNSPEC_BLOCKAGE 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5345 + (UNSPEC_PUSH_RS 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5346 + (UNSPEC_POP_RS 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5347 + (UNSPEC_SWI 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5348 + (UNSPEC_CWAI 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5349 + (UNSPEC_ADD_CARRY 5)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5350 + (UNSPEC_SUB_CARRY 6)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5351 + (UNSPEC_SYNC 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5352 + (UNSPEC_ADD_DECIMAL 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5353 +])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5354 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5355 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5356 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5357 +;;- Predicates
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5358 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5359 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5360 +(include "predicates.md")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5361 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5362 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5363 +;;- Attributes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5364 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5365 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5366 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5367 +;; The type attribute is used to distinguish between different
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5368 +;; types of branch instructions, so that their lengths can be
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5369 +;; calculated correctly.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5370 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5371 +(define_attr "type" "branch,cbranch,unknown" (const_string "unknown"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5372 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5373 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5374 +;; The length of a branch instruction is calculated based on how
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5375 +;; far away the branch target is. Lengths of other insns default
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5376 +;; to 4. set_attr is used in instruction templates to specify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5377 +;; the length when it is known exactly. When not sure, err on
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5378 +;; the high side to avoid compile errors.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5379 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5380 +(define_attr "length" ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5381 + (cond [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5382 + (eq_attr "type" "branch")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5383 + (if_then_else (lt (minus (match_dup 0) (pc))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5384 + (const_int MIN_SHORT_BRANCH_OFFSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5385 + (const_int LONG_BRANCH_LENGTH)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5386 + (if_then_else (gt (minus (match_dup 0) (pc))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5387 + (const_int MAX_SHORT_BRANCH_OFFSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5388 + (const_int LONG_BRANCH_LENGTH)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5389 + (const_int SHORT_BRANCH_LENGTH)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5390 + (eq_attr "type" "cbranch")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5391 + (if_then_else (lt (minus (match_dup 0) (pc))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5392 + (const_int MIN_SHORT_BRANCH_OFFSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5393 + (const_int LONG_CBRANCH_LENGTH)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5394 + (if_then_else (gt (minus (match_dup 0) (pc))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5395 + (const_int MAX_SHORT_BRANCH_OFFSET))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5396 + (const_int LONG_CBRANCH_LENGTH)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5397 + (const_int SHORT_CBRANCH_LENGTH)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5398 + ] (const_int DEFAULT_INSN_LENGTH)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5399 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5400 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5401 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5402 +;; The default attributes for 'asm' statements.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5403 +;; The default length is the longest possible single 6809 instruction,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5404 +;; which is 5 bytes. GCC will automatically multiply this by the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5405 +;; number of real insns contained in an asm statement.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5406 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5407 +(define_asm_attributes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5408 + [(set_attr "length" "5")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5409 + (set_attr "type" "unknown")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5410 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5411 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5412 +;; An attribute for the number of cycles that it takes an instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5413 +;; to execute.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5414 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5415 +(define_attr "cycles" "" (const_int DEFAULT_INSN_CYCLES))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5416 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5417 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5418 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5419 +;;- Instruction patterns. When multiple patterns apply,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5420 +;;- the first one in the file is chosen.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5421 +;;-
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5422 +;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5423 +;;-
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5424 +;;- Note: NOTICE_UPDATE_CC in m6809.h handles condition code updates
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5425 +;;- for most instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5426 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5427 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5428 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5429 +;;- Test
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5430 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5431 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5432 +;; cmpx is 3 bytes, not 4
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5433 +(define_insn "*tsthi_x"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5434 + [(set (cc0) (match_operand:HI 0 "register_operand_x" "v"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5435 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5436 + "cmpx\t#0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5437 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5438 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5439 +;; subd #0 is 3 bytes, better than cmpd #0 which is 4 bytes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5440 +(define_insn "*tsthi_d"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5441 + [(set (cc0) (match_operand:HI 0 "register_operand_d" "d"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5442 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5443 + "subd\t#0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5444 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5445 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5446 +(define_insn "*tsthi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5447 + [(set (cc0) (match_operand:HI 0 "register_operand" "a"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5448 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5449 + "cmp%0\t#0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5450 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5451 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5452 +(define_insn "*bitqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5453 + [(set (cc0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5454 + (and:QI (match_operand:QI 0 "register_operand" "%q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5455 + (match_operand:QI 1 "general_operand" "mi")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5456 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5457 + "bit%0\t%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5458 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5459 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5460 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5461 +(define_insn "tstqi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5462 + [(set (cc0) (match_operand:QI 0 "nonimmediate_operand" "q,mt"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5463 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5464 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5465 + tst%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5466 + tst\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5467 + [(set_attr "length" "1,3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5468 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5469 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5470 +;;- Compare instructions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5471 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5472 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5473 +;; - cmphi for register to memory or register compares
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5474 +(define_insn "cmphi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5475 + [(set (cc0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5476 + (compare
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5477 + (match_operand:HI 0 "general_operand" "da, mi, ??Ud")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5478 + (match_operand:HI 1 "general_operand" "mi, da, dU")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5479 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5480 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5481 + if ((REG_P (operands[0])) && (REG_P (operands[1]))) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5482 + output_asm_insn ("pshs\t%1\t;cmphi: R:%1 with R:%0", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5483 + return "cmp%0\t,s++\t;cmphi:";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5484 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5485 + if (GET_CODE (operands[0]) == REG)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5486 + return "cmp%0\t%1\t;cmphi:";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5487 + else {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5488 + cc_status.flags |= CC_REVERSED;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5489 + return "cmp%1\t%0\t;cmphi:(R)";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5490 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5491 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5492 + [(set_attr "length" "5,5,7")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5493 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5494 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5495 +(define_insn "cmpqi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5496 + [(set (cc0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5497 + (compare (match_operand:QI 0 "whole_general_operand" "q,q, q,O,mt,K")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5498 + (match_operand:QI 1 "whole_general_operand" "O,mt,K,q,q, q")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5499 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5500 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5501 + if (REG_P (operands[0]) && !M_REG_P (operands[0]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5502 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5503 + if (operands[1] == const0_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5504 + return "tst%0\t;cmpqi:(ZERO)";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5505 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5506 + return "cmp%0\t%1\t;cmpqi:";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5507 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5508 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5509 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5510 + cc_status.flags |= CC_REVERSED;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5511 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5512 + if (operands[0] == const0_rtx)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5513 + return "tst%1\t;cmpqi:(RZERO)";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5514 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5515 + return "cmp%1\t%0\t;cmpqi:(R)";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5516 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5517 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5518 + [(set_attr "length" "1,3,2,1,3,2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5519 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5520 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5521 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5522 +;;- Compare/branch pattern
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5523 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5524 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5525 +(define_expand "cbranchhi4"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5526 + [(set (cc0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5527 + (compare
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5528 + (match_operand:HI 1 "general_operand" "da, mi, ??Ud")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5529 + (match_operand:HI 2 "general_operand" "mi, da, dU")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5530 + (set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5531 + (if_then_else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5532 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5533 + (label_ref (match_operand 3 "" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5534 + (pc)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5535 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5536 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5537 +)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5538 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5539 +(define_expand "cbranchqi4"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5540 + [(set (cc0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5541 + (compare
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5542 + (match_operand:QI 1 "whole_general_operand" "q,q, q,O,mt,K")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5543 + (match_operand:QI 2 "whole_general_operand" "O,mt,K,q,q, q")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5544 + (set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5545 + (if_then_else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5546 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5547 + (label_ref (match_operand 3 "" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5548 + (pc)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5549 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5550 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5551 +)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5552 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5553 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5554 +;;- Move
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5555 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5556 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5557 +; this looks good (obviously not finished) but I still see 'movsi'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5558 +; places in udivsi3 where it's broken
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5559 +; (define_insn "pushsi1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5560 +; [(set (mem:SI (pre_dec (reg:HI HARD_S_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5561 +; (match_operand:SI 0 "general_operand" "o"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5562 +; (set (reg:HI HARD_S_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5563 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int -4))) ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5564 +; ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5565 +; "; pushsi %0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5566 +; [(set_attr "length" "12")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5567 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5568 +; (define_insn "popsi1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5569 +; [(set (match_operand:SI 0 "general_operand" "=o")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5570 +; (mem:SI (post_inc (reg:HI HARD_S_REGNUM))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5571 +; (set (reg:HI HARD_S_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5572 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int 4))) ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5573 +; ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5574 +; "; popsi %0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5575 +; [(set_attr "length" "12")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5576 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5577 +; (define_insn "movsi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5578 +; [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5579 +; (match_operand:SI 1 "general_operand" " oi"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5580 +; ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5581 +; "; movsi %0 <- %1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5582 +; [(set_attr "length" "1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5583 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5584 +; this doesn't work
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5585 +; (define_expand "movsi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5586 +; [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5587 +; (set (match_operand:SI 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5588 +; (match_operand:SI 1 "general_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5589 +; (clobber (match_scratch:HI 2 ""))])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5590 +; ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5591 +; {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5592 +; rtx insn;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5593 +; if (STACK_PUSH_P (operands[0]) || STACK_POP_P (operands[1]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5594 +; {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5595 +; REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC, stack_pointer_rtx, REG_NOTES (insn));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5596 +; }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5597 +; insn = emit_move_multi_word (SImode, operands[0], operands[1]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5598 +; DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5599 +; })
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5600 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5601 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5602 +(define_expand "movhi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5603 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5604 + (match_operand:HI 1 "general_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5605 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5606 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5607 + /* One of the ops has to be in a register prior to reload */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5608 + if (!register_operand (operand0, HImode) &&
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5609 + !register_operand (operand1, HImode))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5610 + operands[1] = copy_to_mode_reg (HImode, operand1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5611 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5612 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5613 +;;; Try a splitter to handle failure cases where we try to move
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5614 +;;; an immediate constant (zero usually) directly to memory.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5615 +;;; This absolutely requires an intermediate register.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5616 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5617 + [(set (match_operand:HI 0 "memory_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5618 + (match_operand:HI 1 "immediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5619 + (clobber (match_operand:HI 2 "register_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5620 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5621 + [(set (match_dup 2) (match_dup 1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5622 + (set (match_dup 0) (match_dup 2))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5623 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5624 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5625 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5626 +;;; This would be a nice method for loading from a word array,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5627 +;;; but it is never generated because the combiner cannot merge
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5628 +;;; more than 3 instructions (there are four here). This is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5629 +;;; perhaps better done via a peephole.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5630 +(define_insn "*movhi_array_load"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5631 + [(set (match_operand:HI 0 "nonimmediate_operand" "=da")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5632 + (mem:HI (plus:HI (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B")) (const_int 1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5633 + (match_operand:HI 2 "immediate_operand" "i"))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5634 + (clobber (match_scratch:HI 3 "=X"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5635 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5636 + "ldx\t%2\;abx\;abx\;ld%0\t,x"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5637 + [(set_attr "length" "7")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5638 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5639 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5640 +;;; Optimize the move of a byte to the stack using the pshs instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5641 +;;; instead of a store with pre-increment.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5642 +(define_insn "movhi_push"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5643 + [(set (match_operand:HI 0 "push_operand" "=m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5644 + (match_operand:HI 1 "register_operand" "U"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5645 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5646 + "pshs\t%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5647 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5648 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5649 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5650 +(define_insn "*movhi_pic_symbolref"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5651 + [(set (match_operand:HI 0 "register_operand" "=a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5652 + (match_operand:HI 1 "symbolic_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5653 + "flag_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5654 + "lea%0\t%c1,pcr"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5655 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5656 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5657 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5658 +(define_insn "*movhi_1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5659 + [(set (match_operand:HI 0 "nonimmediate_operand" "=a,d,a,ad,tmu")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5660 + (match_operand:HI 1 "general_operand" " a,a,d,tmiu,ad"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5661 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5662 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5663 + lea%0\t,%1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5664 + tfr\t%1,%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5665 + tfr\t%1,%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5666 + ld%0\t%1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5667 + st%1\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5668 + [(set_attr "length" "2,2,2,*,*")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5669 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5670 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5671 +;;; Generated by the combiner to merge an address calculation with
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5672 +;;; a byte load. We can use the 'abx' instruction here.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5673 +(define_insn "*movqi_array_load"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5674 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5675 + (mem:QI (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5676 + (match_operand:HI 2 "immediate_operand" "i"))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5677 + (clobber (match_scratch:HI 3 "=X"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5678 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5679 + "ldx\t%2\;abx\;ld%0\t,x"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5680 + [(set_attr "length" "6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5681 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5682 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5683 +;;; Optimize the move of a byte to the stack using the pshs instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5684 +;;; instead of a store with pre-increment.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5685 +(define_insn "movqi_push"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5686 + [(set (match_operand:QI 0 "push_operand" "=m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5687 + (match_operand:QI 1 "register_operand" " q"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5688 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5689 + "pshs\t%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5690 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5691 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5692 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5693 +;;; Optimize the move of a byte from the stack using the puls instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5694 +;;; instead of a store with post-decrement.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5695 +(define_insn "movqi_pop"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5696 + [(set (match_operand:QI 0 "register_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5697 + (match_operand:QI 1 "pop_operand" "m"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5698 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5699 + "puls\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5700 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5701 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5702 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5703 +;;- load low byte of 16-bit data into 8-bit register/memory
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5704 +(define_insn "*mov_lsb"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5705 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,!q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5706 + (subreg:QI (match_operand:HI 1 "general_operand" "d,m,a,d, U") 1))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5707 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5708 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5709 + \t;movlsbqihi: D->B
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5710 + ld%0\t%L1\t;movlsbqihi: msb:%1 -> R:%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5711 + tfr\t%1,d\t;movlsbqihi: R:%1 -> R:%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5712 + stb\t%0\t;movlsbqihi: R:%1 -> %0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5713 + pshs\t%1\t;movlsbqihi: R:%1 -> R:%0\;leas\t1,s\;puls\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5714 + [(set_attr "length" "0,*,2,*,6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5715 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5716 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5717 +;;- load high byte of 16-bit data into 8-bit register/memory
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5718 +(define_insn "*mov_msb"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5719 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,q,m,!q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5720 + (subreg:QI (match_operand:HI 1 "general_operand" "d,O,a,m,d, U") 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5721 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5722 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5723 + tfr\ta,b\t;movmsbqihi: D->B
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5724 + clr%0\t\t;movmsbqihi: ZERO -> R:%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5725 + tfr\t%1,d\t;movmsbqihi: R:%1 -> R:%0\;tfr\ta,b
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5726 + ld%0\t%L1\t;movmsbqihi: lsb:%1 -> R:%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5727 + sta\t%0\t;movmsbqihi: R:%1 -> %0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5728 + pshs\t%1\t;movmsbqihi: R:%1 -> R:%0\;puls\t%0\;leas\t1,s"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5729 + [(set_attr "length" "2,1,4,*,*,6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5730 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5731 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5732 +(define_insn "*movqi_boolean"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5733 + [(set (reg:QI HARD_Z_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5734 + (match_operand:QI 0 "general_operand" "q,O,i,m"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5735 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5736 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5737 + tst%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5738 + andcc\t#~4
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5739 + orcc\t#4
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5740 + tst\t%0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5741 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5742 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5743 +(define_insn "movqi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5744 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,tm,q,tm,q,z")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5745 + (match_operand:QI 1 "general_operand" " q,O,O,tmi,q,z,q"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5746 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5747 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5748 + tfr\t%1,%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5749 + clr%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5750 + clr\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5751 + ld%0\t%1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5752 + st%1\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5753 + tfr\tcc,%0\;and%0\t#4
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5754 + tst%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5755 + [(set_attr "length" "2,1,3,*,*,4,1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5756 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5757 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5758 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5759 +;;- Swap registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5760 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5761 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5762 +; Note: 8-bit swap is never needed so it is not defined.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5763 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5764 +(define_insn "swaphi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5765 + [(set (match_operand:HI 0 "register_operand" "+r")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5766 + (match_operand:HI 1 "register_operand" "+r"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5767 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5768 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5769 + "exg\t%1,%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5770 + [(set_attr "length" "2")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5771 + (set (attr "cycles") (const_int EXG_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5772 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5773 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5774 +(define_insn "bswaphi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5775 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5776 + (bswap:HI (match_operand:HI 1 "register_operand" "0")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5777 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5778 + "exg\ta,b"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5779 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5780 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5781 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5782 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5783 +;;- Extension and truncation insns.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5784 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5785 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5786 +(define_insn "extendqihi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5787 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5788 + (sign_extend:HI (match_operand:QI 1 "general_operand" "B")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5789 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5790 + "sex\t\t;extendqihi2: R:%1 -> R:%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5791 + [(set_attr "length" "1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5792 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5793 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5794 +(define_insn "zero_extendqihi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5795 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5796 + (zero_extend:HI (match_operand:QI 1 "general_operand" "B")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5797 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5798 + "clra\t\t;zero_extendqihi: R:%1 -> R:%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5799 + [(set_attr "length" "1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5800 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5801 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5802 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5803 +;;- All kinds of add instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5804 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5805 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5806 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5807 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5808 +;; gcc's automatic version of addsi3 doesn't know about adcb,adca
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5809 +;; so it is MUCH less efficient. Define this one ourselves.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5810 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5811 +;; TODO - can't always get 'd' for the clobber... allow other registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5812 +;; as well and use exg d,R ... exg R,d around the code sequence to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5813 +;; use others, at a price. Also consider libcall for this when
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5814 +;; optimizing for size.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5815 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5816 +(define_insn "addsi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5817 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5818 + (plus:SI (match_operand:SI 1 "general_operand" "%o")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5819 + (match_operand:SI 2 "general_operand" " oi")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5820 + (clobber (match_scratch:HI 3 "=d"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5821 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5822 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5823 + m6809_output_addsi3 (PLUS, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5824 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5825 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5826 + [(set_attr "length" "21")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5827 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5828 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5829 +; Increment of a 16-bit MEM by 1 can be done without a register.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5830 +(define_insn "*addhi_mem_1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5831 + [(set (match_operand:HI 0 "memory_operand" "=m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5832 + (plus:HI (match_operand:HI 1 "memory_operand" "0") (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5833 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5834 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5835 + rtx xoperands[2];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5836 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5837 + xoperands[0] = operands[0];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5838 + xoperands[1] = adjust_address (operands[0], QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5839 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5840 + output_asm_insn ("inc\t%1", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5841 + output_asm_insn ("bne\t__IL%=", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5842 + output_asm_insn ("inc\t%0\;__IL%=:", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5843 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5844 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5845 + [(set_attr "length" "7")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5846 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5847 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5848 +; Decrement of a 16-bit MEM by 1 can be done without a register.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5849 +(define_insn "*addhi_mem_minus1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5850 + [(set (match_operand:HI 0 "memory_operand" "=m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5851 + (plus:HI (match_operand:HI 1 "memory_operand" "0") (const_int -1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5852 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5853 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5854 + rtx xoperands[2];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5855 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5856 + xoperands[0] = operands[0];
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5857 + xoperands[1] = adjust_address (operands[0], QImode, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5858 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5859 + output_asm_insn ("tst\t%1", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5860 + output_asm_insn ("bne\t__IL%=", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5861 + output_asm_insn ("dec\t%0", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5862 + output_asm_insn ("__IL%=:", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5863 + output_asm_insn ("dec\t%1", xoperands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5864 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5865 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5866 + [(set_attr "length" "7")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5867 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5868 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5869 +; Allow the addition of an 8-bit quantity to a 16-bit quantity
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5870 +; using the LEAX B,Y addressing mode, where X and Y are both
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5871 +; index registers. This will only get generated via the peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5872 +; which removes a sign extension.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5873 +(define_insn "*addhi_b"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5874 + [(set (match_operand:HI 0 "index_register_operand" "=a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5875 + (plus:HI(match_operand:HI 1 "index_register_operand" "%a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5876 + (match_operand:QI 2 "register_operand" "q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5877 + ))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5878 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5879 + "lea%0\t%2,%1\t;addhi_b: R:%0 = R:%2 + R:%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5880 + [(set_attr "length" "*")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5881 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5882 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5883 +; Splitter for addhi pattern #5 below
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5884 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5885 + [(set (match_operand:HI 0 "index_register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5886 + (plus:HI (match_dup 0) (match_operand:HI 1 "memory_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5887 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5888 + [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5889 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5890 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5891 + (set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5892 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5893 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5894 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5895 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5896 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5897 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5898 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5899 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5900 +; Splitter for addhi pattern #7 below
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5901 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5902 + [(set (match_operand:HI 0 "index_register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5903 + (plus:HI (match_dup 0) (match_operand:HI 1 "index_register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5904 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5905 + [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5906 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5907 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5908 + (set (match_dup 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5909 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 0)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5910 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5911 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5912 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5913 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5914 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5915 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5916 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5917 +; TODO - this is ugly. During RTL generation, we don't know what registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5918 +; are available, so the multiple-insn sequences can only be solved
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5919 +; via 'define_split's during matching. See andhi3 for an example.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5920 +; Keep the constraints with ? modifiers to help reload pick the right
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5921 +; registers.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5922 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5923 +; The forms are:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5924 +; 1. D += D, expand this into a shift instead. (rtx costs should be corrected
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5925 +; to avoid this even happening...)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5926 +; 2. D += U, require U to be pushed to memory. (Lots of patterns do this
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5927 +; now, is this a better way?)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5928 +; 3. Best choice: 'addd'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5929 +; 4. Next best choice: 'lea'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5930 +; 5. Hybrid of 3 and 4
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5931 +; 6. Same as 4, not bad
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5932 +; 7. BAD, no D register at all
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5933 +; 8. 'lea', as good as 4.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5934 +(define_insn "addhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5935 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d, d, a,?a, a,???T,a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5936 + (plus:HI(match_operand:HI 1 "add_general_operand" "%0, 0, 0, d, 0, a, 0, a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5937 + (match_operand:HI 2 "general_operand" " 0, !U, mi, a, m, d, T, i")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5938 + ))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5939 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5940 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5941 + lslb\t\t;addhi: R:%0 += R:%2\;rola\t\t;also R:%0 *= 2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5942 + pshs\t%2\t;addhi: R:%0 += R:%2\;add%0\t,s++
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5943 + add%0\t%2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5944 + lea%0\t%1,%2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5945 + #
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5946 + lea%0\t%2,%1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5947 + #
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5948 + lea%0\t%a2,%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5949 + [(set_attr "length" "2,6,*,*,7,*,7,*")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5950 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5951 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5952 +(define_insn "addqi3_carry"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5953 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5954 + (unspec:QI [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5955 + (match_operand:QI 1 "whole_general_operand" "%0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5956 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_ADD_CARRY))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5957 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5958 + "adc%0\t%2\t;addqi_carry: R:%0 += %2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5959 + [(set_attr "length" "*")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5960 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5961 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5962 +; TODO: specifying 'A' for the first constraint, to force into the A register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5963 +; is not working because of the way registers are currently set up. This will
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5964 +; take some work to get right. Thus the second alternative as a backup.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5965 +(define_insn "addqi3_decimal"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5966 + [(set (match_operand:QI 0 "nonimmediate_operand" "=A,?q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5967 + (unspec:QI [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5968 + (match_operand:QI 1 "general_operand" "%0,0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5969 + (match_operand:QI 2 "general_operand" "tmi,tmi")] UNSPEC_ADD_DECIMAL))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5970 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5971 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5972 + adda\t%2\;daa
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5973 + tfr\t%0,a\;adda\t%2\;daa\;tfr\ta,%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5974 + [(set_attr "length" "5,9")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5975 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5976 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5977 +(define_insn "addqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5978 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,tm,tm,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5979 + (plus:QI (match_operand:QI 1 "whole_general_operand" "%0,0,0,0,0,0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5980 + (match_operand:QI 2 "whole_general_operand" " 0,I,N,I,N,tmi")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5981 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5982 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5983 + asl%0\t\t;addqi: R:%0 = R:%0 + R:%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5984 + inc%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5985 + dec%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5986 + inc\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5987 + dec\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5988 + add%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5989 + [(set_attr "length" "1,1,1,3,3,*")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5990 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5991 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5992 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5993 +;;- Subtract instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5994 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5995 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5996 +(define_insn "subsi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5997 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5998 + (minus:SI (match_operand:SI 1 "general_operand" " o")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
5999 + (match_operand:SI 2 "general_operand" " oi")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6000 + (clobber (match_scratch:HI 3 "=d"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6001 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6002 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6003 + m6809_output_addsi3 (MINUS, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6004 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6005 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6006 + [(set_attr "length" "21")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6007 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6008 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6009 +(define_insn "subhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6010 + [(set (match_operand:HI 0 "register_operand" "=d, d, a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6011 + (minus:HI (match_operand:HI 1 "register_operand" "0, 0, 0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6012 + (match_operand:HI 2 "general_operand" "mi, ?U,n")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6013 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6014 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6015 + sub%0\t%2\t;subhi: R:%0 -= %2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6016 + pshs\t%2\t;subhi: R:%0 -= R:%2\;sub%0\t,s++
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6017 + lea%0\t%n2,%1\t;subhi: R:%0 = R:%1 + %n2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6018 + [(set_attr "length" "*,5,3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6019 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6020 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6021 +(define_insn "subqi3_carry"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6022 + [(set (match_operand:QI 0 "register_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6023 + (unspec:QI [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6024 + (match_operand:QI 1 "whole_general_operand" "%0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6025 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_SUB_CARRY))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6026 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6027 + "sbc%0\t%2\t;subqi_carry: R:%0 += %2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6028 + [(set_attr "length" "*")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6029 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6030 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6031 +(define_insn "subqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6032 + [(set (match_operand:QI 0 "register_operand" "=q, q, !q, !q, q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6033 + (minus:QI (match_operand:QI 1 "whole_register_operand" "0, 0, I, tmn, 0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6034 + (match_operand:QI 2 "whole_general_operand" "I, mi, 0, 0, t")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6035 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6036 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6037 + dec%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6038 + sub%0\t%2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6039 + dec%0\;neg%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6040 + sub%0\t%1\;neg%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6041 + sub%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6042 + [(set_attr "length" "1,3,2,4,3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6043 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6044 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6045 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6046 +;;- Multiply instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6047 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6048 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6049 +; TODO - merge these two instructions, using 'extend_operator' to match
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6050 +; either signed or zero extension. Everything else is the same.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6051 +(define_insn "mulqihi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6052 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6053 + (mult:HI (sign_extend:HI (match_operand:QI 1 "general_operand" "%q"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6054 + (match_operand:QI 2 "general_operand" "tmK")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6055 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6056 + "lda\t%2\t;mulqihi3\;mul"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6057 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6058 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6059 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6060 +(define_insn "umulqihi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6061 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6062 + (mult:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%q"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6063 + (match_operand:QI 2 "general_operand" "tmK")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6064 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6065 + "lda\t%2\t;umulqihi3\;mul"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6066 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6067 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6068 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6069 +; Expand a 16x16 multiplication into either a libcall or a shift.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6070 +; If the second operand is a small constant, use the above form.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6071 +; Otherwise, do a libcall.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6072 +(define_expand "mulhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6073 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6074 + (mult:HI (match_operand:HI 1 "general_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6075 + (match_operand:HI 2 "nonmemory_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6076 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6077 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6078 + emit_libcall_insns (HImode, "mulhi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6079 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6080 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6081 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6082 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6083 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6084 +;;- Divide instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6085 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6086 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6087 +(define_expand "divhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6088 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6089 + (div:HI (match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6090 + (match_operand:HI 2 "register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6091 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6092 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6093 + emit_libcall_insns (HImode, "divhi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6094 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6095 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6096 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6097 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6098 +(define_expand "divqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6099 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6100 + (div:QI (match_operand:QI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6101 + (match_operand:QI 2 "register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6102 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6103 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6104 + emit_libcall_insns (QImode, "divqi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6105 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6106 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6107 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6108 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6109 +(define_expand "udivhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6110 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6111 + (udiv:HI (match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6112 + (match_operand:HI 2 "register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6113 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6114 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6115 + emit_libcall_insns (HImode, "udivhi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6116 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6117 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6118 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6119 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6120 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6121 +;;- mod
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6122 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6123 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6124 +(define_expand "modhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6125 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6126 + (mod:HI (match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6127 + (match_operand:HI 2 "register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6128 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6129 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6130 + emit_libcall_insns (HImode, "modhi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6131 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6132 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6133 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6134 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6135 +(define_expand "modqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6136 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6137 + (mod:QI (match_operand:QI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6138 + (match_operand:QI 2 "register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6139 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6140 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6141 + emit_libcall_insns (QImode, "modqi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6142 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6143 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6144 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6145 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6146 +(define_expand "umodhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6147 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6148 + (umod:HI (match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6149 + (match_operand:HI 2 "register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6150 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6151 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6152 + emit_libcall_insns (HImode, "umodhi3", operands, 2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6153 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6154 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6155 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6156 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6157 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6158 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6159 +;;- and, or, xor common patterns
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6160 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6161 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6162 +; Split a bitwise HImode into two QImode instructions, with one of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6163 +; the sources in a pushable register. The register is pushed onto
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6164 +; the stack and memory pop operands (,s+) are used in the QI forms.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6165 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6166 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6167 + (match_operator:HI 3 "logical_bit_operator"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6168 + [(match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6169 + (match_operand:HI 2 "register_operand" "")]))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6170 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6171 + [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 2))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6172 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6173 + [(reg:QI HARD_A_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6174 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6175 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6176 + [(reg:QI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6177 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6178 + (use (reg:QI HARD_A_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6179 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6180 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6181 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6182 +; Split a bitwise HImode into two QImode instructions, with one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6183 +; of the sources being a (MEM (MEM (...)); i.e. an indirect memory
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6184 +; reference. This requires dereferencing the pointer into a
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6185 +; temporary register (X), which must be saved/restored around the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6186 +; compute instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6187 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6188 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6189 + (match_operator:HI 3 "logical_bit_operator"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6190 + [(match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6191 + (mem:HI (match_operand:HI 2 "memory_operand" ""))]))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6192 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6193 + [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6194 + (set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 4))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6195 + (set (match_dup 4) (match_dup 2))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6196 + (set (match_dup 4) (mem:HI (match_dup 4)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6197 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6198 + [(reg:QI HARD_A_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6199 + (mem:QI (post_inc:QI (match_dup 4)))]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6200 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6201 + [(reg:QI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6202 + (mem:QI (post_inc:QI (match_dup 4)))]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6203 + (use (reg:QI HARD_A_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6204 + (set (match_dup 4) (mem:HI (post_inc:HI (reg:HI HARD_S_REGNUM))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6205 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6206 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6207 + /* Use X for a temporary index register */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6208 + operands[4] = gen_rtx_REG (HImode, HARD_X_REGNUM);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6209 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6210 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6211 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6212 +; Split a bitwise HImode into two QImode instructions. This is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6213 +; the common case. This handles splitting when neither of the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6214 +; above two cases applies.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6215 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6216 + [(set (match_operand:HI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6217 + (match_operator:HI 3 "logical_bit_operator"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6218 + [(match_operand:HI 1 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6219 + (match_operand:HI 2 "general_operand" "")]))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6220 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6221 + [(set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6222 + [(reg:QI HARD_A_REGNUM) (match_dup 4)]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6223 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6224 + [(reg:QI HARD_D_REGNUM) (match_dup 5)]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6225 + (use (reg:QI HARD_A_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6226 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6227 + if (GET_CODE (operands[2]) == CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6228 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6229 + operands[4] = gen_rtx_const_high (operands[2]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6230 + operands[5] = gen_rtx_const_low (operands[2]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6231 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6232 + else if ((GET_CODE (operands[2]) == MEM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6233 + && (GET_CODE (XEXP (operands[2], 0)) == MEM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6234 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6235 + FAIL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6236 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6237 + else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6238 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6239 + operands[4] = gen_highpart (QImode, operands[2]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6240 + operands[5] = gen_lowpart (QImode, operands[2]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6241 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6242 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6243 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6244 +; Below are the specific cases for each of the operators.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6245 +; The QImode versions are the simplest and can be implemented
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6246 +; directly on the hardware. The HImode cases are all output
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6247 +; using one of the above splitting techniques.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6248 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6249 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6250 +;;- and
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6251 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6252 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6253 +(define_insn "andhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6254 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6255 + (and:HI (match_operand:HI 1 "register_operand" "%0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6256 + (match_operand:HI 2 "general_operand" "mnU")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6257 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6258 + "#")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6259 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6260 +;; it is not clear that this is correct
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6261 +(define_insn "*andqi_2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6262 + [(set
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6263 + (match_operand:QI 0 "register_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6264 + (and:QI (match_operand:QI 1 "register_operand" "q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6265 + (match_operand 2 "const_int_operand" "i")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6266 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6267 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6268 + if (GET_CODE (operands[2]) == CONST_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6269 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6270 + operands[3] = GEN_INT(INTVAL(operands[2]) & 0xff);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6271 + return "and%0 %3";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6272 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6273 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6274 + return "and%0 %2";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6275 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6276 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6277 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6278 +(define_insn "andqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6279 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,qc")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6280 + (and:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6281 + (match_operand:QI 2 "whole_general_operand" " O,N,tm,i")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6282 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6283 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6284 + clr%0\t;andqi(ZERO)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6285 + \t;andqi(-1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6286 + and%0\t%2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6287 + and%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6288 + [(set_attr "length" "1,0,3,2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6289 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6290 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6291 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6292 +;;- or
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6293 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6294 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6295 +(define_insn "iorhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6296 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6297 + (ior:HI (match_operand:HI 1 "register_operand" "%0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6298 + (match_operand:HI 2 "general_operand" "mnU")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6299 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6300 + "#")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6301 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6302 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6303 +(define_insn "iorqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6304 + [(set (match_operand:QI 0 "register_operand" "=q,q, qc")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6305 + (ior:QI (match_operand:QI 1 "whole_register_operand" "%0,0, 0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6306 + (match_operand:QI 2 "whole_general_operand" " O,tm,i")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6307 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6308 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6309 + \t;iorqi(ZERO)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6310 + or%0\t%2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6311 + or%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6312 + [(set_attr "length" "0,3,2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6313 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6314 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6315 +;;- xor
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6316 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6317 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6318 +(define_insn "xorhi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6319 + [(set (match_operand:HI 0 "register_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6320 + (xor:HI (match_operand:HI 1 "register_operand" "%0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6321 + (match_operand:HI 2 "general_operand" "mnU")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6322 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6323 + "#")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6324 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6325 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6326 +(define_insn "xorqi3"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6327 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6328 + (xor:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6329 + (match_operand:QI 2 "whole_general_operand" " O,N,tm,i")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6330 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6331 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6332 + \t;xorqi(ZERO)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6333 + com%0\t;xorqi(-1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6334 + eor%0\t%2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6335 + eor%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6336 + [(set_attr "length" "0,1,3,2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6337 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6338 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6339 +;;- Two's Complements
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6340 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6341 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6342 +(define_insn "neghi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6343 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,!a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6344 + (neg:HI (match_operand:HI 1 "general_operand" "0, 0")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6345 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6346 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6347 + nega\;negb\;sbca\t#0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6348 + exg\td,%0\;nega\;negb\;sbca\t#0\;exg\td,%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6349 + [(set_attr "length" "5,9")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6350 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6351 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6352 +(define_insn "negqi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6353 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6354 + (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6355 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6356 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6357 + neg%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6358 + neg\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6359 + [(set_attr "length" "1,3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6360 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6361 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6362 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6363 +;;- One's Complements
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6364 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6365 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6366 +(define_insn "one_cmplhi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6367 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,?tm,???a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6368 + (not:HI (match_operand:HI 1 "general_operand" "0, 0, 0")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6369 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6370 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6371 + coma\;comb
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6372 + com\t%0\;com\t%L0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6373 + exg\td,%0\;coma\;comb\;exg\td,%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6374 + [(set_attr "length" "2,6,6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6375 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6376 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6377 +(define_insn "one_cmplqi2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6378 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,tm")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6379 + (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6380 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6381 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6382 + com%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6383 + com\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6384 + [(set_attr "length" "1,3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6385 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6386 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6387 +;;- Shifts/rotates
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6388 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6389 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6390 +(define_code_iterator bit_code [ashift ashiftrt lshiftrt])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6391 +(define_code_attr bit_code_name [(ashift "ashl") (ashiftrt "ashr") (lshiftrt "lshr")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6392 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6393 +(define_mode_iterator bit_mode [QI HI])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6394 +(define_mode_attr bit_mode_name [(QI "qi3") (HI "hi3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6395 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6396 +;; Emit RTL for any shift (handles all 3 opcodes and 2 mode sizes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6397 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6398 +(define_expand "<bit_code:bit_code_name><bit_mode:bit_mode_name>"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6399 + [(set (match_operand:bit_mode 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6400 + (bit_code:bit_mode (match_operand:bit_mode 1 "general_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6401 + (match_operand:bit_mode 2 "nonmemory_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6402 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6403 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6404 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6405 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6406 +; Individual instructions implemented in the CPU.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6407 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6408 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6409 +(define_insn "*ashift1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6410 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6411 + (ashift:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6412 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6413 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6414 + asl\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6415 + asl%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6416 + [(set_attr "length" "3,1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6417 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6418 +(define_insn "*lshiftrt1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6419 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6420 + (lshiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6421 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6422 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6423 + lsr\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6424 + lsr%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6425 + [(set_attr "length" "3,1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6426 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6427 +(define_insn "*ashiftrt1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6428 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6429 + (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6430 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6431 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6432 + asr\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6433 + asr%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6434 + [(set_attr "length" "3,1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6435 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6436 +(define_insn "*rotate1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6437 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6438 + (rotate:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6439 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6440 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6441 + rol\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6442 + rol%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6443 + [(set_attr "length" "3,1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6444 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6445 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6446 +(define_insn "*rotatert1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6447 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6448 + (rotatert:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6449 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6450 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6451 + ror\t%0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6452 + ror%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6453 + [(set_attr "length" "3,1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6454 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6455 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6456 +; A shift by 8 for D reg can be optimized by just moving
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6457 +; between the A/B halves, and then zero/sign extending or
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6458 +; filling in zeroes.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6459 +; Because GCC does not understand that 'A' and 'D' refer to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6460 +; the same storage location, we must use 'USE' throughout
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6461 +; to prevent deletion of 'unnecessary' instructions.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6462 +; Similar optimization for MEM would require a scratch register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6463 +; so is not done here.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6464 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6465 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6466 + [(set (reg:HI HARD_D_REGNUM) (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6467 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6468 + [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6469 + (use (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6470 + (set (reg:QI HARD_A_REGNUM) (reg:QI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6471 + (use (reg:QI HARD_A_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6472 + (set (reg:QI HARD_D_REGNUM) (const_int 0))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6473 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6474 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6475 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6476 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6477 + [(set (reg:HI HARD_D_REGNUM) (lshiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6478 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6479 + [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6480 + (use (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6481 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6482 + (use (reg:QI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6483 + (set (reg:HI HARD_D_REGNUM) (zero_extend:HI (reg:QI HARD_D_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6484 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6485 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6486 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6487 +(define_split
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6488 + [(set (reg:HI HARD_D_REGNUM) (ashiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6489 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6490 + [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6491 + (use (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6492 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6493 + (use (reg:QI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6494 + (set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6495 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6496 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6497 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6498 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6499 +; On the WPC hardware, there is a shift register that can be used
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6500 +; to compute (1<<n) efficiently in two instructions. Note that this
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6501 +; form only works when using -mint8 though, because C will promote
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6502 +; to 'int' when doing this operation. TODO : we need a 16-bit form too.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6503 +(define_insn "ashlqi3_wpc"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6504 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6505 + (ashift:QI (match_operand:QI 1 "immediate_operand" "I")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6506 + (match_operand:QI 2 "general_operand" "q")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6507 + "TARGET_WPC"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6508 + "st%2\t0x3FF7\;ld%0\t0x3FF7"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6509 + [(set_attr "length" "6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6510 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6511 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6512 +; Internal instructions for shifting by a constant.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6513 +; Two forms are provided, one for QImode, one for HImode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6514 +; These are always split into the above instructions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6515 +; (except for QImode forms that directly match one of the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6516 +; above instructions, in which the condition will not
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6517 +; allow the splitter to match).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6518 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6519 +(define_insn_and_split "<bit_code:bit_code_name>hi3_const"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6520 + [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6521 + (bit_code:HI (match_operand:HI 1 "general_operand" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6522 + (match_operand:HI 2 "immediate_operand" "n")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6523 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6524 + "#"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6525 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6526 + [(const_int 0)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6527 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6528 + m6809_split_shift (<bit_code:CODE>, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6529 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6530 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6531 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6532 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6533 +(define_insn_and_split "<bit_code:bit_code_name>qi3_const"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6534 + [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6535 + (bit_code:QI (match_operand:QI 1 "general_operand" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6536 + (match_operand:QI 2 "immediate_operand" "n")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6537 + "INTVAL (operands[2]) > 1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6538 + "#"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6539 + "&& reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6540 + [(const_int 0)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6541 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6542 + m6809_split_shift (<bit_code:CODE>, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6543 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6544 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6545 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6546 +; Internal instructions for shifting by a nonconstant.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6547 +; These expand into complex assembly.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6548 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6549 +(define_insn "<bit_code:bit_code_name>hi3_reg"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6550 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6551 + (bit_code:HI (match_operand:HI 1 "general_operand" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6552 + (match_operand:HI 2 "nonimmediate_operand" "v")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6553 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6554 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6555 + m6809_output_shift_insn (<bit_code:CODE>, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6556 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6557 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6558 + [(set_attr "length" "20")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6559 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6560 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6561 +(define_insn "<bit_code:bit_code_name>qi3_reg"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6562 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6563 + (bit_code:QI (match_operand:QI 1 "general_operand" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6564 + (match_operand:QI 2 "nonimmediate_operand" "v")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6565 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6566 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6567 + m6809_output_shift_insn (<bit_code:CODE>, operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6568 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6569 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6570 + [(set_attr "length" "16")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6571 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6572 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6573 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6574 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6575 +;;- Jumps and transfers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6576 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6577 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6578 +;;; The casesi pattern is normally *not* defined; see 'tablejump' instead.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6579 +(define_expand "casesi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6580 + [(match_operand:HI 0 "register_operand" "") ; index to jump on
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6581 + (match_operand:HI 1 "immediate_operand" "") ; lower bound
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6582 + (match_operand:HI 2 "immediate_operand" "") ; total range
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6583 + (match_operand 3 "" "") ; table label
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6584 + (match_operand 4 "" "")] ; out of range label
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6585 + "TARGET_BYTE_INT && TARGET_CASESI"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6586 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6587 + m6809_do_casesi (operands[0], operands[1], operands[2],
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6588 + operands[3], operands[4]);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6589 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6590 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6591 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6592 +(define_insn "tablejump_short_offset"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6593 + [(set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6594 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6595 + (zero_extend:HI (match_operand:QI 0 "register_operand" "q")))))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6596 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6597 + "jmp\t[b,x]\t;tablejump_short_offset"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6598 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6599 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6600 +(define_insn "tablejump_long_offset"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6601 + [(set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6602 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6603 + (match_operand:HI 0 "register_operand" "d"))))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6604 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6605 + "jmp\t[d,x]\t;tablejump_long_offset"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6606 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6607 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6608 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6609 + ;; A tablejump operation gives the address in operand 0, with the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6610 + ;; CODE_LABEL for the table in operand 1. The 'define_expand'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6611 + ;; shows the arguments as GCC presents them. For a register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6612 + ;; operand, the assembly code is straightforward. For a MEM,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6613 + ;; assumed to be a SYMBOL_REF, two forms are given, one normal
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6614 + ;; and one for PIC mode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6615 + (define_expand "tablejump"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6616 + [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6617 + (set (pc) (match_operand:HI 0 "" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6618 + (use (label_ref (match_operand 1 "" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6619 + (clobber (match_scratch:HI 2 ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6620 + ])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6621 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6622 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6623 + })
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6624 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6625 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6626 +(define_insn "*tablejump_reg"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6627 + [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6628 + (set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6629 + (match_operand:HI 0 "register_operand" "a"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6630 + (use (label_ref (match_operand 1 "" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6631 + (clobber (match_scratch:HI 2 ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6632 + ])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6633 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6634 + "jmp\t,%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6635 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6636 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6637 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6638 +(define_insn "*tablejump_symbol"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6639 + [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6640 + (set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6641 + (mem:HI
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6642 + (plus:HI (match_operand:HI 0 "register_operand" "a")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6643 + (label_ref (match_operand 1 "" "")))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6644 + (use (label_ref (match_dup 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6645 + (clobber (match_scratch:HI 2 ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6646 + ])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6647 + "!flag_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6648 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6649 + output_asm_insn ("jmp\t[%a1,%0]", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6650 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6651 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6652 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6653 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6654 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6655 +(define_insn "*tablejump_symbol_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6656 + [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6657 + (set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6658 + (mem:HI
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6659 + (plus:HI (match_operand:HI 0 "register_operand" "d")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6660 + (label_ref (match_operand 1 "" "")))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6661 + (use (label_ref (match_dup 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6662 + (clobber (match_scratch:HI 2 "=&a"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6663 + ])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6664 + "flag_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6665 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6666 + output_asm_insn ("lea%2\t%a1,pcr", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6667 + output_asm_insn ("ld%0\t%0,%2", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6668 + output_asm_insn ("jmp\t%0,%2", operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6669 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6670 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6671 + [(set_attr "length" "8")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6672 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6673 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6674 +(define_insn "indirect_jump"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6675 + [(set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6676 + (match_operand:HI 0 "register_operand" "a"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6677 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6678 + "jmp\t,%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6679 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6680 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6681 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6682 +(define_insn "jump"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6683 + [(set (pc) (label_ref (match_operand 0 "" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6684 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6685 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6686 + return output_branch_insn ( LABEL_REF, operands, get_attr_length (insn));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6687 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6688 + [(set (attr "type") (const_string "branch"))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6689 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6690 +; Output assembly for a condition branch instruction.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6691 +(define_insn "*cond_branch"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6692 + [(set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6693 + (if_then_else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6694 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6695 + (label_ref (match_operand 0 "" "")) (pc)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6696 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6697 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6698 + return output_branch_insn ( GET_CODE(operands[1]),
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6699 + operands, get_attr_length (insn));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6700 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6701 + [(set (attr "type") (const_string "cbranch"))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6702 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6703 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6704 +; Similar to above, but for a condition branch instruction that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6705 +; had its operands reversed at some point.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6706 +(define_insn "*cond_branch_reverse"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6707 + [(set (pc)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6708 + (if_then_else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6709 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6710 + (pc) (label_ref (match_operand 0 "" ""))))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6711 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6712 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6713 + return output_branch_insn ( reverse_condition (GET_CODE(operands[1])),
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6714 + operands, get_attr_length (insn));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6715 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6716 + [(set (attr "type") (const_string "cbranch"))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6717 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6718 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6719 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6720 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6721 +;;- Calls
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6722 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6723 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6724 +;; Generate a call instruction for a function that does not
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6725 +;; return a value. The expander is used during RTL generation.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6726 +;; The instructions below are used during matching; only one
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6727 +;; of them will be used, depending on the type of function
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6728 +;; being called. The different conditions are:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6729 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6730 +;; 1) far_functionp - is this a far function? Those need
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6731 +;; to be output as indirect calls through a far-function
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6732 +;; handler.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6733 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6734 +;; 2) noreturn_functionp - if the function does not return,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6735 +;; we can use a 'jmp' instead of a 'jsr' to call it.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6736 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6737 +;; 3) is PIC mode enabled? If so, we'll always use
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6738 +;; relative calls (lbsr or lbra).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6739 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6740 +;; Note: not all combinations are fully supported, especially
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6741 +;; relating to PIC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6742 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6743 +;; The 'bsr' instruction is never generated.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6744 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6745 +(define_expand "call"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6746 + [(call (match_operand:HI 0 "memory_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6747 + (match_operand:HI 1 "general_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6748 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6749 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6750 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6751 +(define_insn "*call_nopic_far"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6752 + [(call (match_operand:HI 0 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6753 + (match_operand:HI 1 "general_operand" "g"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6754 + "far_functionp (operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6755 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6756 + output_far_call_insn (operands, 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6757 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6758 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6759 + [(set_attr "length" "6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6760 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6761 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6762 +; PIC forms come first, and should only match
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6763 +; (MEM (SYMBOL_REF)). Other MEM forms are treated as usual.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6764 +(define_insn "*call_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6765 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6766 + (match_operand:HI 1 "general_operand" "g"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6767 + "flag_pic && !noreturn_functionp (operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6768 + "lbsr\t%C0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6769 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6770 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6771 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6772 +(define_insn "*call_nopic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6773 + [(call (match_operand:HI 0 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6774 + (match_operand:HI 1 "general_operand" "g"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6775 + "!noreturn_functionp (operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6776 + "jsr\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6777 + [(set_attr "length" "3")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6778 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6779 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6780 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6781 +(define_insn "*call_noreturn_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6782 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6783 + (match_operand:HI 1 "general_operand" "g"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6784 + "flag_pic && noreturn_functionp (operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6785 + "lbra\t%C0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6786 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6787 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6788 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6789 +(define_insn "*call_noreturn_nopic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6790 + [(call (match_operand:HI 0 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6791 + (match_operand:HI 1 "general_operand" "g"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6792 + "noreturn_functionp (operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6793 + "jmp\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6794 + [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6795 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6796 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6797 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6798 +;; Same as above, but for functions that do return a value.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6799 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6800 +(define_expand "call_value"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6801 + [(set (match_operand 0 "" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6802 + (call (match_operand:HI 1 "memory_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6803 + (match_operand:HI 2 "general_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6804 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6805 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6806 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6807 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6808 +(define_insn "*call_value_far"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6809 + [(set (match_operand 0 "" "=gz")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6810 + (call (match_operand:HI 1 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6811 + (match_operand:HI 2 "general_operand" "g")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6812 + "far_functionp (operands[1])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6813 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6814 + output_far_call_insn (operands, 1);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6815 + return "";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6816 +}
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6817 + [(set_attr "length" "6")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6818 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6819 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6820 +(define_insn "*call_value_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6821 + [(set (match_operand 0 "" "=gz")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6822 + (call (mem:HI (match_operand:HI 1 "symbolic_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6823 + (match_operand:HI 2 "general_operand" "g")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6824 + "flag_pic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6825 + "lbsr\t%C1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6826 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6827 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6828 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6829 +(define_insn "*call_value_nopic"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6830 + [(set (match_operand 0 "" "=gz")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6831 + (call (match_operand:HI 1 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6832 + (match_operand:HI 2 "general_operand" "g")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6833 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6834 + "jsr\t%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6835 + [(set_attr "length" "3")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6836 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6837 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6838 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6839 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6840 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6841 +;; How to generate an untyped call.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6842 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6843 +(define_expand "untyped_call"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6844 + [(parallel [(call (match_operand 0 "" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6845 + (const_int 0))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6846 + (match_operand 1 "" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6847 + (match_operand 2 "" "")])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6848 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6849 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6850 + int i;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6851 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6852 + emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6853 + for (i=0; i < XVECLEN (operands[2], 0); i++)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6854 + {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6855 + rtx set = XVECEXP (operands[2], 0, i);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6856 + emit_move_insn (SET_DEST (set), SET_SRC (set));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6857 + }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6858 + emit_insn (gen_blockage ());
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6859 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6860 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6861 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6862 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6863 +(define_expand "sibcall"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6864 + [(parallel
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6865 + [(call (match_operand:HI 0 "memory_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6866 + (match_operand:HI 1 "immediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6867 + (use (reg:HI HARD_PC_REGNUM))])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6868 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6869 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6870 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6871 +(define_insn "*sibcall_1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6872 + [(parallel
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6873 + [(call (match_operand:HI 0 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6874 + (match_operand:HI 1 "immediate_operand" "i"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6875 + (use (reg:HI HARD_PC_REGNUM))])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6876 + "SIBLING_CALL_P(insn)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6877 + "jmp\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6878 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6879 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6880 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6881 +(define_expand "sibcall_value"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6882 + [(parallel
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6883 + [(set (match_operand 0 "" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6884 + (call (match_operand:HI 1 "memory_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6885 + (match_operand:HI 2 "immediate_operand" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6886 + (use (reg:HI HARD_PC_REGNUM))])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6887 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6888 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6889 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6890 +(define_insn "*sibcall_value_1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6891 + [(parallel
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6892 + [(set (match_operand 0 "" "=gz")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6893 + (call (match_operand:HI 1 "memory_operand" "m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6894 + (match_operand:HI 2 "immediate_operand" "i")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6895 + (use (reg:HI HARD_PC_REGNUM))])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6896 + "SIBLING_CALL_P(insn)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6897 + "jmp\t%1"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6898 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6899 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6900 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6901 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6902 +;;- Function Entry and Exit
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6903 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6904 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6905 +;; On entry to a function, the stack frame looks as follows:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6906 +;; - return address (pushed by the caller)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6907 +;; - saved registers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6908 +;; - local variable storage
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6909 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6910 +;; If the function does not modify the stack after that, then
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6911 +;; any of these can be accessed directly as an offset from
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6912 +;; STACK_POINTER_REGNUM. Otherwise, a frame pointer is required.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6913 +;; In that case, the prologue must also initialize HARD_FRAME_POINTER_REGNUM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6914 +;; and all references to the stack frame will use that as a base instead.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6915 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6916 +(define_expand "prologue"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6917 + [(const_int 0)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6918 + "prologue_epilogue_required ()"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6919 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6920 + emit_prologue_insns ();
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6921 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6922 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6923 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6924 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6925 +;; The function epilogue does exactly the reverse of the prologue,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6926 +;; deallocating local variable space, restoring saved registers,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6927 +;; and returning.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6928 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6929 +;; For the 6809, the return may be 'rti' if the function was
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6930 +;; declared as an interrupt function, but is normally 'rts'.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6931 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6932 +;; Also, as an optimization, the register restore and the 'rts'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6933 +;; can be combined into a single instruction, by adding 'PC' to the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6934 +;; list of registers to be restored. This is only done if there are
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6935 +;; any saved registers, as 'rts' is more efficient by itself.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6936 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6937 +(define_expand "epilogue"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6938 + [(const_int 0)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6939 + "prologue_epilogue_required ()"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6940 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6941 + emit_epilogue_insns (false);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6942 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6943 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6944 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6945 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6946 +(define_expand "sibcall_epilogue"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6947 + [(const_int 0)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6948 + "prologue_epilogue_required ()"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6949 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6950 + emit_epilogue_insns (true);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6951 + DONE;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6952 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6953 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6954 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6955 +;; The RTS instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6956 +(define_insn "return_rts"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6957 + [(return)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6958 + (use (reg:HI HARD_PC_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6959 + "!m6809_current_function_has_type_attr_p (\"interrupt\")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6960 + && m6809_get_live_regs () == 0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6961 + "rts"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6962 + [(set_attr "length" "1")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6963 + (set (attr "cycles") (const_int RTS_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6964 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6965 +(define_insn "return_puls_pc"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6966 + [(return)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6967 + (use (reg:HI HARD_PC_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6968 + "!m6809_current_function_has_type_attr_p (\"interrupt\")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6969 + && m6809_get_live_regs () != 0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6970 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6971 + [(set_attr "length" "1")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6972 + (set (attr "cycles") (const_int RTS_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6973 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6974 +;; The RTI instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6975 +(define_insn "return_rti"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6976 + [(return)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6977 + (use (reg:HI HARD_PC_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6978 + "m6809_current_function_has_type_attr_p (\"interrupt\")"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6979 + "rti"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6980 + [(set_attr "length" "1")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6981 + (set (attr "cycles") (const_int RTI_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6982 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6983 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6984 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6985 +;;- Unspecified instructions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6986 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6987 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6988 +;; An instruction that has the effect of an unspec_volatile, but
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6989 +;; which doesn't require emitting any assembly code.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6990 +(define_insn "blockage"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6991 + [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6992 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6993 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6994 + [(set_attr "length" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6995 + (set (attr "cycles") (const_int 0))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6996 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6997 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6998 +;; Say how to push multiple registers onto the stack, using
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
6999 +;; the 6809 'pshs' instruction. The operand is a regset
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7000 +;; specifying which registers to push.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7001 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7002 +;; The operand mode is not given intentionally, so as to allow
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7003 +;; any possible integer mode for the regset.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7004 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7005 +;; See below for a peephole that can combine consecutive push
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7006 +;; instructions that qualify for merging.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7007 +(define_insn "register_push"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7008 + [(use (reg:HI HARD_S_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7009 + (unspec_volatile
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7010 + [(match_operand 0 "immediate_operand" "")] UNSPEC_PUSH_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7011 + (clobber (reg:HI HARD_S_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7012 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7013 + "pshs\t%R0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7014 + [(set_attr "length" "2")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7015 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7016 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7017 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7018 +;; Say how to pop multiple registers from the stack, using
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7019 +;; the 6809 'puls' instruction. The operand is the register
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7020 +;; bitset value.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7021 +(define_insn "register_pop"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7022 + [(use (reg:HI HARD_S_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7023 + (unspec_volatile
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7024 + [(match_operand 0 "immediate_operand" "")] UNSPEC_POP_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7025 + (clobber (reg:HI HARD_S_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7026 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7027 + "puls\t%R0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7028 + [(set_attr "length" "2")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7029 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7030 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7031 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7032 +(define_insn "m6809_swi"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7033 + [(unspec_volatile
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7034 + [(match_operand:QI 0 "immediate_operand" "I,n")] UNSPEC_SWI)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7035 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7036 + "@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7037 + swi
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7038 + swi%c0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7039 + [(set_attr "length" "1,2")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7040 + (set (attr "cycles") (const_int SWI_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7041 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7042 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7043 +;; Generate the CWAI instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7044 +(define_insn "m6809_cwai"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7045 + [(unspec_volatile
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7046 + [(match_operand:QI 0 "immediate_operand" "")] UNSPEC_CWAI)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7047 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7048 + "cwai\t%0"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7049 + [(set_attr "length" "2")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7050 + (set (attr "cycles") (const_int CWAI_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7051 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7052 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7053 +;; Generate the SYNC instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7054 +(define_insn "m6809_sync"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7055 + [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7056 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7057 + "sync"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7058 + [(set_attr "length" "1")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7059 + (set (attr "cycles") (const_int SYNC_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7060 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7061 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7062 +;; Generate the NOP instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7063 +(define_insn "nop"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7064 + [(const_int 0)]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7065 + ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7066 + "nop"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7067 + [(set_attr "length" "1")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7068 + (set (attr "cycles") (const_int NOP_CYCLES))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7069 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7070 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7071 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7072 +;;- Peepholes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7073 +;;--------------------------------------------------------------------
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7074 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7075 +;;; Each peephole has an ID that is used for debugging.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7076 +;;; Each peephole condition is bracketed by calls to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7077 +;;; m6809_match_peephole2() also for debugging.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7078 +(define_constants [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7079 + (PEEP_END 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7080 + (PEEP_COND 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7081 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7082 + (PEEP_STACK_STORE_INC 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7083 + (PEEP_STACK_CLEAR_INC 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7084 + (PEEP_LSRB_ADCB 2)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7085 + (PEEP_ABX 3)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7086 + (PEEP_ABX2 4)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7087 + (PEEP_INDEXED_INC 5)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7088 + (PEEP_MEM_DEC 6)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7089 + (PEEP_MEM_INC 7)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7090 + (PEEP_MEM_DEC_CMP 8)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7091 + (PEEP_PUSH2 9)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7092 + (PEEP_STORE_IMPLIES_CC 10)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7093 + (PEEP_DEC_IMPLIES_CC 11)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7094 + (PEEP_LEAB 12)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7095 + (PEEP_LDX_INDIRECT 13)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7096 + (PEEP_POP_JUNK 14)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7097 +])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7098 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7099 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7100 +;;; Optimize 'leas -1,s' followed by 'stb ,s'. This can happen if the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7101 +;;; function prologue needs to allocate stack space and 'b' is placed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7102 +;;; into that local right away. Combine the stack allocation with the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7103 +;;; store using preincrement mode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7104 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7105 + [(set (reg:HI HARD_S_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7106 + (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7107 + (set (mem:QI (reg:HI HARD_S_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7108 + (match_operand:QI 0 "register_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7109 + "m6809_match_peephole2 (PEEP_STACK_STORE_INC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7110 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7111 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7112 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7113 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7114 +;;; Same as above, but for a 'clr ,s' that follows the prologue.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7115 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7116 + [(set (reg:HI HARD_S_REGNUM) (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7117 + (set (mem:QI (reg:HI HARD_S_REGNUM)) (const_int 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7118 + "m6809_match_peephole2 (PEEP_STACK_CLEAR_INC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7119 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (const_int 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7120 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7121 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7122 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7123 +;;; Merge two consecutive push instructions into a single register_push.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7124 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7125 + [(set (match_operand 0 "push_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7126 + (match_operand 1 "register_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7127 + (set (match_operand 2 "push_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7128 + (match_operand 3 "register_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7129 + "m6809_match_peephole2 (PEEP_PUSH2, PEEP_COND)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7130 + && reload_completed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7131 + && GET_MODE (operands[1]) == GET_MODE (operands[3])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7132 + && m6809_can_merge_pushpop_p (UNSPEC_PUSH_RS, 1 << REGNO (operands[1]), 1 << REGNO (operands[3]))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7133 + && m6809_match_peephole2 (PEEP_PUSH2, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7134 + [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7135 + (use (reg:HI HARD_S_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7136 + (unspec_volatile [(match_dup 4)] UNSPEC_PUSH_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7137 + (clobber (reg:HI HARD_S_REGNUM))])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7138 + (use (match_dup 1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7139 + (use (match_dup 3))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7140 +{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7141 + operands[4] = gen_rtx_CONST_INT (QImode,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7142 + (1 << REGNO (operands[1])) | (1 << REGNO (operands[3])));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7143 +})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7144 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7145 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7146 +;;; Convert 'stX ,--s' into a push instruction. Use the regset
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7147 +;;; notation, so that it may be combined with an adjacent regset.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7148 +;;; TBD - this doesn't compile some code cleanly.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7149 +;(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7150 +; [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7151 +; (reg:HI HARD_X_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7152 +; "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7153 +; [(parallel [
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7154 +; (use (reg:HI HARD_S_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7155 +; (unspec_volatile [(match_dup 0)] UNSPEC_PUSH_RS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7156 +; (clobber (reg:HI HARD_S_REGNUM))])]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7157 +;{
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7158 +; operands[0] = gen_rtx_CONST_INT (HImode, X_REGBIT);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7159 +;})
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7160 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7161 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7162 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7163 +;;; q = (q+1)/2 can be optimized as "lsrb; adcb". This also
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7164 +;;; won't overflow when q=0xFF.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7165 +;;; TODO : this form isn't accounting for promotion when
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7166 +;;; using 16-bit ints.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7167 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7168 +(define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7169 + [(set (reg:QI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7170 + (lshiftrt:QI (plus:HI (match_dup 0) (const_int 1)) (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7171 + "m6809_match_peephole2 (PEEP_LSRB_ADCB, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7172 + "lsrb\;adcb\t#0; peephole"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7173 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7174 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7175 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7176 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7177 +;; Optimize the case of following a register store with a test
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7178 +;; of reg or mem just moved.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7179 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7180 +(define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7181 + [(set (match_operand:HI 0 "memory_operand" "=m")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7182 + (match_operand:HI 1 "register_operand" "r"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7183 + (set (cc0) (match_operand:HI 2 "general_operand" "g"))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7184 + "m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_COND)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7185 + && (operands[2] == operands[0] || operands[2] == operands[1])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7186 + && m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7187 + "st%1\t%0\t;movhi: R:%1 -> %0 w/ implied test of %2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7188 + [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7189 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7190 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7191 +;; Optimize a pair of SET instructions in which the second insn
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7192 +;; is the reverse of the first one. I.e.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7193 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7194 +;; A = B
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7195 +;; ----> A = B
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7196 +;; B = A
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7197 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7198 +;; The second insn is redundant. Define two patterns, one for QI, one for HI.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7199 +;; But don't do this if either is a VOLATILE MEM.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7200 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7201 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7202 + (match_operand:HI 1 "nonimmediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7203 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7204 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7205 + [(set (match_dup 0) (match_dup 1))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7206 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7207 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7208 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7209 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7210 + (match_operand:QI 1 "nonimmediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7211 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7212 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7213 + [(set (match_dup 0) (match_dup 1))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7214 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7215 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7216 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7217 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7218 +;; Optimize the sum of an 8-bit and 16-bit using the 'abx' instruction
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7219 +;; if B and X can be used. Two patterns are provided to catch both
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7220 +;; X=X+D and X=D+X.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7221 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7222 +(define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7223 + [(set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7224 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7225 + (set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7226 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7227 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7228 + "abx"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7229 + [(set_attr "length" "1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7230 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7231 +(define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7232 + [(set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7233 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7234 + (set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7235 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7236 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7237 + "abx"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7238 + [(set_attr "length" "1")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7239 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7240 +;;; Likewise, handle when B is scaled by 2 prior to the add.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7241 +;;; Instead of shifting B in 4 cycles, just do the ABX a second
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7242 +;;; time, in only 3 cycles.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7243 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7244 +(define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7245 + [(set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7246 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7247 + (set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7248 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7249 + (set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7250 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7251 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7252 + "abx\;abx"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7253 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7254 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7255 +(define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7256 + [(set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7257 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7258 + (set (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7259 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7260 + (set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7261 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7262 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7263 + "abx\;abx"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7264 + [(set_attr "length" "2")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7265 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7266 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7267 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7268 +;; Work around a compiler bug that generates bad code when copying
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7269 +;; between 32-bit memory addresses after a libcall. The problem seen is
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7270 +;; that the source is MEM (REG X), but X is used as the reload register.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7271 +;; The second half of the copy therefore fails.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7272 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7273 +;; The solution is to switch the reload register to D, since that is guaranteed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7274 +;; not to be in use right after a libcall.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7275 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7276 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7277 + [(set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7278 + (set (match_operand:HI 0 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7279 + (set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7280 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7281 + (set (match_operand:HI 1 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7282 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7283 + [(set (reg:HI HARD_D_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7284 + (set (match_dup 0) (reg:HI HARD_D_REGNUM))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7285 + (set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7286 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7287 + (set (match_dup 1) (reg:HI HARD_X_REGNUM))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7288 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7289 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7290 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7291 +;; Turn "and then test" into a "bit test" operation.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7292 +;; Provide variants for immediate and memory sources
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7293 +;; This is the most used peephople.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7294 +; (define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7295 +; [(set (match_operand:QI 0 "register_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7296 +; (and:QI (match_operand:QI 1 "register_operand" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7297 +; (match_operand:QI 2 "immediate_operand" "i")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7298 +; (set (cc0) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7299 +; ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7300 +; "bit%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7301 +; [(set_attr "length" "3")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7302 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7303 +; (define_peephole
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7304 +; [(set (match_operand:QI 0 "register_operand" "=q")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7305 +; (and:QI (match_operand:QI 1 "register_operand" "0")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7306 +; (match_operand:QI 2 "memory_operand" "m")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7307 +; (set (cc0) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7308 +; ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7309 +; "bit%0\t%2"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7310 +; [(set_attr "length" "4")])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7311 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7312 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7313 +;; Turn a "decrement, then test" sequence into just a "decrement".
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7314 +;; The test can be omitted, since it is implicitly done.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7315 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7316 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7317 + (plus:QI (match_operand:QI 1 "whole_general_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7318 + (match_operand:QI 2 "immediate_operand" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7319 + (set (cc0) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7320 + "m6809_match_peephole2 (PEEP_DEC_IMPLIES_CC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7321 + [(set (match_dup 0) (plus:QI (match_dup 1) (match_dup 2)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7322 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7323 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7324 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7325 +;; Merge an indexed register increment with a previous usage.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7326 +;; This is usually done automatically, but not always
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7327 +;; The 'use' should be optional; in all cases where this has been
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7328 +;; seen, it is required though.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7329 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7330 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7331 + (mem:QI (match_operand:HI 1 "index_register_operand" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7332 + (use (match_dup 0))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7333 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7334 + "m6809_match_peephole2 (PEEP_INDEXED_INC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7335 + [(set (match_dup 0) (mem:QI (post_inc:HI (match_dup 1))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7336 + (use (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7337 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7338 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7339 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7340 +;;; Merge "ldX MEM; ldX ,X" into a single instruction using
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7341 +;;; the indirect mode.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7342 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7343 + [(set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7344 + (mem:HI (match_operand:HI 0 "general_operand" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7345 + (set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7346 + "reload_completed && m6809_match_peephole2 (PEEP_LDX_INDIRECT, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7347 + [(set (reg:HI HARD_X_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7348 + (mem:HI (mem:HI (match_dup 0))))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7349 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7350 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7351 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7352 +;;; Reorder a store followed by a unary operation on that memory
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7353 +;;; so that the unary is performed and then the store. Consider
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7354 +;;; a binary shift operation, which will be decomposed into
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7355 +;;; identical single shifts, also.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7356 +;;; TODO - recognize more than just 'ashift' here.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7357 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7358 + [(set (match_operand:QI 0 "memory_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7359 + (match_operand:QI 1 "register_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7360 + (set (match_dup 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7361 + (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7362 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7363 + [(set (match_dup 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7364 + (ashift:QI (match_dup 1) (match_operand:QI 2 "immediate_operand")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7365 + (set (match_dup 0) (match_dup 1))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7366 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7367 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7368 +;;; Likewise, reorder a unary MEM followed by a load, so that the load
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7369 +;;; is done first, then use the REG instead of the MEM.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7370 +;;;(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7371 +;;; [(set (match_dup 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7372 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7373 +;;; (set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7374 +;;; (match_operand:QI 1 "memory_operand" ""))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7375 +;;; "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7376 +;;; [(set (match_dup 0) (match_dup 1))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7377 +;;; (set (match_dup 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7378 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7379 +;;; "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7380 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7381 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7382 +;;; Replace sex; leaX d,Y with leaX b,Y.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7383 +;;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7384 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7385 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7386 + (set (match_operand:HI 0 "index_register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7387 + (plus:HI (match_operand:HI 1 "index_register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7388 + (reg:HI HARD_D_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7389 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7390 + [(set (match_dup 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7391 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7392 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7393 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7394 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7395 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7396 + (set (match_operand:HI 0 "index_register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7397 + (plus:HI (reg:HI HARD_D_REGNUM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7398 + (match_operand:HI 1 "index_register_operand" "")))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7399 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7400 + [(set (match_dup 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7401 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7402 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7403 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7404 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7405 +;;; Replace ldb; decb; stb; tstb with dec(mem). If the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7406 +;;; register is not needed, then the load will get deleted
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7407 +;;; automatically, but it may be needed for comparisons.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7408 +;;; Same for incb/inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7409 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7410 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7411 + (match_operand:QI 1 "nonimmediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7412 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7413 + (set (match_dup 1) (match_dup 0))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7414 + (set (cc0) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7415 + "m6809_match_peephole2 (PEEP_MEM_DEC_CMP, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7416 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7417 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7418 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7419 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7420 +;;; Replace ldb; decb; stb with dec(mem); ldb. If the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7421 +;;; register is not needed, then the load will get deleted
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7422 +;;; automatically, but it may be needed for comparisons.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7423 +;;; Same for incb/inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7424 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7425 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7426 + (match_operand:QI 1 "nonimmediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7427 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7428 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7429 + "m6809_match_peephole2 (PEEP_MEM_DEC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7430 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7431 + (set (match_dup 0) (match_dup 1))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7432 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7433 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7434 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7435 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7436 + (match_operand:QI 1 "nonimmediate_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7437 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7438 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7439 + "m6809_match_peephole2 (PEEP_MEM_INC, PEEP_END)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7440 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7441 + (set (match_dup 0) (match_dup 1))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7442 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7443 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7444 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7445 +;;; Replace "andb #N; cmpb #N; bhi" with "andb #N", if it can be proven
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7446 +;;; that the branch can never occur because of the limited range of B.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7447 +;;; N must be a power of two for this to make sense. This helps with
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7448 +;;; the default cases of switch statements on a value (x & N).
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7449 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7450 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7451 + (and:QI (match_dup 0) (match_operand:QI 1 "immediate_operand" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7452 + (set (cc0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7453 + (compare (match_dup 0) (match_dup 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7454 + (set (pc) (if_then_else (gtu (cc0) (const_int 0)) (match_operand 2 "" "") (match_operand 3 "" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7455 + ]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7456 + "reload_completed && power_of_two_p (INTVAL (operands[1]) + 1)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7457 + [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7458 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7459 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7460 +;;; Replace ldd <mem>; addd #1; std <mem> with 16-bit increment
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7461 +;;; of the mem, but only if D is dead. Same for 16-bit decrement.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7462 +;;; <mem> must be offsettable for the instruction to match.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7463 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7464 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7465 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int 1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7466 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7467 + "reload_completed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7468 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7469 + && peep2_reg_dead_p (3, operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7470 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7471 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7472 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7473 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7474 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" ""))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7475 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int -1)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7476 + (set (match_dup 1) (match_dup 0))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7477 + "reload_completed
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7478 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7479 + && peep2_reg_dead_p (3, operands[0])"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7480 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int -1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7481 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7482 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7483 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7484 +;;; Replace a load or store using an indexed register, followed by an increment of that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7485 +;;; register, with the combined form using autoincrement.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7486 +(define_peephole2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7487 + [(set (match_operand:QI 0 "register_operand" "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7488 + (mem:QI (match_operand:HI 1 "index_register_operand" "")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7489 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7490 + "reload_completed"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7491 + [(set (match_dup 0) (mem:QI (post_inc (match_dup 1))))]
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7492 + "")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7493 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7494 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7495 +;;- mode:emacs-lisp
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7496 +;;- comment-start: ";;- "
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7497 +;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7498 +;;- eval: (modify-syntax-entry ?[ "(]")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7499 +;;- eval: (modify-syntax-entry ?] ")[")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7500 +;;- eval: (modify-syntax-entry ?{ "(}")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7501 +;;- eval: (modify-syntax-entry ?} "){")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7502 +;-; vim: set ts=2:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7503 +;-; vim: set expandtab:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7504 +;-; vim: set filetype=lisp:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7505 +;;- End:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7506 diff -urN gcc-4.6.1-orig/gcc/config/m6809/m6809.opt gcc-4.6.1/gcc/config/m6809/m6809.opt
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7507 --- gcc-4.6.1-orig/gcc/config/m6809/m6809.opt 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7508 +++ gcc-4.6.1/gcc/config/m6809/m6809.opt 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7509 @@ -0,0 +1,98 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7510 +; Options for the M6809 port of the compiler
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7511 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7512 +; Copyright (C) 2005 Free Software Foundation, Inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7513 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7514 +; This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7515 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7516 +; GCC is free software; you can redistribute it and/or modify it under
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7517 +; the terms of the GNU General Public License as published by the Free
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7518 +; Software Foundation; either version 2, or (at your option) any later
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7519 +; version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7520 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7521 +; GCC is distributed in the hope that it will be useful, but WITHOUT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7522 +; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7523 +; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7524 +; License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7525 +;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7526 +; You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7527 +; along with GCC; see the file COPYING. If not, write to the Free
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7528 +; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7529 +; 02110-1301, USA.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7530 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7531 +margcount
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7532 +Target Mask(ARGCOUNT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7533 +Push argument count
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7534 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7535 +mint8
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7536 +Target RejectNegative Mask(BYTE_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7537 +Use 8-bit integers
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7538 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7539 +mint16
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7540 +Target RejectNegative
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7541 +Use 16-bit integers InverseMask(BYTE_INT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7542 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7543 +mreg-args
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7544 +Target Mask(REG_ARGS)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7545 +Use registers for function arguments
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7546 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7547 +mshort_size
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7548 +Target RejectNegative Mask(SMALL_SIZE_T)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7549 +Use 8-bit size_t
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7550 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7551 +mlong_size
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7552 +Target RejectNegative InverseMask(SMALL_SIZE_T)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7553 +Use 16-bit size_t
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7554 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7555 +mdirect
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7556 +Target Mask(DIRECT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7557 +Enable direct addressing
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7558 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7559 +mwpc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7560 +Target RejectNegative Mask(WPC)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7561 +Enable WPC platform extensions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7562 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7563 +mexperiment
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7564 +Target RejectNegative Mask(EXPERIMENT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7565 +Enable current experimental feature
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7566 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7567 +m6309
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7568 +Target RejectNegative Mask(6309)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7569 +Enable Hitachi 6309 extensions
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7570 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7571 +mcasesi
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7572 +Target RejectNegative Mask(CASESI)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7573 +Enable the casesi pattern
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7574 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7575 +mfar-code-page=
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7576 +Target RejectNegative Joined Var(far_code_page_option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7577 +Sets the far code page value for this compilation unit
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7578 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7579 +mcode-section=
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7580 +Target RejectNegative Joined Var(code_section_ptr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7581 +Sets the name of the section for code
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7582 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7583 +mdata-section=
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7584 +Target RejectNegative Joined Var(data_section_ptr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7585 +Sets the name of the section for initialized data
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7586 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7587 +mbss-section=
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7588 +Target RejectNegative Joined Var(bss_section_ptr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7589 +Sets the name of the section for uninitialized data
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7590 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7591 +mabi_version=
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7592 +Target RejectNegative Joined Var(m6809_abi_version_ptr)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7593 +Sets the calling convention
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7594 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7595 +msoft-reg-count=
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7596 +Target RejectNegative Joined Var(m6809_soft_reg_count)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7597 +Sets the number of soft registers that can be used
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7598 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7599 +mdret
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7600 +Target RejectNegative Mask(DRET)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7601 +Put function call results in D, not X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7602 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7603 +mfar-stack-param
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7604 +Target Mask(FAR_STACK_PARAM)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7605 +Enable stack parameters to a farcall
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7606 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7607 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7608 diff -urN gcc-4.6.1-orig/gcc/config/m6809/m6809-protos.h gcc-4.6.1/gcc/config/m6809/m6809-protos.h
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7609 --- gcc-4.6.1-orig/gcc/config/m6809/m6809-protos.h 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7610 +++ gcc-4.6.1/gcc/config/m6809/m6809-protos.h 2011-09-17 17:26:19.227644879 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7611 @@ -0,0 +1,94 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7612 +/* GCC for 6809 : machine-specific function prototypes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7613 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7614 +This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7615 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7616 +GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7617 +it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7618 +the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7619 +any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7620 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7621 +GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7622 +but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7623 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7624 +GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7625 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7626 +You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7627 +along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7628 +<http://www.gnu.org/licenses/>. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7629 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7630 +#ifndef __M6809_PROTOS_H__
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7631 +#define __M6809_PROTOS_H__
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7632 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7633 +void print_options (FILE *file);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7634 +void m6809_cpu_cpp_builtins (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7635 +void m6809_override_options (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7636 +void m6809_init_builtins (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7637 +unsigned int m6809_get_live_regs (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7638 +const char * m6809_get_regs_printable (unsigned int regs);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7639 +unsigned int m6809_get_regs_size (unsigned int regs);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7640 +int m6809_function_has_type_attr_p (tree decl, const char *);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7641 +int m6809_current_function_has_type_attr_p (const char *);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7642 +int prologue_epilogue_required (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7643 +int noreturn_functionp (rtx x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7644 +void output_function_prologue (FILE *file, int size);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7645 +void output_function_epilogue (FILE *file, int size);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7646 +int check_float_value (enum machine_mode mode, double *d, int overflow);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7647 +void m6809_asm_named_section (const char *name, unsigned int flags, tree decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7648 +void m6809_asm_file_start (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7649 +void m6809_output_ascii (FILE *fp, const char *str, unsigned long size);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7650 +void m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7651 +void m6809_reorg (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7652 +int m6809_current_function_is_void (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7653 +int m6809_can_merge_pushpop_p (int op, int regs1, int regs2);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7654 +int m6809_function_value_regno_p (unsigned int regno);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7655 +void emit_prologue_insns (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7656 +void emit_epilogue_insns (bool);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7657 +void m6809_conditional_register_usage (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7658 +void m6809_output_quoted_string (FILE *asm_file, const char *string);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7659 +int m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7660 +int m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7661 +int power_of_two_p (unsigned int n);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7662 +void m6809_do_casesi (rtx index, rtx lower_bound, rtx range, rtx table_label, rtx default_label);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7663 +void m6809_output_addsi3 (int rtx_code, rtx *operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7664 +rtx m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7665 +void expand_constant_shift (int code, rtx dst, rtx src, rtx count);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7666 +int m6809_single_operand_operator (rtx exp);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7667 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7668 +#ifdef TREE_CODE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7669 +int m6809_init_cumulative_args (CUMULATIVE_ARGS cum, tree fntype, rtx libname);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7670 +#endif /* TREE_CODE */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7671 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7672 +#ifdef RTX_CODE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7673 +void print_direct_prefix (FILE *file, rtx addr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7674 +void print_operand (FILE *file, rtx x, int code);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7675 +void print_operand_address (FILE *file, rtx addr);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7676 +void notice_update_cc (rtx exp, rtx insn);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7677 +enum reg_class m6809_preferred_reload_class (rtx x, enum reg_class regclass);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7678 +rtx gen_rtx_const_high (rtx r);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7679 +rtx gen_rtx_const_low (rtx r);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7680 +rtx gen_rtx_register_pushpop (int pop_flag, int regs);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7681 +void emit_libcall_insns (enum machine_mode mode, const char *name, rtx *operands, int count);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7682 +const char * output_branch_insn (enum rtx_code code, rtx *operands, int length);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7683 +void output_far_call_insn (rtx *operands, int has_return);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7684 +void m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7685 +rtx m6809_expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7686 +const char * far_functionp (rtx x);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7687 +rtx m6809_function_value (const tree valtype, const tree func);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7688 +void m6809_output_shift_insn (int rtx_code, rtx *operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7689 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7690 +const char * m6809_get_decl_bank (tree decl);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7691 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7692 +rtx m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7693 +const char * far_function_type_p (tree type);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7694 +void m6809_asm_trampoline_template(FILE *f);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7695 +bool m6809_frame_pointer_required (void);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7696 +int m6809_can_eliminate (int from, int to);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7697 +int m6809_initial_elimination_offset (int from, int to);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7698 +void m6809_emit_move_insn (rtx dst, rtx src);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7699 +void m6809_split_shift (enum rtx_code code, rtx *operands);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7700 +bool m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7701 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7702 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7703 +#endif /* RTX_CODE */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7704 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7705 +#endif /* __M6809_PROTOS_H__ */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7706 diff -urN gcc-4.6.1-orig/gcc/config/m6809/predicates.md gcc-4.6.1/gcc/config/m6809/predicates.md
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7707 --- gcc-4.6.1-orig/gcc/config/m6809/predicates.md 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7708 +++ gcc-4.6.1/gcc/config/m6809/predicates.md 2011-09-18 15:09:37.057653095 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7709 @@ -0,0 +1,78 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7710 +;; Predicate definitions for Motorola 6809
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7711 +;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7712 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7713 +;; This file is part of GCC.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7714 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7715 +;; GCC is free software; you can redistribute it and/or modify
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7716 +;; it under the terms of the GNU General Public License as published by
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7717 +;; the Free Software Foundation; either version 3, or (at your option)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7718 +;; any later version.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7719 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7720 +;; GCC is distributed in the hope that it will be useful,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7721 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7722 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7723 +;; GNU General Public License for more details.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7724 +;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7725 +;; You should have received a copy of the GNU General Public License
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7726 +;; along with GCC; see the file COPYING3. If not see
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7727 +;; <http://www.gnu.org/licenses/>.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7728 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7729 +;; whole_register_operand is like register_operand, but it
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7730 +;; does not allow SUBREGs.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7731 +(define_predicate "whole_register_operand"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7732 + (and (match_code "reg")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7733 + (match_operand 0 "register_operand")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7734 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7735 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7736 +;; A predicate that matches any index register. This can be used in nameless
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7737 +;; patterns and peepholes which need a 16-bit reg, but not D.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7738 +(define_predicate "index_register_operand"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7739 + (and (match_code "reg")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7740 + (match_test "REGNO (op) == HARD_X_REGNUM || REGNO (op) == HARD_Y_REGNUM || REGNO (op) == HARD_U_REGNUM")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7741 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7742 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7743 +;; match only X
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7744 +(define_predicate "register_operand_x"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7745 + (and (match_code "reg")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7746 + (match_test "REGNO (op) == HARD_X_REGNUM")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7747 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7748 +;; match only D
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7749 +(define_predicate "register_operand_d"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7750 + (and (match_code "reg")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7751 + (match_test "REGNO (op) == HARD_D_REGNUM")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7752 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7753 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7754 +;; Likwise, a replacement for general_operand which excludes
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7755 +;; SUBREGs.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7756 +(define_predicate "whole_general_operand"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7757 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7758 + (match_operand 0 "general_operand")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7759 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7760 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7761 +(define_predicate "add_general_operand"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7762 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7763 + (match_operand 0 "general_operand")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7764 + (match_test "REGNO (op) != SOFT_AP_REGNUM")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7765 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7766 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7767 +(define_predicate "shift_count_operand"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7768 + (and (match_code "const_int")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7769 + (and (match_operand 0 "const_int_operand")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7770 + (match_test "INTVAL (op) == 1 || INTVAL (op) == 8"))))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7771 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7772 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7773 +;; A predicate that matches any bitwise logical operator. This
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7774 +;; allows for a single RTL pattern to be used for multiple operations.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7775 +(define_predicate "logical_bit_operator"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7776 + (ior (match_code "and") (match_code "ior") (match_code "xor")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7777 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7778 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7779 +;; A predicate that matches any shift or rotate operator. This
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7780 +;; allows for a single RTL pattern to be used for multiple operations.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7781 +(define_predicate "shift_rotate_operator"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7782 + (ior (match_code "ashift") (match_code "ashiftrt") (match_code "lshiftrt")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7783 + (match_code "rotate") (match_code "rotatert")))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7784 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7785 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7786 +(define_predicate "symbolic_operand" (match_code "symbol_ref"))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7787 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7788 diff -urN gcc-4.6.1-orig/gcc/config/m6809/t-coco gcc-4.6.1/gcc/config/m6809/t-coco
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7789 --- gcc-4.6.1-orig/gcc/config/m6809/t-coco 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7790 +++ gcc-4.6.1/gcc/config/m6809/t-coco 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7791 @@ -0,0 +1,6 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7792 +# For a few minor differences in code generation on the CoCo...
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7793 +T_CFLAGS = -DTARGET_COCO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7794 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7795 +# For doing the startup differently on the CoCo...
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7796 +CRT0STUFF_T_CFLAGS += -Wa,--globalize-symbols -DTARGET_COCO
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7797 +# vim: set filetype=make:
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7798 diff -urN gcc-4.6.1-orig/gcc/config/m6809/t-m6809 gcc-4.6.1/gcc/config/m6809/t-m6809
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7799 --- gcc-4.6.1-orig/gcc/config/m6809/t-m6809 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7800 +++ gcc-4.6.1/gcc/config/m6809/t-m6809 2011-09-17 21:38:35.437646470 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7801 @@ -0,0 +1,64 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7802 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7803 +# ranlib doesn't exist, so define it to 'true' to make it a no-op
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7804 +RANLIB_FOR_TARGET = true
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7805 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7806 +# Stubs for libgcc defined by m6809 are here
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7807 +LIB1ASMSRC = m6809/libgcc1.s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7808 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7809 +# Here are the functions that are implemented within libgcc1.s
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7810 +LIB1ASMFUNCS = _mulhi3 _divhi3 _modhi3 _udivhi3 _umodhi3 \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7811 + _euclid _seuclid _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _softregs \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7812 + _ashlhi3 _ashrhi3 _lshrhi3
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7813 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7814 +# Flags to use when building libgcc. IN_GCC does not seem necessary,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7815 +# although the compile breaks without it. -DDF=SF is required to set
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7816 +# the size of "double" to the same as the size of a "float".
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7817 +TARGET_LIBGCC2_CFLAGS =-DIN_GCC -Dinhibit_libc -DDF=SF -DLIBGCC2_HAS_SF_MODE=0 -DLIBGCC2_HAS_DF_MODE=0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7818 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7819 +LIB2ADDEH =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7820 +LIB2ADDEHSTATIC =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7821 +LIB2ADDEHSHARED =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7822 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7823 +LIBGCC2_DEBUG_CFLAGS =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7824 +LIBGCC2_CFLAGS = -Os $(LIBGCC2_INCLUDES) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7825 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7826 +# Multilib information
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7827 +# This creates multiple versions of libgcc.a for each set of incompatible
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7828 +# -mxxx options.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7829 +MULTILIB_OPTIONS = fpic mdret
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7830 +MULTILIB_DIRNAMES =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7831 +MULTILIB_MATCHES =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7832 +MULTILIB_EXCEPTIONS =
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7833 +EXTRA_MULTILIB_PARTS = crt0.o
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7834 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7835 +LIBGCC = stmp-multilib
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7836 +INSTALL_LIBGCC = install-multilib
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7837 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7838 +# We want fine grained libraries, so use the new code to build the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7839 +# floating point emulation libraries.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7840 +FPBIT = fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7841 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7842 +fp-bit.c: $(srcdir)/config/fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7843 + echo '#define FLOAT' > fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7844 + echo '#define FLOAT_ONLY' >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7845 + echo '#define CMPtype HItype' >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7846 + echo '#define SMALL_MACHINE' >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7847 + echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7848 + echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7849 + echo '#endif' >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7850 + echo '#define DI SI' >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7851 + cat $(srcdir)/config/fp-bit.c >> fp-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7852 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7853 +# crt0.o is built from the following source file
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7854 +CRT0_S = $(srcdir)/config/m6809/crt0.S
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7855 +MCRT0_S = $(srcdir)/config/m6809/crt0.S
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7856 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7857 +# Flags to use when building crt0.o
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7858 +CRT0STUFF_T_CFLAGS += -fno-builtin -nostartfiles -nostdlib
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7859 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7860 +# Assemble startup files.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7861 +$(T)crt0.o: $(CRT0_S) $(GCC_PASSES)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7862 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)crt0.o -x assembler-with-cpp $(CRT0_S)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7863 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7864 +$(T)mcrt0.o: $(MCRT0_S) $(GCC_PASSES)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7865 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)mcrt0.o -x assembler-with-cpp $(MCRT0_S)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7866 diff -urN gcc-4.6.1-orig/gcc/config/m6809/t-sim gcc-4.6.1/gcc/config/m6809/t-sim
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7867 --- gcc-4.6.1-orig/gcc/config/m6809/t-sim 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7868 +++ gcc-4.6.1/gcc/config/m6809/t-sim 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7869 @@ -0,0 +1 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7870 +CRT0STUFF_T_CFLAGS += -DTARGET_SIM
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7871 diff -urN gcc-4.6.1-orig/gcc/config.gcc gcc-4.6.1/gcc/config.gcc
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7872 --- gcc-4.6.1-orig/gcc/config.gcc 2011-05-22 14:03:43.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7873 +++ gcc-4.6.1/gcc/config.gcc 2011-09-17 14:08:56.257643636 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7874 @@ -374,6 +374,9 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7875 cpu_type=m32r
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7876 extra_options="${extra_options} g.opt"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7877 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7878 +m6809-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7879 + cpu_type=m6809
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7880 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7881 m68k-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7882 extra_headers=math-68881.h
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7883 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7884 @@ -1689,6 +1692,12 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7885 thread_file='posix'
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7886 fi
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7887 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7888 +m6809-coco-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7889 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-coco"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7890 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7891 +m6809-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7892 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-sim"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7893 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7894 # m68hc11 and m68hc12 share the same machine description.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7895 m68hc11-*-*|m6811-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7896 tm_file="dbxelf.h elfos.h usegas.h newlib-stdint.h m68hc11/m68hc11.h"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7897 diff -urN gcc-4.6.1-orig/gcc/gcse.c gcc-4.6.1/gcc/gcse.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7898 --- gcc-4.6.1-orig/gcc/gcse.c 2011-02-02 23:04:04.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7899 +++ gcc-4.6.1/gcc/gcse.c 2011-09-18 17:25:17.527653952 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7900 @@ -833,7 +833,6 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7901 max_distance = (GCSE_COST_DISTANCE_RATIO * cost) / 10;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7902 if (max_distance == 0)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7903 return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7904 -
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7905 gcc_assert (max_distance > 0);
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7906 }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7907 else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7908 diff -urN gcc-4.6.1-orig/gcc/libgcc2.c gcc-4.6.1/gcc/libgcc2.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7909 --- gcc-4.6.1-orig/gcc/libgcc2.c 2011-01-03 13:52:22.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7910 +++ gcc-4.6.1/gcc/libgcc2.c 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7911 @@ -485,6 +485,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7912 #endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7913
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7914 #ifdef L_bswapsi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7915 +#if MIN_UNITS_PER_WORD > 1
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7916 SItype
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7917 __bswapsi2 (SItype u)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7918 {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7919 @@ -494,7 +495,9 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7920 | (((u) & 0x000000ff) << 24));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7921 }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7922 #endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7923 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7924 #ifdef L_bswapdi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7925 +#if LONG_LONG_TYPE_SIZE > 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7926 DItype
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7927 __bswapdi2 (DItype u)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7928 {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7929 @@ -508,6 +511,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7930 | (((u) & 0x00000000000000ffull) << 56));
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7931 }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7932 #endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7933 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7934 #ifdef L_ffssi2
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7935 #undef int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7936 int
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7937 @@ -1280,7 +1284,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7938 UDWtype
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7939 __fixunssfDI (SFtype a)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7940 {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7941 -#if LIBGCC2_HAS_DF_MODE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7942 +#if LIBGCC2_HAS_DF_MODE || (FLT_MANT_DIG >= W_TYPE_SIZE)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7943 /* Convert the SFtype to a DFtype, because that is surely not going
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7944 to lose any bits. Some day someone else can write a faster version
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7945 that avoids converting to DFtype, and verify it really works right. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7946 @@ -1298,7 +1302,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7947
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7948 /* Assemble result from the two parts. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7949 return ((UDWtype) hi << W_TYPE_SIZE) | lo;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7950 -#elif FLT_MANT_DIG < W_TYPE_SIZE
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7951 +#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7952 if (a < 1)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7953 return 0;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7954 if (a < Wtype_MAXp1_F)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7955 @@ -1334,8 +1338,6 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7956 return (DWtype)counter << shift;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7957 }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7958 return -1;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7959 -#else
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7960 -# error
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7961 #endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7962 }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7963 #endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7964 diff -urN gcc-4.6.1-orig/gcc/longlong.h gcc-4.6.1/gcc/longlong.h
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7965 --- gcc-4.6.1-orig/gcc/longlong.h 2011-06-06 08:34:54.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7966 +++ gcc-4.6.1/gcc/longlong.h 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7967 @@ -527,6 +527,11 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7968 : "cbit")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7969 #endif /* __M32R__ */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7970
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7971 +#if defined (__m6309__) || defined (__m6809__)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7972 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7973 +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7974 +#endif
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7975 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7976 #if defined (__mc68000__) && W_TYPE_SIZE == 32
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7977 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7978 __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7979 diff -urN gcc-4.6.1-orig/gcc/Makefile.in gcc-4.6.1/gcc/Makefile.in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7980 --- gcc-4.6.1-orig/gcc/Makefile.in 2011-05-23 12:12:34.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7981 +++ gcc-4.6.1/gcc/Makefile.in 2011-09-17 14:06:01.197643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7982 @@ -1987,14 +1987,14 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7983
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7984 # Compile the start modules crt0.o and mcrt0.o that are linked with
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7985 # every program
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7986 -$(T)crt0.o: s-crt0 ; @true
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7987 -$(T)mcrt0.o: s-crt0; @true
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7988 +crt0.o: s-crt0 ; @true
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7989 +mcrt0.o: s-crt0; @true
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7990
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7991 s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7992 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7993 - -o $(T)crt0.o -c $(CRT0_S)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7994 + -o crt0.o -c $(CRT0_S)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7995 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7996 - -o $(T)mcrt0.o -c $(MCRT0_S)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7997 + -o mcrt0.o -c $(MCRT0_S)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7998 $(STAMP) s-crt0
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
7999 #
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8000 # Compiling object files from source files.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8001 diff -urN gcc-4.6.1-orig/gcc/opth-gen.awk gcc-4.6.1/gcc/opth-gen.awk
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8002 --- gcc-4.6.1-orig/gcc/opth-gen.awk 2011-02-08 10:41:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8003 +++ gcc-4.6.1/gcc/opth-gen.awk 2011-09-17 14:06:01.227643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8004 @@ -121,7 +121,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8005 END {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8006 print "/* This file is auto-generated by opth-gen.awk. */"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8007 print ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8008 -print "#ifndef OPTIONS_H"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8009 +print "#if !defined(OPTIONS_H) && !defined(IN_LIBGCC2)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8010 print "#define OPTIONS_H"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8011 print ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8012 print "#include \"flag-types.h\""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8013 @@ -432,18 +432,9 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8014
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8015 for (i = 0; i < n_opts; i++) {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8016 opt = opt_args("InverseMask", flags[i])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8017 - if (opt ~ ",") {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8018 - vname = var_name(flags[i])
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8019 - macro = "OPTION_"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8020 - mask = "OPTION_MASK_"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8021 - if (vname == "") {
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8022 - vname = "target_flags"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8023 - macro = "TARGET_"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8024 - mask = "MASK_"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8025 - }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8026 - print "#define " macro nth_arg(1, opt) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8027 - " ((" vname " & " mask nth_arg(0, opt) ") == 0)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8028 - }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8029 + if (opt ~ ",")
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8030 + print "#define TARGET_" nth_arg(1, opt) \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8031 + " ((target_flags & MASK_" nth_arg(0, opt) ") == 0)"
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8032 }
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8033 print ""
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8034
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8035 diff -urN gcc-4.6.1-orig/gcc/tree.h gcc-4.6.1/gcc/tree.h
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8036 --- gcc-4.6.1-orig/gcc/tree.h 2011-06-14 09:28:21.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8037 +++ gcc-4.6.1/gcc/tree.h 2011-09-17 20:28:05.987646026 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8038 @@ -3563,6 +3563,8 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8039 TI_UINTDI_TYPE,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8040 TI_UINTTI_TYPE,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8041
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8042 + TI_UINT8_TYPE,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8043 + TI_UINT16_TYPE,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8044 TI_UINT32_TYPE,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8045 TI_UINT64_TYPE,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8046
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8047 diff -urN gcc-4.6.1-orig/gcc/version.c gcc-4.6.1/gcc/version.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8048 --- gcc-4.6.1-orig/gcc/version.c 2009-04-21 13:03:23.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8049 +++ gcc-4.6.1/gcc/version.c 2011-09-18 19:49:48.437654863 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8050 @@ -21,16 +21,16 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8051
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8052 /* This is the location of the online document giving instructions for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8053 reporting bugs. If you distribute a modified version of GCC,
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8054 - please configure with --with-bugurl pointing to a document giving
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8055 - instructions for reporting bugs to you, not us. (You are of course
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8056 - welcome to forward us bugs reported to you, if you determine that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8057 - they are not bugs in your modifications.) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8058 + please change this to refer to a document giving instructions for
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8059 + reporting bugs to you, not us. (You are of course welcome to
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8060 + forward us bugs reported to you, if you determine that they are
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8061 + not bugs in your modifications.) */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8062
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8063 -const char bug_report_url[] = BUGURL;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8064 +const char bug_report_url[] = "<URL:http://lost.l-w.ca/coco/lwtools/>";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8065
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8066 /* The complete version string, assembled from several pieces.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8067 BASEVER, DATESTAMP, DEVPHASE, and REVISION are defined by the
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8068 Makefile. */
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8069
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8070 -const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8071 +const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION " (gcc6809lw)";
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8072 const char pkgversion_string[] = PKGVERSION;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8073 diff -urN gcc-4.6.1-orig/libgcc/config.host gcc-4.6.1/libgcc/config.host
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8074 --- gcc-4.6.1-orig/libgcc/config.host 2011-03-14 00:06:23.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8075 +++ gcc-4.6.1/libgcc/config.host 2011-09-17 14:06:01.257643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8076 @@ -380,6 +380,8 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8077 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8078 m32rle-*-linux*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8079 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8080 +m6809*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8081 + ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8082 m68hc11-*-*|m6811-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8083 ;;
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8084 m68hc12-*-*|m6812-*-*)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8085 diff -urN gcc-4.6.1-orig/libgcc/fixed-obj.mk gcc-4.6.1/libgcc/fixed-obj.mk
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8086 --- gcc-4.6.1-orig/libgcc/fixed-obj.mk 2007-09-17 16:18:13.000000000 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8087 +++ gcc-4.6.1/libgcc/fixed-obj.mk 2011-09-17 14:06:01.257643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8088 @@ -23,7 +23,7 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8089 #$(info $o$(objext): -DL$($o-label) $($o-opt))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8090
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8091 $o$(objext): %$(objext): $(gcc_srcdir)/config/fixed-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8092 - $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8093 + $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide) -save-temps
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8094
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8095 ifeq ($(enable_shared),yes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8096 $(o)_s$(objext): %_s$(objext): $(gcc_srcdir)/config/fixed-bit.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8097 diff -urN gcc-4.6.1-orig/libgcc/Makefile.in gcc-4.6.1/libgcc/Makefile.in
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8098 --- gcc-4.6.1-orig/libgcc/Makefile.in 2011-01-25 21:19:58.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8099 +++ gcc-4.6.1/libgcc/Makefile.in 2011-09-17 14:06:01.257643616 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8100 @@ -374,8 +374,8 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8101 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8102 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8103 $(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8104 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8105 - $(vis_hide)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8106 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8107 + $(gcc_compile) -DL$* -c $*.c $(vis_hide) -save-temps
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8108 libgcc-objects += $(lib2funcs-o)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8109
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8110 ifeq ($(enable_shared),yes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8111 @@ -410,8 +410,9 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8112 # Build LIB2_DIVMOD_FUNCS.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8113 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8114 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8115 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8116 - -fexceptions -fnon-call-exceptions $(vis_hide)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8117 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8118 + $(gcc_compile) -DL$* -c $*.c \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8119 + -fexceptions -fnon-call-exceptions $(vis_hide) -save-temps
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8120 libgcc-objects += $(lib2-divmod-o)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8121
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8122 ifeq ($(enable_shared),yes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8123 @@ -443,7 +444,8 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8124 ifneq ($(FPBIT),)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8125 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8126 $(fpbit-o): %$(objext): $(FPBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8127 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8128 + ln -sf $(FPBIT) $*.c && \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8129 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8130 libgcc-objects += $(fpbit-o)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8131
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8132 ifeq ($(enable_shared),yes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8133 @@ -458,7 +460,8 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8134 ifneq ($(DPBIT),)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8135 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8136 $(dpbit-o): %$(objext): $(DPBIT)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8137 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8138 + ln -sf $(DPBIT) $*.c && \
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8139 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8140 libgcc-objects += $(dpbit-o)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8141
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8142 ifeq ($(enable_shared),yes)
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8143 diff -urN gcc-4.6.1-orig/README.LW gcc-4.6.1/README.LW
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8144 --- gcc-4.6.1-orig/README.LW 1969-12-31 17:00:00.000000000 -0700
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8145 +++ gcc-4.6.1/README.LW 2011-09-18 19:44:52.457654831 -0600
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8146 @@ -0,0 +1,14 @@
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8147 +This is a port of gcc6809 which is designed to work with the lwtools
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8148 +cross-assembler and linker package. You will need several scripts from that
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8149 +package, available at http://lost.l-w.ca/coco/lwtools/, in order to use
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8150 +this. Instructions for building are present in the lwtools package.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8151 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8152 +This work is based extensively on the gcc6809 4.3.4-3 release by Brian
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8153 +Dominy (brian@oddchange.com) with some significant renovations to make it
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8154 +work with gcc 4.6.1.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8155 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8156 +There is no guarantee that it will work for any particular purpose you
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8157 +choose to put it to.
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8158 +
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8159 +If you run into any problems, contact William Astle (lost@l-w.ca). DO NOT
e0cc66fd0551 Added gcc6809lw patch to extras
lost@l-w.ca
parents:
diff changeset
8160 +contact the main GCC developers!