annotate extra/gcc6809lw-4.6.4-9.patch @ 583:000381ee2d5c default tip

Guard against single operand multiplication when detecting like terms This *shouldn't* happen, but it apparently does in some pathological cases so guard against a single operand multiplication to prevent a crash.
author William Astle <lost@l-w.ca>
date Mon, 04 Nov 2024 23:48:23 -0700
parents 639d19f5fb8e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
447
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1 diff -urN gcc-4.6.4-clean/config.sub gcc-4.6.4/config.sub
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2 --- gcc-4.6.4-clean/config.sub 2010-05-25 07:22:07.000000000 -0600
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3 +++ gcc-4.6.4/config.sub 2017-11-28 21:12:11.136911706 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4 @@ -313,7 +313,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5 c6x)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6 basic_machine=tic6x-unknown
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8 - m6811 | m68hc11 | m6812 | m68hc12 | picochip)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
9 + m6809 | m6811 | m68hc11 | m6812 | m68hc12 | picochip)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
10 # Motorola 68HC11/12.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
11 basic_machine=$basic_machine-unknown
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
12 os=-none
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
13 @@ -354,7 +354,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
14 | i*86-* | i860-* | i960-* | ia64-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
15 | ip2k-* | iq2000-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
16 | lm32-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
17 - | m32c-* | m32r-* | m32rle-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
18 + | m32c-* | m32r-* | m32rle-* | m6809-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
19 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
20 | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
21 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
22 @@ -509,6 +509,10 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
23 basic_machine=arm-unknown
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
24 os=-cegcc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
25 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
26 + coco)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
27 + basic_machine=coco
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
28 + os=-none
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
29 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
30 convex-c1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
31 basic_machine=c1-convex
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
32 os=-bsd
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
33 diff -urN gcc-4.6.4-clean/configure gcc-4.6.4/configure
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
34 --- gcc-4.6.4-clean/configure 2011-12-18 03:03:44.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
35 +++ gcc-4.6.4/configure 2017-11-28 21:12:11.136911706 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
36 @@ -3439,6 +3439,9 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
37 m32r-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
38 noconfigdirs="$noconfigdirs ${libgcj}"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
39 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
40 + m6809*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
41 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
42 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
43 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
44 noconfigdirs="$noconfigdirs target-libstdc++-v3 ${libgcj}"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
45 libgloss_dir=m68hc11
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
46 diff -urN gcc-4.6.4-clean/configure.ac gcc-4.6.4/configure.ac
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
47 --- gcc-4.6.4-clean/configure.ac 2011-11-18 04:45:44.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
48 +++ gcc-4.6.4/configure.ac 2017-11-28 21:12:11.140911685 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
49 @@ -885,6 +885,9 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
50 m32r-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
51 noconfigdirs="$noconfigdirs ${libgcj}"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
52 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
53 + m6809*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
54 + noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 target-libgloss ${libgcj}"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
55 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
56 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
57 noconfigdirs="$noconfigdirs target-libstdc++-v3 ${libgcj}"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
58 libgloss_dir=m68hc11
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
59 diff -urN gcc-4.6.4-clean/gcc/calls.c gcc-4.6.4/gcc/calls.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
60 --- gcc-4.6.4-clean/gcc/calls.c 2012-02-09 10:27:25.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
61 +++ gcc-4.6.4/gcc/calls.c 2017-11-28 21:12:11.140911685 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
62 @@ -2561,7 +2561,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
63 call sequence.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
64 Also do the adjustments before a throwing call, otherwise
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
65 exception handling can fail; PR 19225. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
66 - if (pending_stack_adjust >= 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
67 + if (pending_stack_adjust >= 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
68 || (pending_stack_adjust > 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
69 && (flags & ECF_MAY_BE_ALLOCA))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
70 || (pending_stack_adjust > 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
71 diff -urN gcc-4.6.4-clean/gcc/config/m6809/crt0.S gcc-4.6.4/gcc/config/m6809/crt0.S
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
72 --- gcc-4.6.4-clean/gcc/config/m6809/crt0.S 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
73 +++ gcc-4.6.4/gcc/config/m6809/crt0.S 2017-11-29 17:11:09.221248469 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
74 @@ -0,0 +1,182 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
75 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
76 +;;; Copyright 2006, 2007, 2008, 2009 by Brian Dominy <brian@oddchange.com>
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
77 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
78 +;;; This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
79 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
80 +;;; GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
81 +;;; it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
82 +;;; the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
83 +;;; any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
84 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
85 +;;; GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
86 +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
87 +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
88 +;;; GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
89 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
90 +;;; You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
91 +;;; along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
92 +;;; <http://www.gnu.org/licenses/>.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
93 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
94 + /* Declare external for main() */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
95 + .globl _main
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
96 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
97 +/* The startup is heavily dependent on the type of machine and
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
98 +OS environment that is available at the start point.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
99 +For the most part, the general idea is the same across machines,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
100 +but the implementation is vastly different. This is managed via
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
101 +conditional compiles throughout the startup code for each of the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
102 +supported machines. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
103 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
104 +#if defined(TARGET_COCO) /* CoCo memory map */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
105 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
106 +#define COCO_RAMROM_MODE 0xFFDE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
107 +#define COCO_ALLRAM_MODE 0xFFDF
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
108 +#define COCO_PAGE1 0xFFD5
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
109 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
110 +/* SAM M1 and M0 adjusts the memory size */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
111 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
112 +#define BASIC_WARMSTART_FLAG 0x0071
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
113 +#define BASIC_START 0xA027
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
114 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
115 +#define __STACK_TOP 0x6800
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
116 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
117 +#elif defined(TARGET_PROTO) /* Prototype hardware. Customisation of this section is expected! */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
118 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
119 +#define __STACK_TOP 0x8000
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
120 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
121 +#else /* Simulator (default) memory map */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
122 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
123 +#define SIM_EXIT_REG 0xFF01
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
124 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
125 +#define __STACK_TOP 0xFE00
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
126 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
127 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
128 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
129 + .area .data
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
130 + .area .ctors
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
131 + .area .dtors
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
132 + .area .bss
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
133 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
134 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
135 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
136 + ;;; __exit : Exit point from the program
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
137 + ;;; For simulation, this writes to a special I/O register that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
138 + ;;; the simulator interprets as end-of-program.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
139 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
140 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
141 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
142 + .globl __exit
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
143 +__exit:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
144 +#if defined(TARGET_COCO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
145 + ;; Go back to ROM/RAM mode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
146 + sta COCO_RAMROM_MODE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
147 + clr BASIC_WARMSTART_FLAG
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
148 + jmp BASIC_START
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
149 +#elif defined(TARGET_PROTO) /* Prototype hardware. Customisation of this section is expected! */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
150 + tfr x,d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
151 +__ex@0 bra __ex@0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
152 +#else /* Simulator */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
153 + tfr x,d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
154 + stb SIM_EXIT_REG
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
155 + bra __exit
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
156 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
157 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
158 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
159 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
160 + ;;; __start : Entry point to the program
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
161 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
162 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
163 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
164 + .globl __start
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
165 +__start:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
166 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
167 +#if defined(HAVE_DIRECT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
168 + ;; Initialize the direct page pointer
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
169 + lda #<s_.direct
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
170 + tfr a,dp
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
171 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
172 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
173 +#if defined(TARGET_COCO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
174 + ;; Turn off interrupts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
175 + orcc #(0x10|0x40)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
176 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
177 + ;; Setup All RAM Mode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
178 + sta COCO_ALLRAM_MODE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
179 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
180 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
181 + ;; Initialize the stack. NMI works after this point.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
182 + lds #__STACK_TOP - 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
183 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
184 + ;; Set up hardware; console device, video etc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
185 +#if defined(TARGET_PROTO) /* Prototype hardware. Customisation of this section is expected! */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
186 + lbsr _initialise_hardware
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
187 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
188 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
189 + ;; Call any constructors that may be present
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
190 + ldu #s_.ctors
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
191 +__ctors_loop:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
192 + ldy ,u++
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
193 + cmpy #0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
194 + beq __ctors_done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
195 + jsr ,y
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
196 + bra __ctors_loop
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
197 +__ctors_done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
198 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
199 + ;; Enable interrupts if not on COCO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
200 +#if !defined(TARGET_COCO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
201 + andcc #~(0x10|0x40)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
202 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
203 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
204 + ;; Set up the environment
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
205 + ldu #s_.bss
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
206 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
207 + ;; Set up argc/argv arrays
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
208 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
209 + ;; Call the main function. The exit code will
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
210 + ;; be returned in the X register, unless compiled
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
211 + ;; with -mdret, in which case it comes back in D.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
212 + jsr _main
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
213 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
214 + ;; Call any destructors
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
215 + ldu #s_.dtors
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
216 +__dtors_loop:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
217 + ldy ,u++
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
218 + cmpy #0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
219 + beq __dtors_done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
220 + jsr ,y
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
221 + bra __dtors_loop
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
222 +__dtors_done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
223 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
224 + ;; If main returns, then invoke _*exit() to stop the program
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
225 + ;; The C library doesn't support -mdret yet, so move the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
226 + ;; argument first.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
227 +#if defined(__DRET__)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
228 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
229 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
230 + ;; The newlib exit() is an absolute pig. In calling __call_exitprocs(), it brings with
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
231 + ;; it the kitchen sink, notably malloc() and friends which are *enormous*.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
232 + jmp __exit
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
233 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
234 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
235 + ;;; __crt0_vector : Default handler for interrupts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
236 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
237 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
238 +___crt0_vector:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
239 + ;; The default behavior is to simply ignore all
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
240 + ;; non-reset interrupts.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
241 + rti
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
242 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
243 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
244 + ;;; vector : The interrupt vector table
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
245 + ;;; The linker will ensure that this gets loaded at address 0xFFF0.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
246 + ;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
247 + .area vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
248 +vectors:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
249 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
250 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
251 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
252 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
253 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
254 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
255 + .word ___crt0_vector
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
256 + .word __start
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
257 diff -urN gcc-4.6.4-clean/gcc/config/m6809/libgcc1.s gcc-4.6.4/gcc/config/m6809/libgcc1.s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
258 --- gcc-4.6.4-clean/gcc/config/m6809/libgcc1.s 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
259 +++ gcc-4.6.4/gcc/config/m6809/libgcc1.s 2017-11-28 21:12:11.152911619 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
260 @@ -0,0 +1,511 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
261 +/* libgcc routines for m6809
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
262 + Copyright (C) 2006 Free Software Foundation, Inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
263 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
264 +This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
265 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
266 +GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
267 +it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
268 +the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
269 +any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
270 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
271 +GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
272 +but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
273 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
274 +GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
275 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
276 +You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
277 +along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
278 +<http://www.gnu.org/licenses/>. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
279 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
280 +/* As a special exception, if you link this library with other files,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
281 + some of which are compiled with GCC, to produce an executable,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
282 + this library does not by itself cause the resulting executable
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
283 + to be covered by the GNU General Public License.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
284 + This exception does not however invalidate any other reasons why
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
285 + the executable file might be covered by the GNU General Public License. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
286 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
287 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
288 +#define SIGFPE jmp _abort
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
289 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
290 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
291 + ; Shift functions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
292 + ; On input, D is value to be shifted, and X has shift count.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
293 + ; Result is also in D.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
294 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
295 +#ifdef L_ashlhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
296 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
297 + .globl _ashlhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
298 +_ashlhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
299 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
300 +1$:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
301 + leax -1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
302 + cmpx #-1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
303 + beq 2$
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
304 + aslb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
305 + rola
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
306 + bra 1$
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
307 +2$:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
308 + puls x,pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
309 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
310 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
311 +#ifdef L_ashrhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
312 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
313 + .globl _ashrhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
314 +_ashrhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
315 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
316 +1$:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
317 + leax -1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
318 + cmpx #-1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
319 + beq 2$
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
320 + asra
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
321 + rorb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
322 + bra 1$
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
323 +2$:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
324 + puls x,pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
325 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
326 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
327 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
328 +#ifdef L_lshrhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
329 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
330 + .globl _lshrhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
331 +_lshrhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
332 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
333 +1$:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
334 + leax -1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
335 + cmpx #-1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
336 + beq 2$
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
337 + lsra
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
338 + rorb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
339 + bra 1$
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
340 +2$:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
341 + puls x,pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
342 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
343 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
344 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
345 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
346 +#ifdef L_softregs
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
347 + .area direct
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
348 + .globl m0, m1, m2, m3, m4, m5, m6, m7
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
349 + .globl m8, m9, m10, m11, m12, m13, m14, m15
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
350 +m0: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
351 +m1: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
352 +m2: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
353 +m3: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
354 +m4: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
355 +m5: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
356 +m6: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
357 +m7: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
358 +m8: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
359 +m9: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
360 +m10: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
361 +m11: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
362 +m12: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
363 +m13: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
364 +m14: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
365 +m15: .blkb 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
366 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
367 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
368 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
369 +#ifdef L_ashlsi3_one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
370 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
371 + .globl _ashlsi3_one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
372 +_ashlsi3_one:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
373 + asl 3,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
374 + rol 2,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
375 + rol 1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
376 + rol ,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
377 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
378 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
379 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
380 +#ifdef L_ashlsi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
381 + /* X points to the SImode (source/dest)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
382 + B is the count */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
383 +_ashlsi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
384 + pshs u
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
385 + cmpb #16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
386 + blt try8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
387 + subb #16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
388 + ; Shift by 16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
389 + ldu 2,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
390 + stu ,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
391 +try8:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
392 + cmpb #8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
393 + blt try_rest
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
394 + subb #8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
395 + ; Shift by 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
396 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
397 +try_rest:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
398 + tstb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
399 + beq done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
400 +do_rest:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
401 + ; Shift by 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
402 + asl 3,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
403 + rol 2,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
404 + rol 1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
405 + rol ,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
406 + decb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
407 + bne do_rest
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
408 +done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
409 + puls u,pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
410 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
411 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
412 +#ifdef L_ashrsi3_one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
413 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
414 + .globl _ashlsi3_one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
415 +_ashrsi3_one:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
416 + asr ,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
417 + ror 1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
418 + ror 2,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
419 + ror 3,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
420 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
421 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
422 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
423 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
424 +#ifdef L_lshrsi3_one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
425 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
426 + .globl _lshrsi3_one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
427 +_lshrsi3_one:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
428 + lsr ,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
429 + ror 1,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
430 + ror 2,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
431 + ror 3,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
432 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
433 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
434 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
435 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
436 +#ifdef L_clzsi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
437 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
438 + .globl ___clzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
439 + ; Input: X = 16-bit unsigned integer
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
440 + ; Output: X = number of leading zeros
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
441 + ; This function destroys the value in D.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
442 +___clzhi2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
443 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
444 + ; Find the offset of the leftmost '1' bit in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
445 + ; the left half of the word.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
446 + ;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
447 + ; Bits are numbered in the table with 1 meaning the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
448 + ; LSB and 8 meaning the MSB.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
449 + ;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
450 + ; If nonzero, then clz is 8-a.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
451 + tfr x,d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
452 + ldx #___clz_tab
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
453 + tfr a,b
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
454 + clra
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
455 + ldb d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
456 + bne upper_bit_set
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
457 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
458 +lower_bit_set:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
459 + ; If the upper byte is zero, then check the lower
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
460 + ; half of the word. Return 16-a.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
461 + puls d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
462 + clra
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
463 + ldb d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
464 + negb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
465 + addb #16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
466 + bra done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
467 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
468 +upper_bit_set:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
469 + negb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
470 + addb #8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
471 + puls x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
472 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
473 +done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
474 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
475 + puls pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
476 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
477 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
478 +#ifdef L_clzdi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
479 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
480 + .globl ___clzsi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
481 + ; Input: 32-bit unsigned integer is on the stack, just
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
482 + ; above the return address
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
483 + ; Output: X = number of leading zeros
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
484 +___clzsi2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
485 + ; Check the upper 16-bit word
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
486 + ; If it is not zero, then return clzhi2(X).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
487 + ; A branch can be used instead of a call since no
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
488 + ; postprocessing is needed. Use long branch form
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
489 + ; though since functions may not be near each other.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
490 + ldx 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
491 + lbne ___clzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
492 + ldx 4,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
493 + jsr ___clzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
494 + leax 16,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
495 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
496 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
497 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
498 +#ifdef L_ctzsi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
499 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
500 + .globl ___ctzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
501 + ; Input: X = 16-bit unsigned integer
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
502 + ; Output: X = number of trailing zeros
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
503 + ; F(x) = 15 - clzhi2(X & -x)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
504 + ; This function destroys the value in D.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
505 +___ctzhi2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
506 + tfr x,d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
507 + coma
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
508 + comb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
509 + addd #1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
510 + pshs a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
511 + pshs b
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
512 + tfr x,d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
513 + andb ,s+
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
514 + anda ,s+
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
515 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
516 + jsr ___clzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
517 + tfr x,d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
518 + subd #16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
519 + coma
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
520 + comb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
521 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
522 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
523 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
524 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
525 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
526 +#ifdef L_ctzdi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
527 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
528 + .globl ___ctzsi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
529 + ; Input: 32-bit unsigned integer is on the stack, just
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
530 + ; above the return address
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
531 + ; Output: X = number of leading zeros
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
532 +___ctzsi2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
533 + ; Check the lower 16-bit word
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
534 + ; If it is not zero, then return ctzhi2(X).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
535 + ; A branch can be used instead of a call since no
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
536 + ; postprocessing is needed. Use long branch form
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
537 + ; though since functions may not be near each other.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
538 + ldx 4,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
539 + lbne ___ctzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
540 + ldx 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
541 + jsr ___ctzhi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
542 + leax 16,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
543 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
544 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
545 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
546 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
547 +#ifdef L_mulhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
548 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
549 +;;; ___mulhi3 - signed/unsigned multiply
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
550 +;;; Called by GCC to implement 16x16 multiplication
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
551 +;;; Arguments: Two 16-bit values, one in stack, one in X.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
552 +;;; Result: 16-bit result in X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
553 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
554 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
555 + .globl _mulhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
556 +_mulhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
557 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
558 + lda 5,s ; left msb * right lsb * 256
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
559 + ldb ,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
560 + mul
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
561 + tfr b,a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
562 + clrb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
563 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
564 + ldb 1,s ; left lsb * right msb * 256
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
565 + lda 4,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
566 + mul
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
567 + tfr b,a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
568 + clrb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
569 + leax d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
570 + ldb 1,s ; left lsb * right lsb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
571 + lda 5,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
572 + mul
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
573 + leax d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
574 + puls d,pc ; kill D to remove initial push
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
575 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
576 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
577 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
578 +#ifdef L_divhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
579 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
580 +;;; ___divhi3 - signed division
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
581 +;;; Arguments: Dividend in X, divisor on the stack
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
582 +;;; Returns result in X.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
583 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
584 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
585 + .globl _divhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
586 +_divhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
587 + ldd 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
588 + bne do_div ; check dividend
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
589 + SIGFPE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
590 +do_div:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
591 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
592 + jsr _seuclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
593 + puls x,pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
594 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
595 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
596 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
597 +#ifdef L_modhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
598 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
599 +;;; ___modhi3 - signed modulo
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
600 +;;; Arguments: Dividend in X, divisor on the stack
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
601 +;;; Returns result in X.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
602 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
603 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
604 + .globl _modhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
605 +_modhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
606 + ldd 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
607 + bne do_mod ; check dividend
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
608 + SIGFPE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
609 +do_mod:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
610 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
611 + jsr _seuclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
612 + leas 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
613 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
614 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
615 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
616 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
617 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
618 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
619 +#ifdef L_udivhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
620 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
621 +;;; ___udivhi3 - unsigned division
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
622 +;;; Arguments: Dividend in X, divisor on the stack
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
623 +;;; Returns result in X.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
624 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
625 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
626 + .globl _udivhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
627 +_udivhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
628 + ldd 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
629 + bne do_udiv ; check dividend
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
630 + SIGFPE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
631 +do_udiv:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
632 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
633 + jsr _euclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
634 + puls x,pc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
635 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
636 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
637 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
638 +#ifdef L_umodhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
639 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
640 +;;; ___umodhi3 - unsigned modulo
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
641 +;;; Arguments: Dividend in X, divisor on the stack
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
642 +;;; Returns result in X.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
643 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
644 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
645 + .globl _umodhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
646 +_umodhi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
647 + ldd 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
648 + bne do_umod ; check dividend
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
649 + SIGFPE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
650 +do_umod:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
651 + pshs x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
652 + jsr _euclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
653 + leas 2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
654 + tfr d,x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
655 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
656 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
657 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
658 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
659 +#ifdef L_euclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
660 +; unsigned euclidean division
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
661 +; calling: (left / right)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
662 +; push left
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
663 +; ldd right
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
664 +; jsr _euclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
665 +; quotient on the stack (left)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
666 +; modulus in d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
667 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
668 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
669 + .globl _euclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
670 + left=5
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
671 + right=1 ; word
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
672 + count=0 ; byte
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
673 + CARRY=1 ; alias
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
674 +_euclid:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
675 + leas -3,s ; 2 local variables
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
676 + clr count,s ; prescale divisor
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
677 + inc count,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
678 + tsta
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
679 +presc:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
680 + bmi presc_done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
681 + inc count,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
682 + aslb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
683 + rola
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
684 + bra presc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
685 +presc_done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
686 + std right,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
687 + ldd left,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
688 + clr left,s ; quotient = 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
689 + clr left+1,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
690 +mod1:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
691 + subd right,s ; check subtract
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
692 + bcc mod2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
693 + addd right,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
694 + andcc #~CARRY
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
695 + bra mod3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
696 +mod2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
697 + orcc #CARRY
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
698 +mod3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
699 + rol left+1,s ; roll in carry
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
700 + rol left,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
701 + lsr right,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
702 + ror right+1,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
703 + dec count,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
704 + bne mod1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
705 + leas 3,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
706 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
707 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
708 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
709 +#ifdef L_seuclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
710 +; signed euclidean division
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
711 +; calling: (left / right)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
712 +; push left
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
713 +; ldd right
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
714 +; jsr _seuclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
715 +; quotient on the stack (left)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
716 +; modulus in d
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
717 + .area .text
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
718 + .globl _seuclid
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
719 + left=6
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
720 + right=2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
721 + quot_sign=1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
722 + mod_sign=0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
723 +_seuclid:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
724 + leas -4,s ; 3 local variables
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
725 + std right,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
726 + clr mod_sign,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
727 + clr quot_sign,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
728 + ldd left,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
729 + bge mod_abs
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
730 + inc mod_sign,s ; sign(mod) = sign(left)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
731 + inc quot_sign,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
732 + bsr negd ; abs(left) -> D
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
733 +mod_abs:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
734 + pshs b,a ; push abs(left)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
735 + ldd right+2,s ; all references shifted by 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
736 + bge quot_abs
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
737 + dec quot_sign+2,s ; sign(quot) = sign(left) XOR sign(right)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
738 + bsr negd ; abs(right) -> D
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
739 +quot_abs:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
740 + jsr _euclid ; call (unsigned) euclidean division
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
741 + std right+2,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
742 + puls a,b ; quot -> D
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
743 + tst quot_sign,s ; all references no longer shifted
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
744 + beq quot_done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
745 + bsr negd
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
746 +quot_done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
747 + std left,s ; quot -> left
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
748 + ldd right,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
749 + tst mod_sign,s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
750 + beq mod_done
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
751 + bsr negd
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
752 +mod_done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
753 + leas 4,s ; destroy stack frame
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
754 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
755 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
756 +negd: ; self-explanatory !
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
757 + nega
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
758 + negb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
759 + sbca #0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
760 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
761 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
762 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
763 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
764 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
765 +#ifdef L_pending_addsi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
766 +_addsi3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
767 + rts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
768 +#endif /* L_pending_addsi3 */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
769 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
770 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
771 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
772 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.c gcc-4.6.4/gcc/config/m6809/m6809.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
773 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.c 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
774 +++ gcc-4.6.4/gcc/config/m6809/m6809.c 2017-11-29 17:11:09.221248469 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
775 @@ -0,0 +1,3027 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
776 +/*-------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
777 + FILE: m6809.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
778 +-------------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
779 +/* Subroutines for insn-output.c for MC6809.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
780 + Copyright (C) 1989-2007 Free Software Foundation, Inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
781 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
782 + MC6809 Version by Tom Jones (jones@sal.wisc.edu)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
783 + Space Astronomy Laboratory
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
784 + University of Wisconsin at Madison
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
785 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
786 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
787 + ( msdoerfe@informatik.uni-erlangen.de )
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
788 + also added #pragma interrupt (inspired by gcc-6811)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
789 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
790 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
791 + (ebotcazou@multimania.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
792 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
793 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
794 + (ebotcazou@multimania.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
795 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
796 + major cleanup, improvements, and upgrade to gcc 3.4 by Brian Dominy
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
797 + (brian@oddchange.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
798 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
799 + additional adjustments, etc., for gcc 4.6.1 by William Astle (lost@l-w.ca)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
800 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
801 +This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
802 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
803 +GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
804 +it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
805 +the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
806 +any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
807 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
808 +GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
809 +but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
810 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
811 +GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
812 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
813 +You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
814 +along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
815 +<http://www.gnu.org/licenses/>. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
816 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
817 +#include <string.h>
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
818 +#include <time.h>
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
819 +#include <sys/types.h>
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
820 +#include <sys/timeb.h>
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
821 +#include <stdio.h>
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
822 +#include "config.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
823 +#include "system.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
824 +#include "coretypes.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
825 +#include "tm.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
826 +#include "tree.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
827 +#include "rtl.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
828 +#include "tm_p.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
829 +#include "regs.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
830 +#include "flags.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
831 +#include "hard-reg-set.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
832 +#include "real.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
833 +#include "tree.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
834 +#include "insn-config.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
835 +#include "conditions.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
836 +#include "insn-flags.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
837 +#include "output.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
838 +#include "insn-attr.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
839 +#include "function.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
840 +#include "target.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
841 +#include "target-def.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
842 +#include "expr.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
843 +#include "recog.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
844 +#include "cpplib.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
845 +#include "c-family/c-pragma.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
846 +#include "c-family/c-common.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
847 +#include "toplev.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
848 +#include "optabs.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
849 +#include "version.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
850 +#include "df.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
851 +#include "rtlhooks-def.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
852 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
853 +/* macro to return TRUE if length of operand mode is one byte */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
854 +#define BYTE_MODE(X) ((GET_MODE_SIZE (GET_MODE (X))) == 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
855 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
856 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
857 +/* REAL_REG_P(x) is a true if the rtx 'x' represents a real CPU
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
858 +register and not a fake one that is emulated in software. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
859 +#define REAL_REG_P(x) (REG_P(x) && !M_REG_P(x))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
860 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
861 +/*-------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
862 + Target hooks, moved from target.h
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
863 +-------------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
864 +static void m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
865 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
866 +#undef TARGET_ENCODE_SECTION_INFO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
867 +#define TARGET_ENCODE_SECTION_INFO m6809_encode_section_info
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
868 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
869 +#undef TARGET_ASM_FILE_START
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
870 +#define TARGET_ASM_FILE_START m6809_asm_file_start
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
871 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
872 +#undef TARGET_ASM_ALIGNED_HI_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
873 +#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
874 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
875 +#undef TARGET_ASM_ALIGNED_SI_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
876 +#define TARGET_ASM_ALIGNED_SI_OP NULL
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
877 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
878 +#undef TARGET_ASM_UNALIGNED_HI_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
879 +#define TARGET_ASM_UNALIGNED_HI_OP "\t.word\t"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
880 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
881 +#undef TARGET_ASM_UNALIGNED_SI_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
882 +#define TARGET_ASM_UNALIGNED_SI_OP NULL
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
883 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
884 +#undef TARGET_RTX_COSTS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
885 +#define TARGET_RTX_COSTS m6809_rtx_costs
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
886 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
887 +#undef TARGET_ATTRIBUTE_TABLE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
888 +#define TARGET_ATTRIBUTE_TABLE m6809_attribute_table
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
889 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
890 +#undef TARGET_INIT_BUILTINS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
891 +#define TARGET_INIT_BUILTINS m6809_init_builtins
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
892 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
893 +#undef TARGET_EXPAND_BUILTIN
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
894 +#define TARGET_EXPAND_BUILTIN m6809_expand_builtin
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
895 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
896 +#undef TARGET_DEFAULT_TARGET_FLAGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
897 +#define TARGET_DEFAULT_TARGET_FLAGS (MASK_REG_ARGS | MASK_DIRECT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
898 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
899 +#undef TARGET_FUNCTION_OK_FOR_SIBCALL
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
900 +#define TARGET_FUNCTION_OK_FOR_SIBCALL m6809_function_ok_for_sibcall
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
901 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
902 +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
903 +#define TARGET_ASM_TRAMPOLINE_TEMPLATE m6809_asm_trampoline_template
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
904 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
905 +#undef TARGET_TRAMPOLINE_INIT
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
906 +#define TARGET_TRAMPOLINE_INIT m6809_initialize_trampoline
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
907 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
908 +#undef TARGET_FRAME_POINTER_REQUIRED
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
909 +#define TARGET_FRAME_POINTER_REQUIRED m6809_frame_pointer_required
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
910 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
911 +#undef TARGET_OPTION_OVERRIDE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
912 +#define TARGET_OPTION_OVERRIDE m6809_override_options
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
913 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
914 +/* External variables used */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
915 +extern int reload_completed; /* set in toplev.c */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
916 +extern FILE *asm_out_file;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
917 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
918 +static int last_mem_size; /* operand size (bytes) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
919 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
920 +/* True if the section was recently changed and another .area
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
921 + * directive needs to be output before emitting the next label. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
922 +int section_changed = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
923 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
924 +/* Section names. The defaults here are used until an
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
925 + * __attribute__((section)) is seen that changes it. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
926 +char code_section_op[128] = "\n\t.area\t.text";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
927 +char data_section_op[128] = "\n\t.area\t.data";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
928 +char bss_section_op[128] = "\n\t.area\t.bss";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
929 +const char *code_bank_option = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
930 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
931 +/* TRUE if the direct mode prefix might be valid in this context.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
932 + * This is set by 'print_address' prior to calling output_addr_const,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
933 + * which performs into 'print_direct_prefix' to do the final checks. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
934 +static int check_direct_prefix_flag;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
935 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
936 +/* Nonzero if an address is being printed in a context which does not
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
937 + * permit any PIC modifications to the address */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
938 +static int pic_ok_for_addr_p = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
939 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
940 +/* Current code page. This supports machines which can do bank
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
941 + * switching to allow for more than 64KB of code/data. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
942 +char far_code_page[64];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
943 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
944 +/* Current bank name */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
945 +static char current_bank_name[8] = "-1";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
946 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
947 +/* Default bank name */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
948 +static char default_code_bank_name[8] = "-1";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
949 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
950 +/* Direct memory reserved as soft registers */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
951 +unsigned int m6809_soft_regs = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
952 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
953 +/* ABI version */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
954 +unsigned int m6809_abi_version = M6809_ABI_VERSION_REGS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
955 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
956 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
957 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
958 + * Called after options have been parsed.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
959 + * If overrides have been specified on the command-line, then
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
960 + * these values are copied into the main storage variables.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
961 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
962 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
963 +m6809_override_options (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
964 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
965 + /* Handle -mfar-code-page */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
966 + if (far_code_page_option == 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
967 + far_code_page_option = "__default_code_page";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
968 + strcpy (far_code_page, far_code_page_option);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
969 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
970 + /* Handle -mcode-section, -mdata-section, and -mbss-section */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
971 + if (code_section_ptr != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
972 + sprintf (code_section_op, "\t.area\t%s", code_section_ptr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
973 + if (data_section_ptr != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
974 + sprintf (data_section_op, "\t.area\t%s", data_section_ptr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
975 + if (bss_section_ptr != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
976 + sprintf (bss_section_op, "\t.area\t%s", bss_section_ptr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
977 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
978 + /* Handle -mcode-bank */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
979 + if (code_bank_option != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
980 + sprintf (default_code_bank_name, "%s", code_bank_option);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
981 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
982 + /* Handle -mabi-version or -mno-reg-args */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
983 + if (m6809_abi_version_ptr != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
984 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
985 + if (!strcmp (m6809_abi_version_ptr, "stack"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
986 + m6809_abi_version = M6809_ABI_VERSION_STACK;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
987 + else if (!strcmp (m6809_abi_version_ptr, "regs"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
988 + m6809_abi_version = M6809_ABI_VERSION_REGS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
989 + else if (!strcmp (m6809_abi_version_ptr, "bx"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
990 + m6809_abi_version = M6809_ABI_VERSION_BX;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
991 + else if (!strcmp (m6809_abi_version_ptr, "latest"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
992 + m6809_abi_version = M6809_ABI_VERSION_LATEST;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
993 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
994 + m6809_abi_version = atoi (m6809_abi_version_ptr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
995 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
996 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
997 + /* The older -mno-reg-args option is deprecated, and treated
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
998 + as -mabi=stack. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
999 + if (!TARGET_REG_ARGS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1000 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1001 + warning (WARNING_OPT "-mno-reg-args deprecated; use -mabi=stack instead.");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1002 + m6809_abi_version = M6809_ABI_VERSION_STACK;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1003 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1004 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1005 + /* -fexceptions is unsupported */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1006 + flag_exceptions = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1007 + flag_non_call_exceptions = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1008 + flag_unwind_tables = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1009 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1010 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1011 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1012 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1013 + * Output prefix that directs the assembler to use a direct-mode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1014 + * instruction if globally enabled, address is a symbol, and symbol
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1015 + * has been marked as in direct page. Also, never do this if
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1016 + * using the indirect mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1017 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1018 +print_direct_prefix (FILE * file, rtx addr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1019 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1020 + if (TARGET_DIRECT &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1021 + (GET_CODE (addr) == SYMBOL_REF) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1022 + SYMBOL_REF_FLAG (addr) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1023 + check_direct_prefix_flag)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1024 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1025 + putc ('*', file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1026 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1027 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1028 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1029 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1030 +/** Prints an operand (that is not an address) in assembly from RTL. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1031 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1032 +print_operand (FILE * file, rtx x, int code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1033 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1034 + if (REG_P (x)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1035 + /* gcc currently allocates the entire 16-bit 'd' register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1036 + * even when it only needs an 8-bit value. So here it
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1037 + * is tricked into printing only the lower 8-bit 'b'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1038 + * register into the assembly output.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1039 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1040 + * Eventually gcc should be modified to allocate a/b
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1041 + * independently and this hack can be removed.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1042 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1043 + * Occasionally, we may want to do an operation using
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1044 + * the 'a' register instead of 'b'; use the 'A' code
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1045 + * to specify that.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1046 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1047 + if (code == 'A')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1048 + fputs ("a", file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1049 + else if ((BYTE_MODE (x)) && (REGNO (x) == HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1050 + fputs ("b", file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1051 + else if (M_REG_P (x) && code == 'L')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1052 + /* Soft registers can be treated like memory and accessed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1053 + * at a particular offset. TODO : handle 'W' */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1054 + fputs (reg_names[REGNO (x)+1], file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1055 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1056 + fputs (reg_names[REGNO (x)], file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1057 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1058 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1059 + else if (MEM_P (x)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1060 + last_mem_size = GET_MODE_SIZE (GET_MODE (x));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1061 + if (code == 'L') { /* LSH of word address */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1062 + if (GET_CODE (XEXP (x, 0)) == MEM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1063 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1064 + /* Offseting an indirect addressing mode is not supported */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1065 + error ("expression too complex for 6809 (offset indirect mode)");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1066 + debug_rtx (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1067 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1068 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1069 + x = adjust_address (x, QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1070 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1071 + else if (code == 'M') { /* MSH of word address */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1072 + if (GET_CODE (XEXP (x, 0)) == MEM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1073 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1074 + /* Offseting an indirect addressing mode is not supported */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1075 + error ("expression too complex for 6809 (offset indirect mode)");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1076 + debug_rtx (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1077 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1078 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1079 + x = adjust_address (x, QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1080 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1081 + else if (code == 'W') { /* least significant half of 32-bit */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1082 + x = adjust_address (x, HImode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1083 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1084 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1085 + pic_ok_for_addr_p = (code != 'C');
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1086 + output_address (XEXP (x, 0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1087 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1088 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1089 + else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != DImode) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1090 + union { double d; int i[2]; } u;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1091 + u.i[0] = CONST_DOUBLE_LOW (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1092 + u.i[1] = CONST_DOUBLE_HIGH (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1093 + fprintf (file, "#%#9.9g", u.d);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1094 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1095 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1096 + else if (code == 'R') {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1097 + fprintf (file, "%s",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1098 + m6809_get_regs_printable (INTVAL (x)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1099 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1100 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1101 + else {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1102 + if (code == 'L') { /* LSH of word address */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1103 + x = gen_rtx_CONST_INT (VOIDmode, (INTVAL(x) & 0xff));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1104 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1105 + else if (code == 'M') { /* MSH of word address */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1106 + x = gen_rtx_CONST_INT (VOIDmode, ((INTVAL(x) >> 8) & 0xff));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1107 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1108 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1109 + putc ('#', file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1110 + output_addr_const (file, x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1111 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1112 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1113 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1114 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1115 +/** Prints an address operand to assembler from its RTL representation. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1116 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1117 +print_operand_address (FILE *file, rtx addr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1118 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1119 + register rtx base = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1120 + register rtx offset = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1121 + int regno;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1122 + int indirect_flag = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1123 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1124 + check_direct_prefix_flag = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1125 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1126 + /*** check for indirect addressing ***/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1127 + if (MEM_P (addr)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1128 + last_mem_size = GET_MODE_SIZE (GET_MODE (addr));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1129 + addr = XEXP (addr, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1130 + if (pic_ok_for_addr_p)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1131 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1132 + indirect_flag = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1133 + fprintf (file, "[");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1134 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1135 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1136 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1137 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1138 + switch (GET_CODE (addr)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1139 + case REG:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1140 + regno = REGNO (addr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1141 + fprintf (file, ",%s", reg_names[regno]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1142 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1143 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1144 + case PRE_DEC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1145 + regno = REGNO (XEXP (addr, 0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1146 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1147 + fprintf (file, "%s", reg_names[regno]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1148 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1149 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1150 + case POST_INC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1151 + regno = REGNO (XEXP (addr, 0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1152 + fprintf (file, ",%s", reg_names[regno]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1153 + fputs (((last_mem_size == 1) ? "+" : "++"), file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1154 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1155 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1156 + case PLUS:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1157 + base = XEXP (addr, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1158 + if (MEM_P (base))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1159 + base = XEXP (base, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1160 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1161 + offset = XEXP (addr, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1162 + if (MEM_P (offset))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1163 + offset = XEXP (offset, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1164 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1165 + if ((CONSTANT_ADDRESS_P (base)) && (CONSTANT_ADDRESS_P (offset))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1166 + if (!indirect_flag)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1167 + check_direct_prefix_flag = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1168 + output_addr_const (file, base);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1169 + check_direct_prefix_flag = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1170 + fputs ("+", file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1171 + output_addr_const (file, offset);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1172 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1173 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1174 + else if ((CONSTANT_ADDRESS_P (base)) && (A_REG_P (offset))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1175 + output_addr_const (file, base);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1176 + fprintf (file, ",%s", reg_names[REGNO (offset)]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1177 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1178 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1179 + else if ((CONSTANT_ADDRESS_P (offset)) && (A_REG_P (base))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1180 + output_addr_const (file, offset);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1181 + fprintf (file, ",%s", reg_names[REGNO (base)]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1182 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1183 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1184 + /*** accumulator offset ***/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1185 + else if (((D_REG_P (offset)) || (Q_REG_P (offset)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1186 + && (A_REG_P (base))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1187 + fprintf (file, "%s,%s",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1188 + reg_names[REGNO (offset)], reg_names[REGNO (base)]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1189 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1190 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1191 + else if (((D_REG_P (base)) || (Q_REG_P (base)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1192 + && (A_REG_P (offset))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1193 + fprintf (file, "%s,%s",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1194 + reg_names[REGNO (base)], reg_names[REGNO (offset)]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1195 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1196 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1197 + else if (GET_CODE (base) == PRE_DEC) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1198 + regno = REGNO (XEXP (base, 0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1199 + fputs (((last_mem_size == 1) ? ",-" : ",--"), file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1200 + fprintf (file, "%s", reg_names[regno]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1201 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1202 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1203 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1204 + abort ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1205 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1206 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1207 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1208 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1209 + /* Set this global before calling output_addr_const() */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1210 + if (!indirect_flag)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1211 + check_direct_prefix_flag = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1212 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1213 + /* When printing a SYMBOL_REF in PIC mode, do not print the leading
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1214 + * '#' and follow it by ',pcr' to enable relative addressing. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1215 + if (flag_pic && pic_ok_for_addr_p && GET_CODE (addr) == SYMBOL_REF)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1216 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1217 + ASM_OUTPUT_SYMBOL_REF (file, addr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1218 + fputs (",pcr", file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1219 + pic_ok_for_addr_p = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1220 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1221 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1222 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1223 + output_addr_const (file, addr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1224 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1225 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1226 + check_direct_prefix_flag = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1227 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1228 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1229 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1230 + if (indirect_flag)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1231 + fprintf (file, "]");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1232 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1233 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1234 +/*-------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1235 + Update the CC Status
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1236 +---------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1237 + Set the cc_status for the results of an insn whose pattern is EXP.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1238 + We assume that jumps don't affect the condition codes.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1239 + All else, clobbers the condition codes, by assumption.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1240 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1241 + We assume that ALL add, minus, etc. instructions effect the condition
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1242 + codes.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1243 +-------------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1244 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1245 +notice_update_cc (rtx exp, rtx insn ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1246 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1247 + int src_code;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1248 + int dst_code;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1249 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1250 + /*** recognize SET insn's ***/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1251 + if (GET_CODE (exp) == SET)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1252 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1253 + src_code = GET_CODE (SET_SRC (exp));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1254 + dst_code = GET_CODE (SET_DEST (exp));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1255 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1256 + /* Jumps do not alter the cc's. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1257 + if (SET_DEST (exp) == pc_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1258 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1259 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1260 + /* Moving one register into another register (tfr):
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1261 + Doesn't alter the cc's. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1262 + if (REG_P (SET_DEST (exp)) && (REG_P (SET_SRC (exp))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1263 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1264 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1265 + /* Moving memory into a register (load): Sets cc's. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1266 + if (REG_P (SET_DEST (exp)) && src_code == MEM) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1267 + cc_status.value1 = SET_SRC (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1268 + cc_status.value2 = SET_DEST (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1269 + cc_status.flags |= CC_NO_OVERFLOW;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1270 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1271 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1272 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1273 + /* Moving register into memory (store): Sets cc's. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1274 + if (dst_code == MEM && REG_P (SET_SRC (exp))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1275 + cc_status.value1 = SET_SRC (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1276 + cc_status.value2 = SET_DEST (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1277 + cc_status.flags |= CC_NO_OVERFLOW;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1278 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1279 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1280 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1281 + /* Function calls clobber the cc's. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1282 + else if (GET_CODE (SET_SRC (exp)) == CALL) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1283 + CC_STATUS_INIT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1284 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1285 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1286 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1287 + /* Tests and compares set the cc's in predictable ways. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1288 + else if (SET_DEST (exp) == cc0_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1289 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1290 + cc_status.flags = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1291 + cc_status.value1 = SET_SRC (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1292 + cc_status.value2 = SET_DEST (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1293 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1294 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1295 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1296 + else if (A_REG_P (SET_DEST (exp)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1297 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1298 + CC_STATUS_INIT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1299 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1300 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1301 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1302 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1303 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1304 + /* Certain instructions affect the condition codes. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1305 + switch (src_code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1306 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1307 + case PLUS:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1308 + case MINUS:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1309 + case NEG:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1310 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1311 + /* These instructions set the condition codes,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1312 + * and may modify the V bit. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1313 + cc_status.flags |= CC_NO_OVERFLOW;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1314 + /* FALLTHRU */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1315 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1316 + case AND:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1317 + case IOR:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1318 + case XOR:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1319 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1320 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1321 + /* These instructions set the condition codes,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1322 + * but cannot overflow (V=0). */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1323 + cc_status.value1 = SET_SRC (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1324 + cc_status.value2 = SET_DEST (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1325 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1326 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1327 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1328 + /* Everything else is clobbered */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1329 + CC_STATUS_INIT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1330 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1331 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1332 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1333 + } /* SET */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1334 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1335 + else if (GET_CODE (exp) == PARALLEL
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1336 + && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1337 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1338 + if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1339 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1340 + if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1341 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1342 + CC_STATUS_INIT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1343 + cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1344 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1345 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1346 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1347 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1348 + /*** default action if we haven't recognized something
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1349 + and returned earlier ***/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1350 + CC_STATUS_INIT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1351 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1352 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1353 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1354 +/** Returns nonzero if the expression EXP can be implemented using one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1355 + * of the 6809's single operand instructions. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1356 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1357 +m6809_single_operand_operator (rtx exp)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1358 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1359 + rtx op1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1360 + HOST_WIDE_INT val;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1361 + enum rtx_code code;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1362 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1363 + debug_rtx(exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1364 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1365 + code = GET_CODE (exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1366 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1367 + /* Unary operators always qualify */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1368 + switch (code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1369 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1370 + case NEG:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1371 + case NOT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1372 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1373 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1374 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1375 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1376 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1377 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1378 + /* Binary operators can only qualify if the second
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1379 + * argument is a CONST_INT of certain value. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1380 + op1 = XEXP (exp, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1381 + if (GET_CODE (op1) != CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1382 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1383 + val = INTVAL (op1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1384 + switch (code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1385 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1386 + case PLUS:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1387 + case MINUS:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1388 + if (val == -1 || val == 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1389 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1390 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1391 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1392 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1393 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1394 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1395 + case ROTATE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1396 + case ROTATERT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1397 + if (val == 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1398 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1399 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1400 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1401 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1402 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1403 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1404 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1405 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1406 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1407 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1408 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1409 +/** Return a bitarray of the hard registers which are used by a function. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1410 +unsigned int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1411 +m6809_get_live_regs (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1412 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1413 + unsigned int regs = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1414 + int regno;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1415 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1416 + if (frame_pointer_needed)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1417 + regs |= (1 << HARD_FRAME_POINTER_REGNUM);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1418 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1419 + for (regno = HARD_X_REGNUM; regno <= HARD_U_REGNUM; regno++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1420 + if (df_regs_ever_live_p (regno) && ! call_used_regs[regno])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1421 + regs |= (1 << regno);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1422 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1423 + return regs;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1424 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1425 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1426 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1427 +/** Return a printable version of a list of hard registers, suitable
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1428 + * for use in a PSHx or PULx insn. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1429 +const char *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1430 +m6809_get_regs_printable (unsigned int regs)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1431 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1432 + static char list[64];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1433 + char *listp = list;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1434 + unsigned int regno;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1435 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1436 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1437 + if ((regs & (1 << regno)) && !S_REGNO_P (regno))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1438 + listp += sprintf (listp,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1439 + (listp == list) ? "%s" : ",%s", reg_names[regno]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1440 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1441 + return list;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1442 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1443 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1444 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1445 +/** Return the total number of bytes covered by a set of hard registers. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1446 +unsigned int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1447 +m6809_get_regs_size (unsigned int regs)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1448 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1449 + unsigned int regno;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1450 + unsigned int size = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1451 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1452 + for (regno=0; regno < FIRST_PSEUDO_REGISTER; regno++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1453 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1454 + /* Only count register in the given register set */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1455 + if (REGSET_CONTAINS_P (regno, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1456 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1457 + /* Add 1 or 2 byte, depending on the size of the register.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1458 + * Since 'D' may be in both sets, check for WORD_REGSET first. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1459 + if (REGSET_CONTAINS_P(regno, WORD_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1460 + size += 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1461 + else if (REGSET_CONTAINS_P(regno, BYTE_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1462 + size++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1463 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1464 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1465 + return size;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1466 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1467 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1468 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1469 +/* Given the target of call instruction in X,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1470 + * return the tree node that contains the function declaration for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1471 + * that target.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1472 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1473 + * If the rtx or the tree do not appear valid for any reason,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1474 + * then return NULL_TREE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1475 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1476 +static tree call_target_decl (rtx x)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1477 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1478 + tree decl;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1479 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1480 + /* Make sure the target is really a MEM. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1481 + if (!x || !MEM_P (x))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1482 + return NULL_TREE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1483 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1484 + /* Make sure the address is a SYMBOL_REF. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1485 + x = XEXP (x, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1486 + if (!x || (GET_CODE (x) != SYMBOL_REF))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1487 + return NULL_TREE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1488 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1489 + /* Get the declaration of this symbol */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1490 + decl = SYMBOL_REF_DECL (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1491 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1492 + /* Make sure the declaration is really a function. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1493 + if (!decl || (TREE_CODE(decl) != FUNCTION_DECL))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1494 + return NULL_TREE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1495 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1496 + return decl;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1497 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1498 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1499 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1500 +/** Returns nonzero if a function, whose declaration is in DECL,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1501 + * was declared to have the attribute given by ATTR_NAME. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1502 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1503 +m6809_function_has_type_attr_p (tree decl, const char *attr_name)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1504 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1505 + tree type;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1506 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1507 + type = TREE_TYPE (decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1508 + return lookup_attribute (attr_name, TYPE_ATTRIBUTES (type)) != NULL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1509 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1510 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1511 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1512 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1513 +/** Returns nonzero if the current function was declared to have the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1514 + * attribute given by ATTR_NAME. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1515 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1516 +m6809_current_function_has_type_attr_p (const char *attr_name)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1517 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1518 + return m6809_function_has_type_attr_p (current_function_decl, attr_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1519 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1520 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1521 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1522 +/** Return nonzero if the current function has no return value. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1523 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1524 +m6809_current_function_is_void (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1525 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1526 + return (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1527 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1528 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1529 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1530 +/** Get the value of a declaration's 'bank', as set by the 'bank'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1531 + * attribute. If no bank was declared, it returns NULL by default. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1532 +const char *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1533 +m6809_get_decl_bank (tree decl)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1534 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1535 + tree attr;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1536 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1537 + /* Lookup the 'bank' attribute. If it does not exist, then
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1538 + * return NULL */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1539 + attr = lookup_attribute ("bank", DECL_ATTRIBUTES (decl));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1540 + if (attr == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1541 + return NULL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1542 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1543 + /* Make sure it has a value assigned to it */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1544 + attr = TREE_VALUE (attr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1545 + if (attr == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1546 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1547 + warning (WARNING_OPT "banked function did not declare a bank number");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1548 + return NULL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1549 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1550 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1551 + /* Return the bank name */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1552 + attr = TREE_VALUE (attr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1553 + return TREE_STRING_POINTER (attr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1554 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1555 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1556 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1557 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1558 +m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1559 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1560 + /* Check the function declaration for special properties.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1561 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1562 + * If the function was declare with __attribute__((bank)), output
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1563 + * assembler definitions to force the function to go into the named
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1564 + * bank.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1565 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1566 + const char *bank_name = m6809_get_decl_bank (decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1567 + if (bank_name != NULL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1568 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1569 + fprintf (asm_out_file, "\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1570 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1571 + /* Declare __self_bank as a local assembler value that denotes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1572 + * which bank the current function is in. This is required only
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1573 + * when the bank actually changes. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1574 + if (strcmp (bank_name, current_bank_name))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1575 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1576 + fprintf (asm_out_file, "__self_bank\t.equ\t%s\n", bank_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1577 + strcpy (current_bank_name, bank_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1578 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1579 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1580 + /* Declare a global assembler value that denotes which bank the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1581 + * named function is in. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1582 + fprintf (asm_out_file, "__%s_bank\t.gblequ\t%s\n", name, bank_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1583 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1584 + /* Force the current function into a new area */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1585 + fprintf (asm_out_file, "\t.bank\tbank_%s (FSFX=_%s)\n",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1586 + bank_name, bank_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1587 + fprintf (asm_out_file, "\t.area\tbank_%s (BANK=bank_%s)\n",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1588 + bank_name, bank_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1589 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1590 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1591 + /* Emit the label for the function's name */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1592 + ASM_OUTPUT_LABEL (asm_out_file, name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1593 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1594 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1595 +#if 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1596 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1597 + * Handle pragmas. Note that only the last branch pragma seen in the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1598 + * source has any affect on code generation.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1599 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1600 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1601 +#define BAD_PRAGMA(msgid, arg) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1602 + do { warning (WARNING_OPT msgid, arg); return -1; } while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1603 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1604 +static int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1605 +pragma_parse (const char *name, tree *sect)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1606 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1607 + tree s, x;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1608 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1609 + if (pragma_lex (&x) != CPP_OPEN_PAREN)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1610 + BAD_PRAGMA ("missing '(' after '#pragma %s' - ignored", name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1611 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1612 + if (pragma_lex (&s) != CPP_STRING)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1613 + BAD_PRAGMA ("missing section name in '#pragma %s' - ignored", name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1614 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1615 + if (pragma_lex (&x) != CPP_CLOSE_PAREN)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1616 + BAD_PRAGMA ("missing ')' for '#pragma %s' - ignored", name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1617 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1618 + if (pragma_lex (&x) != CPP_EOF)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1619 + warning (WARNING_OPT "junk at end of '#pragma %s'", name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1620 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1621 + *sect = s;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1622 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1623 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1624 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1625 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1626 +/*
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1627 + * Handle #pragma section.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1628 + * This is deprecated; code should use __attribute__(section("name"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1629 + * instead.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1630 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1631 +void pragma_section (cpp_reader *pfile ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1632 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1633 + tree sect;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1634 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1635 + if (pragma_parse ("section", &sect))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1636 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1637 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1638 + snprintf (code_section_op, 6+TREE_STRING_LENGTH (sect),
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1639 + ".area\t%s", TREE_STRING_POINTER (sect));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1640 + snprintf (data_section_op, 6+TREE_STRING_LENGTH (sect),
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1641 + ".area\t%s", TREE_STRING_POINTER (sect));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1642 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1643 + /* Mark a flag that sections have changed. Upon emitting another
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1644 + * declaration, the new .area directive will be written. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1645 + section_changed++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1646 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1647 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1648 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1649 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1650 + * Check a `double' value for validity for a particular machine mode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1651 + * Called by the CHECK_FLOAT_VALUE() machine-dependent macro.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1652 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1653 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1654 +check_float_value (enum machine_mode mode, double *d, int overflow)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1655 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1656 + if (mode == SFmode) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1657 + if (*d > 1.7014117331926443e+38) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1658 + error("magnitude of constant too large for `float'");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1659 + *d = 1.7014117331926443e+38;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1660 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1661 + else if (*d < -1.7014117331926443e+38) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1662 + error("magnitude of constant too large for `float'");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1663 + *d = -1.7014117331926443e+38;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1664 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1665 + else if ((*d > 0) && (*d < 2.9387358770557188e-39)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1666 + warning(WARNING_OPT "`float' constant truncated to zero");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1667 + *d = 0.0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1668 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1669 + else if ((*d < 0) && (*d > -2.9387358770557188e-39)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1670 + warning(WARNING_OPT "`float' constant truncated to zero");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1671 + *d = 0.0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1672 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1673 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1674 + return overflow;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1675 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1676 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1677 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1678 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1679 +/** Declare that the target supports named output sections. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1680 +bool m6809_have_named_section = (bool)1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1681 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1682 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1683 +/** Write to the assembler file a directive to place
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1684 + * subsequent objects to a different section in the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1685 + * object file. ASxxxx uses the "area" directive for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1686 + * this purpose. It does not however support generalized
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1687 + * alignment, and can only place items on an odd/even
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1688 + * boundary. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1689 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1690 +m6809_asm_named_section (
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1691 + const char *name,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1692 + unsigned int flags ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1693 + tree decl)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1694 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1695 + fprintf (asm_out_file, "\n\t.area\t%s\n", name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1696 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1697 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1698 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1699 +enum reg_class
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1700 +m6809_preferred_reload_class (rtx x, enum reg_class regclass)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1701 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1702 + /* Check cases based on type code of rtx */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1703 + switch (GET_CODE(x))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1704 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1705 + /*
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1706 + * Observation, 2015-07-19, William Astle
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1707 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1708 + * The original comparison for range for 16 bits was wrong, adding 0x80
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1709 + * instead of 0x8000. Replaced both 8 bit and 16 bit comparisions with
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1710 + * a more straight forward range comparison - excessive cleverness isn't
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1711 + * really required here.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1712 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1713 + case CONST_INT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1714 + /* Constants that can fit into 1 byte should be
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1715 + * loaded into a Q_REGS reg */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1716 + if ((INTVAL(x) >= -128 && INTVAL(x) <= 127) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1717 +// if (((unsigned) (INTVAL(x) + 0x80) < 0x100) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1718 + (regclass > A_REGS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1719 + return Q_REGS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1720 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1721 + /* 16-bit constants should be loaded into A_REGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1722 + * when possible. gcc may already require A_REGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1723 + * or D_REGS for certain types of instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1724 + * This case applies mostly to simple copy operations
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1725 + * to/from memory when any register will do, but
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1726 + * it's best to avoid using D register since it is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1727 + * needed for other things.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1728 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1729 + else if ((INTVAL(x) >= -32768 && INTVAL(x) <= 32767) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1730 +// else if (((unsigned) (INTVAL(x) + 0x80) < 0x10000) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1731 + (regclass > A_REGS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1732 + return A_REGS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1733 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1734 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1735 + case SYMBOL_REF:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1736 + case LABEL_REF:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1737 + /* Addresses should always be loaded into A_REGS */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1738 + if (regclass >= A_REGS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1739 + return (A_REGS);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1740 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1741 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1742 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1743 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1744 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1745 + /* Check cases based on mode of rtx */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1746 + if ((GET_MODE(x) == QImode) && (regclass != A_REGS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1747 + return Q_REGS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1748 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1749 + /* Default: return whatever class reload suggested */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1750 + return regclass;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1751 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1752 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1753 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1754 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1755 + * Check a new declaration for the "section" attribute.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1756 + * If it exists, and the target section is "direct", then mark
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1757 + * the declaration (in RTL) to indicate special treatment.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1758 + * When the variable is referenced later, we test for this flag
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1759 + * and can emit special asm text to force the assembler to use
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1760 + * short instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1761 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1762 +static void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1763 +m6809_encode_section_info (tree decl, rtx rtl, int new_decl_p ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1764 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1765 + tree attr, id;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1766 + const char *name;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1767 + const char *decl_name;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1768 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1769 + /* We only care about variable declarations, not functions */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1770 + if (TREE_CODE (decl) != VAR_DECL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1771 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1772 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1773 + /* For debugging purposes only; grab the decl's name */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1774 + decl_name = IDENTIFIER_POINTER (DECL_NAME (decl));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1775 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1776 + /* Give up if the decl doesn't have any RTL */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1777 + if (!DECL_RTL (decl))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1778 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1779 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1780 + /* See if it has a section attribute */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1781 + attr = lookup_attribute ("section", DECL_ATTRIBUTES (decl));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1782 + if (!attr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1783 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1784 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1785 + /* See if the section attribute has a value */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1786 + id = TREE_VALUE (TREE_VALUE (attr));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1787 + if (!id)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1788 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1789 + name = TREE_STRING_POINTER (id);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1790 + if (!name)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1791 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1792 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1793 + /* See if the value is 'direct'. If so, mark it. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1794 + if (!strcmp (name, "direct"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1795 + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1796 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1797 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1798 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1799 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1800 + * Output code to perform a complex shift, for which there is no
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1801 + * direct support in the instruction set.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1802 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1803 + * shift1 is an instruction pattern for performing a 1-bit modification.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1804 + * This code wraps that pattern in a loop to perform the shift N times,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1805 + * where N is given by the address register in operands[2].
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1806 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1807 + * To support 16-bit shifts, shift2 can also be provided: it is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1808 + * a second instruction to be included in the loop. 8-bit shift
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1809 + * insns will pass NULL here.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1810 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1811 + * The insn length of shift1/shift2 is assumed to be 1 byte,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1812 + * which works in all of the cases it is needed so far.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1813 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1814 +static void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1815 +m6809_gen_register_shift (
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1816 + rtx *operands,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1817 + const char *shift1,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1818 + const char *shift2 )
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1819 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1820 + char beq_pattern[32];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1821 + char bra_pattern[32];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1822 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1823 + int shiftlen = (shift1 && shift2) ? 2 : 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1824 + int cmplen = (REGNO (operands[2]) == HARD_X_REGNUM) ? 3 : 4;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1825 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1826 + int beq_offset = 2 + shiftlen + 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1827 + int bra_offset = shiftlen + 2 + cmplen + 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1828 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1829 + sprintf (beq_pattern, "beq\t.+%d", beq_offset);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1830 + sprintf (bra_pattern, "bra\t.-%d", bra_offset);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1831 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1832 + output_asm_insn ("pshs\t%2", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1833 + output_asm_insn ("lea%2\t-1,%2", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1834 + output_asm_insn ("cmp%2\t#-1", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1835 + output_asm_insn (beq_pattern, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1836 + if (shift1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1837 + output_asm_insn (shift1, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1838 + if (shift2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1839 + output_asm_insn (shift2, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1840 + output_asm_insn (bra_pattern, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1841 + output_asm_insn ("puls\t%2", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1842 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1843 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1844 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1845 +/** Generate RTL for the upper 8-bits of a 16-bit constant. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1846 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1847 +gen_rtx_const_high (rtx r)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1848 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1849 + unsigned char v = (INTVAL (r) >> 8) & 0xFF;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1850 + signed char s = (signed char)v;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1851 + return gen_int_mode (s, QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1852 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1853 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1854 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1855 +/** Generate RTL for the lower 8-bits of a 16-bit constant. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1856 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1857 +gen_rtx_const_low (rtx r)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1858 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1859 + unsigned char v = INTVAL (r) & 0xFF;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1860 + signed char s = (signed char)v;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1861 + return gen_int_mode (s, QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1862 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1863 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1864 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1865 +/** Generate RTL to allocate/free bytes on the stack.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1866 + * CODE is given as MINUS when allocating and PLUS when freeing,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1867 + * to match the semantics of a downward-growing stack. SIZE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1868 + * is always given as a positive integer.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1869 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1870 +static rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1871 +gen_rtx_stack_adjust (enum rtx_code code, int size)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1872 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1873 + if (size <= 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1874 + return NULL_RTX;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1875 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1876 + if (code == MINUS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1877 + size = -size;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1878 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1879 + return gen_rtx_SET (Pmode, stack_pointer_rtx,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1880 + gen_rtx_PLUS (Pmode, stack_pointer_rtx,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1881 + gen_int_mode (size, HImode)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1882 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1883 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1884 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1885 +/** Generate RTL to push/pop a set of registers. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1886 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1887 +gen_rtx_register_pushpop (int op, int regs)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1888 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1889 + rtx nregs = gen_int_mode (regs, QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1890 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1891 + if (op == UNSPEC_PUSH_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1892 + return gen_register_push (nregs);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1893 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1894 + return gen_register_pop (nregs);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1895 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1896 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1897 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1898 +/* Given a register set REGS, where the bit positions correspond to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1899 + * hard register numbers, return another bitmask that represents the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1900 + * order in which those registers would be pushed/popped.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1901 + * Registers that are pushed first have higher bit positions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1902 + * The pop order is just the reverse bitmask.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1903 + * These values are the same as the bitmasks actually used in the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1904 + * machine instructions. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1905 +static unsigned int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1906 +register_push_order (int regs)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1907 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1908 + unsigned int order = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1909 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1910 + if (REGSET_CONTAINS_P (HARD_PC_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1911 + order |= 0x80;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1912 + if (REGSET_CONTAINS_P (HARD_U_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1913 + order |= 0x40;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1914 + if (REGSET_CONTAINS_P (HARD_Y_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1915 + order |= 0x20;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1916 + if (REGSET_CONTAINS_P (HARD_X_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1917 + order |= 0x10;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1918 + if (REGSET_CONTAINS_P (HARD_DP_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1919 + order |= 0x8;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1920 + if (REGSET_CONTAINS_P (HARD_B_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1921 + order |= 0x4;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1922 + if (REGSET_CONTAINS_P (HARD_A_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1923 + order |= 0x2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1924 + if (REGSET_CONTAINS_P (HARD_CC_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1925 + order |= 0x1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1926 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1927 + if (REGSET_CONTAINS_P (HARD_D_REGNUM, regs))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1928 + order |= (0x4 | 0x2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1929 + return order;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1930 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1931 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1932 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1933 +/* Returns nonzero if two consecutive push or pop instructions,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1934 + * as determined by the OP, can be merged into a single instruction.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1935 + * The first instruction in the sequence pushes/pops REGS1; the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1936 + * second applies to REGS2.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1937 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1938 + * If true, the resulting instruction can use (regs1 | regs2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1939 + * safely.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1940 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1941 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1942 +m6809_can_merge_pushpop_p (int op, int regs1, int regs2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1943 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1944 + /* Register sets must not overlap */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1945 + if (regs1 & regs2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1946 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1947 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1948 + if (op == UNSPEC_PUSH_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1949 + return (register_push_order (regs1) > register_push_order (regs2));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1950 + else if (op == UNSPEC_POP_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1951 + return (register_push_order (regs1) < register_push_order (regs2));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1952 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1953 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1954 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1955 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1956 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1957 +/** Emit instructions for making a library call.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1958 + * MODE is the mode of the operation.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1959 + * NAME is the library function name.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1960 + * OPERANDS is the rtx array provided by the recognizer.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1961 + * COUNT is the number of input operands to the call, and
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1962 + * should be 1 for a unary op or 2 for a binary op.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1963 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1964 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1965 +emit_libcall_insns (enum machine_mode mode,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1966 + const char *name,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1967 + rtx *operands,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1968 + int count)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1969 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1970 + /* Generate an rtx for the call target. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1971 + rtx symbol = gen_rtx_SYMBOL_REF (Pmode, name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1972 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1973 + /* Emit the library call. Slightly different based
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1974 + on the number of operands */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1975 + if (count == 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1976 + emit_library_call (symbol, LCT_NORMAL, mode,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1977 + 2, operands[1], mode, operands[2], mode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1978 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1979 + emit_library_call (symbol, LCT_NORMAL, mode,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1980 + 1, operands[1], mode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1981 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1982 + /* The library call is expected to put its result
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1983 + in LIBCALL_VALUE, so need to copy it into the destination. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1984 + emit_move_insn (operands[0], LIBCALL_VALUE(mode));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1985 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1986 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1987 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1988 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1989 + * A small helper function that writes out a single branch instruction.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1990 + * OPCODE is the short name, e.g. "ble".
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1991 + * OPERANDS has the rtx for the target label.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1992 + * LONG_P is nonzero if we are emitting a long branch, and need to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1993 + * prepend an 'l' to the opcode name.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1994 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1995 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1996 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1997 + char pattern[64];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1998 + sprintf (pattern, "%s%s\t%%l0", long_p ? "l" : "", opcode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
1999 + output_asm_insn (pattern, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2000 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2001 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2002 +/**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2003 + * Output a branch/conditional branch insn of the proper
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2004 + * length. code identifies the particular branch insn.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2005 + * operands holds the branch target in operands[0].
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2006 + * length says what the size of this insn should be.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2007 + * Based on the length, we know whether it should be a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2008 + * short (8-bit) or long (16-bit) branch.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2009 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2010 +const char *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2011 +output_branch_insn (enum rtx_code code, rtx *operands, int length)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2012 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2013 + int shortform;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2014 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2015 + /* Decide whether or not to use the long or short form.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2016 + * Calculate automatically based on insn lengths. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2017 + shortform = ((length > 2) ? 0 : 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2018 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2019 + /* Determine the proper opcode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2020 + * Use the short (2-byte) opcode if the target is within
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2021 + * reach. Otherwise, use jmp (3-byte opcode), unless
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2022 + * compiling with -fpic, in which case we'll need to use
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2023 + * lbra (4-byte opcode).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2024 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2025 + switch (code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2026 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2027 + case LABEL_REF:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2028 + if (shortform)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2029 + output_branch_insn1 ("bra", operands, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2030 + else if (flag_pic)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2031 + output_branch_insn1 ("bra", operands, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2032 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2033 + output_branch_insn1 ("jmp", operands, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2034 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2035 + case EQ:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2036 + output_branch_insn1 ("beq", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2037 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2038 + case NE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2039 + output_branch_insn1 ("bne", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2040 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2041 + case GT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2042 + output_branch_insn1 ("bgt", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2043 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2044 + case GTU:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2045 + output_branch_insn1 ("bhi", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2046 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2047 + case LT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2048 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2049 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2050 + output_branch_insn1 ("bmi", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2051 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2052 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2053 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2054 + output_branch_insn1 ("blt", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2055 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2056 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2057 + case LTU:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2058 + output_branch_insn1 ("blo", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2059 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2060 + case GE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2061 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2062 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2063 + output_branch_insn1 ("bpl", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2064 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2065 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2066 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2067 + output_branch_insn1 ("bge", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2068 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2069 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2070 + case GEU:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2071 + output_branch_insn1 ("bhs", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2072 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2073 + case LE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2074 + if (cc_prev_status.flags & CC_NO_OVERFLOW)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2075 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2076 + output_branch_insn1 ("bmi", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2077 + output_branch_insn1 ("beq", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2078 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2079 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2080 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2081 + output_branch_insn1 ("ble", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2082 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2083 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2084 + case LEU:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2085 + output_branch_insn1 ("bls", operands, !shortform);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2086 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2087 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2088 + abort();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2089 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2090 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2091 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2092 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2093 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2094 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2095 +/** Returns the "cost" of an RTL expression.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2096 + * In general, the expression "COSTS_N_INSNS(1)" is used to represent
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2097 + * the cost of a fast 8-bit arithmetic instruction that operates on
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2098 + * a reg/mem or a reg/immed. Other costs are relative to this.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2099 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2100 + * Notes:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2101 + * - The cost of a REG is always zero; this cannot be changed.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2102 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2103 + * - On the 6809, instructions on two registers will nearly always take
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2104 + * longer than those that operate on a register and a constant/memory,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2105 + * because of the way the instruction set is structured.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2106 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2107 + * TODO: multiply HImode by 2 should be done via shifts, instead of add.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2108 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2109 +static bool
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2110 +m6809_rtx_costs (rtx X, int code, int outer_code ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2111 + int *total, bool speed)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2112 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2113 + int has_const_arg = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2114 + HOST_WIDE_INT const_arg;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2115 + enum machine_mode mode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2116 + int nargs = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2117 + rtx op0, op1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2118 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2119 + /* Data RTXs return a value between 0-3, depending on complexity.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2120 + All of these are less than COSTS_N_INSNS(1). */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2121 + switch (code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2122 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2123 + case CC0:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2124 + case PC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2125 + *total = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2126 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2127 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2128 + case CONST_INT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2129 + if (X == const0_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2130 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2131 + *total = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2132 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2133 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2134 + else if ((unsigned) INTVAL (X) < 077)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2135 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2136 + *total = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2137 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2138 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2139 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2140 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2141 + *total = 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2142 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2143 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2144 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2145 + case LABEL_REF: case CONST:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2146 + *total = 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2147 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2148 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2149 + case SYMBOL_REF:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2150 + /* References to memory are made cheaper if they have
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2151 + * the 'direct' mode attribute set */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2152 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2153 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2154 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2155 + case MEM:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2156 + /* See what form of address was given */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2157 + X = XEXP (X, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2158 + switch (GET_CODE (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2159 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2160 + case SYMBOL_REF:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2161 + *total = (SYMBOL_REF_FLAG (X)) ? 1 : 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2162 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2163 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2164 + case CONST_INT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2165 + *total = 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2166 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2167 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2168 + case MEM:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2169 + *total = COSTS_N_INSNS (1) + 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2170 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2171 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2172 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2173 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2174 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2175 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2176 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2177 + case CONST_DOUBLE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2178 + /* TODO : not sure about this value. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2179 + *total = 3;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2180 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2181 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2182 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2183 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2184 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2185 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2186 + /* Decode the rtx */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2187 + mode = GET_MODE (X);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2188 + op0 = XEXP (X, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2189 + op1 = XEXP (X, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2190 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2191 + /* We don't implement anything in SImode or greater. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2192 + if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2193 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2194 + *total = COSTS_N_INSNS (100);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2195 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2196 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2197 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2198 + /* Figure out if there is a constant argument, and its value. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2199 + if (GET_RTX_CLASS (code) == RTX_BIN_ARITH
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2200 + || GET_RTX_CLASS (code) == RTX_COMM_ARITH)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2201 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2202 + nargs = 2;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2203 + if (GET_CODE (op1) == CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2204 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2205 + has_const_arg = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2206 + const_arg = INTVAL (op1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2207 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2208 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2209 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2210 + /* Penalize a reg/reg operation by adding MEMORY_MOVE_COST,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2211 + * Ignore soft registers, since these are really in memory.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2212 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2213 + * TODO: penalize HImode reg/reg for most operations, except maybe
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2214 + * additions since index registers allow for that.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2215 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2216 + * TODO: shifts by constant N do not always require N instructions;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2217 + * some of this can be done cheaper. The number of actual insns can be
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2218 + * predicted well.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2219 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2220 + if (nargs == 2 && REAL_REG_P (op0) && REAL_REG_P (op1))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2221 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2222 + *total = MEMORY_MOVE_COST (mode, Q_REGS, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2223 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2224 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2225 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2226 + *total = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2227 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2228 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2229 + /* Operator RTXs are counted as COSTS_N_INSNS(N), where N is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2230 + the estimated number of actual machine instructions needed to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2231 + perform the computation. Some small adjustments are made since
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2232 + some "instructions" are more complex than others. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2233 + switch (code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2234 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2235 + case PLUS: case MINUS: case COMPARE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2236 + /* 6809 handles these natively in QImode, and in HImode as long
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2237 + * as operand 1 is constant. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2238 + if (mode == QImode || (mode == HImode && has_const_arg))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2239 + *total += COSTS_N_INSNS (1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2240 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2241 + *total += COSTS_N_INSNS (GET_MODE_SIZE (mode));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2242 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2243 + /* -1, 0, and 1 can be done using inherent instructions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2244 + * for PLUS and MINUS in QImode, so don't add extra cost. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2245 + if (has_const_arg
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2246 + && (mode == QImode || mode == HImode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2247 + && (const_arg == -1 || const_arg == 0 || const_arg == 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2248 + && (code == PLUS || code == MINUS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2249 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2250 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2251 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2252 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2253 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2254 + case AND: case IOR: case XOR:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2255 + case NEG: case NOT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2256 + /* 6809 handles these natively in QImode, but requires
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2257 + * splitting in HImode. Treat these as 2 insns. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2258 + *total += COSTS_N_INSNS (1) * GET_MODE_SIZE (mode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2259 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2260 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2261 + case ASHIFT: case ASHIFTRT: case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2262 + case ROTATE: case ROTATERT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2263 + /* 6809 can do shift/rotates of a QImode by a constant in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2264 + * 1 insn times the shift count, or in HImode by a constant
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2265 + * by splitting to 2 insns.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2266 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2267 + * Shift by a nonconstant will take significantly longer
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2268 + * than any of these. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2269 + if (has_const_arg)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2270 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2271 + const_arg %= (GET_MODE_SIZE (mode) * 8);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2272 + if (const_arg == 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2273 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2274 + *total += COSTS_N_INSNS(1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2275 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2276 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2277 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2278 + /* HImode shifts greater than 8 get optimized due
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2279 + * to register transfer from b to a; this cuts down the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2280 + * cost. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2281 + if (const_arg >= 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2282 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2283 + *total += COSTS_N_INSNS (1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2284 + const_arg -= 8;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2285 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2286 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2287 + /* The computed cost is 'const_arg' 1-bit shifts, doubled
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2288 + if in HImode, minus the cost of the constant itself which
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2289 + will be added in later but really shouldn't be. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2290 + *total += COSTS_N_INSNS (const_arg) * GET_MODE_SIZE (mode) - 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2291 + return true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2292 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2293 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2294 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2295 + /* It may take up to 7 iterations of about 6-7 real
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2296 + * instructions, so make this expensive. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2297 + *total += COSTS_N_INSNS (50);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2298 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2299 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2300 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2301 + case MULT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2302 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2303 + /* Multiply is cheap when both arguments are 8-bits. They
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2304 + could be QImode, or QImode widened to HImode, or a constant
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2305 + that fits into 8-bits. As long as both operands qualify,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2306 + we can use a single mul instruction.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2307 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2308 + Assume that fast multiply can be used, and change this if we find
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2309 + differently... */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2310 + int ok_for_qihi3 = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2311 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2312 + /* Check the first operand */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2313 + switch (GET_MODE (op0))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2314 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2315 + case QImode:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2316 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2317 + case HImode:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2318 + if (GET_CODE (op0) != SIGN_EXTEND && GET_CODE (op0) != ZERO_EXTEND)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2319 + ok_for_qihi3 = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2320 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2321 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2322 + ok_for_qihi3 = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2323 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2324 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2325 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2326 + /* Likewise, check the second operand. This is where constants may appear. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2327 + switch (GET_MODE (op1))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2328 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2329 + case QImode:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2330 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2331 + case HImode:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2332 + if (GET_CODE (op1) != SIGN_EXTEND && GET_CODE (op1) != ZERO_EXTEND)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2333 + ok_for_qihi3 = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2334 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2335 + case VOIDmode:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2336 + if (!CONST_OK_FOR_LETTER_P (const_arg, 'K'))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2337 + ok_for_qihi3 = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2338 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2339 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2340 + ok_for_qihi3 = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2341 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2342 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2343 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2344 + /* Fast multiply takes about 4 times as many cycles as a normal
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2345 + arithmetic operation. Otherwise, it will take an expensive libcall. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2346 + if (ok_for_qihi3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2347 + *total += COSTS_N_INSNS (4);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2348 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2349 + *total = COSTS_N_INSNS (50);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2350 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2351 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2352 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2353 + case DIV: case UDIV: case MOD: case UMOD:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2354 + /* These all require more expensive libcalls. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2355 + *total += COSTS_N_INSNS (100);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2356 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2357 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2358 + /* TODO : TRUNCATE, SIGN_EXTEND, and ZERO_EXTEND */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2359 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2360 + /* These can normally be done with autoincrement, etc., so
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2361 + * don't charge for them. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2362 + case PRE_DEC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2363 + case PRE_INC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2364 + case POST_DEC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2365 + case POST_INC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2366 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2367 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2368 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2369 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2370 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2371 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2372 + /* Always return false, and let the caller gather the costs
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2373 + * of the operands */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2374 + return false;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2375 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2376 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2377 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2378 +static tree
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2379 +m6809_handle_fntype_attribute (tree *node, tree name,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2380 + tree args ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2381 + int flags ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2382 + bool *no_add_attrs)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2383 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2384 + if (TREE_CODE (*node) != FUNCTION_TYPE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2385 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2386 + warning (WARNING_OPT "'%s' only valid for functions",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2387 + IDENTIFIER_POINTER (name));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2388 + *no_add_attrs = TRUE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2389 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2390 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2391 + return NULL_TREE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2392 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2393 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2394 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2395 +static tree
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2396 +m6809_handle_data_type_attribute (tree *node ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2397 + tree name ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2398 + tree args ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2399 + int flags ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2400 + bool *no_add_attrs ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2401 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2402 + return NULL_TREE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2403 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2404 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2405 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2406 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2407 +static tree
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2408 +m6809_handle_default_attribute (tree *node ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2409 + tree name ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2410 + tree args ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2411 + int flags ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2412 + bool *no_add_attrs ATTRIBUTE_UNUSED )
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2413 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2414 + return NULL_TREE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2415 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2416 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2417 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2418 +/* Table of valid machine attributes */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2419 +const struct attribute_spec m6809_attribute_table[] = { /*
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2420 +{ name, min, max, decl, type, fntype, handler } */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2421 +{ "interrupt", 0, 0, false, true, true, m6809_handle_fntype_attribute },
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2422 +{ "naked", 0, 0, false, true, true, m6809_handle_fntype_attribute },
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2423 +{ "far", 0, 1, false, true, true, m6809_handle_fntype_attribute },
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2424 +{ "bank", 0, 1, true, false, false, m6809_handle_default_attribute },
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2425 +{ "boolean", 0, 0, false, true, false, m6809_handle_data_type_attribute },
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2426 +{ NULL, 0, 0, false, true, false, NULL },
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2427 +};
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2428 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2429 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2430 +/** Initialize builtin routines for the 6809. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2431 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2432 +m6809_init_builtins (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2433 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2434 + /* Create type trees for each function signature required.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2435 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2436 + * void_ftype_void = void f(void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2437 + * void_ftype_uchar = void f(unsigned char)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2438 + * uchar_ftype_uchar2 = unsigned char f (unsigned char, unsigned char)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2439 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2440 + tree void_ftype_void =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2441 + build_function_type (void_type_node, void_list_node);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2442 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2443 + tree void_ftype_uchar =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2444 + build_function_type (void_type_node,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2445 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2446 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2447 + tree uchar_ftype_uchar2 =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2448 + build_function_type (unsigned_char_type_node,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2449 + tree_cons (NULL_TREE, unsigned_char_type_node,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2450 + tree_cons (NULL_TREE, unsigned_char_type_node, void_list_node)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2451 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2452 + /* Register each builtin function. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2453 + add_builtin_function ("__builtin_swi", void_ftype_void,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2454 + M6809_SWI, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2455 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2456 + add_builtin_function ("__builtin_swi2", void_ftype_void,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2457 + M6809_SWI2, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2458 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2459 + add_builtin_function ("__builtin_swi3", void_ftype_void,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2460 + M6809_SWI3, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2461 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2462 + add_builtin_function ("__builtin_cwai", void_ftype_uchar,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2463 + M6809_CWAI, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2464 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2465 + add_builtin_function ("__builtin_sync", void_ftype_void,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2466 + M6809_SYNC, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2467 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2468 + add_builtin_function ("__builtin_nop", void_ftype_void,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2469 + M6809_NOP, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2470 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2471 + add_builtin_function ("__builtin_blockage", void_ftype_void,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2472 + M6809_BLOCKAGE, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2473 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2474 + add_builtin_function ("__builtin_add_decimal", uchar_ftype_uchar2,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2475 + M6809_ADD_DECIMAL, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2476 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2477 + add_builtin_function ("__builtin_add_carry", uchar_ftype_uchar2,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2478 + M6809_ADD_CARRY, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2479 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2480 + add_builtin_function ("__builtin_sub_carry", uchar_ftype_uchar2,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2481 + M6809_SUB_CARRY, BUILT_IN_MD, NULL, NULL_TREE);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2482 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2483 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2484 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2485 +/** Used by m6809_expand_builtin, given a tree ARGLIST which
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2486 + * refers to the operands of a builtin call, return an rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2487 + * that represents the nth operand, as denoted by OPNUM, which
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2488 + * is a zero-based integer. MODE gives the expected mode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2489 + * of the operand.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2490 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2491 + * This rtx is suitable for use in the emitted RTL for the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2492 + * builtin instruction. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2493 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2494 +m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2495 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2496 + tree arg;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2497 + rtx r;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2498 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2499 + arg = CALL_EXPR_ARG (arglist, opnum);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2500 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2501 + /* Convert the tree to RTL */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2502 + r = expand_expr (arg, NULL_RTX, mode, EXPAND_NORMAL);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2503 + if (r == NULL_RTX)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2504 + return NULL_RTX;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2505 + return r;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2506 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2507 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2508 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2509 +/** Expand a builtin that was registered in init_builtins into
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2510 + * RTL. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2511 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2512 +m6809_expand_builtin (tree exp,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2513 + rtx target,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2514 + rtx subtarget ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2515 + enum machine_mode mode ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2516 + int ignore ATTRIBUTE_UNUSED )
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2517 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2518 + tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2519 + tree arglist = exp;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2520 + unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2521 + rtx r0, r1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2522 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2523 + switch (fcode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2524 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2525 + case M6809_SWI:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2526 + r0 = gen_rtx_CONST_INT (VOIDmode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2527 + emit_insn (target = gen_m6809_swi (r0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2528 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2529 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2530 + case M6809_SWI2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2531 + r0 = gen_rtx_CONST_INT (VOIDmode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2532 + emit_insn (target = gen_m6809_swi (r0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2533 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2534 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2535 + case M6809_SWI3:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2536 + r0 = gen_rtx_CONST_INT (VOIDmode, 3);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2537 + emit_insn (target = gen_m6809_swi (r0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2538 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2539 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2540 + case M6809_CWAI:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2541 + r0 = m6809_builtin_operand (arglist, QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2542 + emit_insn (target = gen_m6809_cwai (r0));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2543 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2544 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2545 + case M6809_SYNC:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2546 + emit_insn (target = gen_m6809_sync ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2547 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2548 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2549 + case M6809_ADD_CARRY:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2550 + r0 = m6809_builtin_operand (arglist, QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2551 + r1 = m6809_builtin_operand (arglist, QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2552 + if (!target)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2553 + target = gen_reg_rtx (QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2554 + emit_insn (gen_addqi3_carry (target, r0, r1));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2555 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2556 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2557 + case M6809_SUB_CARRY:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2558 + r0 = m6809_builtin_operand (arglist, QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2559 + r1 = m6809_builtin_operand (arglist, QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2560 + if (!target)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2561 + target = gen_reg_rtx (QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2562 + emit_insn (gen_subqi3_carry (target, r0, r1));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2563 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2564 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2565 + case M6809_NOP:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2566 + emit_insn (target = gen_nop ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2567 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2568 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2569 + case M6809_BLOCKAGE:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2570 + emit_insn (target = gen_blockage ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2571 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2572 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2573 + case M6809_ADD_DECIMAL:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2574 + r0 = m6809_builtin_operand (arglist, QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2575 + r1 = m6809_builtin_operand (arglist, QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2576 + if (!target)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2577 + target = gen_reg_rtx (QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2578 + emit_insn (gen_addqi3_decimal (target, r0, r1));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2579 + return target;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2580 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2581 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2582 + warning (WARNING_OPT "unknown builtin expansion ignored");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2583 + return NULL_RTX;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2584 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2585 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2586 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2587 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2588 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2589 +/* Returns nonzero if 'x' represents a function that was declared
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2590 + * as __noreturn__. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2591 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2592 +noreturn_functionp (rtx x)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2593 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2594 + tree decl = call_target_decl (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2595 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2596 + if (decl == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2597 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2598 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2599 + return TREE_THIS_VOLATILE (decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2600 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2601 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2602 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2603 +const char *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2604 +far_function_type_p (tree type)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2605 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2606 + tree attr;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2607 + const char *page;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2608 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2609 + /* Return whether or not this decl has the far attribute */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2610 + attr = lookup_attribute ("far", TYPE_ATTRIBUTES (type));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2611 + if (attr == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2612 + return NULL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2613 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2614 + /* If it is far, check for a value */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2615 + attr = TREE_VALUE (attr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2616 + if (attr == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2617 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2618 + warning (WARNING_OPT "far code page not specified, using local value");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2619 + return far_code_page;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2620 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2621 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2622 + /* We have a TREE_LIST of attribute values, get the first one.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2623 + * It should be an INTEGER_CST. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2624 + attr = TREE_VALUE (attr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2625 + page = TREE_STRING_POINTER (attr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2626 + return page;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2627 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2628 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2629 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2630 +/* For a far function, returns the identifier that states which page
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2631 + * it resides in. Otherwise, returns NULL for ordinary functions. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2632 +const char *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2633 +far_functionp (rtx x)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2634 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2635 + tree decl, decl_type;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2636 + const char *page;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2637 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2638 + /* Find the FUNCTION_DECL corresponding to the rtx being called. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2639 + decl = call_target_decl (x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2640 + if (decl == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2641 + return NULL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2642 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2643 + /* See if the function has the new 'banked' attribute. These
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2644 + * are numeric instead of text */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2645 + page = m6809_get_decl_bank (decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2646 + if (page)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2647 + return page;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2648 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2649 + /* No, lookup the type of the function and see if the type
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2650 + * specifies far or not. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2651 + decl_type = TREE_TYPE (decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2652 + if (decl_type == NULL_TREE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2653 + return NULL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2654 + return far_function_type_p (decl_type);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2655 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2656 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2657 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2658 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2659 +/** Outputs the assembly language for a far call. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2660 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2661 +output_far_call_insn (rtx *operands, int has_return)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2662 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2663 + static char page_data[64];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2664 + const char *called_page;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2665 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2666 + /* The logic is the same for functions whether or not there
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2667 + * is a return value. Skip over the return value in this
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2668 + * case, so that the call location is always operands[0]. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2669 + if (has_return)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2670 + operands++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2671 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2672 + /* Get the name of the page being called */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2673 + called_page = far_functionp (operands[0]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2674 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2675 +#if 0 /* TODO : broken logic */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2676 + /* See if the called page name is a 'bank' */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2677 + if (isdigit (*called_page))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2678 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2679 + /* New style banking */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2680 + if (!strcmp (called_page, current_bank_name))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2681 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2682 + /* Same page */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2683 + output_asm_insn ("jsr\t%0", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2684 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2685 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2686 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2687 + /* Different page */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2688 + output_asm_insn ("jsr\t__far_call_handler\t;new style", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2689 + output_asm_insn ("\t.dw\t%0", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2690 + sprintf (page_data, "\t.db\t%s", called_page);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2691 + output_asm_insn (page_data, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2692 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2693 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2694 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2695 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2696 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2697 + /* Are we calling a different page than we are running in? */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2698 + if (!strcmp (called_page, far_code_page))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2699 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2700 + /* Same page : no need to execute a far call */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2701 + if (flag_pic)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2702 + output_asm_insn ("lbsr\t%C0", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2703 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2704 + output_asm_insn ("jsr\t%0", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2705 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2706 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2707 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2708 + /* Different page : need to emit far call thunk */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2709 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2710 + /* First output a call to the thunk for making far calls. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2711 + if (flag_pic)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2712 + output_asm_insn ("lbsr\t__far_call_handler", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2713 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2714 + output_asm_insn ("jsr\t__far_call_handler\t;old style", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2715 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2716 + /* Now output the name of the call site */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2717 + output_asm_insn ("\t.dw\t%C0", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2718 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2719 + /* Finally output the page number */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2720 + sprintf (page_data, "\t.db\t%s", far_functionp (operands[0]));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2721 + output_asm_insn (page_data, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2722 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2723 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2724 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2725 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2726 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2727 +m6809_init_cumulative_args (CUMULATIVE_ARGS cum ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2728 + tree fntype,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2729 + rtx libname ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2730 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2731 + cum = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2732 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2733 + /* For far functions, the current implementation does not allow for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2734 + * stack parameters. So note whenever the called function is far
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2735 + * and in a different page than the current one; such a function
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2736 + * should give an error if a stack parameter is generated. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2737 + if (fntype)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2738 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2739 + const char *called_page = far_function_type_p (fntype);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2740 + if (called_page && strcmp (called_page, far_code_page) && !TARGET_FAR_STACK_PARAM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2741 + cum |= CUM_STACK_INVALID;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2742 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2743 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2744 + if (fntype && TYPE_ARG_TYPES (fntype) != 0 &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2745 + (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) != void_type_node))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2746 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2747 + /* has variable arguments, cannot use registers */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2748 + cum |= (CUM_X_MASK | CUM_B_MASK | CUM_STACK_ONLY);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2749 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2750 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2751 + if (m6809_abi_version == M6809_ABI_VERSION_STACK)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2752 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2753 + /* cannot use registers ; only use the stack */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2754 + cum |= (CUM_STACK_ONLY | CUM_X_MASK | CUM_B_MASK);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2755 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2756 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2757 + return cum;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2758 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2759 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2760 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2761 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2762 +m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2763 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2764 + if (*cump & CUM_STACK_INVALID)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2765 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2766 + *cump &= ~CUM_STACK_INVALID;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2767 + error ("far function needs stack, will not work");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2768 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2769 + return NULL_RTX;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2770 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2771 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2772 +void m6809_asm_trampoline_template(FILE *f)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2773 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2774 + fprintf(f, "ldy #0000\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2775 + fprintf(f, "jmp 0x0000\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2776 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2777 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2778 +/*
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2779 + * Trampoline output:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2780 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2781 + * ldu #&cxt 4 bytes --LDY- ?? ??
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2782 + * jmp fnaddr 3 bytes JMP ?? ??
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2783 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2784 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2785 +m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2786 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2787 + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2788 + /* TODO - optimize by generating the entire trampoline code here,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2789 + * and removing the template altogether, since there are only two
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2790 + * bytes there that matter. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2791 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 2)), cxt);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2792 + emit_move_insn (gen_rtx_MEM (HImode, plus_constant (tramp, 5)), fnaddr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2793 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2794 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2795 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2796 +/** Echo the version of the compiler and the name of the source file
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2797 + * at the beginning of each assembler output file. asm_out_file
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2798 + * is a global FILE * pointing to the output stream. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2799 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2800 +m6809_asm_file_start (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2801 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2802 + const char *module_name;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2803 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2804 + fprintf (asm_out_file, "\n;;; gcc for m6809 : %s %s\n",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2805 + __DATE__, __TIME__);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2806 + fprintf (asm_out_file, ";;; %s\n", version_string);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2807 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2808 + fprintf (asm_out_file, ";;; ABI version %d\n", m6809_abi_version);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2809 + fprintf (asm_out_file, ";;; %s\n",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2810 + (TARGET_BYTE_INT ? "-mint8" : "-mint16"));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2811 + if (TARGET_EXPERIMENT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2812 + fprintf (asm_out_file, ";;; -mexperiment\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2813 + if (TARGET_WPC)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2814 + fprintf (asm_out_file, ";;; -mwpc\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2815 + if (TARGET_6309)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2816 + fprintf (asm_out_file, ";;; -m6309\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2817 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2818 + /* Print the name of the module, which is taken as the base name
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2819 + * of the input file.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2820 + * See the 'User-Defined Symbols' section of the assembler
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2821 + * documentation for the rules on valid symbols.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2822 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2823 + module_name = lbasename (main_input_filename);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2824 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2825 + fprintf (asm_out_file, "\t.module\t");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2826 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2827 + if (*module_name >= '0' && *module_name <= '9')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2828 + fprintf (asm_out_file, "_");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2829 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2830 + while (*module_name)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2831 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2832 + if ((*module_name >= '0' && *module_name <= '9')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2833 + || (*module_name >= 'A' && *module_name <= 'Z')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2834 + || (*module_name >= 'a' && *module_name <= 'z')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2835 + || *module_name == '$'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2836 + || *module_name == '.'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2837 + || *module_name == '_')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2838 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2839 + fprintf (asm_out_file, "%c", *module_name);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2840 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2841 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2842 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2843 + fprintf (asm_out_file, "_");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2844 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2845 + module_name++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2846 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2847 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2848 + fprintf (asm_out_file, "\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2849 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2850 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2851 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2852 +/** Returns true if prologue/epilogue code is required for the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2853 + * current function being compiled.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2854 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2855 + * This is just the inverse of whether the function is declared as
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2856 + * 'naked'.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2857 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2858 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2859 +prologue_epilogue_required (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2860 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2861 + return !m6809_current_function_has_type_attr_p ("naked")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2862 + && !m6809_current_function_has_type_attr_p ("noreturn");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2863 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2864 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2865 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2866 +/** Expand RTL for function entry */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2867 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2868 +emit_prologue_insns (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2869 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2870 + rtx insn;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2871 + unsigned int live_regs = m6809_get_live_regs ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2872 + unsigned int frame_size = get_frame_size ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2873 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2874 + /* Save all registers used, including the frame pointer */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2875 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2876 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2877 + insn = emit_insn (
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2878 + gen_rtx_register_pushpop (UNSPEC_PUSH_RS, live_regs));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2879 + RTX_FRAME_RELATED_P (insn) = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2880 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2881 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2882 + /* Allocate space for local variables */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2883 + if (frame_size != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2884 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2885 + insn = emit_insn (gen_rtx_stack_adjust (MINUS, frame_size));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2886 + RTX_FRAME_RELATED_P (insn) = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2887 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2888 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2889 + /* Set the frame pointer if it is needed */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2890 + if (frame_pointer_needed)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2891 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2892 + insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2893 + RTX_FRAME_RELATED_P (insn) = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2894 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2895 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2896 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2897 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2898 +/** Expand RTL for function exit */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2899 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2900 +emit_epilogue_insns (bool sibcall_p)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2901 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2902 + unsigned int live_regs = m6809_get_live_regs ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2903 + unsigned int frame_size = get_frame_size ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2904 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2905 + if (frame_size != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2906 + emit_insn (gen_rtx_stack_adjust (PLUS, frame_size));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2907 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2908 + if (sibcall_p)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2909 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2910 + if (live_regs)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2911 + emit_insn (gen_rtx_register_pushpop (UNSPEC_POP_RS, live_regs));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2912 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2913 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2914 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2915 + if (live_regs && !m6809_current_function_has_type_attr_p ("interrupt"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2916 + emit_insn (
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2917 + gen_rtx_register_pushpop (UNSPEC_POP_RS, PC_REGBIT | live_regs));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2918 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2919 + if (m6809_current_function_has_type_attr_p ("interrupt"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2920 + emit_jump_insn (gen_return_rti ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2921 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2922 + emit_jump_insn (gen_return_rts ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2923 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2924 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2925 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2926 +#if 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2927 +/** Predefine some preprocessor names according to the currently
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2928 + * selected compiler options */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2929 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2930 +m6809_cpu_cpp_builtins (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2931 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2932 + if (TARGET_6309)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2933 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2934 + builtin_define_std ("__M6309__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2935 + builtin_define_std ("__m6309__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2936 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2937 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2938 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2939 + builtin_define_std ("__M6809__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2940 + builtin_define_std ("__m6809__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2941 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2942 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2943 + if (TARGET_BYTE_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2944 + builtin_define_std ("__int8__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2945 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2946 + builtin_define_std ("__int16__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2947 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2948 + switch (m6809_abi_version)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2949 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2950 + case M6809_ABI_VERSION_STACK:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2951 + builtin_define_std ("__regargs__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2952 + builtin_define_std ("__ABI_STACK__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2953 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2954 + case M6809_ABI_VERSION_REGS:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2955 + builtin_define_std ("__ABI_REGS__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2956 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2957 + case M6809_ABI_VERSION_BX:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2958 + builtin_define_std ("__ABI_BX__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2959 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2960 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2961 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2962 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2963 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2964 + if (TARGET_WPC)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2965 + builtin_define_std ("__WPC__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2966 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2967 + if (TARGET_DRET)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2968 + builtin_define_std ("__DRET__");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2969 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2970 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2971 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2972 +#define MAX_ASM_ASCII_STRING 48
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2973 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2974 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2975 +m6809_output_ascii (FILE *fp, const char *str, unsigned long size)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2976 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2977 + unsigned long i;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2978 + bool use_ascii = true;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2979 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2980 + /* If the size is too large, then break this up into multiple
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2981 + outputs. The assembler can only output roughly 48 bytes at a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2982 + time. Note that if there are lots of escape sequences in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2983 + the string, this may fail. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2984 + if (size > MAX_ASM_ASCII_STRING)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2985 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2986 + m6809_output_ascii (fp, str, MAX_ASM_ASCII_STRING);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2987 + m6809_output_ascii (fp, str + MAX_ASM_ASCII_STRING,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2988 + size - MAX_ASM_ASCII_STRING);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2989 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2990 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2991 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2992 + /* Check for 8-bit codes, which cannot be embedded in an .ascii */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2993 + for (i = 0; i < size; i++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2994 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2995 + int c = str[i] & 0377;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2996 + if (c >= 0x80)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2997 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2998 + use_ascii = false;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
2999 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3000 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3001 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3002 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3003 + if (use_ascii)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3004 + fprintf (fp, "\t.ascii \"");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3005 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3006 + for (i = 0; i < size; i++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3007 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3008 + int c = str[i] & 0377;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3009 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3010 + if (use_ascii)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3011 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3012 + /* Just output the plain character if it is printable,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3013 + otherwise output the escape code for the character.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3014 + The assembler recognizes the same C-style octal escape sequences,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3015 + except that it only supports 7-bit codes. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3016 + if (c >= ' ' && c < 0177 && c != '\\' && c != '"')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3017 + putc (c, fp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3018 + else switch (c)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3019 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3020 + case '\n':
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3021 +#ifndef TARGET_COCO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3022 + fputs ("\\n", fp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3023 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3024 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3025 + /* On the CoCo, we fallthrough and treat '\n' like '\r'. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3026 + case '\r':
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3027 + fputs ("\\r", fp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3028 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3029 + case '\t':
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3030 + fputs ("\\t", fp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3031 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3032 + case '\f':
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3033 + fputs ("\\f", fp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3034 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3035 + case 0:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3036 + fputs ("\\0", fp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3037 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3038 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3039 + fprintf (fp, "\\%03o", c);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3040 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3041 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3042 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3043 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3044 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3045 + fprintf (fp, "\t.byte\t0x%02X\n", c);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3046 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3047 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3048 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3049 + if (use_ascii)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3050 + fprintf (fp, "\"\n");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3051 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3052 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3053 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3054 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3055 +m6809_output_quoted_string (FILE *asm_file, const char *string)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3056 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3057 + char c;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3058 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3059 + if (strlen (string) > MAX_ASM_ASCII_STRING)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3060 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3061 + /* The string length is too large. We'll have to truncate it.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3062 + This is only called from debugging functions, so it's usually
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3063 + not critical. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3064 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3065 + char truncated_string[MAX_ASM_ASCII_STRING+1];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3066 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3067 + /* Copy as many characters as we can. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3068 + strncpy (truncated_string, string, MAX_ASM_ASCII_STRING);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3069 + truncated_string[MAX_ASM_ASCII_STRING] = '\0';
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3070 + string = truncated_string;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3071 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3072 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3073 + /* Copied from toplev.c */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3074 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3075 + putc ('\"', asm_file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3076 + while ((c = *string++) != 0) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3077 + if (ISPRINT (c)) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3078 + if (c == '\"' || c == '\\')
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3079 + putc ('\\', asm_file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3080 + putc (c, asm_file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3081 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3082 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3083 + fprintf (asm_file, "\\%03o", (unsigned char) c);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3084 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3085 + putc ('\"', asm_file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3086 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3087 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3088 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3089 +/** Output the assembly code for a shift instruction where the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3090 + * shift count is not constant. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3091 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3092 +m6809_output_shift_insn (int rtx_code, rtx *operands)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3093 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3094 + struct shift_opcode *op;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3095 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3096 + if (GET_CODE (operands[2]) == CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3097 + abort ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3098 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3099 + if (optimize_size && GET_MODE (operands[0]) == HImode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3100 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3101 + switch (rtx_code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3102 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3103 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3104 + output_asm_insn ("jsr\t_ashlhi3", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3105 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3106 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3107 + output_asm_insn ("jsr\t_ashrhi3", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3108 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3109 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3110 + output_asm_insn ("jsr\t_lshrhi3", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3111 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3112 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3113 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3114 + else if (GET_MODE (operands[0]) == HImode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3115 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3116 + switch (rtx_code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3117 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3118 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3119 + m6809_gen_register_shift (operands, "aslb", "rola");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3120 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3121 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3122 + m6809_gen_register_shift (operands, "asra", "rorb");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3123 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3124 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3125 + m6809_gen_register_shift (operands, "lsra", "rorb");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3126 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3127 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3128 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3129 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3130 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3131 + switch (rtx_code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3132 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3133 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3134 + m6809_gen_register_shift (operands, "aslb", NULL);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3135 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3136 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3137 + m6809_gen_register_shift (operands, "asrb", NULL);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3138 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3139 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3140 + m6809_gen_register_shift (operands, "lsrb", NULL);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3141 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3142 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3143 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3144 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3145 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3146 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3147 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3148 +m6809_emit_move_insn (rtx dst, rtx src)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3149 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3150 + emit_insn (gen_rtx_SET (VOIDmode, dst, src));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3151 + if (ACC_A_REG_P (dst))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3152 + emit_insn (gen_rtx_USE (VOIDmode, dst));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3153 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3154 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3155 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3156 +/** Split a complex shift instruction into multiple CPU
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3157 + * shift instructions. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3158 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3159 +m6809_split_shift (enum rtx_code code, rtx *operands)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3160 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3161 + enum machine_mode mode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3162 + int count;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3163 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3164 + mode = GET_MODE (operands[0]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3165 + count = INTVAL (operands[2]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3166 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3167 + /* Handle a shift count outside the range of 0 .. N-1, where
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3168 + * N is the mode size in bits. We normalize the count, and
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3169 + * for negative counts we also invert the direction of the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3170 + * shift. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3171 + if ((count < 0) || (count >= 8 * GET_MODE_SIZE (mode)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3172 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3173 + if (count < 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3174 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3175 + count = -count;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3176 + code = (code == ASHIFT) ? ASHIFTRT : ASHIFT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3177 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3178 + count %= (8 * GET_MODE_SIZE (mode));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3179 + m6809_emit_move_insn (operands[0],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3180 + gen_rtx_fmt_ee (code, mode, operands[1],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3181 + gen_rtx_CONST_INT (VOIDmode, count)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3182 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3183 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3184 + /* Handle shift by zero explicitly as a no-op. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3185 + if (count == 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3186 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3187 + emit_insn (gen_nop ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3188 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3189 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3190 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3191 + /* Decompose the shift by a constant N > 8 into two
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3192 + * shifts, first by 8 and then by N-8.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3193 + * This "speeds up" the process for large shifts that would be
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3194 + * handled below, but allows for some optimization.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3195 + * In some cases shift by 8 can be implemented fast. If an
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3196 + * instruction to shift by 8 is defined, it will be used here;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3197 + * otherwise it will be further decomposed as below. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3198 + if (mode == HImode && count > 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3199 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3200 + rtx output = operands[0];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3201 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3202 + m6809_emit_move_insn (operands[0],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3203 + gen_rtx_fmt_ee (code, mode, operands[1],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3204 + gen_rtx_CONST_INT (VOIDmode, 8)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3205 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3206 + /* Unsigned shifts always produce a zero in either the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3207 + * upper or lower half of the output; then, that part
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3208 + * does not need to be shifted anymore. We modify the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3209 + * output and the subsequent instructions to operate in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3210 + * QImode only on the relevant part. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3211 + if (REG_P (output))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3212 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3213 + if (code == ASHIFT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3214 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3215 + output = gen_rtx_REG (QImode, HARD_A_REGNUM);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3216 + mode = QImode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3217 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3218 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3219 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3220 + output = gen_rtx_REG (QImode, HARD_D_REGNUM);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3221 + mode = QImode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3222 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3223 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3224 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3225 + m6809_emit_move_insn (output,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3226 + gen_rtx_fmt_ee (code, mode, copy_rtx (output),
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3227 + gen_rtx_CONST_INT (VOIDmode, count-8)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3228 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3229 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3230 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3231 + /* Rewrite the unsigned shift of an 8-bit register by a large constant N
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3232 + * (near to the maximum of 8) as a rotate and mask. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3233 + if (mode == QImode && REG_P (operands[0]) && count >= ((code == ASHIFTRT) ? 7 : 6))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3234 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3235 + unsigned int mask;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3236 + unsigned int was_signed = (code == ASHIFTRT);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3237 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3238 + code = (code == ASHIFT) ? ROTATERT : ROTATE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3239 + if (code == ROTATE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3240 + mask = (count == 6) ? 0x03 : 0x01;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3241 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3242 + mask = (count == 6) ? 0xC0 - 0x100 : 0x80 - 0x100;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3243 + count = 9 - count;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3244 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3245 + do {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3246 + m6809_emit_move_insn (operands[0],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3247 + gen_rtx_fmt_ee (code, QImode, operands[1], const1_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3248 + } while (--count != 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3249 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3250 + m6809_emit_move_insn (operands[0],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3251 + gen_rtx_fmt_ee (AND, QImode, operands[1],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3252 + gen_rtx_CONST_INT (VOIDmode, mask)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3253 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3254 + if (was_signed)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3255 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3256 + emit_insn (gen_negqi2 (operands[0], copy_rtx (operands[0])));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3257 + if (ACC_A_REG_P (operands[0]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3258 + emit_insn (gen_rtx_USE (VOIDmode, operands[0]));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3259 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3260 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3261 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3262 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3263 + /* Decompose the shift by any constant N > 1 into a sequence
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3264 + * of N shifts.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3265 + * This is done recursively, by creating a shift by 1 and a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3266 + * shift by N-1, as long as N>1. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3267 + if (count > 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3268 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3269 + m6809_emit_move_insn (operands[0],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3270 + gen_rtx_fmt_ee (code, mode, operands[1], const1_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3271 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3272 + m6809_emit_move_insn (operands[0],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3273 + gen_rtx_fmt_ee (code, mode, operands[1],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3274 + gen_rtx_CONST_INT (VOIDmode, count-1)));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3275 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3276 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3277 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3278 + /* Decompose the single shift of a 16-bit quantity into two
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3279 + * CPU instructions, one for each 8-bit half.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3280 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3281 + if (mode == HImode && count == 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3282 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3283 + rtx first, second;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3284 + enum rtx_code rotate_code;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3285 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3286 + rotate_code = (code == ASHIFT) ? ROTATE : ROTATERT;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3287 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3288 + /* Split the operand into two 8-bit entities.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3289 + * FIRST is the one that will get shifted via a regular CPU
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3290 + * instruction.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3291 + * SECOND is the one that will have the result of the first shift
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3292 + * rotated in.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3293 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3294 + * We initialize first and second as if we are doing a left shift,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3295 + * then swap the operands if it's a right shift.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3296 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3297 + if (REG_P (operands[0]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3298 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3299 + first = gen_rtx_REG (QImode, HARD_D_REGNUM); /* HARD_B_REGNUM? */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3300 + second = gen_rtx_REG (QImode, HARD_A_REGNUM);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3301 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3302 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3303 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3304 + first = adjust_address (operands[0], QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3305 + second = adjust_address (operands[0], QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3306 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3307 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3308 + if (rotate_code == ROTATERT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3309 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3310 + rtx tmp; tmp = first; first = second; second = tmp;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3311 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3312 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3313 + /* Decompose into a shift and a rotate instruction. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3314 + m6809_emit_move_insn (first,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3315 + gen_rtx_fmt_ee (code, QImode, copy_rtx (first), const1_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3316 + m6809_emit_move_insn (second,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3317 + gen_rtx_fmt_ee (rotate_code, QImode, copy_rtx (second), const1_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3318 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3319 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3320 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3321 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3322 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3323 +/** Adjust register usage based on compile-time flags. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3324 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3325 +m6809_conditional_register_usage (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3326 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3327 + unsigned int soft_regno;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3328 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3329 +#ifdef CONFIG_SOFT_REGS_ALWAYS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3330 + m6809_soft_regs = CONFIG_SOFT_REGS_ALWAYS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3331 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3332 + if (!m6809_soft_reg_count)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3333 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3334 + m6809_soft_regs = atoi (m6809_soft_reg_count);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3335 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3336 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3337 + if (m6809_soft_regs == 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3338 + return;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3339 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3340 + if (m6809_soft_regs > NUM_M_REGS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3341 + m6809_soft_regs = NUM_M_REGS;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3342 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3343 + /* Registers are marked FIXED by default. Free up if
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3344 + the user wishes. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3345 + for (soft_regno = 1; soft_regno < m6809_soft_regs; soft_regno++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3346 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3347 + fixed_regs[SOFT_M0_REGNUM + soft_regno] = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3348 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3349 + /* Mark the softregs as call-clobbered, so that they need
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3350 + * not be saved/restored on function entry/exit. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3351 + call_used_regs[SOFT_M0_REGNUM + soft_regno] = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3352 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3353 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3354 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3355 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3356 +/** Return a RTX representing how to return a value from a function.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3357 + VALTYPE gives the type of the value, FUNC identifies the function
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3358 + itself.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3359 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3360 + In general, we only care about the width of the result. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3361 +rtx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3362 +m6809_function_value (const tree valtype, const tree func ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3363 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3364 + unsigned int regno;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3365 + enum machine_mode mode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3366 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3367 + /* Get the mode (i.e. width) of the result. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3368 + mode = TYPE_MODE (valtype);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3369 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3370 + if (lookup_attribute ("boolean", TYPE_ATTRIBUTES (valtype)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3371 + regno = HARD_Z_REGNUM;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3372 + else if (mode == QImode || (TARGET_DRET && mode == HImode))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3373 + regno = HARD_D_REGNUM;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3374 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3375 + regno = HARD_X_REGNUM;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3376 + return gen_rtx_REG (mode, regno);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3377 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3378 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3379 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3380 +/** Return 1 if REGNO is possibly needed to return the result
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3381 +of a function, 0 otherwise. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3382 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3383 +m6809_function_value_regno_p (unsigned int regno)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3384 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3385 + if (regno == HARD_Z_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3386 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3387 + else if ((TARGET_BYTE_INT || TARGET_DRET) && regno == HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3388 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3389 + else if (!TARGET_DRET && regno == HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3390 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3391 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3392 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3393 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3394 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3395 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3396 +#ifdef TRACE_PEEPHOLE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3397 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3398 +m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3399 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3400 + if (stage == PEEP_END)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3401 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3402 + printf ("%s: peephole %d pattern and predicate matched\n",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3403 + main_input_filename, peephole_id);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3404 + fflush (stdout);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3405 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3406 + else if (stage == PEEP_COND)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3407 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3408 + printf ("%s: peephole %d? at least pattern matched\n",
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3409 + main_input_filename, peephole_id);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3410 + fflush (stdout);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3411 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3412 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3413 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3414 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3415 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3416 +m6809_match_peephole2 (unsigned int peephole_id ATTRIBUTE_UNUSED,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3417 + unsigned int stage ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3418 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3419 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3420 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3421 +#endif /* TRACE_PEEPHOLE */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3422 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3423 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3424 +/** Return 1 if it is OK to store a value of MODE in REGNO. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3425 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3426 +m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3427 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3428 + /* Soft registers, as they are just memory, can really hold
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3429 + values of any type. However we restrict them to values of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3430 + size HImode or QImode to prevent exhausting them for larger
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3431 + values.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3432 + Word values cannot be placed into the first soft register,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3433 + as it is the low byte that is being placed there, which
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3434 + corrupts the (non-soft) register before it. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3435 + if (M_REGNO_P (regno))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3436 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3437 + switch (GET_MODE_SIZE (mode))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3438 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3439 + case 1:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3440 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3441 + case 2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3442 + return regno != SOFT_M0_REGNUM;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3443 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3444 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3445 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3446 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3447 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3448 + /* VOIDmode can be stored anywhere */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3449 + else if (mode == VOIDmode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3450 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3451 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3452 + /* Zero is a reserved register, but problems occur if we don't
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3453 + say yes here??? */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3454 + else if (regno == 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3455 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3456 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3457 + /* For other registers, return true only if the requested size
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3458 + exactly matches the hardware size. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3459 + else if ((G_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 2))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3460 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3461 + else if ((BYTE_REGNO_P (regno)) && (GET_MODE_SIZE (mode) == 1))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3462 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3463 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3464 + return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3465 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3466 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3467 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3468 +/* exp is the call expression. DECL is the called function,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3469 + * or NULL for an indirect call */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3470 +bool
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3471 +m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3472 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3473 + tree type, arg;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3474 + const char *name;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3475 + bool result = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3476 + int argcount = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3477 + int step = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3478 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3479 + /* If there is no DECL, it is an indirect call.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3480 + * Never optimize this??? */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3481 + if (decl == NULL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3482 + goto done;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3483 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3484 + /* Never allow an interrupt handler to be optimized this way. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3485 + if (m6809_function_has_type_attr_p (decl, "interrupt"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3486 + goto done;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3487 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3488 + /* Skip sibcall if the type can't be found for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3489 + * some reason */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3490 + step++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3491 + name = IDENTIFIER_POINTER (DECL_NAME (decl));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3492 + type = TREE_TYPE (decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3493 + if (type == NULL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3494 + goto done;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3495 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3496 + /* Skip sibcall if the target is a far function */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3497 + step++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3498 + if (far_function_type_p (type) != NULL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3499 + goto done;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3500 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3501 + /* Skip sibcall if the called function's arguments are
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3502 + * variable */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3503 + step++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3504 + if (TYPE_ARG_TYPES (type) == NULL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3505 + goto done;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3506 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3507 + /* Allow sibcalls in other cases. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3508 + result = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3509 +done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3510 + /* printf ("%s ok for sibcall? %s, step %d, args %d\n", name, result ? "yes" : "no", step, argcount); */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3511 + return result;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3512 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3513 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3514 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3515 +/** Emit code for the 'casesi' pattern.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3516 + * This pattern is only used in 8-bit mode, and can be disabled
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3517 + * with -mold-case there as well. The rationale for this is to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3518 + * do a better job than the simpler but well-tested 'tablejump'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3519 + * method.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3520 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3521 + * For small jumptables, where the switch expression is an
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3522 + * 8-bit value, the lookup can be done more efficiently
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3523 + * using the "B,X" style index mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3524 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3525 +m6809_do_casesi (rtx index, rtx lower_bound, rtx range,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3526 + rtx table_label, rtx default_label)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3527 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3528 + enum machine_mode mode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3529 + rtx scaled;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3530 + rtx table_in_reg;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3531 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3532 + /* expr.c has to be patched so that it does not promote
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3533 + * the expression to SImode, but rather to HImode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3534 + * Fail now if that isn't the case. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3535 + if (GET_MODE_SIZE (GET_MODE (index)) > GET_MODE_SIZE (HImode))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3536 + error ("try_casesi promotion bug");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3537 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3538 + /* Determine whether or not we are going to work primarily in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3539 + * QImode or HImode. This depends on the size of the index
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3540 + * into the lookup table. QImode can only be used when the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3541 + * index is less than 0x40, since it will be doubled but
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3542 + * must remain unsigned. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3543 + if ((GET_CODE (range) == CONST_INT) && (INTVAL (range) < 0x40))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3544 + mode = QImode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3545 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3546 + mode = HImode;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3547 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3548 + /* Convert to QImode if necessary */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3549 + if (mode == QImode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3550 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3551 + index = gen_lowpart_general (mode, index);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3552 + lower_bound = gen_lowpart_general (mode, lower_bound);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3553 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3554 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3555 + /* Translate from case value to table index by subtraction */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3556 + if (lower_bound != const0_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3557 + index = expand_binop (mode, sub_optab, index, lower_bound,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3558 + NULL_RTX, 0, OPTAB_LIB_WIDEN);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3559 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3560 + /* Emit compare-and-jump to test for index out-of-range */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3561 + emit_cmp_and_jump_insns (index, range, GTU, NULL_RTX, mode, 1,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3562 + default_label);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3563 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3564 + /* Put the table address is in a register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3565 + table_in_reg = gen_reg_rtx (Pmode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3566 + emit_move_insn (table_in_reg, gen_rtx_LABEL_REF (Pmode, table_label));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3567 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3568 + /* Emit table lookup and jump */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3569 + if (mode == QImode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3570 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3571 + /* Scale the index */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3572 + scaled = gen_reg_rtx (QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3573 + emit_insn (gen_ashlqi3 (scaled, index, const1_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3574 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3575 + /* Emit the jump */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3576 + emit_jump_insn (gen_tablejump_short_offset (scaled, table_in_reg));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3577 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3578 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3579 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3580 + /* Scale the index */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3581 + emit_insn (gen_ashlhi3 (index, index, const1_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3582 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3583 + /* Emit the jump */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3584 + emit_jump_insn (gen_tablejump_long_offset (index, table_in_reg));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3585 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3586 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3587 + /* Copied from expr.c */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3588 + if (!CASE_VECTOR_PC_RELATIVE && !flag_pic)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3589 + emit_barrier ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3590 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3591 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3592 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3593 +/** Output the assembly code for a 32-bit add/subtract. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3594 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3595 +m6809_output_addsi3 (int rtx_code, rtx *operands)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3596 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3597 + rtx xoperands[8];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3598 + rtx dst = operands[0];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3599 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3600 + /* Prepare the operands by splitting each SImode into two HImodes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3601 + that can be operated independently. The high word of operand 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3602 + is further divided into two QImode components for use with 'adc'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3603 + style instructions. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3604 + xoperands[7] = operands[3];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3605 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3606 + xoperands[0] = adjust_address (dst, HImode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3607 + xoperands[3] = adjust_address (dst, HImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3608 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3609 +#if 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3610 + xoperands[2] = adjust_address (operands[1], HImode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3611 + xoperands[6] = adjust_address (operands[1], HImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3612 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3613 + /* Operand 2 may be a MEM or a CONST_INT */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3614 + if (GET_CODE (operands[2]) == CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3615 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3616 + xoperands[1] = gen_int_mode (INTVAL (operands[2]) & 0xFFFF, HImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3617 + xoperands[4] = gen_int_mode ((INTVAL (operands[2]) >> 24) & 0xFF, QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3618 + xoperands[5] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFF, QImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3619 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3620 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3621 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3622 + xoperands[1] = adjust_address (operands[2], HImode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3623 + xoperands[4] = adjust_address (operands[2], QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3624 + xoperands[5] = adjust_address (operands[2], QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3625 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3626 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3627 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3628 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3629 +#if 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3630 + xoperands[1] = adjust_address (operands[1], HImode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3631 + xoperands[4] = adjust_address (operands[1], QImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3632 + xoperands[5] = adjust_address (operands[1], QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3633 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3634 + /* Operand 2 may be a MEM or a CONST_INT */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3635 + if (GET_CODE (operands[2]) == CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3636 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3637 + xoperands[2] = gen_int_mode ((INTVAL (operands[2])) & 0xFFFF, HImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3638 + xoperands[6] = gen_int_mode ((INTVAL (operands[2]) >> 16) & 0xFFFF, HImode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3639 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3640 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3641 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3642 + xoperands[2] = adjust_address (operands[2], HImode, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3643 + xoperands[6] = adjust_address (operands[2], HImode, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3644 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3645 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3646 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3647 + /* Output the assembly code. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3648 + if (rtx_code == PLUS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3649 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3650 + output_asm_insn ("ld%7\t%2", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3651 + output_asm_insn ("add%7\t%1", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3652 + output_asm_insn ("st%7\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3653 + output_asm_insn ("ld%7\t%6", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3654 + output_asm_insn ("adcb\t%5", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3655 + output_asm_insn ("adca\t%4", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3656 + output_asm_insn ("st%7\t%3", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3657 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3658 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3659 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3660 + output_asm_insn ("ld%7\t%2", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3661 + output_asm_insn ("sub%7\t%1", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3662 + output_asm_insn ("st%7\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3663 + output_asm_insn ("ld%7\t%6", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3664 + output_asm_insn ("sbcb\t%5", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3665 + output_asm_insn ("sbca\t%4", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3666 + output_asm_insn ("st%7\t%3", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3667 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3668 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3669 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3670 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3671 +#if 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3672 +/** Output the assembly code for a 32-bit shift.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3673 +Operands 0 and 1 must be the same rtx, forced by a matching
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3674 +constraint. Operand 2 must be a CONST_INT. Operand 3 is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3675 +"d" in case a temporary reg is needed. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3676 +void
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3677 +m6809_output_shiftsi3 (int rtx_code, rtx *operands)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3678 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3679 + unsigned int count = INTVAL (operands[2]) % 32;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3680 + unsigned int size = 4; /* sizeof (SImode) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3681 + int s;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3682 + rtx xoperands[4];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3683 + int op;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3684 + int start, end, step;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3685 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3686 + /* Initialize */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3687 + if (rtx_code == ASHIFT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3688 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3689 + start = size-1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3690 + end = -1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3691 + step = -1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3692 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3693 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3694 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3695 + start = 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3696 + end = size;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3697 + step = 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3698 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3699 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3700 + xoperands[2] = operands[2];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3701 + xoperands[3] = operands[3];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3702 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3703 + if (count <= 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3704 + abort ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3705 + if (rtx_code == ROTATE || rtx_code == ROTATERT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3706 + abort ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3707 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3708 + /* Extract bit shifts over 16 bits by HImode moves. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3709 + if (count >= 16)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3710 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3711 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3712 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3713 + /* Extract bit shifts over 8 bits by QImode moves. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3714 + if (count >= 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3715 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3716 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3717 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3718 + /* Iterate over the number of bits to be shifted. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3719 + while (count > 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3720 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3721 + /* Each bit to be shifted requires 1 proper bit shift
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3722 + and 3 rotates. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3723 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3724 + /* First, do the arithmetic/logical shift. Left shifts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3725 + start from the LSB; right shifts start from the MSB. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3726 + xoperands[0] = adjust_address (operands[0], QImode, start);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3727 + switch (rtx_code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3728 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3729 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3730 + output_asm_insn ("asl\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3731 + start--;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3732 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3733 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3734 + output_asm_insn ("asr\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3735 + start++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3736 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3737 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3738 + output_asm_insn ("lsr\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3739 + start++;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3740 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3741 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3742 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3743 + /* Next, rotate the other bytes */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3744 + for (s = start; s != end; s += step)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3745 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3746 + xoperands[0] = adjust_address (operands[0], QImode, s);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3747 + switch (rtx_code)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3748 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3749 + case ASHIFT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3750 + output_asm_insn ("rol\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3751 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3752 + case ASHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3753 + case LSHIFTRT:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3754 + output_asm_insn ("ror\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3755 + break;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3756 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3757 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3758 + count--;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3759 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3760 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3761 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3762 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3763 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3764 +power_of_two_p (unsigned int n)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3765 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3766 + return (n & (n-1)) == 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3767 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3768 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3769 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3770 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3771 +m6809_can_eliminate (int from, int to)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3772 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3773 + if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3774 + return !frame_pointer_needed;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3775 + return 1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3776 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3777 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3778 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3779 +int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3780 +m6809_initial_elimination_offset (int from, int to)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3781 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3782 + switch (from)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3783 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3784 + case ARG_POINTER_REGNUM:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3785 + return get_frame_size () + m6809_get_regs_size (m6809_get_live_regs ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3786 + case FRAME_POINTER_REGNUM:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3787 + return get_frame_size ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3788 + default:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3789 + gcc_unreachable ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3790 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3791 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3792 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3793 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3794 +bool
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3795 +m6809_frame_pointer_required (void)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3796 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3797 + return false;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3798 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3799 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3800 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3801 +/* Defines the target-specific hooks structure. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3802 +struct gcc_target targetm = TARGET_INITIALIZER;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3803 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.h gcc-4.6.4/gcc/config/m6809/m6809.h
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3804 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.h 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3805 +++ gcc-4.6.4/gcc/config/m6809/m6809.h 2017-11-29 17:11:09.221248469 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3806 @@ -0,0 +1,1336 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3807 +/* Definitions of target machine for GNU compiler. MC6809 version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3808 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3809 + MC6809 Version by Tom Jones (jones@sal.wisc.edu)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3810 + Space Astronomy Laboratory
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3811 + University of Wisconsin at Madison
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3812 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3813 + minor changes to adapt it to gcc-2.5.8 by Matthias Doerfel
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3814 + ( msdoerfe@informatik.uni-erlangen.de )
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3815 + also added #pragma interrupt (inspired by gcc-6811)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3816 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3817 + minor changes to adapt it to gcc-2.8.0 by Eric Botcazou
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3818 + (ebotcazou@multimania.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3819 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3820 + minor changes to adapt it to egcs-1.1.2 by Eric Botcazou
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3821 + (ebotcazou@multimania.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3822 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3823 + minor changes to adapt it to gcc-2.95.3 by Eric Botcazou
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3824 + (ebotcazou@multimania.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3825 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3826 + changes for gcc-3.1.1 by ???
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3827 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3828 + further changes for gcc-3.1.1 and beyond by Brian Dominy
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3829 + (brian@oddchange.com)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3830 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3831 + even more changes for gcc-4.6.1 by William Astle (lost@l-w.ca)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3832 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3833 +This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3834 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3835 +GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3836 +it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3837 +the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3838 +any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3839 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3840 +GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3841 +but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3842 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3843 +GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3844 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3845 +You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3846 +along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3847 +<http://www.gnu.org/licenses/>. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3848 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3849 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3850 +/* Helper macros for creating strings with macros */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3851 +#define C_STRING(x) C_STR(x)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3852 +#define C_STR(x) #x
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3853 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3854 +/* Certain parts of GCC include host-side includes, which is bad.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3855 + * Some things that get pulled in need to be undone.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3856 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3857 +#undef HAVE_GAS_HIDDEN
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3858 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3859 +/* Names to predefine in the preprocessor for this target machine. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3860 +/*#define TARGET_CPU_CPP_BUILTINS() m6809_cpu_cpp_builtins () */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3861 +#define TARGET_CPU_CPP_BUILTINS() do \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3862 + { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3863 + if (TARGET_6309) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3864 + { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3865 + builtin_define_std ("__M6309__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3866 + builtin_define_std ("__m6309__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3867 + } \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3868 + else \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3869 + { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3870 + builtin_define_std ("__M6809__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3871 + builtin_define_std ("__m6809__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3872 + } \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3873 + \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3874 + if (TARGET_BYTE_INT) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3875 + builtin_define_std ("__int8__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3876 + else \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3877 + builtin_define_std ("__int16__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3878 + \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3879 + switch (m6809_abi_version) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3880 + { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3881 + case M6809_ABI_VERSION_STACK: \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3882 + builtin_define_std ("__regargs__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3883 + builtin_define_std ("__ABI_STACK__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3884 + break; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3885 + case M6809_ABI_VERSION_REGS: \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3886 + builtin_define_std ("__ABI_REGS__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3887 + break; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3888 + case M6809_ABI_VERSION_BX: \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3889 + builtin_define_std ("__ABI_BX__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3890 + break; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3891 + default: \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3892 + break; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3893 + } \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3894 + \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3895 + if (TARGET_WPC) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3896 + builtin_define_std ("__WPC__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3897 + \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3898 + if (TARGET_DRET) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3899 + builtin_define_std ("__DRET__"); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3900 + } while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3901 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3902 +/* As an embedded target, we have no libc. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3903 +#ifndef inhibit_libc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3904 +#define inhibit_libc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3905 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3906 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3907 +/* Print subsidiary information on the compiler version in use. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3908 +#define TARGET_VERSION fprintf (stderr, " (MC6809)");
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3909 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3910 +/* Run-time compilation parameters selecting different hardware subsets. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3911 +/*extern int target_flags; */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3912 +extern short *reg_renumber; /* def in local_alloc.c */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3913 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3914 +/* Runtime current values of section names */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3915 +extern int section_changed;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3916 +extern char code_section_op[], data_section_op[], bss_section_op[];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3917 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3918 +#define WARNING_OPT 0,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3919 +/*extern const char *m6809_abi_version_ptr; */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3920 +extern unsigned int m6809_soft_regs;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3921 +extern unsigned int m6809_abi_version;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3922 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3923 +/* ABI versions */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3924 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3925 +#define M6809_ABI_VERSION_STACK 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3926 +#define M6809_ABI_VERSION_REGS 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3927 +#define M6809_ABI_VERSION_BX 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3928 +#define M6809_ABI_VERSION_LATEST (M6809_ABI_VERSION_BX)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3929 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3930 +/* Allow $ in identifiers */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3931 +#define DOLLARS_IN_IDENTIFIERS 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3932 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3933 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3934 + Target machine storage layout
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3935 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3936 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3937 +/* Define this if most significant bit is lowest numbered
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3938 + in instructions that operate on numbered bit-fields. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3939 +#define BITS_BIG_ENDIAN 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3940 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3941 +/* Define to 1 if most significant byte of a word is the lowest numbered. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3942 +#define BYTES_BIG_ENDIAN 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3943 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3944 +/* Define to 1 if most significant word of a multiword value is the lowest numbered. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3945 +#define WORDS_BIG_ENDIAN 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3946 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3947 +/* Number of bits in an addressible storage unit */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3948 +#define BITS_PER_UNIT 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3949 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3950 +/* Width in bits of a "word", or the contents of a machine register.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3951 + * Although the 6809 has a few byte registers, define this to 16-bits
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3952 + * since this is the natural size of most registers. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3953 +#define BITS_PER_WORD 16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3954 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3955 +/* Width of a word, in units (bytes). */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3956 +#define UNITS_PER_WORD (BITS_PER_WORD/8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3957 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3958 +/* Width in bits of a pointer. See also the macro `Pmode' defined below. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3959 +#define POINTER_SIZE 16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3960 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3961 +/* Allocation boundary (bits) for storing pointers in memory. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3962 +#define POINTER_BOUNDARY 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3963 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3964 +/* Allocation boundary (bits) for storing arguments in argument list. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3965 +/* PARM_BOUNDARY is divided by BITS_PER_WORD in expr.c -- tej */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3966 +#define PARM_BOUNDARY 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3967 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3968 +/* Boundary (bits) on which stack pointer should be aligned. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3969 +#define STACK_BOUNDARY 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3970 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3971 +/* Allocation boundary (bits) for the code of a function. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3972 +#define FUNCTION_BOUNDARY 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3973 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3974 +/* Alignment of field after `int : 0' in a structure. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3975 +#define EMPTY_FIELD_BOUNDARY 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3976 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3977 +/* Every structure's size must be a multiple of this. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3978 +#define STRUCTURE_SIZE_BOUNDARY 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3979 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3980 +/* Largest mode size to use when putting an object, including
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3981 + * a structure, into a register. By limiting this to 16, no
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3982 + * 32-bit objects will ever be allocated to a pair of hard
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3983 + * registers. This is a good thing, since there aren't that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3984 + * many of them. 32-bit objects are only needed for floats
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3985 + * and "long long"s. Larger values have been tried and did not
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3986 + * work. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3987 +#define MAX_FIXED_MODE_SIZE 16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3988 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3989 +/* No data type wants to be aligned rounder than this. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3990 +#define BIGGEST_ALIGNMENT 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3991 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3992 +/* Define this if move instructions will actually fail to work
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3993 + when given unaligned data. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3994 +#define STRICT_ALIGNMENT 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3995 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3996 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3997 + Standard register usage.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3998 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
3999 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4000 +/* Register values as bitmasks.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4001 + * TODO : merge D_REGBIT and B_REGBIT, and treat this as the same
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4002 + * register. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4003 +#define RSVD1_REGBIT (1 << HARD_RSVD1_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4004 +#define D_REGBIT (1 << HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4005 +#define X_REGBIT (1 << HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4006 +#define Y_REGBIT (1 << HARD_Y_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4007 +#define U_REGBIT (1 << HARD_U_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4008 +#define S_REGBIT (1 << HARD_S_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4009 +#define PC_REGBIT (1 << HARD_PC_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4010 +#define Z_REGBIT (1 << HARD_Z_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4011 +#define A_REGBIT (1 << HARD_A_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4012 +#define B_REGBIT (1 << HARD_B_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4013 +#define CC_REGBIT (1 << HARD_CC_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4014 +#define DP_REGBIT (1 << HARD_DP_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4015 +#define SOFT_FP_REGBIT (1 << SOFT_FP_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4016 +#define SOFT_AP_REGBIT (1 << SOFT_AP_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4017 +#define M_REGBIT(n) (1 << (SOFT_M0_REGNUM + n))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4018 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4019 +/* Macros for dealing with set of registers.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4020 + * A register set is just a bitwise-OR of all the register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4021 + * bitmask values. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4022 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4023 +/* Which registers can hold 8-bits */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4024 +#define BYTE_REGSET \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4025 + (Z_REGBIT | A_REGBIT | D_REGBIT | CC_REGBIT | DP_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4026 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4027 +/* Which registers can hold 16-bits.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4028 + * Note: D_REGBIT is defined as both an 8-bit and 16-bit register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4029 +#define WORD_REGSET \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4030 + (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT | SOFT_FP_REGBIT | SOFT_AP_REGBIT | RSVD1_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4031 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4032 +/* Returns nonzero if a given REGNO is in the REGSET. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4033 +#define REGSET_CONTAINS_P(regno, regset) (((1 << (regno)) & (regset)) != 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4034 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4035 +/* Defines related to the number of soft registers supported.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4036 + * The actual number used may be less depending on -msoft-reg-count.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4037 + * If you change one of these, you should change them all. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4038 +#define NUM_M_REGS 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4039 +#define M_REGS_FIXED 1, 1, 1, 1, 1, 1, 1, 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4040 +#define M_REGS_CALL_USED 1, 1, 1, 1, 1, 1, 1, 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4041 +#define HARD_M_REGNUMS \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4042 + SOFT_M0_REGNUM+0, SOFT_M0_REGNUM+1, SOFT_M0_REGNUM+2, SOFT_M0_REGNUM+3, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4043 + SOFT_M0_REGNUM+4, SOFT_M0_REGNUM+5, SOFT_M0_REGNUM+6, SOFT_M0_REGNUM+7
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4044 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4045 +#define SOFT_M_REGBITS (((1UL << NUM_M_REGS) - 1) << (SOFT_M0_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4046 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4047 +/* Number of actual hardware registers.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4048 + The hardware registers are assigned numbers for the compiler
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4049 + from 0 to just below FIRST_PSEUDO_REGISTER.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4050 + All registers that the compiler knows about must be given numbers,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4051 + even those that are not normally considered general registers.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4052 + Make sure the constant below matches the value of SOFT_M0_REGNUM;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4053 + for some reason, GCC won't compile if that name is used here directly. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4054 +#ifdef SOFT_M0_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4055 +#if (SOFT_M0_REGNUM != 14)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4056 +#error "bad register numbering"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4057 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4058 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4059 +#define FIRST_PSEUDO_REGISTER (14 + NUM_M_REGS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4060 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4061 +/* 1 for registers that have pervasive standard uses
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4062 + and are not available for the register allocator.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4063 + The psuedoregisters (M_REGS) are declared fixed here, but
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4064 + will be unfixed if -msoft-reg-count is seen later. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4065 +#define FIXED_REGISTERS \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4066 + {1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, M_REGS_FIXED, }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4067 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4068 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4069 +/* 1 for registers not available across function calls.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4070 + These must include the FIXED_REGISTERS and also any
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4071 + registers that can be used without being saved.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4072 + The latter must include the registers where values are returned
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4073 + and the register where structure-value addresses are passed.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4074 + Aside from that, you can include as many other registers as you like. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4075 +#define CALL_USED_REGISTERS \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4076 + {1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, M_REGS_CALL_USED, }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4077 + /* -, X, Y, U, S, PC,D, Z, A, B, C, DP,FP,AP,M... */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4078 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4079 +/* Return number of consecutive hard regs needed starting at reg REGNO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4080 + to hold something of mode MODE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4081 + For the 6809, we distinguish between word-length and byte-length
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4082 + registers. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4083 +#define HARD_REGNO_NREGS(REGNO, MODE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4084 + (REGSET_CONTAINS_P (REGNO, WORD_REGSET) ? \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4085 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4086 + (GET_MODE_SIZE (MODE)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4087 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4088 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4089 +/* Value is 1 if hard register REGNO can hold a value
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4090 +of machine-mode MODE. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4091 +#define HARD_REGNO_MODE_OK(REGNO, MODE) m6809_hard_regno_mode_ok (REGNO, MODE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4092 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4093 +/* Value is 1 if it is a good idea to tie two pseudo registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4094 + when one has mode MODE1 and one has mode MODE2.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4095 + If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4096 + for any hard reg, then this must be 0 for correct output. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4097 +#define MODES_TIEABLE_P(MODE1, MODE2) 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4098 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4099 +/* Specify the registers used for certain standard purposes.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4100 + The values of these macros are register numbers. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4101 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4102 +/* program counter if referenced as a register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4103 +#define PC_REGNUM HARD_PC_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4104 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4105 +/* Register to use for pushing function arguments. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4106 +#define STACK_POINTER_REGNUM HARD_S_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4107 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4108 +/* Base register for access to local variables of the function.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4109 + * Before reload, FRAME_POINTER_REGNUM will be used. Later,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4110 + * the elimination pass will convert these to STACK_POINTER_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4111 + * if possible, or else HARD_FRAME_POINTER_REGNUM. The idea is to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4112 + * avoid tying up a hard register (U) for the frame pointer if
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4113 + * it can be eliminated entirely, making it available for use as
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4114 + * a general register. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4115 +#define FRAME_POINTER_REGNUM SOFT_FP_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4116 +#define HARD_FRAME_POINTER_REGNUM HARD_U_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4117 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4118 +/* Define a table of possible eliminations.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4119 + * The idea is to try to avoid using hard registers for the argument
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4120 + * and frame pointers if they can be derived from the stack pointer
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4121 + * instead, which already has a hard register reserved for it.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4122 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4123 + * The order of entries in this table will try to convert
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4124 + * ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM into stack pointer
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4125 + * references first, but if that fails, they will be converted to use
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4126 + * HARD_FRAME_POINTER_REGNUM.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4127 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4128 +#define ELIMINABLE_REGS \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4129 +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4130 + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4131 + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4132 + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4133 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4134 +/* #define CAN_ELIMINATE(FROM, TO) m6809_can_eliminate (FROM, TO) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4135 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4136 +/* Define how to offset the frame or argument pointer to turn it
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4137 + * into a stack pointer reference. This is based on the way that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4138 + * the frame is constructed in the function prologue. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4139 +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4140 + (OFFSET) = m6809_initial_elimination_offset (FROM, TO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4141 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4142 +/* Base register for access to arguments of the function.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4143 + * This is only used prior to reload; no instructions will ever
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4144 + * be output referring to this register. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4145 +#define ARG_POINTER_REGNUM SOFT_AP_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4146 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4147 +/* Register in which static-chain is passed to a function. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4148 +#define STATIC_CHAIN_REGNUM HARD_Y_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4149 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4150 +/* #define CONDITIONAL_REGISTER_USAGE (m6809_conditional_register_usage ()) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4151 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4152 +/* Order in which hard registers are allocated to pseudos.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4153 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4154 + * Since the D register is the only valid reg for 8-bit values
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4155 + * now, avoid using it for 16-bit values by putting it after all
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4156 + * other 16-bits.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4157 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4158 + * Prefer X first since the first 16-bit function argument goes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4159 + * there. We may be able to pass in to a subroutine without
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4160 + * a copy.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4161 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4162 + * Prefer U over Y since instructions using Y take one extra
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4163 + * byte, and thus one extra cycle to execute.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4164 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4165 +#define REG_ALLOC_ORDER \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4166 + { HARD_X_REGNUM, HARD_U_REGNUM, HARD_Y_REGNUM, HARD_D_REGNUM, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4167 + HARD_M_REGNUMS, HARD_S_REGNUM, HARD_PC_REGNUM, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4168 + HARD_B_REGNUM, HARD_A_REGNUM, HARD_CC_REGNUM, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4169 + HARD_DP_REGNUM, SOFT_FP_REGNUM, SOFT_AP_REGNUM, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4170 + 6, HARD_Z_REGNUM }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4171 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4172 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4173 + classes of registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4174 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4175 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4176 +/* Define the classes of registers for register constraints in the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4177 + machine description. Also define ranges of constants.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4178 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4179 + One of the classes must always be named ALL_REGS and include all hard regs.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4180 + If there is more than one class, another class must be named NO_REGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4181 + and contain no registers.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4182 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4183 + The name GENERAL_REGS must be the name of a class (or an alias for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4184 + another name such as ALL_REGS). This is the class of registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4185 + that is allowed by "g" or "r" in a register constraint.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4186 + Also, registers outside this class are allocated only when
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4187 + instructions express preferences for them.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4188 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4189 + The classes must be numbered in nondecreasing order; that is,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4190 + a larger-numbered class must never be contained completely
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4191 + in a smaller-numbered class.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4192 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4193 + For any two classes, it is very desirable that there be another
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4194 + class that represents their union. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4195 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4196 +enum reg_class {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4197 + NO_REGS, /* The trivial class with no registers in it */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4198 + D_REGS, /* 16-bit (word (HI)) data (D) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4199 + ACC_A_REGS, /* The A register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4200 + ACC_B_REGS, /* The B register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4201 + X_REGS, /* The X register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4202 + Z_REGS, /* The Z (zero-bit) register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4203 + Q_REGS, /* 8-bit (byte (QI)) data (A,B) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4204 + M_REGS, /* 8-bit (byte (QI)) soft registers */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4205 + CC_REGS, /* 8-bit condition code register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4206 + I_REGS, /* An index register (A,B,D) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4207 + T_REGS, /* 16-bit addresses, not including stack or PC (X,Y,U) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4208 + A_REGS, /* 16-bit addresses (X,Y,U,S,PC) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4209 + S_REGS, /* 16-bit soft registers (FP, AP) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4210 + P_REGS, /* 16-bit pushable registers (D,X,Y,U); omit PC and S */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4211 + G_REGS, /* 16-bit data and address (D,X,Y,U,S,PC) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4212 + ALL_REGS, /* All registers */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4213 + LIM_REG_CLASSES
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4214 +};
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4215 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4216 +#define N_REG_CLASSES (int) LIM_REG_CLASSES
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4217 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4218 +/* Since GENERAL_REGS is a smaller class than ALL_REGS,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4219 + it is not an alias to ALL_REGS, but to G_REGS. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4220 +#define GENERAL_REGS G_REGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4221 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4222 +/* Give names of register classes as strings for dump file. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4223 +#define REG_CLASS_NAMES \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4224 + { "NO_REGS", "D_REGS", "ACC_A_REGS", "ACC_B_REGS", "X_REGS", "Z_REGS", "Q_REGS", "M_REGS", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4225 + "CC_REGS", "I_REGS", "T_REGS", "A_REGS", "S_REGS", "P_REGS", "G_REGS", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4226 + "ALL_REGS" }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4227 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4228 +/* Define which registers fit in which classes.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4229 + This is an initializer for a vector of HARD_REG_SET
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4230 + of length N_REG_CLASSES. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4231 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4232 +#define D_REGSET (D_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4233 +#define ACC_A_REGSET (A_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4234 +#define ACC_B_REGSET (D_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4235 +#define X_REGSET (X_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4236 +#define Z_REGSET (Z_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4237 +#define Q_REGSET (D_REGBIT | A_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4238 +#define M_REGSET (SOFT_M_REGBITS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4239 +#define CC_REGSET (CC_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4240 +#define I_REGSET (A_REGBIT | B_REGBIT | D_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4241 +#define T_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4242 +#define A_REGSET (X_REGBIT | Y_REGBIT | U_REGBIT | S_REGBIT | PC_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4243 +#define S_REGSET (SOFT_FP_REGBIT | SOFT_AP_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4244 +#define P_REGSET (D_REGBIT | X_REGBIT | Y_REGBIT | U_REGBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4245 +#define G_REGSET \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4246 + (D_REGSET | Q_REGSET | I_REGSET | A_REGSET | M_REGSET | S_REGSET)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4247 +#define ALL_REGSET (G_REGSET)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4248 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4249 +#define REG_CLASS_CONTENTS { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4250 + {0}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4251 + {D_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4252 + {ACC_A_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4253 + {ACC_B_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4254 + {X_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4255 + {Z_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4256 + {Q_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4257 + {M_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4258 + {CC_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4259 + {I_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4260 + {T_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4261 + {A_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4262 + {S_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4263 + {P_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4264 + {G_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4265 + {ALL_REGSET}, \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4266 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4267 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4268 +/* The same information, inverted.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4269 + * This is defined to use the REG_CLASS_CONTENTS defines above, so that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4270 + * these two sets of definitions are always consistent. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4271 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4272 +#define REGNO_REG_CLASS(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4273 + (D_REGNO_P (REGNO) ? D_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4274 + (Z_REGNO_P (REGNO) ? Z_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4275 + (ACC_A_REGNO_P (REGNO) ? ACC_A_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4276 + (ACC_B_REGNO_P (REGNO) ? ACC_B_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4277 + (X_REGNO_P (REGNO) ? X_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4278 + (Q_REGNO_P (REGNO) ? Q_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4279 + (M_REGNO_P (REGNO) ? M_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4280 + (CC_REGNO_P (REGNO) ? CC_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4281 + (I_REGNO_P (REGNO) ? I_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4282 + (T_REGNO_P (REGNO) ? T_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4283 + (A_REGNO_P (REGNO) ? A_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4284 + (S_REGNO_P (REGNO) ? S_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4285 + (P_REGNO_P (REGNO) ? P_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4286 + (G_REGNO_P (REGNO) ? G_REGS : ALL_REGS))))))))))))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4287 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4288 +#define D_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, D_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4289 +#define ACC_A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_A_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4290 +#define ACC_B_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, ACC_B_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4291 +#define X_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, X_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4292 +#define Z_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Z_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4293 +#define Q_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, Q_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4294 +#define M_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, M_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4295 +#define CC_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, CC_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4296 +#define I_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, I_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4297 +#define T_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, T_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4298 +#define A_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, A_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4299 +#define S_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, S_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4300 +#define P_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, P_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4301 +#define G_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, G_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4302 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4303 +/* Macros that test an rtx 'X' to see if it's in a particular
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4304 + * register class. 'X' need not be a REG necessarily. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4305 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4306 +#define D_REG_P(X) (REG_P (X) && D_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4307 +#define ACC_A_REG_P(X) (REG_P (X) && ACC_A_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4308 +#define ACC_B_REG_P(X) (REG_P (X) && ACC_B_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4309 +#define X_REG_P(X) (REG_P (X) && X_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4310 +#define Z_REG_P(X) (REG_P (X) && Z_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4311 +#define I_REG_P(X) (REG_P (X) && I_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4312 +#define T_REG_P(X) (REG_P (X) && T_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4313 +#define A_REG_P(X) (REG_P (X) && A_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4314 +#define S_REG_P(X) (REG_P (X) && S_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4315 +#define P_REG_P(X) (REG_P (X) && P_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4316 +#define Q_REG_P(X) (REG_P (X) && Q_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4317 +#define M_REG_P(X) (REG_P (X) && M_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4318 +#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4319 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4320 +/* Redefine this in terms of BYTE_REGSET */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4321 +#define BYTE_REGNO_P(REGNO) (REGSET_CONTAINS_P (REGNO, BYTE_REGSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4322 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4323 +/* The class value for index registers, and the one for base regs. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4324 +#define INDEX_REG_CLASS I_REGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4325 +#define BASE_REG_CLASS A_REGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4326 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4327 +/* Get reg_class from a letter in the machine description. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4328 +#define REG_CLASS_FROM_LETTER(C) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4329 + (((C) == 'a' ? A_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4330 + ((C) == 'd' ? D_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4331 + ((C) == 'x' ? I_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4332 + ((C) == 't' ? M_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4333 + ((C) == 'c' ? CC_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4334 + ((C) == 'A' ? ACC_A_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4335 + ((C) == 'B' ? ACC_B_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4336 + ((C) == 'v' ? X_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4337 + ((C) == 'u' ? S_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4338 + ((C) == 'U' ? P_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4339 + ((C) == 'T' ? T_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4340 + ((C) == 'z' ? Z_REGS : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4341 + ((C) == 'q' ? Q_REGS : NO_REGS))))))))))))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4342 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4343 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4344 + The letters I through O in a register constraint string
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4345 + can be used to stand for particular ranges of immediate operands.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4346 + This macro defines what the ranges are.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4347 + C is the letter, and VALUE is a constant value.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4348 + Return 1 if VALUE is in the range specified by C.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4349 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4350 + For the 6809, J, K, L are used for indexed addressing.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4351 + `I' is used for the constant 1.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4352 + `J' is used for the 5-bit offsets.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4353 + `K' is used for the 8-bit offsets.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4354 + `L' is used for the range of signed numbers that fit in 16 bits.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4355 + `M' is used for the exact value '8'.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4356 + `N' is used for the constant -1.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4357 + `O' is used for the constant 0.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4358 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4359 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4360 +#define CONST_OK_FOR_LETTER_P(VALUE, C) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4361 + ((C) == 'I' ? ((VALUE) == 1) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4362 + (C) == 'J' ? ((VALUE) >= -16 && (VALUE) <= 15) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4363 + (C) == 'K' ? ((VALUE) >= -128 && (VALUE) <= 127) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4364 + (C) == 'L' ? ((VALUE) >= -32768 && (VALUE) <= 32767) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4365 + (C) == 'M' ? ((VALUE) == 8) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4366 + (C) == 'N' ? ((VALUE) == -1) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4367 + (C) == 'O' ? ((VALUE) == 0) : 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4368 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4369 +/* Similar, but for floating constants, and defining letters G and H.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4370 + No floating-point constants are valid on MC6809. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4371 +#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4372 + ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4373 + && VALUE == CONST0_RTX (GET_MODE (VALUE))) : 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4374 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4375 +/* Given an rtx X being reloaded into a reg required to be
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4376 + in class CLASS, return the class of reg to actually use.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4377 + In general this is just CLASS; but on some machines
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4378 + in some cases it is preferable to use a more restrictive class. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4379 +#define PREFERRED_RELOAD_CLASS(X,CLASS) m6809_preferred_reload_class(X,CLASS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4380 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4381 +#define SMALL_REGISTER_CLASSES 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4382 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4383 +/* Return the maximum number of consecutive registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4384 + needed to represent mode MODE in a register of class CLASS. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4385 +#define CLASS_MAX_NREGS(CLASS, MODE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4386 + ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4387 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4388 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4389 + Stack layout; function entry, exit and calling.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4390 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4391 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4392 +/* Define this if pushing a word on the stack
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4393 + makes the stack pointer a smaller address. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4394 +#define STACK_GROWS_DOWNWARD
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4395 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4396 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4397 +/* Define this if the nominal address of the stack frame
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4398 + is at the high-address end of the local variables;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4399 + that is, each additional local variable allocated
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4400 + goes at a more negative offset in the frame. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4401 +#define FRAME_GROWS_DOWNWARD 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4402 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4403 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4404 +/* Offset within stack frame to start allocating local variables at.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4405 + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4406 + first local allocated. Otherwise, it is the offset to the BEGINNING
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4407 + of the first local allocated. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4408 +#define STARTING_FRAME_OFFSET 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4409 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4410 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4411 +/* Always push stack arguments for now. Accumulation is not yet working. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4412 +#define PUSH_ROUNDING(BYTES) (BYTES)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4413 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4414 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4415 +/* Offset of first parameter from the argument pointer register value.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4416 + * ARG_POINTER_REGNUM is defined to point to the return address pushed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4417 + * onto the stack, so we must offset by 2 bytes to get to the arguments. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4418 +#define FIRST_PARM_OFFSET(FNDECL) 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4419 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4420 +/* Value is 1 if returning from a function call automatically
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4421 + pops the arguments described by the number-of-args field in the call.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4422 + FUNTYPE is the data type of the function (as a tree),
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4423 + or for a library call it is an identifier node for the subroutine name. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4424 +/* #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4425 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4426 +/* Define how to find the value returned by a function.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4427 + VALTYPE is the data type of the value (as a tree).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4428 + If the precise function being called is known, FUNC is its FUNCTION_DECL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4429 + otherwise, FUNC is 0. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4430 +#define FUNCTION_VALUE(VALTYPE, FUNC) m6809_function_value (VALTYPE, FUNC)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4431 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4432 +/* Define how to find the value returned by a library function
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4433 + assuming the value has mode MODE. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4434 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4435 +/* All return values are in the X-register. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4436 +#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4437 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4438 +/* Define this if using the nonreentrant convention for returning
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4439 + structure and union values. No; it is inefficient and buggy. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4440 +#undef PCC_STATIC_STRUCT_RETURN
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4441 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4442 +/* 1 if N is a possible register number for a function value. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4443 +#define FUNCTION_VALUE_REGNO_P(N) m6809_function_value_regno_p (N)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4444 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4445 +/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4446 + more than one register. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4447 +#define NEEDS_UNTYPED_CALL 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4448 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4449 +/* 1 if N is a possible register number for function argument passing. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4450 +#define FUNCTION_ARG_REGNO_P(N) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4451 + ((m6809_abi_version != M6809_ABI_VERSION_STACK) ? \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4452 + (((N) == HARD_D_REGNUM) || ((N) == HARD_X_REGNUM)) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4453 + 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4454 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4455 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4456 + Argument Lists
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4457 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4458 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4459 +/* Cumulative arguments are tracked in a single integer,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4460 + * which is the number of bytes of arguments scanned so far,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4461 + * plus which registers have already been used. The register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4462 + * info is kept in some of the upper bits */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4463 +#define CUMULATIVE_ARGS unsigned int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4464 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4465 +#define CUM_STACK_ONLY 0x80000000
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4466 +#define CUM_X_MASK 0x40000000
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4467 +#define CUM_B_MASK 0x20000000
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4468 +#define CUM_STACK_INVALID 0x10000000
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4469 +#define CUM_STACK_MASK 0xFFFFFFF
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4470 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4471 +#define CUM_ADVANCE_8BIT(cum) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4472 + (((cum) & CUM_B_MASK) ? (cum)++ : ((cum) |= CUM_B_MASK))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4473 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4474 +#define CUM_ADVANCE_16BIT(cum) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4475 + (((cum) & CUM_X_MASK) ? (cum) += 2 : ((cum) |= CUM_X_MASK))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4476 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4477 +/* Initialize a variable CUM of type CUMULATIVE_ARGS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4478 + for a call to a function whose data type is FNTYPE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4479 + For a library call, FNTYPE is 0.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4480 + N_NAMED was added in gcc 3.4 and is not used currently. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4481 +#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4482 + ((CUM) = m6809_init_cumulative_args (CUM, FNTYPE, LIBNAME))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4483 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4484 +#define FUNCTION_ARG_SIZE(MODE, TYPE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4485 + ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4486 + : (unsigned) int_size_in_bytes (TYPE))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4487 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4488 +/* Update the data in CUM to advance over an argument
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4489 + of mode MODE and data type TYPE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4490 + (TYPE is null for libcalls where that information may not be available.) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4491 +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4492 + (((MODE == QImode) && !((CUM) & CUM_STACK_ONLY)) ? \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4493 + CUM_ADVANCE_8BIT (CUM) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4494 + ((MODE == HImode) && !((CUM) & CUM_STACK_ONLY)) ? \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4495 + CUM_ADVANCE_16BIT (CUM) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4496 + ((CUM) = ((CUM) + (TYPE ? int_size_in_bytes (TYPE) : 2))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4497 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4498 +/* Define where to put the arguments to a function.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4499 + Value is zero to push the argument on the stack,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4500 + or a hard register rtx in which to store the argument.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4501 + This macro is used _before_ FUNCTION_ARG_ADVANCE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4502 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4503 + For the 6809, the first 8-bit function argument can be placed into B,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4504 + and the first 16-bit arg can go into X. All other arguments
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4505 + will be pushed onto the stack.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4506 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4507 + Command-line options can adjust this behavior somewhat.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4508 + */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4509 +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4510 + ((MODE == VOIDmode) ? NULL_RTX : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4511 + ((MODE == BLKmode) || (GET_MODE_SIZE (MODE) > 2)) ? NULL_RTX : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4512 + ((MODE == QImode) && !((CUM) & (CUM_STACK_ONLY | CUM_B_MASK))) ? \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4513 + gen_rtx_REG (QImode, HARD_D_REGNUM) : \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4514 + ((MODE == HImode) && !((CUM) & (CUM_STACK_ONLY | CUM_X_MASK))) ? \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4515 + gen_rtx_REG (HImode, HARD_X_REGNUM) : m6809_function_arg_on_stack (&CUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4516 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4517 +/* Output assembler code to FILE to increment profiler label # LABELNO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4518 + for profiling a function entry. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4519 +#define FUNCTION_PROFILER(FILE, LABELNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4520 + fprintf (FILE, "\tldd\t#LP%u\n\tjsr\tmcount\n", (LABELNO));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4521 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4522 +/* Stack pointer must be correct on function exit */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4523 +#define EXIT_IGNORE_STACK 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4524 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4525 +/*****************************************************************************
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4526 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4527 +** Trampolines for Nested Functions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4528 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4529 +*****************************************************************************/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4530 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4531 +/* Length in units of the trampoline for entering a nested function. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4532 +#define TRAMPOLINE_SIZE 7
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4533 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4534 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4535 + Addressing modes,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4536 + and classification of registers for them.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4537 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4538 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4539 +/* 6809 has postincrement and predecrement addressing modes */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4540 +#define HAVE_POST_INCREMENT 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4541 +#define HAVE_PRE_DECREMENT 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4542 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4543 +/* Whether or not to use index registers is configurable.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4544 + * Experiments show that things work better when this is off, so
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4545 + * that's the way it is for now. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4546 +#undef USE_INDEX_REGISTERS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4547 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4548 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4549 +/* Macros to check register numbers against specific register classes. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4550 +#define REG_VALID_FOR_BASE_P(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4551 + (((REGNO) < FIRST_PSEUDO_REGISTER) && A_REGNO_P (REGNO))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4552 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4553 +/* MC6809 index registers do not allow scaling, */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4554 +/* but there is "accumulator-offset" mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4555 +#ifdef USE_INDEX_REGISTERS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4556 +#define REG_VALID_FOR_INDEX_P(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4557 + (((REGNO) < FIRST_PSEUDO_REGISTER) && I_REGNO_P (REGNO))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4558 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4559 +#define REG_VALID_FOR_INDEX_P(REGNO) 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4560 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4561 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4562 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_BASE_P */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4563 +#define REGNO_OK_FOR_BASE_NONSTRICT_P(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4564 + ((REGNO) >= FIRST_PSEUDO_REGISTER \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4565 + || REG_VALID_FOR_BASE_P (REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4566 + || (REGNO) == FRAME_POINTER_REGNUM \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4567 + || (REGNO) == HARD_FRAME_POINTER_REGNUM \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4568 + || (REGNO) == ARG_POINTER_REGNUM \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4569 + || (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO])))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4570 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4571 +/* Internal macro, the nonstrict definition for REGNO_OK_FOR_INDEX_P */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4572 +#define REGNO_OK_FOR_INDEX_NONSTRICT_P(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4573 + ((REGNO) >= FIRST_PSEUDO_REGISTER \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4574 + || REG_VALID_FOR_INDEX_P (REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4575 + || (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO])))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4576 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4577 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4578 +/* Internal macro, the strict definition for REGNO_OK_FOR_BASE_P */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4579 +#define REGNO_OK_FOR_BASE_STRICT_P(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4580 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_BASE_P (REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4581 + : (reg_renumber && REG_VALID_FOR_BASE_P (reg_renumber[REGNO])))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4582 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4583 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4584 +/* Internal macro, the strict definition for REGNO_OK_FOR_INDEX_P */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4585 +#define REGNO_OK_FOR_INDEX_STRICT_P(REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4586 + ((REGNO) < FIRST_PSEUDO_REGISTER ? REG_VALID_FOR_INDEX_P (REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4587 + : (reg_renumber && REG_VALID_FOR_INDEX_P (reg_renumber[REGNO])))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4588 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4589 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4590 +#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_BASE_STRICT_P (REGNO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4591 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4592 +#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_INDEX_STRICT_P (REGNO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4593 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4594 +#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_STRICT_P (REGNO (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4595 +#define REG_OK_FOR_BASE_NONSTRICT_P(X) REGNO_OK_FOR_BASE_NONSTRICT_P (REGNO (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4596 +#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_STRICT_P (REGNO (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4597 +#define REG_OK_FOR_INDEX_NONSTRICT_P(X) REGNO_OK_FOR_INDEX_NONSTRICT_P (REGNO (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4598 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4599 +#ifndef REG_OK_STRICT
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4600 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4601 +#ifdef USE_INDEX_REGISTERS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4602 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4603 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4604 +#define REG_OK_FOR_INDEX_P(X) 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4605 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4606 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4607 +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4608 +#ifdef USE_INDEX_REGISTERS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4609 +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4610 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4611 +#define REG_OK_FOR_INDEX_P(X) 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4612 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4613 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4614 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4615 +/* Maximum number of registers that can appear in a valid memory address */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4616 +#ifdef USE_INDEX_REGISTERS
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4617 +#define MAX_REGS_PER_ADDRESS 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4618 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4619 +#define MAX_REGS_PER_ADDRESS 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4620 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4621 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4622 +/* 1 if X is an rtx for a constant that is a valid address.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4623 + * We allow any constant, plus the sum of any two constants (this allows
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4624 + * offsetting a symbol ref) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4625 +#define CONSTANT_ADDRESS_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4626 + ((CONSTANT_P (X)) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4627 + || ((GET_CODE (X) == PLUS) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4628 + && (CONSTANT_P (XEXP (X, 0))) && (CONSTANT_P (XEXP (X, 1)))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4629 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4630 +/* Nonzero if the constant value X is a legitimate general operand.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4631 + It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4632 +/* Any single-word constant is ok; the only contexts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4633 + allowing general_operand of mode DI or DF are movdi and movdf. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4634 +#define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4635 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4636 +/* Nonzero if the X is a legitimate immediate operand in PIC mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4637 +#define LEGITIMATE_PIC_OPERAND_P(X) !symbolic_operand (X, VOIDmode)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4638 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4639 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4640 + Test for valid memory addresses
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4641 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4642 +/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4643 + that is a valid memory address for an instruction.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4644 + The MODE argument is the machine mode for the MEM expression
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4645 + that wants to use this address. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4646 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4647 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4648 + Valid addresses are either direct or indirect (MEM) versions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4649 + of the following forms.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4650 + constant N
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4651 + register ,X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4652 + constant indexed N,X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4653 + accumulator indexed D,X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4654 + auto_increment ,X++
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4655 + auto_decrement ,--X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4656 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4657 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4658 +#define REGISTER_ADDRESS_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4659 + (REG_P (X) && REG_OK_FOR_BASE_P (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4660 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4661 +#define EXTENDED_ADDRESS_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4662 + CONSTANT_ADDRESS_P (X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4663 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4664 +#define LEGITIMATE_BASE_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4665 + ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4666 + || (GET_CODE (X) == SIGN_EXTEND \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4667 + && GET_CODE (XEXP (X, 0)) == REG \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4668 + && GET_MODE (XEXP (X, 0)) == HImode \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4669 + && REG_OK_FOR_BASE_P (XEXP (X, 0))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4670 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4671 +#define LEGITIMATE_OFFSET_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4672 + (CONSTANT_ADDRESS_P (X) || (REG_P (X) && REG_OK_FOR_INDEX_P (X)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4673 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4674 +/* 1 if X is the sum of a base register and an offset. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4675 +#define INDEXED_ADDRESS(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4676 + ((GET_CODE (X) == PLUS \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4677 + && LEGITIMATE_BASE_P (XEXP (X, 0)) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4678 + && LEGITIMATE_OFFSET_P (XEXP (X, 1))) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4679 + || (GET_CODE (X) == PLUS \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4680 + && LEGITIMATE_BASE_P (XEXP (X, 1)) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4681 + && LEGITIMATE_OFFSET_P (XEXP (X, 0))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4682 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4683 +#define STACK_REG_P(X) (REG_P(X) && REGNO(X) == HARD_S_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4684 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4685 +#define STACK_PUSH_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4686 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == PRE_DEC && STACK_REG_P (XEXP (XEXP (X, 0), 0)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4687 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4688 +#define STACK_POP_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4689 + (MEM_P (X) && GET_CODE (XEXP (X, 0)) == POST_INC && STACK_REG_P (XEXP (XEXP (X, 0), 0)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4690 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4691 +#define PUSH_POP_ADDRESS_P(X) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4692 + (((GET_CODE (X) == PRE_DEC) || (GET_CODE (X) == POST_INC)) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4693 + && (LEGITIMATE_BASE_P (XEXP (X, 0))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4694 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4695 +/* Go to ADDR if X is a valid address. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4696 +#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4697 +{ \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4698 + if (REGISTER_ADDRESS_P(X)) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4699 + if (PUSH_POP_ADDRESS_P (X)) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4700 + if (EXTENDED_ADDRESS_P (X)) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4701 + if (INDEXED_ADDRESS (X)) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4702 + if (MEM_P (X) && REGISTER_ADDRESS_P(XEXP (X, 0))) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4703 + if (MEM_P (X) && PUSH_POP_ADDRESS_P (XEXP (X, 0))) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4704 + if (MEM_P (X) && EXTENDED_ADDRESS_P (XEXP (X, 0))) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4705 + if (MEM_P (X) && INDEXED_ADDRESS (XEXP (X, 0))) goto ADDR; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4706 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4707 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4708 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4709 + Address Fix-up
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4710 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4711 +/* Go to LABEL if ADDR (a legitimate address expression)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4712 + has an effect that depends on the machine mode it is used for.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4713 + In the latest GCC, this case is already handled by the core code
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4714 + so no action is required here. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4715 +#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4716 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4717 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4718 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4719 + Miscellaneous Parameters
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4720 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4721 +/* Specify the machine mode that this machine uses
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4722 + for the index in the tablejump instruction. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4723 +#define CASE_VECTOR_MODE Pmode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4724 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4725 +/* Define this as 1 if `char' should by default be signed; else as 0. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4726 +#define DEFAULT_SIGNED_CHAR 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4727 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4728 +/* This flag, if defined, says the same insns that convert to a signed fixnum
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4729 + also convert validly to an unsigned one. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4730 +#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4731 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4732 +/* Max number of bytes we can move from memory to memory/register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4733 + in one reasonably fast instruction. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4734 +#define MOVE_MAX 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4735 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4736 +/* Int can be 8 or 16 bits (default is 16) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4737 +#define INT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4738 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4739 +/* Short is always 16 bits */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4740 +#define SHORT_TYPE_SIZE (TARGET_BYTE_INT ? 8 : 16)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4741 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4742 +/* Size (bits) of the type "long" on target machine */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4743 +#define LONG_TYPE_SIZE (TARGET_BYTE_INT ? 16 : 32)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4744 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4745 +/* Size (bits) of the type "long long" on target machine */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4746 +#define LONG_LONG_TYPE_SIZE 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4747 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4748 +/* Size (bits) of the type "char" on target machine */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4749 +#define CHAR_TYPE_SIZE 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4750 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4751 +/* Size (bits) of the type "float" on target machine */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4752 +#define FLOAT_TYPE_SIZE 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4753 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4754 +/* Size (bits) of the type "double" on target machine.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4755 + * Note that the C standard does not require that doubles
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4756 + * hold any more bits than float. Since the 6809 has so few
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4757 + * registers, we cannot really support more than 32-bits. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4758 +#define DOUBLE_TYPE_SIZE 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4759 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4760 +/* Size (bits) of the type "long double" on target machine */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4761 +#define LONG_DOUBLE_TYPE_SIZE 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4762 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4763 +/* Define the type used for "size_t". With a 64KB address space,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4764 + * only a 16-bit value here makes sense. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4765 +#define SIZE_TYPE (TARGET_BYTE_INT ? "long unsigned int" : "unsigned int")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4766 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4767 +/* Likewise, the difference between two pointers is also a 16-bit
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4768 + * signed value. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4769 +#define PTRDIFF_TYPE (TARGET_BYTE_INT ? "long int" : "int")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4770 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4771 +/* Nonzero if access to memory by bytes is slow and undesirable. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4772 +#define SLOW_BYTE_ACCESS 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4773 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4774 +/* Define if shifts truncate the shift count
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4775 + which implies one can omit a sign-extension or zero-extension
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4776 + of a shift count. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4777 +#define SHIFT_COUNT_TRUNCATED 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4778 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4779 +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4780 + is done just by pretending it is already truncated. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4781 +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4782 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4783 +/* It is as good to call a constant function address as to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4784 + call an address kept in a register. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4785 +#define NO_FUNCTION_CSE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4786 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4787 +/* Specify the machine mode that pointers have.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4788 + After generation of rtl, the compiler makes no further distinction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4789 + between pointers and any other objects of this machine mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4790 +#define Pmode HImode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4791 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4792 +/* A function address in a call instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4793 + is a byte address (for indexing purposes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4794 + so give the MEM rtx a byte's mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4795 +#define FUNCTION_MODE HImode
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4796 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4797 +/* Define the cost of moving a value from a register in CLASS1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4798 + * to CLASS2, of a given MODE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4799 + *
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4800 + * On the 6809, hard register transfers are all basically equivalent.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4801 + * But soft register moves are treated more like memory moves. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4802 +#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4803 + (((CLASS1 == M_REGS) || (CLASS2 == M_REGS)) ? 4 : 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4804 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4805 +/* Define the cost of moving a value between a register and memory. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4806 +#define MEMORY_MOVE_COST(MODE, CLASS, IN) 5
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4807 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4808 +/* Check a `double' value for validity for a particular machine mode. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4809 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4810 +#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4811 + ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4812 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4813 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4814 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4815 + machine-dependent
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4816 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4817 +/* Tell final.c how to eliminate redundant test instructions. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4818 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4819 +/* Here we define machine-dependent flags and fields in cc_status
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4820 + (see `conditions.h'). */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4821 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4822 +/* Store in cc_status the expressions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4823 + that the condition codes will describe
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4824 + after execution of an instruction whose pattern is EXP.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4825 + Do not alter them if the instruction would not alter the cc's. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4826 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4827 +/* On the 6809, most of the insns to store in an address register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4828 + fail to set the cc's. However, in some cases these instructions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4829 + can make it possibly invalid to use the saved cc's. In those
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4830 + cases we clear out some or all of the saved cc's so they won't be used. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4831 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4832 +#define NOTICE_UPDATE_CC(EXP, INSN) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4833 + notice_update_cc((EXP), (INSN))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4834 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4835 +/*****************************************************************************
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4836 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4837 +** pragma support
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4838 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4839 +*****************************************************************************/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4840 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4841 +#if 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4842 +#define REGISTER_TARGET_PRAGMAS() \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4843 +do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4844 + extern void pragma_section PARAMS ((cpp_reader *)); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4845 + c_register_pragma (0, "section", pragma_section); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4846 +} while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4847 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4848 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4849 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4850 +/*--------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4851 + ASSEMBLER FORMAT
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4852 +--------------------------------------------------------------*/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4853 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4854 +#define FMT_HOST_WIDE_INT "%ld"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4855 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4856 +/* Output to assembler file text saying following lines
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4857 + may contain character constants, extra white space, comments, etc. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4858 +#define ASM_APP_ON ";----- asm -----\n"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4859 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4860 +/* Output to assembler file text saying following lines
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4861 + no longer contain unusual constructs. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4862 +#define ASM_APP_OFF ";--- end asm ---\n"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4863 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4864 +/* Use a semicolon to begin a comment. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4865 +#define ASM_COMMENT_START "; "
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4866 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4867 +/* Output assembly directives to switch to section 'name' */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4868 +#undef TARGET_ASM_NAMED_SECTION
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4869 +#define TARGET_ASM_NAMED_SECTION m6809_asm_named_section
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4870 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4871 +#undef TARGET_HAVE_NAMED_SECTION
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4872 +#define TARGET_HAVE_NAMED_SECTION m6809_have_named_section
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4873 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4874 +/* Output before read-only data. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4875 +#define TEXT_SECTION_ASM_OP (code_section_op)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4876 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4877 +/* Output before writable data. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4878 +#define DATA_SECTION_ASM_OP (data_section_op)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4879 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4880 +/* Output before uninitialized data. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4881 +#define BSS_SECTION_ASM_OP (bss_section_op)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4882 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4883 +/* Support the ctors and dtors sections for g++. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4884 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4885 +#undef CTORS_SECTION_ASM_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4886 +#define CTORS_SECTION_ASM_OP "\t.area\t.ctors"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4887 +#undef DTORS_SECTION_ASM_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4888 +#define DTORS_SECTION_ASM_OP "\t.area\t.dtors"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4889 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4890 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4891 +#undef DO_GLOBAL_CTORS_BODY
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4892 +#undef DO_GLOBAL_DTORS_BODY
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4893 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4894 +#define HAS_INIT_SECTION
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4895 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4896 +/* This is how to output an assembler line
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4897 + that says to advance the location counter
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4898 + to a multiple of 2**LOG bytes. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4899 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4900 +#define ASM_OUTPUT_ALIGN(FILE,LOG) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4901 + if ((LOG) > 1) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4902 + fprintf (FILE, "\t.bndry\t%u\n", 1 << (LOG))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4903 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4904 +/* The .set foo,bar construct doesn't work by default */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4905 +#undef SET_ASM_OP
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4906 +#define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4907 + do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4908 + assemble_name (FILE, LABEL1); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4909 + fputs ("\tequ\t", FILE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4910 + assemble_name (FILE, LABEL2); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4911 + fputc ('\n', FILE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4912 + } while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4913 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4914 +/* How to refer to registers in assembler output.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4915 + This sequence is indexed by compiler's hard-register-number (see above). */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4916 +#define MNAME(x) [SOFT_M0_REGNUM+(x)] = "*m" C_STRING(x) ,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4917 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4918 +#define REGISTER_NAMES { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4919 + [HARD_D_REGNUM]= "d", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4920 + [HARD_X_REGNUM]= "x", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4921 + [HARD_Y_REGNUM]= "y", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4922 + [HARD_U_REGNUM]= "u", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4923 + [HARD_S_REGNUM]= "s", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4924 + [HARD_PC_REGNUM]= "pc", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4925 + [HARD_A_REGNUM]= "a", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4926 + [HARD_B_REGNUM]= "b", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4927 + [HARD_CC_REGNUM]= "cc",\
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4928 + [HARD_DP_REGNUM]= "dp", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4929 + [SOFT_FP_REGNUM]= "soft_fp", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4930 + [SOFT_AP_REGNUM]= "soft_ap", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4931 + MNAME(0) MNAME(1) MNAME(2) MNAME(3) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4932 + MNAME(4) MNAME(5) MNAME(6) MNAME(7) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4933 + [HARD_RSVD1_REGNUM] = "-", \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4934 + [HARD_Z_REGNUM] = "z" /* bit 2 of CC */ }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4935 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4936 +/*****************************************************************************
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4937 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4938 +** Debug Support
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4939 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4940 +*****************************************************************************/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4941 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4942 +/* Default to DBX-style debugging */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4943 +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4944 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4945 +#define DBX_DEBUGGING_INFO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4946 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4947 +#define DEFAULT_GDB_EXTENSIONS 0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4948 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4949 +#define ASM_STABS_OP ";\t.stabs\t"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4950 +#define ASM_STABD_OP ";\t.stabd\t"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4951 +#define ASM_STABN_OP ";\t.stabn\t"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4952 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4953 +#define DBX_CONTIN_LENGTH 54
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4954 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4955 +#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(ASMFILE, FILENAME) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4956 +do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4957 + const char *p = FILENAME; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4958 + while ((p = strchr (p, '/')) != NULL) { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4959 + p = FILENAME = p+1; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4960 + } \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4961 + fprintf (ASMFILE, "%s", ASM_STABS_OP); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4962 + output_quoted_string (ASMFILE, FILENAME); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4963 + fprintf (ASMFILE, ",%d,0,0,", N_SO); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4964 + assemble_name (ASMFILE, ltext_label_name); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4965 + fputc ('\n', ASMFILE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4966 + switch_to_section (text_section); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4967 + (*targetm.asm_out.internal_label) (ASMFILE, "Ltext", 0); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4968 +} while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4969 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4970 +/* With -g, GCC sometimes outputs string literals that are longer than
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4971 + * the assembler can handle. Without actual debug support, these are
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4972 + * not really required. Redefine the function to output strings to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4973 + * output as much as possible. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4974 +#define OUTPUT_QUOTED_STRING(FILE, STR) m6809_output_quoted_string (FILE, STR)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4975 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4976 +/*****************************************************************************
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4977 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4978 +** Output and Generation of Labels
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4979 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4980 +*****************************************************************************/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4981 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4982 +/* Prefixes for various assembly-time objects */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4983 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4984 +#define REGISTER_PREFIX ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4985 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4986 +#define LOCAL_LABEL_PREFIX ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4987 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4988 +#define USER_LABEL_PREFIX "_"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4989 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4990 +#define IMMEDIATE_PREFIX "#"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4991 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4992 +/* This is how to output the definition of a user-level label named NAME,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4993 + such as the label on a static function or variable NAME. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4994 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4995 +#define ASM_OUTPUT_LABEL(FILE,NAME) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4996 +do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4997 + if (section_changed) { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4998 + fprintf (FILE, "\n%s\n\n", code_section_op); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
4999 + section_changed = 0; \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5000 + } \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5001 + assemble_name (FILE, NAME); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5002 + fputs (":\n", FILE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5003 +} while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5004 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5005 +/* This is how to output the label for a function definition. It
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5006 + invokes ASM_OUTPUT_LABEL, but may examine the DECL tree node for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5007 + other properties. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5008 +#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5009 + m6809_declare_function_name (FILE,NAME,DECL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5010 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5011 +/* This is how to output a command to make the user-level label
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5012 + named NAME defined for reference from other files. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5013 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5014 +#define GLOBAL_ASM_OP "\n\t.globl\t"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5015 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5016 +/* This is how to output a reference to a user label named NAME. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5017 +#define ASM_OUTPUT_LABELREF(FILE,NAME) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5018 + fprintf (FILE, "_%s", NAME)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5019 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5020 +/* This is how to output a reference to a symbol ref
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5021 + * Check to see if the symbol is in the direct page */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5022 +#define ASM_OUTPUT_SYMBOL_REF(FILE,sym) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5023 +{ \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5024 + print_direct_prefix (FILE, sym); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5025 + assemble_name (FILE, XSTR (sym, 0)); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5026 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5027 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5028 +/* External references aren't necessary, so don't emit anything */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5029 +#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5030 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5031 +/* This is how to store into the string LABEL
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5032 + the symbol_ref name of an internal numbered label where
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5033 + PREFIX is the class of label and NUM is the number within the class.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5034 + This is suitable for output with `assemble_name'. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5035 +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5036 + sprintf (LABEL, "*%s%lu", PREFIX, (unsigned long int)NUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5037 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5038 +/* This is how to output an assembler line defining an `int' constant. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5039 +#define ASM_OUTPUT_INT(FILE,VALUE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5040 +( fprintf (FILE, "\t.word\t"), \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5041 + output_addr_const (FILE, (VALUE)), \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5042 + fprintf (FILE, "\n"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5043 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5044 +/* Likewise for `char' and `short' constants. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5045 +#define ASM_OUTPUT_SHORT(FILE,VALUE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5046 +( fprintf (FILE, "\t.word\t"), \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5047 + output_addr_const (FILE, (VALUE)), \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5048 + fprintf (FILE, "\n"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5049 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5050 +/* This is how to output a string. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5051 +#define ASM_OUTPUT_ASCII(FILE,STR,SIZE) m6809_output_ascii (FILE, STR, SIZE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5052 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5053 +/* This is how to output an insn to push a register on the stack.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5054 + It need not be very fast code. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5055 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5056 +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5057 + fprintf (FILE, "\tpshs\t%s\n", reg_names[REGNO])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5058 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5059 +/* This is how to output an insn to pop a register from the stack.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5060 + It need not be very fast code. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5061 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5062 +#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5063 + fprintf (FILE, "\tpuls\t%s\n", reg_names[REGNO])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5064 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5065 +/* This is how to output an element of a case-vector that is absolute. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5066 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5067 +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5068 + fprintf (FILE, "\t.word\tL%u\n", VALUE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5069 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5070 +/* This is how to output an element of a case-vector that is relative. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5071 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5072 +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5073 + fprintf (FILE, "\t.word\tL%u-L%u\n", VALUE, REL)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5074 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5075 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5076 +/*****************************************************************************
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5077 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5078 +** Assembler Commands for Alignment
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5079 +**
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5080 +*****************************************************************************/
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5081 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5082 +/* ASM_OUTPUT_SKIP is supposed to zero initialize the data. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5083 +#define ASM_OUTPUT_SKIP(FILE,SIZE) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5084 + do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5085 + fprintf (FILE, "\tzmb\t%d\t;skip space\n", SIZE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5086 + } while (0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5087 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5088 +/* This says how to output an assembler line
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5089 + to define a global common symbol. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5090 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5091 +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5092 + do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5093 + switch_to_section (bss_section); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5094 + fputs ("\n\t.globl\t", FILE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5095 + assemble_name ((FILE), (NAME)); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5096 + fputs ("\n", FILE); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5097 + assemble_name ((FILE), (NAME)); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5098 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5099 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5100 +/* This says how to output an assembler line
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5101 + to define a local common symbol. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5102 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5103 +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5104 +do { \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5105 + switch_to_section (bss_section); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5106 + assemble_name ((FILE), (NAME)); \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5107 + fprintf ((FILE), ":\t.blkb\t" FMT_HOST_WIDE_INT "\n", (ROUNDED));} while(0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5108 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5109 +/* Store in OUTPUT a string (made with alloca) containing
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5110 + an assembler-name for a local static variable named NAME.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5111 + LABELNO is an integer which is different for each call. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5112 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5113 +#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5114 +( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5115 + sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long int)(LABELNO)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5116 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5117 +/* Print an instruction operand X on file FILE.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5118 + CODE is the code from the %-spec for printing this operand.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5119 + If `%z3' was used to print operand 3, then CODE is 'z'. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5120 +#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5121 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5122 +/* Print a memory operand whose address is X, on file FILE. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5123 +#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5124 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5125 +/* Don't let stack pushes build up too much. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5126 +#define MAX_PENDING_STACK 8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5127 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5128 +/* Define values for builtin operations */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5129 +enum m6809_builtins
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5130 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5131 + M6809_SWI,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5132 + M6809_SWI2,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5133 + M6809_SWI3,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5134 + M6809_CWAI,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5135 + M6809_SYNC,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5136 + M6809_ADD_CARRY,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5137 + M6809_SUB_CARRY,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5138 + M6809_ADD_DECIMAL,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5139 + M6809_NOP,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5140 + M6809_BLOCKAGE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5141 +};
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5142 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5143 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.md gcc-4.6.4/gcc/config/m6809/m6809.md
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5144 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.md 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5145 +++ gcc-4.6.4/gcc/config/m6809/m6809.md 2017-11-29 17:11:09.221248469 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5146 @@ -0,0 +1,2358 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5147 +;; GCC machine description for Motorola 6809
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5148 +;; Copyright (C) 1989, 2005, 2006, 2007, 2008,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5149 +;; 2009 Free Software Foundation, Inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5150 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5151 +;; Mostly by Brian Dominy (brian@oddchange.com) with substantial renovations
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5152 +;; by William Astle (lost@l-w.ca).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5153 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5154 +;; Based on earlier work by Tom Jones (jones@sal.wisc.edu) and
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5155 +;; Matthias Doerfel (msdoerfe@informatik.uni-erlangen.de)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5156 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5157 +;; This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5158 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5159 +;; GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5160 +;; it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5161 +;; the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5162 +;; any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5163 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5164 +;; GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5165 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5166 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5167 +;; GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5168 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5169 +;; You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5170 +;; along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5171 +;; <http://www.gnu.org/licenses/>.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5172 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5173 +;; General information:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5174 +;; --------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5175 +;; * This backend is mostly a rewrite from earlier (3.1.1 and before)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5176 +;; versions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5177 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5178 +;; * The 'A' and 'B' registers are treated as a single register by the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5179 +;; register allocator; hence, the instruction templates assume that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5180 +;; both can be modified if either one is available for use. No
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5181 +;; attempt is made to split instructions to refer to a particular half
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5182 +;; of the register. It is always referred to as the 'D' register, even
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5183 +;; in QImode (when it will be displayed as 'B').
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5184 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5185 +;; * There is full support for proper branch instruction generation,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5186 +;; based on instruction lengths. However, many instruction patterns
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5187 +;; are still overloaded to emit lots of real instructions, which can
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5188 +;; make the length calculation difficult; in those cases, I've tried
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5189 +;; to be pessimistic and assume the worst-case.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5190 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5191 +;; * The instruction type attributes are only defined for branch
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5192 +;; vs. non branch instructions for now, since there is seemingly no
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5193 +;; reason to define these for other types anyway.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5194 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5195 +;; * The limited number of total registers presents the greatest
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5196 +;; challenge. There are 'soft registers' -- memory locations
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5197 +;; used to simulate real regs -- which can be helpful.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5198 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5199 +;; * Position-independent code (PIC) is supported and has been tested
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5200 +;; but not to the extent of absolute code generation.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5201 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5202 +;; * All of the 6809 special opcodes, e.g. SWI and SYNC, are defined
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5203 +;; as UNSPEC instructions, and can be accessed from C code using
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5204 +;; __builtin_xxxx() style functions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5205 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5206 +;; What still needs to be done:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5207 +;; ----------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5208 +;; * Replace remaining instances of (define_peephole) with
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5209 +;; (define_peephole2), or remove them completely if they are not
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5210 +;; matching anyway. Add more peepholes for things actually encountered.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5211 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5212 +;; * Indexing addressing can lead to crashes in complex functions when
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5213 +;; register pressure is high. Only the 'D' register can actually be
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5214 +;; used as an index register, and its demand by other instructions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5215 +;; can sometimes mean that it is impossible to satisfy constraints.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5216 +;; Currently, indexing is completely disabled to avoid these types
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5217 +;; of problems, although code is slightly more inefficient in some
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5218 +;; working cases.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5219 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5220 +;; * 32-bit math is terribly inefficient.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5221 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5222 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5223 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5224 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5225 +;;- Constants
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5226 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5227 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5228 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5229 +; Define constants for hard register numbers.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5230 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5231 +(define_constants [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5232 + (HARD_RSVD1_REGNUM 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5233 + (HARD_X_REGNUM 1) (HARD_Y_REGNUM 2) (HARD_U_REGNUM 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5234 + (HARD_S_REGNUM 4) (HARD_PC_REGNUM 5) (HARD_D_REGNUM 6)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5235 + (HARD_Z_REGNUM 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5236 + (HARD_A_REGNUM 8) (HARD_B_REGNUM 9)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5237 + (HARD_CC_REGNUM 10) (HARD_DP_REGNUM 11)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5238 + (SOFT_FP_REGNUM 12) (SOFT_AP_REGNUM 13)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5239 + (SOFT_M0_REGNUM 14) (SOFT_M1_REGNUM 15)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5240 + (SOFT_M2_REGNUM 16) (SOFT_M3_REGNUM 17)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5241 +])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5242 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5243 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5244 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5245 +; The range in which a short branch insn can be used.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5246 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5247 +(define_constants [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5248 + (MIN_SHORT_BRANCH_OFFSET -127)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5249 + (MAX_SHORT_BRANCH_OFFSET 128)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5250 +])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5251 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5252 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5253 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5254 +; The lengths of various types of real 6809 instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5255 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5256 +; By default, ordinary insns are 4 bytes long. This is often not
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5257 +; right, and the insn patterns below will redefine this to the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5258 +; correct value.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5259 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5260 +; Branch instruction lengths (conditional and unconditionals) are
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5261 +; well known and declared here. The short insns are used when the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5262 +; offset is within the range declared above (between MIN_SHORT
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5263 +; and MAX_SHORT) ; otherwise the long form is used.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5264 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5265 +(define_constants [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5266 + (DEFAULT_INSN_LENGTH 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5267 + (SHORT_CBRANCH_LENGTH 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5268 + (LONG_CBRANCH_LENGTH 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5269 + (SHORT_BRANCH_LENGTH 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5270 + (LONG_BRANCH_LENGTH 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5271 +])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5272 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5273 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5274 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5275 +; Constants for insn cycle counts.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5276 +; Note that these counts all assume 1-byte opcodes. 2-byte
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5277 +; opcodes require 1 extra cycles for fetching the extra byte.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5278 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5279 +(define_constants [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5280 + ;; The default insn length, when it cannot be calculated.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5281 + ;; Take a conservative approach and estimate high.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5282 + (DEFAULT_INSN_CYCLES 10)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5283 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5284 + ;; Cycle counts for ALU and load operations.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5285 + (ALU_INHERENT_CYCLES 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5286 + (ALU_IMMED_CYCLES 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5287 + (ALU_DIRECT_CYCLES 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5288 + (ALU_INDEXED_BASE_CYCLES 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5289 + (ALU_EXTENDED_CYCLES 5)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5290 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5291 + ;; If an ALU operation is on a 16-bit register (D), then
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5292 + ;; add this number of cycles to the total count.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5293 + (ALU_16BIT_CYCLES 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5294 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5295 + ;; A load of a 16-bit register incurs this extra amount.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5296 + (LOAD_16BIT_CYCLES 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5297 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5298 + ;; Cycle counts for memory-only operations (bit shifts, clear, test)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5299 + (MEM_DIRECT_CYCLES 6)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5300 + (MEM_INDEXED_BASE_CYCLES 6)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5301 + (MEM_EXTENDED_CYCLES 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5302 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5303 + ;; Cycle count for any reg-reg transfer (regardless of size)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5304 + (EXG_CYCLES 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5305 + (TFR_CYCLES 6)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5306 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5307 + ;; Cycle count for a condition code update (andcc/orcc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5308 + (CC_CYCLES 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5309 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5310 + (JMP_DIRECT_CYCLES 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5311 + (JMP_INDEXED_BASE_CYCLES 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5312 + (JMP_EXTENDED_CYCLES 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5313 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5314 + (JSR_DIRECT_CYCLES 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5315 + (JSR_INDEXED_BASE_CYCLES 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5316 + (JSR_EXTENDED_CYCLES 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5317 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5318 + (LEA_BASE_CYCLES 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5319 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5320 + ;; Cycle count for a psh/pul operations. Add to this the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5321 + ;; total number of bytes moved for the correct count.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5322 + (PSH_PUL_CYCLES 5)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5323 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5324 + ;; Miscellaneous cycle counts
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5325 + (CWAI_CYCLES 20)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5326 + (MUL_CYCLES 11)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5327 + (NOP_CYCLES 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5328 + (RTI_CYCLES 15)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5329 + (RTS_CYCLES 5)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5330 + (SWI_CYCLES 20)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5331 + (SYNC_CYCLES 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5332 +])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5333 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5334 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5335 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5336 +; An enumeration of values for each "unspec"; i.e. unspecified
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5337 +; instruction. These represent insns that are meaningful on the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5338 +; 6809 but which have no intrinsic meaning to GCC itself.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5339 +; These insns can be generated explicitly using the __builtin_xxx
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5340 +; syntax; they are also implicitly generated by the backend
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5341 +; as needed to implement other insns.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5342 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5343 +(define_constants [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5344 + (UNSPEC_BLOCKAGE 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5345 + (UNSPEC_PUSH_RS 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5346 + (UNSPEC_POP_RS 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5347 + (UNSPEC_SWI 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5348 + (UNSPEC_CWAI 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5349 + (UNSPEC_ADD_CARRY 5)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5350 + (UNSPEC_SUB_CARRY 6)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5351 + (UNSPEC_SYNC 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5352 + (UNSPEC_ADD_DECIMAL 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5353 +])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5354 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5355 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5356 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5357 +;;- Predicates
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5358 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5359 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5360 +(include "predicates.md")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5361 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5362 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5363 +;;- Attributes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5364 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5365 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5366 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5367 +;; The type attribute is used to distinguish between different
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5368 +;; types of branch instructions, so that their lengths can be
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5369 +;; calculated correctly.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5370 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5371 +(define_attr "type" "branch,cbranch,unknown" (const_string "unknown"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5372 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5373 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5374 +;; The length of a branch instruction is calculated based on how
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5375 +;; far away the branch target is. Lengths of other insns default
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5376 +;; to 4. set_attr is used in instruction templates to specify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5377 +;; the length when it is known exactly. When not sure, err on
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5378 +;; the high side to avoid compile errors.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5379 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5380 +(define_attr "length" ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5381 + (cond [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5382 + (eq_attr "type" "branch")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5383 + (if_then_else (lt (minus (match_dup 0) (pc))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5384 + (const_int MIN_SHORT_BRANCH_OFFSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5385 + (const_int LONG_BRANCH_LENGTH)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5386 + (if_then_else (gt (minus (match_dup 0) (pc))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5387 + (const_int MAX_SHORT_BRANCH_OFFSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5388 + (const_int LONG_BRANCH_LENGTH)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5389 + (const_int SHORT_BRANCH_LENGTH)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5390 + (eq_attr "type" "cbranch")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5391 + (if_then_else (lt (minus (match_dup 0) (pc))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5392 + (const_int MIN_SHORT_BRANCH_OFFSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5393 + (const_int LONG_CBRANCH_LENGTH)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5394 + (if_then_else (gt (minus (match_dup 0) (pc))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5395 + (const_int MAX_SHORT_BRANCH_OFFSET))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5396 + (const_int LONG_CBRANCH_LENGTH)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5397 + (const_int SHORT_CBRANCH_LENGTH)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5398 + ] (const_int DEFAULT_INSN_LENGTH)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5399 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5400 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5401 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5402 +;; The default attributes for 'asm' statements.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5403 +;; The default length is the longest possible single 6809 instruction,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5404 +;; which is 5 bytes. GCC will automatically multiply this by the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5405 +;; number of real insns contained in an asm statement.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5406 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5407 +(define_asm_attributes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5408 + [(set_attr "length" "5")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5409 + (set_attr "type" "unknown")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5410 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5411 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5412 +;; An attribute for the number of cycles that it takes an instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5413 +;; to execute.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5414 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5415 +(define_attr "cycles" "" (const_int DEFAULT_INSN_CYCLES))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5416 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5417 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5418 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5419 +;;- Instruction patterns. When multiple patterns apply,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5420 +;;- the first one in the file is chosen.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5421 +;;-
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5422 +;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5423 +;;-
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5424 +;;- Note: NOTICE_UPDATE_CC in m6809.h handles condition code updates
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5425 +;;- for most instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5426 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5427 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5428 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5429 +;;- Test
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5430 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5431 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5432 +;; cmpx is 3 bytes, not 4
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5433 +(define_insn "*tsthi_x"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5434 + [(set (cc0) (match_operand:HI 0 "register_operand_x" "v"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5435 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5436 + "cmpx\t#0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5437 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5438 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5439 +;; subd #0 is 3 bytes, better than cmpd #0 which is 4 bytes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5440 +(define_insn "*tsthi_d"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5441 + [(set (cc0) (match_operand:HI 0 "register_operand_d" "d"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5442 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5443 + "subd\t#0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5444 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5445 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5446 +(define_insn "*tsthi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5447 + [(set (cc0) (match_operand:HI 0 "register_operand" "a"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5448 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5449 + "cmp%0\t#0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5450 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5451 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5452 +(define_insn "*bitqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5453 + [(set (cc0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5454 + (and:QI (match_operand:QI 0 "register_operand" "%q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5455 + (match_operand:QI 1 "general_operand" "mi")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5456 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5457 + "bit%0\t%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5458 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5459 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5460 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5461 +(define_insn "tstqi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5462 + [(set (cc0) (match_operand:QI 0 "nonimmediate_operand" "q,mt"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5463 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5464 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5465 + tst%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5466 + tst\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5467 + [(set_attr "length" "1,3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5468 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5469 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5470 +;;- Compare instructions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5471 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5472 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5473 +;; - cmphi for register to memory or register compares
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5474 +(define_insn "cmphi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5475 + [(set (cc0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5476 + (compare
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5477 + (match_operand:HI 0 "general_operand" "da, mi, ??Ud")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5478 + (match_operand:HI 1 "general_operand" "mi, da, dU")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5479 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5480 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5481 + if ((REG_P (operands[0])) && (REG_P (operands[1]))) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5482 + output_asm_insn ("pshs\t%1\t;cmphi: R:%1 with R:%0", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5483 + return "cmp%0\t,s++\t;cmphi:";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5484 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5485 + if (GET_CODE (operands[0]) == REG)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5486 + return "cmp%0\t%1\t;cmphi:";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5487 + else {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5488 + cc_status.flags |= CC_REVERSED;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5489 + return "cmp%1\t%0\t;cmphi:(R)";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5490 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5491 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5492 + [(set_attr "length" "5,5,7")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5493 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5494 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5495 +(define_insn "cmpqi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5496 + [(set (cc0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5497 + (compare (match_operand:QI 0 "whole_general_operand" "q,q, q,O,mt,K")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5498 + (match_operand:QI 1 "whole_general_operand" "O,mt,K,q,q, q")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5499 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5500 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5501 + if (REG_P (operands[0]) && !M_REG_P (operands[0]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5502 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5503 + if (operands[1] == const0_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5504 + return "tst%0\t;cmpqi:(ZERO)";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5505 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5506 + return "cmp%0\t%1\t;cmpqi:";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5507 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5508 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5509 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5510 + cc_status.flags |= CC_REVERSED;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5511 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5512 + if (operands[0] == const0_rtx)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5513 + return "tst%1\t;cmpqi:(RZERO)";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5514 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5515 + return "cmp%1\t%0\t;cmpqi:(R)";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5516 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5517 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5518 + [(set_attr "length" "1,3,2,1,3,2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5519 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5520 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5521 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5522 +;;- Compare/branch pattern
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5523 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5524 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5525 +(define_expand "cbranchhi4"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5526 + [(set (cc0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5527 + (compare
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5528 + (match_operand:HI 1 "general_operand" "da, mi, ??Ud")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5529 + (match_operand:HI 2 "general_operand" "mi, da, dU")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5530 + (set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5531 + (if_then_else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5532 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5533 + (label_ref (match_operand 3 "" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5534 + (pc)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5535 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5536 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5537 +)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5538 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5539 +(define_expand "cbranchqi4"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5540 + [(set (cc0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5541 + (compare
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5542 + (match_operand:QI 1 "whole_general_operand" "q,q, q,O,mt,K")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5543 + (match_operand:QI 2 "whole_general_operand" "O,mt,K,q,q, q")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5544 + (set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5545 + (if_then_else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5546 + (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5547 + (label_ref (match_operand 3 "" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5548 + (pc)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5549 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5550 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5551 +)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5552 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5553 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5554 +;;- Move
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5555 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5556 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5557 +; this looks good (obviously not finished) but I still see 'movsi'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5558 +; places in udivsi3 where it's broken
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5559 +; (define_insn "pushsi1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5560 +; [(set (mem:SI (pre_dec (reg:HI HARD_S_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5561 +; (match_operand:SI 0 "general_operand" "o"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5562 +; (set (reg:HI HARD_S_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5563 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int -4))) ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5564 +; ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5565 +; "; pushsi %0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5566 +; [(set_attr "length" "12")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5567 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5568 +; (define_insn "popsi1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5569 +; [(set (match_operand:SI 0 "general_operand" "=o")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5570 +; (mem:SI (post_inc (reg:HI HARD_S_REGNUM))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5571 +; (set (reg:HI HARD_S_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5572 +; (plus:HI (reg:HI HARD_S_REGNUM) (const_int 4))) ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5573 +; ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5574 +; "; popsi %0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5575 +; [(set_attr "length" "12")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5576 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5577 +; (define_insn "movsi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5578 +; [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5579 +; (match_operand:SI 1 "general_operand" " oi"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5580 +; ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5581 +; "; movsi %0 <- %1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5582 +; [(set_attr "length" "1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5583 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5584 +; this doesn't work
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5585 +; (define_expand "movsi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5586 +; [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5587 +; (set (match_operand:SI 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5588 +; (match_operand:SI 1 "general_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5589 +; (clobber (match_scratch:HI 2 ""))])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5590 +; ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5591 +; {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5592 +; rtx insn;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5593 +; if (STACK_PUSH_P (operands[0]) || STACK_POP_P (operands[1]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5594 +; {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5595 +; REG_NOTES (insn) = alloc_EXPR_LIST (REG_INC, stack_pointer_rtx, REG_NOTES (insn));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5596 +; }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5597 +; insn = emit_move_multi_word (SImode, operands[0], operands[1]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5598 +; DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5599 +; })
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5600 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5601 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5602 +(define_expand "movhi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5603 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5604 + (match_operand:HI 1 "general_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5605 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5606 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5607 + /* One of the ops has to be in a register prior to reload */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5608 + if (!register_operand (operand0, HImode) &&
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5609 + !register_operand (operand1, HImode))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5610 + operands[1] = copy_to_mode_reg (HImode, operand1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5611 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5612 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5613 +;;; Try a splitter to handle failure cases where we try to move
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5614 +;;; an immediate constant (zero usually) directly to memory.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5615 +;;; This absolutely requires an intermediate register.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5616 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5617 + [(set (match_operand:HI 0 "memory_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5618 + (match_operand:HI 1 "immediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5619 + (clobber (match_operand:HI 2 "register_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5620 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5621 + [(set (match_dup 2) (match_dup 1))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5622 + (set (match_dup 0) (match_dup 2))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5623 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5624 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5625 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5626 +;;; This would be a nice method for loading from a word array,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5627 +;;; but it is never generated because the combiner cannot merge
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5628 +;;; more than 3 instructions (there are four here). This is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5629 +;;; perhaps better done via a peephole.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5630 +(define_insn "*movhi_array_load"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5631 + [(set (match_operand:HI 0 "nonimmediate_operand" "=da")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <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))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5633 + (match_operand:HI 2 "immediate_operand" "i"))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5634 + (clobber (match_scratch:HI 3 "=X"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5635 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5636 + "ldx\t%2\;abx\;abx\;ld%0\t,x"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5637 + [(set_attr "length" "7")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5638 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5639 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5640 +;;; Optimize the move of a byte to the stack using the pshs instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5641 +;;; instead of a store with pre-increment.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5642 +(define_insn "movhi_push"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5643 + [(set (match_operand:HI 0 "push_operand" "=m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5644 + (match_operand:HI 1 "register_operand" "U"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5645 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5646 + "pshs\t%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5647 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5648 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5649 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5650 +(define_insn "*movhi_pic_symbolref"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5651 + [(set (match_operand:HI 0 "register_operand" "=a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5652 + (match_operand:HI 1 "symbolic_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5653 + "flag_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5654 + "lea%0\t%c1,pcr"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5655 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5656 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5657 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5658 +(define_insn "*movhi_1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5659 + [(set (match_operand:HI 0 "nonimmediate_operand" "=a,d,a,ad,mu")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5660 + (match_operand:HI 1 "general_operand" " a,a,d,miu,ad"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5661 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5662 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5663 + lea%0\t,%1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5664 + tfr\t%1,%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5665 + tfr\t%1,%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5666 + ld%0\t%1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5667 + st%1\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5668 + [(set_attr "length" "2,2,2,*,*")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5669 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5670 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5671 +;;; Generated by the combiner to merge an address calculation with
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5672 +;;; a byte load. We can use the 'abx' instruction here.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5673 +(define_insn "*movqi_array_load"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5674 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5675 + (mem:QI (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%B"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5676 + (match_operand:HI 2 "immediate_operand" "i"))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5677 + (clobber (match_scratch:HI 3 "=X"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5678 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5679 + "ldx\t%2\;abx\;ld%0\t,x"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5680 + [(set_attr "length" "6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5681 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5682 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5683 +;;; Optimize the move of a byte to the stack using the pshs instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5684 +;;; instead of a store with pre-increment.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5685 +(define_insn "movqi_push"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5686 + [(set (match_operand:QI 0 "push_operand" "=m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5687 + (match_operand:QI 1 "register_operand" " q"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5688 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5689 + "pshs\t%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5690 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5691 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5692 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5693 +;;; Optimize the move of a byte from the stack using the puls instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5694 +;;; instead of a store with post-decrement.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5695 +(define_insn "movqi_pop"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5696 + [(set (match_operand:QI 0 "register_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5697 + (match_operand:QI 1 "pop_operand" "m"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5698 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5699 + "puls\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5700 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5701 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5702 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5703 +;;- load low byte of 16-bit data into 8-bit register/memory
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5704 +(define_insn "*mov_lsb"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5705 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,!q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5706 + (subreg:QI (match_operand:HI 1 "general_operand" "d,m,a,d, U") 1))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5707 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5708 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5709 + \t;movlsbqihi: D->B
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5710 + ld%0\t%L1\t;movlsbqihi: msb:%1 -> R:%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5711 + tfr\t%1,d\t;movlsbqihi: R:%1 -> R:%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5712 + stb\t%0\t;movlsbqihi: R:%1 -> %0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5713 + pshs\t%1\t;movlsbqihi: R:%1 -> R:%0\;leas\t1,s\;puls\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5714 + [(set_attr "length" "0,*,2,*,6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5715 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5716 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5717 +;;- load high byte of 16-bit data into 8-bit register/memory
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5718 +(define_insn "*mov_msb"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5719 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,q,m,!q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5720 + (subreg:QI (match_operand:HI 1 "general_operand" "d,O,a,m,d, U") 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5721 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5722 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5723 + tfr\ta,b\t;movmsbqihi: D->B
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5724 + clr%0\t\t;movmsbqihi: ZERO -> R:%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5725 + tfr\t%1,d\t;movmsbqihi: R:%1 -> R:%0\;tfr\ta,b
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5726 + ld%0\t%L1\t;movmsbqihi: lsb:%1 -> R:%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5727 + sta\t%0\t;movmsbqihi: R:%1 -> %0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5728 + pshs\t%1\t;movmsbqihi: R:%1 -> R:%0\;puls\t%0\;leas\t1,s"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5729 + [(set_attr "length" "2,1,4,*,*,6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5730 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5731 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5732 +(define_insn "*movqi_boolean"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5733 + [(set (reg:QI HARD_Z_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5734 + (match_operand:QI 0 "general_operand" "q,O,i,m"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5735 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5736 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5737 + tst%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5738 + andcc\t#~4
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5739 + orcc\t#4
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5740 + tst\t%0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5741 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5742 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5743 +(define_insn "movqi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5744 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,m,q,m,q,z")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5745 + (match_operand:QI 1 "general_operand" " q,O,O,mi,q,z,q"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5746 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5747 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5748 + tfr\t%1,%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5749 + clr%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5750 + clr\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5751 + ld%0\t%1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5752 + st%1\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5753 + tfr\tcc,%0\;and%0\t#4
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5754 + tst%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5755 + [(set_attr "length" "2,1,3,*,*,4,1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5756 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5757 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5758 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5759 +;;- Swap registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5760 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5761 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5762 +; Note: 8-bit swap is never needed so it is not defined.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5763 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5764 +(define_insn "swaphi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5765 + [(set (match_operand:HI 0 "register_operand" "+r")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5766 + (match_operand:HI 1 "register_operand" "+r"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5767 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5768 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5769 + "exg\t%1,%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5770 + [(set_attr "length" "2")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5771 + (set (attr "cycles") (const_int EXG_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5772 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5773 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5774 +(define_insn "bswaphi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5775 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5776 + (bswap:HI (match_operand:HI 1 "register_operand" "0")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5777 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5778 + "exg\ta,b"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5779 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5780 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5781 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5782 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5783 +;;- Extension and truncation insns.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5784 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5785 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5786 +(define_insn "extendqihi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5787 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5788 + (sign_extend:HI (match_operand:QI 1 "general_operand" "B")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5789 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5790 + "sex\t\t;extendqihi2: R:%1 -> R:%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5791 + [(set_attr "length" "1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5792 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5793 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5794 +(define_insn "zero_extendqihi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5795 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5796 + (zero_extend:HI (match_operand:QI 1 "general_operand" "B")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5797 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5798 + "clra\t\t;zero_extendqihi: R:%1 -> R:%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5799 + [(set_attr "length" "1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5800 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5801 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5802 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5803 +;;- All kinds of add instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5804 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5805 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5806 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5807 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5808 +;; gcc's automatic version of addsi3 doesn't know about adcb,adca
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5809 +;; so it is MUCH less efficient. Define this one ourselves.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5810 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5811 +;; TODO - can't always get 'd' for the clobber... allow other registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5812 +;; as well and use exg d,R ... exg R,d around the code sequence to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5813 +;; use others, at a price. Also consider libcall for this when
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5814 +;; optimizing for size.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5815 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5816 +(define_insn "addsi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5817 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5818 + (plus:SI (match_operand:SI 1 "general_operand" "%o")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5819 + (match_operand:SI 2 "general_operand" " oi")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5820 + (clobber (match_scratch:HI 3 "=d"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5821 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5822 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5823 + m6809_output_addsi3 (PLUS, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5824 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5825 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5826 + [(set_attr "length" "21")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5827 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5828 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5829 +; Increment of a 16-bit MEM by 1 can be done without a register.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5830 +(define_insn "*addhi_mem_1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5831 + [(set (match_operand:HI 0 "memory_operand" "=m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5832 + (plus:HI (match_dup 0) (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5833 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5834 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5835 + rtx xoperands[2];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5836 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5837 + xoperands[0] = operands[0];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5838 + xoperands[1] = adjust_address (operands[0], QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5839 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5840 + output_asm_insn ("inc\t%1", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5841 + output_asm_insn ("bne\t__IL%=", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5842 + output_asm_insn ("inc\t%0\;__IL%=:", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5843 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5844 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5845 + [(set_attr "length" "7")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5846 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5847 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5848 +; Decrement of a 16-bit MEM by 1 can be done without a register.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5849 +(define_insn "*addhi_mem_minus1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5850 + [(set (match_operand:HI 0 "memory_operand" "=m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5851 + (plus:HI (match_dup 0) (const_int -1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5852 + "GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5853 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5854 + rtx xoperands[2];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5855 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5856 + xoperands[0] = operands[0];
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5857 + xoperands[1] = adjust_address (operands[0], QImode, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5858 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5859 + output_asm_insn ("tst\t%1", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5860 + output_asm_insn ("bne\t__IL%=", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5861 + output_asm_insn ("dec\t%0", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5862 + output_asm_insn ("__IL%=:", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5863 + output_asm_insn ("dec\t%1", xoperands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5864 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5865 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5866 + [(set_attr "length" "7")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5867 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5868 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5869 +; Allow the addition of an 8-bit quantity to a 16-bit quantity
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5870 +; using the LEAX B,Y addressing mode, where X and Y are both
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5871 +; index registers. This will only get generated via the peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5872 +; which removes a sign extension.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5873 +(define_insn "*addhi_b"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5874 + [(set (match_operand:HI 0 "index_register_operand" "=a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5875 + (plus:HI(match_operand:HI 1 "index_register_operand" "%a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5876 + (match_operand:QI 2 "register_operand" "q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5877 + ))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5878 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5879 + "lea%0\t%2,%1\t;addhi_b: R:%0 = R:%2 + R:%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5880 + [(set_attr "length" "*")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5881 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5882 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5883 +; Splitter for addhi pattern #5 below
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5884 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5885 + [(set (match_operand:HI 0 "index_register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5886 + (plus:HI (match_dup 0) (match_operand:HI 1 "memory_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5887 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5888 + [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5889 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5890 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5891 + (set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5892 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5893 + (parallel [(set (match_dup 0) (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5894 + (set (reg:HI HARD_D_REGNUM) (match_dup 0))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5895 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5896 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5897 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5898 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5899 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5900 +; Splitter for addhi pattern #7 below
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5901 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5902 + [(set (match_operand:HI 0 "index_register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5903 + (plus:HI (match_dup 0) (match_operand:HI 1 "index_register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5904 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5905 + [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5906 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5907 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5908 + (set (match_dup 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5909 + (plus:HI (reg:HI HARD_D_REGNUM) (match_dup 0)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5910 + (parallel [(set (match_dup 1) (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5911 + (set (reg:HI HARD_D_REGNUM) (match_dup 1))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5912 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5913 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5914 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5915 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5916 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5917 +; TODO - this is ugly. During RTL generation, we don't know what registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5918 +; are available, so the multiple-insn sequences can only be solved
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5919 +; via 'define_split's during matching. See andhi3 for an example.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5920 +; Keep the constraints with ? modifiers to help reload pick the right
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5921 +; registers.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5922 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5923 +; The forms are:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5924 +; 1. D += D, expand this into a shift instead. (rtx costs should be corrected
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5925 +; to avoid this even happening...)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5926 +; 2. D += U, require U to be pushed to memory. (Lots of patterns do this
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5927 +; now, is this a better way?)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5928 +; 3. Best choice: 'addd'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5929 +; 4. Next best choice: 'lea'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5930 +; 5. Hybrid of 3 and 4
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5931 +; 6. Same as 4, not bad
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5932 +; 7. BAD, no D register at all
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5933 +; 8. 'lea', as good as 4.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5934 +(define_insn "addhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5935 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d, d, a,?a, a,???T,a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <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")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5937 + (match_operand:HI 2 "general_operand" " 0, !U, mi, a, m, d, T, i")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5938 + ))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5939 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5940 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5941 + lslb\t\t;addhi: R:%0 += R:%2\;rola\t\t;also R:%0 *= 2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5942 + pshs\t%2\t;addhi: R:%0 += R:%2\;add%0\t,s++
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5943 + add%0\t%2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5944 + lea%0\t%1,%2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5945 + #
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5946 + lea%0\t%2,%1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5947 + #
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5948 + lea%0\t%a2,%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5949 + [(set_attr "length" "2,6,*,*,7,*,7,*")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5950 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5951 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5952 +(define_insn "addqi3_carry"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5953 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5954 + (unspec:QI [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5955 + (match_operand:QI 1 "whole_general_operand" "%0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5956 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_ADD_CARRY))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5957 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5958 + "adc%0\t%2\t;addqi_carry: R:%0 += %2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5959 + [(set_attr "length" "*")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5960 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5961 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5962 +; TODO: specifying 'A' for the first constraint, to force into the A register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5963 +; is not working because of the way registers are currently set up. This will
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5964 +; take some work to get right. Thus the second alternative as a backup.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5965 +(define_insn "addqi3_decimal"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5966 + [(set (match_operand:QI 0 "nonimmediate_operand" "=A,?q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5967 + (unspec:QI [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5968 + (match_operand:QI 1 "general_operand" "%0,0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5969 + (match_operand:QI 2 "general_operand" "mi,mi")] UNSPEC_ADD_DECIMAL))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5970 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5971 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5972 + adda\t%2\;daa
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5973 + tfr\t%0,a\;adda\t%2\;daa\;tfr\ta,%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5974 + [(set_attr "length" "5,9")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5975 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5976 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5977 +(define_insn "addqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5978 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,q,m,m,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5979 + (plus:QI (match_operand:QI 1 "whole_general_operand" "%0,0,0,0,0,0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5980 + (match_operand:QI 2 "whole_general_operand" " 0,I,N,I,N,mi")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5981 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5982 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5983 + asl%0\t\t;addqi: R:%0 = R:%0 + R:%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5984 + inc%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5985 + dec%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5986 + inc\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5987 + dec\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5988 + add%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5989 + [(set_attr "length" "1,1,1,3,3,*")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5990 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5991 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5992 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5993 +;;- Subtract instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5994 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5995 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5996 +(define_insn "subsi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5997 + [(set (match_operand:SI 0 "nonimmediate_operand" "=o")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5998 + (minus:SI (match_operand:SI 1 "general_operand" " o")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
5999 + (match_operand:SI 2 "general_operand" " oi")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6000 + (clobber (match_scratch:HI 3 "=d"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6001 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6002 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6003 + m6809_output_addsi3 (MINUS, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6004 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6005 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6006 + [(set_attr "length" "21")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6007 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6008 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6009 +(define_insn "subhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6010 + [(set (match_operand:HI 0 "register_operand" "=d, d, a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6011 + (minus:HI (match_operand:HI 1 "register_operand" "0, 0, 0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6012 + (match_operand:HI 2 "general_operand" "mi, ?U,n")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6013 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6014 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6015 + sub%0\t%2\t;subhi: R:%0 -= %2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6016 + pshs\t%2\t;subhi: R:%0 -= R:%2\;sub%0\t,s++
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6017 + lea%0\t%n2,%1\t;subhi: R:%0 = R:%1 + %n2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6018 + [(set_attr "length" "*,5,3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6019 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6020 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6021 +(define_insn "subqi3_carry"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6022 + [(set (match_operand:QI 0 "register_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6023 + (unspec:QI [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6024 + (match_operand:QI 1 "whole_general_operand" "%0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6025 + (match_operand:QI 2 "whole_general_operand" "tmi")] UNSPEC_SUB_CARRY))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6026 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6027 + "sbc%0\t%2\t;subqi_carry: R:%0 += %2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6028 + [(set_attr "length" "*")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6029 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6030 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6031 +(define_insn "subqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6032 + [(set (match_operand:QI 0 "register_operand" "=q, q, !q, q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6033 + (minus:QI (match_operand:QI 1 "whole_register_operand" "0, 0, I, 0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6034 + (match_operand:QI 2 "whole_general_operand" "I, mi, 0, t")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6035 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6036 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6037 + dec%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6038 + sub%0\t%2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6039 + dec%0\;neg%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6040 + sub%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6041 + [(set_attr "length" "1,3,2,3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6042 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6043 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6044 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6045 +;;- Multiply instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6046 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6047 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6048 +; TODO - merge these two instructions, using 'extend_operator' to match
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6049 +; either signed or zero extension. Everything else is the same.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6050 +(define_insn "mulqihi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6051 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6052 + (mult:HI (sign_extend:HI (match_operand:QI 1 "general_operand" "%q"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6053 + (match_operand:QI 2 "general_operand" "tmK")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6054 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6055 + "lda\t%2\t;mulqihi3\;mul"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6056 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6057 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6058 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6059 +(define_insn "umulqihi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6060 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6061 + (mult:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%q"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6062 + (match_operand:QI 2 "general_operand" "tmK")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6063 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6064 + "lda\t%2\t;umulqihi3\;mul"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6065 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6066 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6067 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6068 +; Expand a 16x16 multiplication into either a libcall or a shift.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6069 +; If the second operand is a small constant, use the above form.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6070 +; Otherwise, do a libcall.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6071 +(define_expand "mulhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6072 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6073 + (mult:HI (match_operand:HI 1 "general_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6074 + (match_operand:HI 2 "nonmemory_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6075 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6076 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6077 + emit_libcall_insns (HImode, "mulhi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6078 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6079 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6080 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6081 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6082 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6083 +;;- Divide instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6084 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6085 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6086 +(define_expand "divhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6087 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6088 + (div:HI (match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6089 + (match_operand:HI 2 "register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6090 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6091 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6092 + emit_libcall_insns (HImode, "divhi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6093 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6094 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6095 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6096 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6097 +(define_expand "divqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6098 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6099 + (div:QI (match_operand:QI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6100 + (match_operand:QI 2 "register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6101 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6102 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6103 + emit_libcall_insns (QImode, "divqi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6104 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6105 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6106 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6107 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6108 +(define_expand "udivhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6109 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6110 + (udiv:HI (match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6111 + (match_operand:HI 2 "register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6112 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6113 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6114 + emit_libcall_insns (HImode, "udivhi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6115 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6116 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6117 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6118 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6119 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6120 +;;- mod
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6121 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6122 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6123 +(define_expand "modhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6124 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6125 + (mod:HI (match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6126 + (match_operand:HI 2 "register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6127 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6128 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6129 + emit_libcall_insns (HImode, "modhi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6130 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6131 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6132 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6133 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6134 +(define_expand "modqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6135 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6136 + (mod:QI (match_operand:QI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6137 + (match_operand:QI 2 "register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6138 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6139 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6140 + emit_libcall_insns (QImode, "modqi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6141 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6142 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6143 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6144 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6145 +(define_expand "umodhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6146 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6147 + (umod:HI (match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6148 + (match_operand:HI 2 "register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6149 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6150 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6151 + emit_libcall_insns (HImode, "umodhi3", operands, 2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6152 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6153 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6154 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6155 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6156 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6157 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6158 +;;- and, or, xor common patterns
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6159 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6160 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6161 +; Split a bitwise HImode into two QImode instructions, with one of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6162 +; the sources in a pushable register. The register is pushed onto
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6163 +; the stack and memory pop operands (,s+) are used in the QI forms.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6164 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6165 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6166 + (match_operator:HI 3 "logical_bit_operator"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6167 + [(match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6168 + (match_operand:HI 2 "register_operand" "")]))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6169 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6170 + [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 2))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6171 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6172 + [(reg:QI HARD_A_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6173 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6174 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6175 + [(reg:QI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6176 + (mem:QI (post_inc:QI (reg:HI HARD_S_REGNUM)))]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6177 + (use (reg:QI HARD_A_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6178 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6179 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6180 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6181 +; Split a bitwise HImode into two QImode instructions, with one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6182 +; of the sources being a (MEM (MEM (...)); i.e. an indirect memory
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6183 +; reference. This requires dereferencing the pointer into a
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6184 +; temporary register (X), which must be saved/restored around the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6185 +; compute instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6186 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6187 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6188 + (match_operator:HI 3 "logical_bit_operator"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6189 + [(match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6190 + (mem:HI (match_operand:HI 2 "memory_operand" ""))]))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6191 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6192 + [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6193 + (set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 4))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6194 + (set (match_dup 4) (match_dup 2))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6195 + (set (match_dup 4) (mem:HI (match_dup 4)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6196 + (set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6197 + [(reg:QI HARD_A_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6198 + (mem:QI (post_inc:QI (match_dup 4)))]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6199 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6200 + [(reg:QI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6201 + (mem:QI (post_inc:QI (match_dup 4)))]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6202 + (use (reg:QI HARD_A_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6203 + (set (match_dup 4) (mem:HI (post_inc:HI (reg:HI HARD_S_REGNUM))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6204 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6205 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6206 + /* Use X for a temporary index register */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6207 + operands[4] = gen_rtx_REG (HImode, HARD_X_REGNUM);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6208 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6209 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6210 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6211 +; Split a bitwise HImode into two QImode instructions. This is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6212 +; the common case. This handles splitting when neither of the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6213 +; above two cases applies.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6214 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6215 + [(set (match_operand:HI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6216 + (match_operator:HI 3 "logical_bit_operator"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6217 + [(match_operand:HI 1 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6218 + (match_operand:HI 2 "general_operand" "")]))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6219 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6220 + [(set (reg:QI HARD_A_REGNUM) (match_op_dup:QI 3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6221 + [(reg:QI HARD_A_REGNUM) (match_dup 4)]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6222 + (set (reg:QI HARD_D_REGNUM) (match_op_dup:QI 3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6223 + [(reg:QI HARD_D_REGNUM) (match_dup 5)]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6224 + (use (reg:QI HARD_A_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6225 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6226 + if (GET_CODE (operands[2]) == CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6227 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6228 + operands[4] = gen_rtx_const_high (operands[2]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6229 + operands[5] = gen_rtx_const_low (operands[2]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6230 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6231 + else if ((GET_CODE (operands[2]) == MEM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6232 + && (GET_CODE (XEXP (operands[2], 0)) == MEM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6233 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6234 + FAIL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6235 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6236 + else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6237 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6238 + operands[4] = gen_highpart (QImode, operands[2]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6239 + operands[5] = gen_lowpart (QImode, operands[2]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6240 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6241 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6242 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6243 +; Below are the specific cases for each of the operators.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6244 +; The QImode versions are the simplest and can be implemented
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6245 +; directly on the hardware. The HImode cases are all output
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6246 +; using one of the above splitting techniques.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6247 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6248 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6249 +;;- and
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6250 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6251 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6252 +(define_insn "andhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6253 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6254 + (and:HI (match_operand:HI 1 "register_operand" "%0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6255 + (match_operand:HI 2 "general_operand" "mnU")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6256 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6257 + "#")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6258 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6259 +;; it is not clear that this is correct
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6260 +(define_insn "*andqi_2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6261 + [(set
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6262 + (match_operand:QI 0 "register_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6263 + (and:QI (match_operand:QI 1 "register_operand" "q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6264 + (match_operand 2 "const_int_operand" "i")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6265 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6266 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6267 + if (GET_CODE (operands[2]) == CONST_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6268 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6269 + operands[3] = GEN_INT(INTVAL(operands[2]) & 0xff);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6270 + return "and%0\t%3";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6271 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6272 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6273 + return "and%0\t%2";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6274 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6275 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6276 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6277 +(define_insn "andqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6278 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,qc")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6279 + (and:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6280 + (match_operand:QI 2 "whole_general_operand" " O,N,m,i")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6281 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6282 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6283 + clr%0\t;andqi(ZERO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6284 + \t;andqi(-1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6285 + and%0\t%2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6286 + and%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6287 + [(set_attr "length" "1,0,3,2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6288 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6289 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6290 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6291 +;;- or
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6292 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6293 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6294 +(define_insn "iorhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6295 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6296 + (ior:HI (match_operand:HI 1 "register_operand" "%0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6297 + (match_operand:HI 2 "general_operand" "mnU")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6298 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6299 + "#")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6300 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6301 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6302 +(define_insn "iorqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6303 + [(set (match_operand:QI 0 "register_operand" "=q,q, qc")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6304 + (ior:QI (match_operand:QI 1 "whole_register_operand" "%0,0, 0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6305 + (match_operand:QI 2 "whole_general_operand" " O,m,i")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6306 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6307 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6308 + \t;iorqi(ZERO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6309 + or%0\t%2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6310 + or%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6311 + [(set_attr "length" "0,3,2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6312 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6313 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6314 +;;- xor
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6315 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6316 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6317 +(define_insn "xorhi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6318 + [(set (match_operand:HI 0 "register_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6319 + (xor:HI (match_operand:HI 1 "register_operand" "%0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6320 + (match_operand:HI 2 "general_operand" "mnU")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6321 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6322 + "#")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6323 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6324 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6325 +(define_insn "xorqi3"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6326 + [(set (match_operand:QI 0 "register_operand" "=q,q,q,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6327 + (xor:QI (match_operand:QI 1 "whole_register_operand" "%0,0,0,0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6328 + (match_operand:QI 2 "whole_general_operand" " O,N,m,i")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6329 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6330 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6331 + \t;xorqi(ZERO)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6332 + com%0\t;xorqi(-1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6333 + eor%0\t%2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6334 + eor%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6335 + [(set_attr "length" "0,1,3,2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6336 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6337 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6338 +;;- Two's Complements
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6339 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6340 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6341 +(define_insn "neghi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6342 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,!a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6343 + (neg:HI (match_operand:HI 1 "general_operand" "0, 0")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6344 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6345 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6346 + nega\;negb\;sbca\t#0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6347 + exg\td,%0\;nega\;negb\;sbca\t#0\;exg\td,%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6348 + [(set_attr "length" "5,9")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6349 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6350 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6351 +(define_insn "negqi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6352 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6353 + (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6354 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6355 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6356 + neg%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6357 + neg\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6358 + [(set_attr "length" "1,3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6359 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6360 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6361 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6362 +;;- One's Complements
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6363 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6364 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6365 +(define_insn "one_cmplhi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6366 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d,?tm,???a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6367 + (not:HI (match_operand:HI 1 "general_operand" "0, 0, 0")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6368 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6369 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6370 + coma\;comb
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6371 + com\t%0\;com\t%L0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6372 + exg\td,%0\;coma\;comb\;exg\td,%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6373 + [(set_attr "length" "2,6,6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6374 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6375 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6376 +(define_insn "one_cmplqi2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6377 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6378 + (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6379 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6380 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6381 + com%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6382 + com\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6383 + [(set_attr "length" "1,3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6384 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6385 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6386 +;;- Shifts/rotates
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6387 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6388 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6389 +(define_code_iterator bit_code [ashift ashiftrt lshiftrt])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6390 +(define_code_attr bit_code_name [(ashift "ashl") (ashiftrt "ashr") (lshiftrt "lshr")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6391 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6392 +(define_mode_iterator bit_mode [QI HI])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6393 +(define_mode_attr bit_mode_name [(QI "qi3") (HI "hi3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6394 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6395 +;; Emit RTL for any shift (handles all 3 opcodes and 2 mode sizes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6396 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6397 +(define_expand "<bit_code:bit_code_name><bit_mode:bit_mode_name>"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6398 + [(set (match_operand:bit_mode 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6399 + (bit_code:bit_mode (match_operand:bit_mode 1 "general_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6400 + (match_operand:bit_mode 2 "nonmemory_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6401 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6402 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6403 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6404 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6405 +; Individual instructions implemented in the CPU.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6406 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6407 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6408 +(define_insn "*ashift1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6409 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6410 + (ashift:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6411 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6412 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6413 + asl\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6414 + asl%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6415 + [(set_attr "length" "3,1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6416 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6417 +(define_insn "*lshiftrt1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6418 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6419 + (lshiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6420 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6421 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6422 + lsr\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6423 + lsr%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6424 + [(set_attr "length" "3,1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6425 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6426 +(define_insn "*ashiftrt1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6427 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6428 + (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6429 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6430 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6431 + asr\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6432 + asr%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6433 + [(set_attr "length" "3,1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6434 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6435 +(define_insn "*rotate1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6436 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6437 + (rotate:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6438 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6439 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6440 + rol\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6441 + rol%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6442 + [(set_attr "length" "3,1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6443 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6444 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6445 +(define_insn "*rotatert1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6446 + [(set (match_operand:QI 0 "nonimmediate_operand" "=m,q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6447 + (rotatert:QI (match_operand:QI 1 "general_operand" "0,0") (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6448 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6449 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6450 + ror\t%0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6451 + ror%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6452 + [(set_attr "length" "3,1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6453 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6454 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6455 +; A shift by 8 for D reg can be optimized by just moving
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6456 +; between the A/B halves, and then zero/sign extending or
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6457 +; filling in zeroes.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6458 +; Because GCC does not understand that 'A' and 'D' refer to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6459 +; the same storage location, we must use 'USE' throughout
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6460 +; to prevent deletion of 'unnecessary' instructions.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6461 +; Similar optimization for MEM would require a scratch register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6462 +; so is not done here.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6463 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6464 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6465 + [(set (reg:HI HARD_D_REGNUM) (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6466 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6467 + [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6468 + (use (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6469 + (set (reg:QI HARD_A_REGNUM) (reg:QI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6470 + (use (reg:QI HARD_A_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6471 + (set (reg:QI HARD_D_REGNUM) (const_int 0))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6472 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6473 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6474 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6475 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6476 + [(set (reg:HI HARD_D_REGNUM) (lshiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6477 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6478 + [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6479 + (use (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6480 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6481 + (use (reg:QI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6482 + (set (reg:HI HARD_D_REGNUM) (zero_extend:HI (reg:QI HARD_D_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6483 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6484 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6485 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6486 +(define_split
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6487 + [(set (reg:HI HARD_D_REGNUM) (ashiftrt:HI (reg:HI HARD_D_REGNUM) (const_int 8)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6488 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6489 + [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6490 + (use (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6491 + (set (reg:QI HARD_D_REGNUM) (reg:QI HARD_A_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6492 + (use (reg:QI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6493 + (set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6494 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6495 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6496 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6497 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6498 +; On the WPC hardware, there is a shift register that can be used
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6499 +; to compute (1<<n) efficiently in two instructions. Note that this
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6500 +; form only works when using -mint8 though, because C will promote
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6501 +; to 'int' when doing this operation. TODO : we need a 16-bit form too.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6502 +(define_insn "ashlqi3_wpc"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6503 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6504 + (ashift:QI (match_operand:QI 1 "immediate_operand" "I")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6505 + (match_operand:QI 2 "general_operand" "q")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6506 + "TARGET_WPC"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6507 + "st%2\t0x3FF7\;ld%0\t0x3FF7"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6508 + [(set_attr "length" "6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6509 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6510 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6511 +; Internal instructions for shifting by a constant.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6512 +; Two forms are provided, one for QImode, one for HImode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6513 +; These are always split into the above instructions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6514 +; (except for QImode forms that directly match one of the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6515 +; above instructions, in which the condition will not
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6516 +; allow the splitter to match).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6517 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6518 +(define_insn_and_split "<bit_code:bit_code_name>hi3_const"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6519 + [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6520 + (bit_code:HI (match_operand:HI 1 "general_operand" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6521 + (match_operand:HI 2 "immediate_operand" "n")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6522 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6523 + "#"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6524 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6525 + [(const_int 0)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6526 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6527 + m6809_split_shift (<bit_code:CODE>, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6528 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6529 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6530 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6531 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6532 +(define_insn_and_split "<bit_code:bit_code_name>qi3_const"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6533 + [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6534 + (bit_code:QI (match_operand:QI 1 "general_operand" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6535 + (match_operand:QI 2 "immediate_operand" "n")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6536 + "INTVAL (operands[2]) > 1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6537 + "#"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6538 + "&& reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6539 + [(const_int 0)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6540 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6541 + m6809_split_shift (<bit_code:CODE>, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6542 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6543 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6544 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6545 +; Internal instructions for shifting by a nonconstant.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6546 +; These expand into complex assembly.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6547 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6548 +(define_insn "<bit_code:bit_code_name>hi3_reg"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6549 + [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6550 + (bit_code:HI (match_operand:HI 1 "general_operand" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6551 + (match_operand:HI 2 "nonimmediate_operand" "v")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6552 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6553 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6554 + m6809_output_shift_insn (<bit_code:CODE>, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6555 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6556 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6557 + [(set_attr "length" "20")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6558 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6559 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6560 +(define_insn "<bit_code:bit_code_name>qi3_reg"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6561 + [(set (match_operand:QI 0 "nonimmediate_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6562 + (bit_code:QI (match_operand:QI 1 "general_operand" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6563 + (match_operand:QI 2 "nonimmediate_operand" "v")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6564 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6565 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6566 + m6809_output_shift_insn (<bit_code:CODE>, operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6567 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6568 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6569 + [(set_attr "length" "16")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6570 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6571 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6572 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6573 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6574 +;;- Jumps and transfers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6575 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6576 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6577 +;;; The casesi pattern is normally *not* defined; see 'tablejump' instead.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6578 +(define_expand "casesi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6579 + [(match_operand:HI 0 "register_operand" "") ; index to jump on
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6580 + (match_operand:HI 1 "immediate_operand" "") ; lower bound
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6581 + (match_operand:HI 2 "immediate_operand" "") ; total range
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6582 + (match_operand 3 "" "") ; table label
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6583 + (match_operand 4 "" "")] ; out of range label
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6584 + "TARGET_BYTE_INT && TARGET_CASESI"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6585 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6586 + m6809_do_casesi (operands[0], operands[1], operands[2],
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6587 + operands[3], operands[4]);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6588 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6589 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6590 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6591 +(define_insn "tablejump_short_offset"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6592 + [(set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6593 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6594 + (zero_extend:HI (match_operand:QI 0 "register_operand" "q")))))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6595 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6596 + "jmp\t[b,x]\t;tablejump_short_offset"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6597 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6598 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6599 +(define_insn "tablejump_long_offset"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6600 + [(set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6601 + (mem:HI (plus:HI (match_operand:HI 1 "register_operand" "U")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6602 + (match_operand:HI 0 "register_operand" "d"))))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6603 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6604 + "jmp\t[d,x]\t;tablejump_long_offset"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6605 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6606 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6607 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6608 + ;; A tablejump operation gives the address in operand 0, with the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6609 + ;; CODE_LABEL for the table in operand 1. The 'define_expand'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6610 + ;; shows the arguments as GCC presents them. For a register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6611 + ;; operand, the assembly code is straightforward. For a MEM,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6612 + ;; assumed to be a SYMBOL_REF, two forms are given, one normal
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6613 + ;; and one for PIC mode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6614 + (define_expand "tablejump"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6615 + [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6616 + (set (pc) (match_operand:HI 0 "" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6617 + (use (label_ref (match_operand 1 "" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6618 + (clobber (match_scratch:HI 2 ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6619 + ])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6620 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6621 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6622 + })
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6623 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6624 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6625 +(define_insn "*tablejump_reg"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6626 + [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6627 + (set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6628 + (match_operand:HI 0 "register_operand" "a"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6629 + (use (label_ref (match_operand 1 "" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6630 + (clobber (match_scratch:HI 2 ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6631 + ])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6632 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6633 + "jmp\t,%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6634 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6635 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6636 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6637 +(define_insn "*tablejump_symbol"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6638 + [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6639 + (set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6640 + (mem:HI
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6641 + (plus:HI (match_operand:HI 0 "register_operand" "a")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6642 + (label_ref (match_operand 1 "" "")))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6643 + (use (label_ref (match_dup 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6644 + (clobber (match_scratch:HI 2 ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6645 + ])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6646 + "!flag_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6647 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6648 + output_asm_insn ("jmp\t[%a1,%0]", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6649 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6650 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6651 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6652 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6653 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6654 +(define_insn "*tablejump_symbol_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6655 + [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6656 + (set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6657 + (mem:HI
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6658 + (plus:HI (match_operand:HI 0 "register_operand" "d")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6659 + (label_ref (match_operand 1 "" "")))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6660 + (use (label_ref (match_dup 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6661 + (clobber (match_scratch:HI 2 "=&a"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6662 + ])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6663 + "flag_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6664 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6665 + output_asm_insn ("lea%2\t%a1,pcr", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6666 + output_asm_insn ("ld%0\t%0,%2", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6667 + output_asm_insn ("jmp\t%0,%2", operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6668 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6669 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6670 + [(set_attr "length" "8")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6671 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6672 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6673 +(define_insn "indirect_jump"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6674 + [(set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6675 + (match_operand:HI 0 "register_operand" "a"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6676 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6677 + "jmp\t,%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6678 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6679 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6680 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6681 +(define_insn "jump"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6682 + [(set (pc) (label_ref (match_operand 0 "" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6683 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6684 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6685 + return output_branch_insn ( LABEL_REF, operands, get_attr_length (insn));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6686 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6687 + [(set (attr "type") (const_string "branch"))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6688 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6689 +; Output assembly for a condition branch instruction.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6690 +(define_insn "*cond_branch"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6691 + [(set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6692 + (if_then_else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6693 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6694 + (label_ref (match_operand 0 "" "")) (pc)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6695 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6696 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6697 + return output_branch_insn ( GET_CODE(operands[1]),
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6698 + operands, get_attr_length (insn));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6699 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6700 + [(set (attr "type") (const_string "cbranch"))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6701 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6702 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6703 +; Similar to above, but for a condition branch instruction that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6704 +; had its operands reversed at some point.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6705 +(define_insn "*cond_branch_reverse"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6706 + [(set (pc)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6707 + (if_then_else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6708 + (match_operator 1 "comparison_operator" [(cc0) (const_int 0)])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6709 + (pc) (label_ref (match_operand 0 "" ""))))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6710 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6711 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6712 + return output_branch_insn ( reverse_condition (GET_CODE(operands[1])),
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6713 + operands, get_attr_length (insn));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6714 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6715 + [(set (attr "type") (const_string "cbranch"))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6716 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6717 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6718 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6719 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6720 +;;- Calls
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6721 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6722 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6723 +;; Generate a call instruction for a function that does not
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6724 +;; return a value. The expander is used during RTL generation.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6725 +;; The instructions below are used during matching; only one
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6726 +;; of them will be used, depending on the type of function
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6727 +;; being called. The different conditions are:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6728 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6729 +;; 1) far_functionp - is this a far function? Those need
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6730 +;; to be output as indirect calls through a far-function
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6731 +;; handler.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6732 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6733 +;; 2) noreturn_functionp - if the function does not return,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6734 +;; we can use a 'jmp' instead of a 'jsr' to call it.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6735 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6736 +;; 3) is PIC mode enabled? If so, we'll always use
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6737 +;; relative calls (lbsr or lbra).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6738 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6739 +;; Note: not all combinations are fully supported, especially
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6740 +;; relating to PIC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6741 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6742 +;; The 'bsr' instruction is never generated.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6743 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6744 +(define_expand "call"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6745 + [(call (match_operand:HI 0 "memory_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6746 + (match_operand:HI 1 "general_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6747 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6748 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6749 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6750 +(define_insn "*call_nopic_far"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6751 + [(call (match_operand:HI 0 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6752 + (match_operand:HI 1 "general_operand" "g"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6753 + "far_functionp (operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6754 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6755 + output_far_call_insn (operands, 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6756 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6757 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6758 + [(set_attr "length" "6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6759 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6760 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6761 +; PIC forms come first, and should only match
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6762 +; (MEM (SYMBOL_REF)). Other MEM forms are treated as usual.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6763 +(define_insn "*call_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6764 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6765 + (match_operand:HI 1 "general_operand" "g"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6766 + "flag_pic && !noreturn_functionp (operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6767 + "lbsr\t%C0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6768 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6769 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6770 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6771 +(define_insn "*call_nopic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6772 + [(call (match_operand:HI 0 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6773 + (match_operand:HI 1 "general_operand" "g"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6774 + "!noreturn_functionp (operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6775 + "jsr\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6776 + [(set_attr "length" "3")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6777 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6778 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6779 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6780 +(define_insn "*call_noreturn_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6781 + [(call (mem:HI (match_operand:HI 0 "symbolic_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6782 + (match_operand:HI 1 "general_operand" "g"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6783 + "flag_pic && noreturn_functionp (operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6784 + "lbra\t%C0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6785 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6786 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6787 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6788 +(define_insn "*call_noreturn_nopic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6789 + [(call (match_operand:HI 0 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6790 + (match_operand:HI 1 "general_operand" "g"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6791 + "noreturn_functionp (operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6792 + "jmp\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6793 + [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6794 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6795 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6796 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6797 +;; Same as above, but for functions that do return a value.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6798 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6799 +(define_expand "call_value"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6800 + [(set (match_operand 0 "" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6801 + (call (match_operand:HI 1 "memory_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6802 + (match_operand:HI 2 "general_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6803 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6804 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6805 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6806 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6807 +(define_insn "*call_value_far"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6808 + [(set (match_operand 0 "" "=gz")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6809 + (call (match_operand:HI 1 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6810 + (match_operand:HI 2 "general_operand" "g")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6811 + "far_functionp (operands[1])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6812 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6813 + output_far_call_insn (operands, 1);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6814 + return "";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6815 +}
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6816 + [(set_attr "length" "6")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6817 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6818 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6819 +(define_insn "*call_value_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6820 + [(set (match_operand 0 "" "=gz")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6821 + (call (mem:HI (match_operand:HI 1 "symbolic_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6822 + (match_operand:HI 2 "general_operand" "g")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6823 + "flag_pic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6824 + "lbsr\t%C1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6825 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6826 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6827 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6828 +(define_insn "*call_value_nopic"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6829 + [(set (match_operand 0 "" "=gz")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6830 + (call (match_operand:HI 1 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6831 + (match_operand:HI 2 "general_operand" "g")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6832 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6833 + "jsr\t%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6834 + [(set_attr "length" "3")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6835 + (set (attr "cycles") (const_int JSR_EXTENDED_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6836 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6837 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6838 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6839 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6840 +;; How to generate an untyped call.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6841 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6842 +(define_expand "untyped_call"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6843 + [(parallel [(call (match_operand 0 "" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6844 + (const_int 0))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6845 + (match_operand 1 "" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6846 + (match_operand 2 "" "")])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6847 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6848 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6849 + int i;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6850 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6851 + emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6852 + for (i=0; i < XVECLEN (operands[2], 0); i++)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6853 + {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6854 + rtx set = XVECEXP (operands[2], 0, i);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6855 + emit_move_insn (SET_DEST (set), SET_SRC (set));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6856 + }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6857 + emit_insn (gen_blockage ());
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6858 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6859 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6860 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6861 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6862 +(define_expand "sibcall"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6863 + [(parallel
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6864 + [(call (match_operand:HI 0 "memory_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6865 + (match_operand:HI 1 "immediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6866 + (use (reg:HI HARD_PC_REGNUM))])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6867 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6868 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6869 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6870 +(define_insn "*sibcall_1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6871 + [(parallel
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6872 + [(call (match_operand:HI 0 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6873 + (match_operand:HI 1 "immediate_operand" "i"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6874 + (use (reg:HI HARD_PC_REGNUM))])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6875 + "SIBLING_CALL_P(insn)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6876 + "jmp\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6877 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6878 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6879 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6880 +(define_expand "sibcall_value"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6881 + [(parallel
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6882 + [(set (match_operand 0 "" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6883 + (call (match_operand:HI 1 "memory_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6884 + (match_operand:HI 2 "immediate_operand" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6885 + (use (reg:HI HARD_PC_REGNUM))])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6886 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6887 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6888 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6889 +(define_insn "*sibcall_value_1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6890 + [(parallel
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6891 + [(set (match_operand 0 "" "=gz")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6892 + (call (match_operand:HI 1 "memory_operand" "m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6893 + (match_operand:HI 2 "immediate_operand" "i")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6894 + (use (reg:HI HARD_PC_REGNUM))])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6895 + "SIBLING_CALL_P(insn)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6896 + "jmp\t%1"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6897 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6898 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6899 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6900 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6901 +;;- Function Entry and Exit
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6902 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6903 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6904 +;; On entry to a function, the stack frame looks as follows:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6905 +;; - return address (pushed by the caller)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6906 +;; - saved registers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6907 +;; - local variable storage
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6908 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6909 +;; If the function does not modify the stack after that, then
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6910 +;; any of these can be accessed directly as an offset from
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6911 +;; STACK_POINTER_REGNUM. Otherwise, a frame pointer is required.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6912 +;; In that case, the prologue must also initialize HARD_FRAME_POINTER_REGNUM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6913 +;; and all references to the stack frame will use that as a base instead.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6914 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6915 +(define_expand "prologue"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6916 + [(const_int 0)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6917 + "prologue_epilogue_required ()"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6918 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6919 + emit_prologue_insns ();
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6920 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6921 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6922 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6923 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6924 +;; The function epilogue does exactly the reverse of the prologue,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6925 +;; deallocating local variable space, restoring saved registers,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6926 +;; and returning.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6927 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6928 +;; For the 6809, the return may be 'rti' if the function was
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6929 +;; declared as an interrupt function, but is normally 'rts'.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6930 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6931 +;; Also, as an optimization, the register restore and the 'rts'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6932 +;; can be combined into a single instruction, by adding 'PC' to the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6933 +;; list of registers to be restored. This is only done if there are
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6934 +;; any saved registers, as 'rts' is more efficient by itself.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6935 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6936 +(define_expand "epilogue"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6937 + [(const_int 0)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6938 + "prologue_epilogue_required ()"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6939 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6940 + emit_epilogue_insns (false);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6941 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6942 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6943 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6944 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6945 +(define_expand "sibcall_epilogue"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6946 + [(const_int 0)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6947 + "prologue_epilogue_required ()"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6948 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6949 + emit_epilogue_insns (true);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6950 + DONE;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6951 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6952 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6953 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6954 +;; The RTS instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6955 +(define_insn "return_rts"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6956 + [(return)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6957 + (use (reg:HI HARD_PC_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6958 + "!m6809_current_function_has_type_attr_p (\"interrupt\")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6959 + && m6809_get_live_regs () == 0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6960 + "rts"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6961 + [(set_attr "length" "1")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6962 + (set (attr "cycles") (const_int RTS_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6963 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6964 +(define_insn "return_puls_pc"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6965 + [(return)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6966 + (use (reg:HI HARD_PC_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6967 + "!m6809_current_function_has_type_attr_p (\"interrupt\")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6968 + && m6809_get_live_regs () != 0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6969 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6970 + [(set_attr "length" "1")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6971 + (set (attr "cycles") (const_int RTS_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6972 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6973 +;; The RTI instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6974 +(define_insn "return_rti"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6975 + [(return)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6976 + (use (reg:HI HARD_PC_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6977 + "m6809_current_function_has_type_attr_p (\"interrupt\")"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6978 + "rti"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6979 + [(set_attr "length" "1")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6980 + (set (attr "cycles") (const_int RTI_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6981 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6982 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6983 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6984 +;;- Unspecified instructions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6985 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6986 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6987 +;; An instruction that has the effect of an unspec_volatile, but
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6988 +;; which doesn't require emitting any assembly code.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6989 +(define_insn "blockage"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6990 + [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6991 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6992 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6993 + [(set_attr "length" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6994 + (set (attr "cycles") (const_int 0))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6995 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6996 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6997 +;; Say how to push multiple registers onto the stack, using
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6998 +;; the 6809 'pshs' instruction. The operand is a regset
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
6999 +;; specifying which registers to push.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7000 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7001 +;; The operand mode is not given intentionally, so as to allow
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7002 +;; any possible integer mode for the regset.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7003 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7004 +;; See below for a peephole that can combine consecutive push
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7005 +;; instructions that qualify for merging.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7006 +(define_insn "register_push"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7007 + [(use (reg:HI HARD_S_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7008 + (unspec_volatile
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7009 + [(match_operand 0 "immediate_operand" "")] UNSPEC_PUSH_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7010 + (clobber (reg:HI HARD_S_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7011 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7012 + "pshs\t%R0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7013 + [(set_attr "length" "2")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7014 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7015 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7016 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7017 +;; Say how to pop multiple registers from the stack, using
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7018 +;; the 6809 'puls' instruction. The operand is the register
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7019 +;; bitset value.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7020 +(define_insn "register_pop"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7021 + [(use (reg:HI HARD_S_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7022 + (unspec_volatile
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7023 + [(match_operand 0 "immediate_operand" "")] UNSPEC_POP_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7024 + (clobber (reg:HI HARD_S_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7025 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7026 + "puls\t%R0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7027 + [(set_attr "length" "2")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7028 + (set (attr "cycles") (const_int PSH_PUL_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7029 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7030 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7031 +(define_insn "m6809_swi"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7032 + [(unspec_volatile
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7033 + [(match_operand:QI 0 "immediate_operand" "I,n")] UNSPEC_SWI)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7034 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7035 + "@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7036 + swi
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7037 + swi%c0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7038 + [(set_attr "length" "1,2")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7039 + (set (attr "cycles") (const_int SWI_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7040 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7041 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7042 +;; Generate the CWAI instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7043 +(define_insn "m6809_cwai"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7044 + [(unspec_volatile
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7045 + [(match_operand:QI 0 "immediate_operand" "")] UNSPEC_CWAI)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7046 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7047 + "cwai\t%0"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7048 + [(set_attr "length" "2")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7049 + (set (attr "cycles") (const_int CWAI_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7050 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7051 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7052 +;; Generate the SYNC instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7053 +(define_insn "m6809_sync"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7054 + [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7055 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7056 + "sync"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7057 + [(set_attr "length" "1")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7058 + (set (attr "cycles") (const_int SYNC_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7059 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7060 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7061 +;; Generate the NOP instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7062 +(define_insn "nop"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7063 + [(const_int 0)]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7064 + ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7065 + "nop"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7066 + [(set_attr "length" "1")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7067 + (set (attr "cycles") (const_int NOP_CYCLES))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7068 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7069 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7070 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7071 +;;- Peepholes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7072 +;;--------------------------------------------------------------------
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7073 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7074 +;;; Each peephole has an ID that is used for debugging.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7075 +;;; Each peephole condition is bracketed by calls to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7076 +;;; m6809_match_peephole2() also for debugging.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7077 +(define_constants [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7078 + (PEEP_END 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7079 + (PEEP_COND 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7080 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7081 + (PEEP_STACK_STORE_INC 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7082 + (PEEP_STACK_CLEAR_INC 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7083 + (PEEP_LSRB_ADCB 2)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7084 + (PEEP_ABX 3)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7085 + (PEEP_ABX2 4)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7086 + (PEEP_INDEXED_INC 5)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7087 + (PEEP_MEM_DEC 6)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7088 + (PEEP_MEM_INC 7)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7089 + (PEEP_MEM_DEC_CMP 8)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7090 + (PEEP_PUSH2 9)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7091 + (PEEP_STORE_IMPLIES_CC 10)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7092 + (PEEP_DEC_IMPLIES_CC 11)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7093 + (PEEP_LEAB 12)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7094 + (PEEP_LDX_INDIRECT 13)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7095 + (PEEP_POP_JUNK 14)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7096 +])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7097 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7098 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7099 +;;; Optimize 'leas -1,s' followed by 'stb ,s'. This can happen if the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7100 +;;; function prologue needs to allocate stack space and 'b' is placed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7101 +;;; into that local right away. Combine the stack allocation with the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7102 +;;; store using preincrement mode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7103 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7104 + [(set (reg:HI HARD_S_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7105 + (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7106 + (set (mem:QI (reg:HI HARD_S_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7107 + (match_operand:QI 0 "register_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7108 + "m6809_match_peephole2 (PEEP_STACK_STORE_INC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7109 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7110 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7111 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7112 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7113 +;;; Same as above, but for a 'clr ,s' that follows the prologue.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7114 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7115 + [(set (reg:HI HARD_S_REGNUM) (plus:HI (reg:HI HARD_S_REGNUM) (const_int -1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7116 + (set (mem:QI (reg:HI HARD_S_REGNUM)) (const_int 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7117 + "m6809_match_peephole2 (PEEP_STACK_CLEAR_INC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7118 + [(set (mem:QI (pre_dec:HI (reg:HI HARD_S_REGNUM))) (const_int 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7119 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7120 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7121 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7122 +;;; Merge two consecutive push instructions into a single register_push.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7123 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7124 + [(set (match_operand 0 "push_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7125 + (match_operand 1 "register_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7126 + (set (match_operand 2 "push_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7127 + (match_operand 3 "register_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7128 + "m6809_match_peephole2 (PEEP_PUSH2, PEEP_COND)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7129 + && reload_completed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7130 + && GET_MODE (operands[1]) == GET_MODE (operands[3])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7131 + && m6809_can_merge_pushpop_p (UNSPEC_PUSH_RS, 1 << REGNO (operands[1]), 1 << REGNO (operands[3]))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7132 + && m6809_match_peephole2 (PEEP_PUSH2, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7133 + [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7134 + (use (reg:HI HARD_S_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7135 + (unspec_volatile [(match_dup 4)] UNSPEC_PUSH_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7136 + (clobber (reg:HI HARD_S_REGNUM))])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7137 + (use (match_dup 1))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7138 + (use (match_dup 3))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7139 +{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7140 + operands[4] = gen_rtx_CONST_INT (QImode,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7141 + (1 << REGNO (operands[1])) | (1 << REGNO (operands[3])));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7142 +})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7143 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7144 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7145 +;;; Convert 'stX ,--s' into a push instruction. Use the regset
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7146 +;;; notation, so that it may be combined with an adjacent regset.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7147 +;;; TBD - this doesn't compile some code cleanly.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7148 +;(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7149 +; [(set (mem:HI (pre_dec:HI (reg:HI HARD_S_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7150 +; (reg:HI HARD_X_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7151 +; "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7152 +; [(parallel [
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7153 +; (use (reg:HI HARD_S_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7154 +; (unspec_volatile [(match_dup 0)] UNSPEC_PUSH_RS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7155 +; (clobber (reg:HI HARD_S_REGNUM))])]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7156 +;{
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7157 +; operands[0] = gen_rtx_CONST_INT (HImode, X_REGBIT);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7158 +;})
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7159 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7160 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7161 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7162 +;;; q = (q+1)/2 can be optimized as "lsrb; adcb". This also
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7163 +;;; won't overflow when q=0xFF.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7164 +;;; TODO : this form isn't accounting for promotion when
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7165 +;;; using 16-bit ints.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7166 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7167 +(define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7168 + [(set (reg:QI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7169 + (lshiftrt:QI (plus:HI (match_dup 0) (const_int 1)) (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7170 + "m6809_match_peephole2 (PEEP_LSRB_ADCB, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7171 + "lsrb\;adcb\t#0; peephole"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7172 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7173 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7174 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7175 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7176 +;; Optimize the case of following a register store with a test
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7177 +;; of reg or mem just moved.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7178 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7179 +(define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7180 + [(set (match_operand:HI 0 "memory_operand" "=m")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7181 + (match_operand:HI 1 "register_operand" "r"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7182 + (set (cc0) (match_operand:HI 2 "general_operand" "g"))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7183 + "m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_COND)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7184 + && (operands[2] == operands[0] || operands[2] == operands[1])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7185 + && m6809_match_peephole2 (PEEP_STORE_IMPLIES_CC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7186 + "st%1\t%0\t;movhi: R:%1 -> %0 w/ implied test of %2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7187 + [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7188 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7189 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7190 +;; Optimize a pair of SET instructions in which the second insn
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7191 +;; is the reverse of the first one. I.e.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7192 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7193 +;; A = B
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7194 +;; ----> A = B
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7195 +;; B = A
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7196 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7197 +;; The second insn is redundant. Define two patterns, one for QI, one for HI.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7198 +;; But don't do this if either is a VOLATILE MEM.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7199 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7200 + [(set (match_operand:HI 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7201 + (match_operand:HI 1 "nonimmediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7202 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7203 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7204 + [(set (match_dup 0) (match_dup 1))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7205 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7206 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7207 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7208 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7209 + (match_operand:QI 1 "nonimmediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7210 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7211 + "!MEM_P (operands[0]) || !MEM_P (operands[1]) || (!MEM_VOLATILE_P (operands[0]) && !MEM_VOLATILE_P (operands[1]))"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7212 + [(set (match_dup 0) (match_dup 1))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7213 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7214 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7215 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7216 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7217 +;; Optimize the sum of an 8-bit and 16-bit using the 'abx' instruction
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7218 +;; if B and X can be used. Two patterns are provided to catch both
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7219 +;; X=X+D and X=D+X.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7220 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7221 +(define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7222 + [(set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7223 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7224 + (set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7225 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7226 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7227 + "abx"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7228 + [(set_attr "length" "1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7229 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7230 +(define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7231 + [(set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7232 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7233 + (set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7234 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7235 + "m6809_match_peephole2 (PEEP_ABX, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7236 + "abx"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7237 + [(set_attr "length" "1")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7238 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7239 +;;; Likewise, handle when B is scaled by 2 prior to the add.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7240 +;;; Instead of shifting B in 4 cycles, just do the ABX a second
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7241 +;;; time, in only 3 cycles.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7242 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7243 +(define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7244 + [(set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7245 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7246 + (set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7247 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7248 + (set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7249 + (plus:HI (reg:HI HARD_D_REGNUM) (reg:HI HARD_X_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7250 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7251 + "abx\;abx"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7252 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7253 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7254 +(define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7255 + [(set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7256 + (zero_extend:HI (match_operand:QI 0 "general_operand" "q")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7257 + (set (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7258 + (ashift:HI (reg:HI HARD_D_REGNUM) (const_int 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7259 + (set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7260 + (plus:HI (reg:HI HARD_X_REGNUM) (reg:HI HARD_D_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7261 + "m6809_match_peephole2 (PEEP_ABX2, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7262 + "abx\;abx"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7263 + [(set_attr "length" "2")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7264 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7265 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7266 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7267 +;; Work around a compiler bug that generates bad code when copying
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7268 +;; between 32-bit memory addresses after a libcall. The problem seen is
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7269 +;; that the source is MEM (REG X), but X is used as the reload register.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7270 +;; The second half of the copy therefore fails.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7271 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7272 +;; The solution is to switch the reload register to D, since that is guaranteed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7273 +;; not to be in use right after a libcall.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7274 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7275 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7276 + [(set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7277 + (set (match_operand:HI 0 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7278 + (set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7279 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7280 + (set (match_operand:HI 1 "nonimmediate_operand" "") (reg:HI HARD_X_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7281 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7282 + [(set (reg:HI HARD_D_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7283 + (set (match_dup 0) (reg:HI HARD_D_REGNUM))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7284 + (set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7285 + (mem:HI (plus:HI (reg:HI HARD_X_REGNUM) (const_int 2))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7286 + (set (match_dup 1) (reg:HI HARD_X_REGNUM))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7287 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7288 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7289 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7290 +;; Turn "and then test" into a "bit test" operation.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7291 +;; Provide variants for immediate and memory sources
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7292 +;; This is the most used peephople.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7293 +; (define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7294 +; [(set (match_operand:QI 0 "register_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7295 +; (and:QI (match_operand:QI 1 "register_operand" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7296 +; (match_operand:QI 2 "immediate_operand" "i")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7297 +; (set (cc0) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7298 +; ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7299 +; "bit%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7300 +; [(set_attr "length" "3")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7301 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7302 +; (define_peephole
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7303 +; [(set (match_operand:QI 0 "register_operand" "=q")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7304 +; (and:QI (match_operand:QI 1 "register_operand" "0")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7305 +; (match_operand:QI 2 "memory_operand" "m")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7306 +; (set (cc0) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7307 +; ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7308 +; "bit%0\t%2"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7309 +; [(set_attr "length" "4")])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7310 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7311 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7312 +;; Turn a "decrement, then test" sequence into just a "decrement".
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7313 +;; The test can be omitted, since it is implicitly done.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7314 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7315 + [(set (match_operand:QI 0 "nonimmediate_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7316 + (plus:QI (match_operand:QI 1 "whole_general_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7317 + (match_operand:QI 2 "immediate_operand" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7318 + (set (cc0) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7319 + "m6809_match_peephole2 (PEEP_DEC_IMPLIES_CC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7320 + [(set (match_dup 0) (plus:QI (match_dup 1) (match_dup 2)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7321 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7322 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7323 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7324 +;; Merge an indexed register increment with a previous usage.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7325 +;; This is usually done automatically, but not always
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7326 +;; The 'use' should be optional; in all cases where this has been
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7327 +;; seen, it is required though.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7328 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7329 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7330 + (mem:QI (match_operand:HI 1 "index_register_operand" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7331 + (use (match_dup 0))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7332 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7333 + "m6809_match_peephole2 (PEEP_INDEXED_INC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7334 + [(set (match_dup 0) (mem:QI (post_inc:HI (match_dup 1))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7335 + (use (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7336 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7337 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7338 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7339 +;;; Merge "ldX MEM; ldX ,X" into a single instruction using
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7340 +;;; the indirect mode.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7341 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7342 + [(set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7343 + (mem:HI (match_operand:HI 0 "general_operand" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7344 + (set (reg:HI HARD_X_REGNUM) (mem:HI (reg:HI HARD_X_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7345 + "reload_completed && m6809_match_peephole2 (PEEP_LDX_INDIRECT, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7346 + [(set (reg:HI HARD_X_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7347 + (mem:HI (mem:HI (match_dup 0))))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7348 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7349 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7350 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7351 +;;; Reorder a store followed by a unary operation on that memory
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7352 +;;; so that the unary is performed and then the store. Consider
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7353 +;;; a binary shift operation, which will be decomposed into
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7354 +;;; identical single shifts, also.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7355 +;;; TODO - recognize more than just 'ashift' here.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7356 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7357 + [(set (match_operand:QI 0 "memory_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7358 + (match_operand:QI 1 "register_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7359 + (set (match_dup 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7360 + (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7361 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7362 + [(set (match_dup 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7363 + (ashift:QI (match_dup 1) (match_operand:QI 2 "immediate_operand")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7364 + (set (match_dup 0) (match_dup 1))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7365 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7366 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7367 +;;; Likewise, reorder a unary MEM followed by a load, so that the load
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7368 +;;; is done first, then use the REG instead of the MEM.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7369 +;;;(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7370 +;;; [(set (match_dup 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7371 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7372 +;;; (set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7373 +;;; (match_operand:QI 1 "memory_operand" ""))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7374 +;;; "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7375 +;;; [(set (match_dup 0) (match_dup 1))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7376 +;;; (set (match_dup 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7377 +;;; (ashift:QI (match_dup 0) (match_operand:QI 2 "immediate_operand")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7378 +;;; "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7379 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7380 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7381 +;;; Replace sex; leaX d,Y with leaX b,Y.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7382 +;;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7383 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7384 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7385 + (set (match_operand:HI 0 "index_register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7386 + (plus:HI (match_operand:HI 1 "index_register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7387 + (reg:HI HARD_D_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7388 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7389 + [(set (match_dup 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7390 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7391 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7392 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7393 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7394 + [(set (reg:HI HARD_D_REGNUM) (sign_extend:HI (reg:QI HARD_D_REGNUM)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7395 + (set (match_operand:HI 0 "index_register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7396 + (plus:HI (reg:HI HARD_D_REGNUM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7397 + (match_operand:HI 1 "index_register_operand" "")))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7398 + "reload_completed && m6809_match_peephole2 (PEEP_LEAB, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7399 + [(set (match_dup 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7400 + (plus:HI (match_dup 1) (reg:QI HARD_D_REGNUM)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7401 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7402 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7403 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7404 +;;; Replace ldb; decb; stb; tstb with dec(mem). If the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7405 +;;; register is not needed, then the load will get deleted
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7406 +;;; automatically, but it may be needed for comparisons.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7407 +;;; Same for incb/inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7408 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7409 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7410 + (match_operand:QI 1 "nonimmediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7411 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7412 + (set (match_dup 1) (match_dup 0))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7413 + (set (cc0) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7414 + "m6809_match_peephole2 (PEEP_MEM_DEC_CMP, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7415 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7416 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7417 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7418 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7419 +;;; Replace ldb; decb; stb with dec(mem); ldb. If the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7420 +;;; register is not needed, then the load will get deleted
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7421 +;;; automatically, but it may be needed for comparisons.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7422 +;;; Same for incb/inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7423 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7424 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7425 + (match_operand:QI 1 "nonimmediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7426 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7427 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7428 + "m6809_match_peephole2 (PEEP_MEM_DEC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7429 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int -1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7430 + (set (match_dup 0) (match_dup 1))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7431 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7432 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7433 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7434 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7435 + (match_operand:QI 1 "nonimmediate_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7436 + (set (match_dup 0) (plus:QI (match_dup 0) (const_int 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7437 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7438 + "m6809_match_peephole2 (PEEP_MEM_INC, PEEP_END)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7439 + [(set (match_dup 1) (plus:QI (match_dup 1) (const_int 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7440 + (set (match_dup 0) (match_dup 1))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7441 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7442 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7443 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7444 +;;; Replace "andb #N; cmpb #N; bhi" with "andb #N", if it can be proven
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7445 +;;; that the branch can never occur because of the limited range of B.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7446 +;;; N must be a power of two for this to make sense. This helps with
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7447 +;;; the default cases of switch statements on a value (x & N).
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7448 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7449 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7450 + (and:QI (match_dup 0) (match_operand:QI 1 "immediate_operand" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7451 + (set (cc0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7452 + (compare (match_dup 0) (match_dup 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7453 + (set (pc) (if_then_else (gtu (cc0) (const_int 0)) (match_operand 2 "" "") (match_operand 3 "" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7454 + ]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7455 + "reload_completed && power_of_two_p (INTVAL (operands[1]) + 1)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7456 + [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7457 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7458 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7459 +;;; Replace ldd <mem>; addd #1; std <mem> with 16-bit increment
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7460 +;;; of the mem, but only if D is dead. Same for 16-bit decrement.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7461 +;;; <mem> must be offsettable for the instruction to match.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7462 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7463 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7464 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int 1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7465 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7466 + "reload_completed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7467 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7468 + && peep2_reg_dead_p (3, operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7469 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7470 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7471 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7472 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7473 + [(set (match_operand:HI 0 "register_operand" "") (match_operand:HI 1 "memory_operand" ""))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7474 + (set (match_dup 0) (plus:HI (match_dup 0) (const_int -1)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7475 + (set (match_dup 1) (match_dup 0))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7476 + "reload_completed
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7477 + && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7478 + && peep2_reg_dead_p (3, operands[0])"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7479 + [(set (match_dup 1) (plus:HI (match_dup 1) (const_int -1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7480 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7481 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7482 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7483 +;;; Replace a load or store using an indexed register, followed by an increment of that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7484 +;;; register, with the combined form using autoincrement.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7485 +(define_peephole2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7486 + [(set (match_operand:QI 0 "register_operand" "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7487 + (mem:QI (match_operand:HI 1 "index_register_operand" "")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7488 + (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7489 + "reload_completed"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7490 + [(set (match_dup 0) (mem:QI (post_inc (match_dup 1))))]
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7491 + "")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7492 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7493 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7494 +;;- mode:emacs-lisp
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7495 +;;- comment-start: ";;- "
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7496 +;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7497 +;;- eval: (modify-syntax-entry ?[ "(]")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7498 +;;- eval: (modify-syntax-entry ?] ")[")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7499 +;;- eval: (modify-syntax-entry ?{ "(}")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7500 +;;- eval: (modify-syntax-entry ?} "){")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7501 +;-; vim: set ts=2:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7502 +;-; vim: set expandtab:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7503 +;-; vim: set filetype=lisp:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7504 +;;- End:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7505 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809.opt gcc-4.6.4/gcc/config/m6809/m6809.opt
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7506 --- gcc-4.6.4-clean/gcc/config/m6809/m6809.opt 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7507 +++ gcc-4.6.4/gcc/config/m6809/m6809.opt 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7508 @@ -0,0 +1,98 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7509 +; Options for the M6809 port of the compiler
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7510 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7511 +; Copyright (C) 2005 Free Software Foundation, Inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7512 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7513 +; This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7514 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7515 +; GCC is free software; you can redistribute it and/or modify it under
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7516 +; the terms of the GNU General Public License as published by the Free
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7517 +; Software Foundation; either version 2, or (at your option) any later
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7518 +; version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7519 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7520 +; GCC is distributed in the hope that it will be useful, but WITHOUT
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7521 +; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7522 +; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7523 +; License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7524 +;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7525 +; You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7526 +; along with GCC; see the file COPYING. If not, write to the Free
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7527 +; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7528 +; 02110-1301, USA.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7529 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7530 +margcount
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7531 +Target Mask(ARGCOUNT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7532 +Push argument count
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7533 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7534 +mint8
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7535 +Target RejectNegative Mask(BYTE_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7536 +Use 8-bit integers
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7537 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7538 +mint16
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7539 +Target RejectNegative
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7540 +Use 16-bit integers InverseMask(BYTE_INT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7541 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7542 +mreg-args
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7543 +Target Mask(REG_ARGS)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7544 +Use registers for function arguments
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7545 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7546 +mshort_size
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7547 +Target RejectNegative Mask(SMALL_SIZE_T)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7548 +Use 8-bit size_t
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7549 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7550 +mlong_size
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7551 +Target RejectNegative InverseMask(SMALL_SIZE_T)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7552 +Use 16-bit size_t
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7553 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7554 +mdirect
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7555 +Target Mask(DIRECT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7556 +Enable direct addressing
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7557 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7558 +mwpc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7559 +Target RejectNegative Mask(WPC)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7560 +Enable WPC platform extensions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7561 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7562 +mexperiment
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7563 +Target RejectNegative Mask(EXPERIMENT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7564 +Enable current experimental feature
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7565 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7566 +m6309
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7567 +Target RejectNegative Mask(6309)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7568 +Enable Hitachi 6309 extensions
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7569 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7570 +mcasesi
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7571 +Target RejectNegative Mask(CASESI)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7572 +Enable the casesi pattern
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7573 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7574 +mfar-code-page=
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7575 +Target RejectNegative Joined Var(far_code_page_option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7576 +Sets the far code page value for this compilation unit
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7577 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7578 +mcode-section=
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7579 +Target RejectNegative Joined Var(code_section_ptr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7580 +Sets the name of the section for code
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7581 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7582 +mdata-section=
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7583 +Target RejectNegative Joined Var(data_section_ptr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7584 +Sets the name of the section for initialized data
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7585 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7586 +mbss-section=
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7587 +Target RejectNegative Joined Var(bss_section_ptr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7588 +Sets the name of the section for uninitialized data
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7589 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7590 +mabi_version=
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7591 +Target RejectNegative Joined Var(m6809_abi_version_ptr)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7592 +Sets the calling convention
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7593 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7594 +msoft-reg-count=
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7595 +Target RejectNegative Joined Var(m6809_soft_reg_count)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7596 +Sets the number of soft registers that can be used
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7597 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7598 +mdret
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7599 +Target RejectNegative Mask(DRET)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7600 +Put function call results in D, not X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7601 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7602 +mfar-stack-param
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7603 +Target Mask(FAR_STACK_PARAM)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7604 +Enable stack parameters to a farcall
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7605 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7606 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7607 diff -urN gcc-4.6.4-clean/gcc/config/m6809/m6809-protos.h gcc-4.6.4/gcc/config/m6809/m6809-protos.h
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7608 --- gcc-4.6.4-clean/gcc/config/m6809/m6809-protos.h 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7609 +++ gcc-4.6.4/gcc/config/m6809/m6809-protos.h 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7610 @@ -0,0 +1,94 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7611 +/* GCC for 6809 : machine-specific function prototypes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7612 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7613 +This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7614 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7615 +GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7616 +it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7617 +the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7618 +any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7619 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7620 +GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7621 +but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7622 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7623 +GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7624 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7625 +You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7626 +along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7627 +<http://www.gnu.org/licenses/>. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7628 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7629 +#ifndef __M6809_PROTOS_H__
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7630 +#define __M6809_PROTOS_H__
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7631 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7632 +void print_options (FILE *file);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7633 +void m6809_cpu_cpp_builtins (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7634 +void m6809_override_options (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7635 +void m6809_init_builtins (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7636 +unsigned int m6809_get_live_regs (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7637 +const char * m6809_get_regs_printable (unsigned int regs);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7638 +unsigned int m6809_get_regs_size (unsigned int regs);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7639 +int m6809_function_has_type_attr_p (tree decl, const char *);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7640 +int m6809_current_function_has_type_attr_p (const char *);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7641 +int prologue_epilogue_required (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7642 +int noreturn_functionp (rtx x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7643 +void output_function_prologue (FILE *file, int size);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7644 +void output_function_epilogue (FILE *file, int size);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7645 +int check_float_value (enum machine_mode mode, double *d, int overflow);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7646 +void m6809_asm_named_section (const char *name, unsigned int flags, tree decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7647 +void m6809_asm_file_start (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7648 +void m6809_output_ascii (FILE *fp, const char *str, unsigned long size);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7649 +void m6809_declare_function_name (FILE *asm_out_file, const char *name, tree decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7650 +void m6809_reorg (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7651 +int m6809_current_function_is_void (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7652 +int m6809_can_merge_pushpop_p (int op, int regs1, int regs2);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7653 +int m6809_function_value_regno_p (unsigned int regno);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7654 +void emit_prologue_insns (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7655 +void emit_epilogue_insns (bool);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7656 +void m6809_conditional_register_usage (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7657 +void m6809_output_quoted_string (FILE *asm_file, const char *string);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7658 +int m6809_match_peephole2 (unsigned int peephole_id, unsigned int stage);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7659 +int m6809_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7660 +int power_of_two_p (unsigned int n);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7661 +void m6809_do_casesi (rtx index, rtx lower_bound, rtx range, rtx table_label, rtx default_label);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7662 +void m6809_output_addsi3 (int rtx_code, rtx *operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7663 +rtx m6809_function_arg_on_stack (CUMULATIVE_ARGS *cump);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7664 +void expand_constant_shift (int code, rtx dst, rtx src, rtx count);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7665 +int m6809_single_operand_operator (rtx exp);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7666 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7667 +#ifdef TREE_CODE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7668 +int m6809_init_cumulative_args (CUMULATIVE_ARGS cum, tree fntype, rtx libname);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7669 +#endif /* TREE_CODE */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7670 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7671 +#ifdef RTX_CODE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7672 +void print_direct_prefix (FILE *file, rtx addr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7673 +void print_operand (FILE *file, rtx x, int code);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7674 +void print_operand_address (FILE *file, rtx addr);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7675 +void notice_update_cc (rtx exp, rtx insn);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7676 +enum reg_class m6809_preferred_reload_class (rtx x, enum reg_class regclass);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7677 +rtx gen_rtx_const_high (rtx r);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7678 +rtx gen_rtx_const_low (rtx r);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7679 +rtx gen_rtx_register_pushpop (int pop_flag, int regs);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7680 +void emit_libcall_insns (enum machine_mode mode, const char *name, rtx *operands, int count);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7681 +const char * output_branch_insn (enum rtx_code code, rtx *operands, int length);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7682 +void output_far_call_insn (rtx *operands, int has_return);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7683 +void m6809_initialize_trampoline (rtx tramp, tree fndecl, rtx cxt);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7684 +rtx m6809_expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7685 +const char * far_functionp (rtx x);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7686 +rtx m6809_function_value (const tree valtype, const tree func);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7687 +void m6809_output_shift_insn (int rtx_code, rtx *operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7688 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7689 +const char * m6809_get_decl_bank (tree decl);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7690 +void output_branch_insn1 (const char *opcode, rtx *operands, int long_p);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7691 +rtx m6809_builtin_operand (tree arglist, enum machine_mode mode, int opnum);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7692 +const char * far_function_type_p (tree type);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7693 +void m6809_asm_trampoline_template(FILE *f);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7694 +bool m6809_frame_pointer_required (void);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7695 +int m6809_can_eliminate (int from, int to);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7696 +int m6809_initial_elimination_offset (int from, int to);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7697 +void m6809_emit_move_insn (rtx dst, rtx src);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7698 +void m6809_split_shift (enum rtx_code code, rtx *operands);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7699 +bool m6809_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7700 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7701 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7702 +#endif /* RTX_CODE */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7703 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7704 +#endif /* __M6809_PROTOS_H__ */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7705 diff -urN gcc-4.6.4-clean/gcc/config/m6809/predicates.md gcc-4.6.4/gcc/config/m6809/predicates.md
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7706 --- gcc-4.6.4-clean/gcc/config/m6809/predicates.md 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7707 +++ gcc-4.6.4/gcc/config/m6809/predicates.md 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7708 @@ -0,0 +1,78 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7709 +;; Predicate definitions for Motorola 6809
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7710 +;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7711 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7712 +;; This file is part of GCC.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7713 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7714 +;; GCC is free software; you can redistribute it and/or modify
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7715 +;; it under the terms of the GNU General Public License as published by
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7716 +;; the Free Software Foundation; either version 3, or (at your option)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7717 +;; any later version.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7718 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7719 +;; GCC is distributed in the hope that it will be useful,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7720 +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7721 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7722 +;; GNU General Public License for more details.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7723 +;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7724 +;; You should have received a copy of the GNU General Public License
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7725 +;; along with GCC; see the file COPYING3. If not see
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7726 +;; <http://www.gnu.org/licenses/>.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7727 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7728 +;; whole_register_operand is like register_operand, but it
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7729 +;; does not allow SUBREGs.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7730 +(define_predicate "whole_register_operand"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7731 + (and (match_code "reg")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7732 + (match_operand 0 "register_operand")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7733 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7734 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7735 +;; A predicate that matches any index register. This can be used in nameless
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7736 +;; patterns and peepholes which need a 16-bit reg, but not D.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7737 +(define_predicate "index_register_operand"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7738 + (and (match_code "reg")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7739 + (match_test "REGNO (op) == HARD_X_REGNUM || REGNO (op) == HARD_Y_REGNUM || REGNO (op) == HARD_U_REGNUM")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7740 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7741 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7742 +;; match only X
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7743 +(define_predicate "register_operand_x"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7744 + (and (match_code "reg")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7745 + (match_test "REGNO (op) == HARD_X_REGNUM")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7746 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7747 +;; match only D
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7748 +(define_predicate "register_operand_d"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7749 + (and (match_code "reg")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7750 + (match_test "REGNO (op) == HARD_D_REGNUM")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7751 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7752 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7753 +;; Likwise, a replacement for general_operand which excludes
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7754 +;; SUBREGs.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7755 +(define_predicate "whole_general_operand"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7756 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7757 + (match_operand 0 "general_operand")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7758 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7759 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7760 +(define_predicate "add_general_operand"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7761 + (and (match_code "const_int,const_double,const,symbol_ref,label_ref,reg,mem")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7762 + (match_operand 0 "general_operand")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7763 + (match_test "REGNO (op) != SOFT_AP_REGNUM")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7764 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7765 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7766 +(define_predicate "shift_count_operand"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7767 + (and (match_code "const_int")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7768 + (and (match_operand 0 "const_int_operand")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7769 + (match_test "INTVAL (op) == 1 || INTVAL (op) == 8"))))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7770 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7771 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7772 +;; A predicate that matches any bitwise logical operator. This
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7773 +;; allows for a single RTL pattern to be used for multiple operations.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7774 +(define_predicate "logical_bit_operator"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7775 + (ior (match_code "and") (match_code "ior") (match_code "xor")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7776 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7777 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7778 +;; A predicate that matches any shift or rotate operator. This
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7779 +;; allows for a single RTL pattern to be used for multiple operations.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7780 +(define_predicate "shift_rotate_operator"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7781 + (ior (match_code "ashift") (match_code "ashiftrt") (match_code "lshiftrt")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7782 + (match_code "rotate") (match_code "rotatert")))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7783 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7784 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7785 +(define_predicate "symbolic_operand" (match_code "symbol_ref"))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7786 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7787 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-coco gcc-4.6.4/gcc/config/m6809/t-coco
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7788 --- gcc-4.6.4-clean/gcc/config/m6809/t-coco 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7789 +++ gcc-4.6.4/gcc/config/m6809/t-coco 2017-11-29 17:11:09.221248469 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7790 @@ -0,0 +1,6 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7791 +# For a few minor differences in code generation on the CoCo...
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7792 +T_CFLAGS = -DTARGET_COCO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7793 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7794 +# For doing the startup differently on the CoCo...
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7795 +CRT0STUFF_T_CFLAGS += -DTARGET_COCO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7796 +# vim: set filetype=make:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7797 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-m6809 gcc-4.6.4/gcc/config/m6809/t-m6809
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7798 --- gcc-4.6.4-clean/gcc/config/m6809/t-m6809 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7799 +++ gcc-4.6.4/gcc/config/m6809/t-m6809 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7800 @@ -0,0 +1,64 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7801 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7802 +# ranlib doesn't exist, so define it to 'true' to make it a no-op
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7803 +RANLIB_FOR_TARGET = true
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7804 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7805 +# Stubs for libgcc defined by m6809 are here
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7806 +LIB1ASMSRC = m6809/libgcc1.s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7807 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7808 +# Here are the functions that are implemented within libgcc1.s
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7809 +LIB1ASMFUNCS = _mulhi3 _divhi3 _modhi3 _udivhi3 _umodhi3 \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7810 + _euclid _seuclid _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _softregs \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7811 + _ashlhi3 _ashrhi3 _lshrhi3
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7812 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7813 +# Flags to use when building libgcc. IN_GCC does not seem necessary,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7814 +# although the compile breaks without it. -DDF=SF is required to set
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7815 +# the size of "double" to the same as the size of a "float".
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7816 +TARGET_LIBGCC2_CFLAGS =-DIN_GCC -Dinhibit_libc -DDF=SF -DLIBGCC2_HAS_SF_MODE=0 -DLIBGCC2_HAS_DF_MODE=0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7817 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7818 +LIB2ADDEH =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7819 +LIB2ADDEHSTATIC =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7820 +LIB2ADDEHSHARED =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7821 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7822 +LIBGCC2_DEBUG_CFLAGS =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7823 +LIBGCC2_CFLAGS = -Os $(LIBGCC2_INCLUDES) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7824 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7825 +# Multilib information
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7826 +# This creates multiple versions of libgcc.a for each set of incompatible
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7827 +# -mxxx options.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7828 +MULTILIB_OPTIONS = fpic mdret
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7829 +MULTILIB_DIRNAMES =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7830 +MULTILIB_MATCHES =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7831 +MULTILIB_EXCEPTIONS =
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7832 +EXTRA_MULTILIB_PARTS = crt0.o
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7833 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7834 +LIBGCC = stmp-multilib
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7835 +INSTALL_LIBGCC = install-multilib
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7836 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7837 +# We want fine grained libraries, so use the new code to build the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7838 +# floating point emulation libraries.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7839 +FPBIT = fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7840 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7841 +fp-bit.c: $(srcdir)/config/fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7842 + echo '#define FLOAT' > fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7843 + echo '#define FLOAT_ONLY' >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7844 + echo '#define CMPtype HItype' >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7845 + echo '#define SMALL_MACHINE' >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7846 + echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7847 + echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7848 + echo '#endif' >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7849 + echo '#define DI SI' >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7850 + cat $(srcdir)/config/fp-bit.c >> fp-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7851 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7852 +# crt0.o is built from the following source file
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7853 +CRT0_S = $(srcdir)/config/m6809/crt0.S
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7854 +MCRT0_S = $(srcdir)/config/m6809/crt0.S
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7855 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7856 +# Flags to use when building crt0.o
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7857 +CRT0STUFF_T_CFLAGS += -fno-builtin -nostartfiles -nostdlib
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7858 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7859 +# Assemble startup files.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7860 +$(T)crt0.o: $(CRT0_S) $(GCC_PASSES)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7861 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)crt0.o -x assembler-with-cpp $(CRT0_S)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7862 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7863 +$(T)mcrt0.o: $(MCRT0_S) $(GCC_PASSES)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7864 + $(GCC_FOR_TARGET) $(CRT0STUFF_T_CFLAGS) $(MULTILIB_CFLAGS) -c -o $(T)mcrt0.o -x assembler-with-cpp $(MCRT0_S)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7865 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-proto gcc-4.6.4/gcc/config/m6809/t-proto
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7866 --- gcc-4.6.4-clean/gcc/config/m6809/t-proto 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7867 +++ gcc-4.6.4/gcc/config/m6809/t-proto 2017-11-29 17:11:09.221248469 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7868 @@ -0,0 +1,6 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7869 +# For a few minor differences in code generation on a custom prototype.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7870 +T_CFLAGS = -DTARGET_PROTO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7871 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7872 +# For doing the startup differently on a custom prototype.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7873 +CRT0STUFF_T_CFLAGS += -DTARGET_PROTO
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7874 +# vim: set filetype=make:
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7875 diff -urN gcc-4.6.4-clean/gcc/config/m6809/t-sim gcc-4.6.4/gcc/config/m6809/t-sim
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7876 --- gcc-4.6.4-clean/gcc/config/m6809/t-sim 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7877 +++ gcc-4.6.4/gcc/config/m6809/t-sim 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7878 @@ -0,0 +1 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7879 +CRT0STUFF_T_CFLAGS += -DTARGET_SIM
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7880 diff -urN gcc-4.6.4-clean/gcc/config.gcc gcc-4.6.4/gcc/config.gcc
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7881 --- gcc-4.6.4-clean/gcc/config.gcc 2013-03-06 10:40:07.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7882 +++ gcc-4.6.4/gcc/config.gcc 2017-11-29 17:11:09.229248437 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7883 @@ -375,6 +375,9 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7884 cpu_type=m32r
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7885 extra_options="${extra_options} g.opt"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7886 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7887 +m6809-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7888 + cpu_type=m6809
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7889 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7890 m68k-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7891 extra_headers=math-68881.h
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7892 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7893 @@ -1706,6 +1709,15 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7894 thread_file='posix'
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7895 fi
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7896 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7897 +m6809-coco-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7898 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-coco"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7899 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7900 +m6809-proto-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7901 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-proto"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7902 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7903 +m6809-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7904 + tmake_file="${tmake_file} m6809/t-m6809 m6809/t-sim"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7905 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7906 # m68hc11 and m68hc12 share the same machine description.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7907 m68hc11-*-*|m6811-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7908 tm_file="dbxelf.h elfos.h usegas.h newlib-stdint.h m68hc11/m68hc11.h"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7909 diff -urN gcc-4.6.4-clean/gcc/gcse.c gcc-4.6.4/gcc/gcse.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7910 --- gcc-4.6.4-clean/gcc/gcse.c 2011-02-02 23:04:04.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7911 +++ gcc-4.6.4/gcc/gcse.c 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7912 @@ -833,7 +833,6 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7913 max_distance = (GCSE_COST_DISTANCE_RATIO * cost) / 10;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7914 if (max_distance == 0)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7915 return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7916 -
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7917 gcc_assert (max_distance > 0);
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7918 }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7919 else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7920 diff -urN gcc-4.6.4-clean/gcc/libgcc2.c gcc-4.6.4/gcc/libgcc2.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7921 --- gcc-4.6.4-clean/gcc/libgcc2.c 2011-01-03 13:52:22.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7922 +++ gcc-4.6.4/gcc/libgcc2.c 2017-11-28 21:12:11.156911596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7923 @@ -485,6 +485,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7924 #endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7925
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7926 #ifdef L_bswapsi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7927 +#if MIN_UNITS_PER_WORD > 1
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7928 SItype
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7929 __bswapsi2 (SItype u)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7930 {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7931 @@ -494,7 +495,9 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7932 | (((u) & 0x000000ff) << 24));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7933 }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7934 #endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7935 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7936 #ifdef L_bswapdi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7937 +#if LONG_LONG_TYPE_SIZE > 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7938 DItype
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7939 __bswapdi2 (DItype u)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7940 {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7941 @@ -508,6 +511,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7942 | (((u) & 0x00000000000000ffull) << 56));
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7943 }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7944 #endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7945 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7946 #ifdef L_ffssi2
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7947 #undef int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7948 int
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7949 @@ -1280,7 +1284,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7950 UDWtype
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7951 __fixunssfDI (SFtype a)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7952 {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7953 -#if LIBGCC2_HAS_DF_MODE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7954 +#if LIBGCC2_HAS_DF_MODE || (FLT_MANT_DIG >= W_TYPE_SIZE)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7955 /* Convert the SFtype to a DFtype, because that is surely not going
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7956 to lose any bits. Some day someone else can write a faster version
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7957 that avoids converting to DFtype, and verify it really works right. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7958 @@ -1298,7 +1302,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7959
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7960 /* Assemble result from the two parts. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7961 return ((UDWtype) hi << W_TYPE_SIZE) | lo;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7962 -#elif FLT_MANT_DIG < W_TYPE_SIZE
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7963 +#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7964 if (a < 1)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7965 return 0;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7966 if (a < Wtype_MAXp1_F)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7967 @@ -1334,8 +1338,6 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7968 return (DWtype)counter << shift;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7969 }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7970 return -1;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7971 -#else
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7972 -# error
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7973 #endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7974 }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7975 #endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7976 diff -urN gcc-4.6.4-clean/gcc/longlong.h gcc-4.6.4/gcc/longlong.h
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7977 --- gcc-4.6.4-clean/gcc/longlong.h 2011-10-04 01:28:50.000000000 -0600
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7978 +++ gcc-4.6.4/gcc/longlong.h 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7979 @@ -528,6 +528,11 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7980 : "cbit")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7981 #endif /* __M32R__ */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7982
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7983 +#if defined (__m6309__) || defined (__m6809__)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7984 +#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7985 +#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7986 +#endif
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7987 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7988 #if defined (__mc68000__) && W_TYPE_SIZE == 32
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7989 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7990 __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7991 diff -urN gcc-4.6.4-clean/gcc/Makefile.in gcc-4.6.4/gcc/Makefile.in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7992 --- gcc-4.6.4-clean/gcc/Makefile.in 2013-04-01 02:32:34.000000000 -0600
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7993 +++ gcc-4.6.4/gcc/Makefile.in 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7994 @@ -2003,14 +2003,14 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7995
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7996 # Compile the start modules crt0.o and mcrt0.o that are linked with
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7997 # every program
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7998 -$(T)crt0.o: s-crt0 ; @true
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
7999 -$(T)mcrt0.o: s-crt0; @true
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8000 +crt0.o: s-crt0 ; @true
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8001 +mcrt0.o: s-crt0; @true
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8002
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8003 s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8004 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8005 - -o $(T)crt0.o -c $(CRT0_S)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8006 + -o crt0.o -c $(CRT0_S)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8007 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8008 - -o $(T)mcrt0.o -c $(MCRT0_S)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8009 + -o mcrt0.o -c $(MCRT0_S)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8010 $(STAMP) s-crt0
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8011 #
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8012 # Compiling object files from source files.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8013 diff -urN gcc-4.6.4-clean/gcc/opth-gen.awk gcc-4.6.4/gcc/opth-gen.awk
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8014 --- gcc-4.6.4-clean/gcc/opth-gen.awk 2011-02-08 10:41:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8015 +++ gcc-4.6.4/gcc/opth-gen.awk 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8016 @@ -121,7 +121,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8017 END {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8018 print "/* This file is auto-generated by opth-gen.awk. */"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8019 print ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8020 -print "#ifndef OPTIONS_H"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8021 +print "#if !defined(OPTIONS_H) && !defined(IN_LIBGCC2)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8022 print "#define OPTIONS_H"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8023 print ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8024 print "#include \"flag-types.h\""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8025 @@ -432,18 +432,9 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8026
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8027 for (i = 0; i < n_opts; i++) {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8028 opt = opt_args("InverseMask", flags[i])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8029 - if (opt ~ ",") {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8030 - vname = var_name(flags[i])
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8031 - macro = "OPTION_"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8032 - mask = "OPTION_MASK_"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8033 - if (vname == "") {
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8034 - vname = "target_flags"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8035 - macro = "TARGET_"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8036 - mask = "MASK_"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8037 - }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8038 - print "#define " macro nth_arg(1, opt) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8039 - " ((" vname " & " mask nth_arg(0, opt) ") == 0)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8040 - }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8041 + if (opt ~ ",")
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8042 + print "#define TARGET_" nth_arg(1, opt) \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8043 + " ((target_flags & MASK_" nth_arg(0, opt) ") == 0)"
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8044 }
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8045 print ""
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8046
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8047 diff -urN gcc-4.6.4-clean/gcc/tree.h gcc-4.6.4/gcc/tree.h
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8048 --- gcc-4.6.4-clean/gcc/tree.h 2011-10-06 13:57:52.000000000 -0600
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8049 +++ gcc-4.6.4/gcc/tree.h 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8050 @@ -3563,6 +3563,8 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8051 TI_UINTDI_TYPE,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8052 TI_UINTTI_TYPE,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8053
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8054 + TI_UINT8_TYPE,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8055 + TI_UINT16_TYPE,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8056 TI_UINT32_TYPE,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8057 TI_UINT64_TYPE,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8058
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8059 diff -urN gcc-4.6.4-clean/gcc/version.c gcc-4.6.4/gcc/version.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8060 --- gcc-4.6.4-clean/gcc/version.c 2009-04-21 13:03:23.000000000 -0600
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8061 +++ gcc-4.6.4/gcc/version.c 2017-11-29 17:11:34.133149157 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8062 @@ -21,16 +21,16 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8063
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8064 /* This is the location of the online document giving instructions for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8065 reporting bugs. If you distribute a modified version of GCC,
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8066 - please configure with --with-bugurl pointing to a document giving
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8067 - instructions for reporting bugs to you, not us. (You are of course
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8068 - welcome to forward us bugs reported to you, if you determine that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8069 - they are not bugs in your modifications.) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8070 + please change this to refer to a document giving instructions for
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8071 + reporting bugs to you, not us. (You are of course welcome to
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8072 + forward us bugs reported to you, if you determine that they are
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8073 + not bugs in your modifications.) */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8074
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8075 -const char bug_report_url[] = BUGURL;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8076 +const char bug_report_url[] = "<URL:http://lost.l-w.ca/coco/lwtools/>";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8077
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8078 /* The complete version string, assembled from several pieces.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8079 BASEVER, DATESTAMP, DEVPHASE, and REVISION are defined by the
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8080 Makefile. */
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8081
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8082 -const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8083 +const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION " (gcc6809lw pl9)";
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8084 const char pkgversion_string[] = PKGVERSION;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8085 diff -urN gcc-4.6.4-clean/libgcc/config.host gcc-4.6.4/libgcc/config.host
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8086 --- gcc-4.6.4-clean/libgcc/config.host 2011-11-23 15:15:54.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8087 +++ gcc-4.6.4/libgcc/config.host 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8088 @@ -371,6 +371,8 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8089 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8090 m32rle-*-linux*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8091 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8092 +m6809*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8093 + ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8094 m68hc11-*-*|m6811-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8095 ;;
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8096 m68hc12-*-*|m6812-*-*)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8097 diff -urN gcc-4.6.4-clean/libgcc/fixed-obj.mk gcc-4.6.4/libgcc/fixed-obj.mk
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8098 --- gcc-4.6.4-clean/libgcc/fixed-obj.mk 2007-09-17 16:18:13.000000000 -0600
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8099 +++ gcc-4.6.4/libgcc/fixed-obj.mk 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8100 @@ -23,7 +23,7 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8101 #$(info $o$(objext): -DL$($o-label) $($o-opt))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8102
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8103 $o$(objext): %$(objext): $(gcc_srcdir)/config/fixed-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8104 - $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8105 + $(gcc_compile) -DL$($*-label) $($*-opt) -c $(gcc_srcdir)/config/fixed-bit.c $(vis_hide) -save-temps
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8106
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8107 ifeq ($(enable_shared),yes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8108 $(o)_s$(objext): %_s$(objext): $(gcc_srcdir)/config/fixed-bit.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8109 diff -urN gcc-4.6.4-clean/libgcc/Makefile.in gcc-4.6.4/libgcc/Makefile.in
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8110 --- gcc-4.6.4-clean/libgcc/Makefile.in 2012-12-04 12:11:33.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8111 +++ gcc-4.6.4/libgcc/Makefile.in 2017-11-28 21:12:11.160911575 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8112 @@ -374,8 +374,8 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8113 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8114 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8115 $(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8116 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8117 - $(vis_hide)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8118 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8119 + $(gcc_compile) -DL$* -c $*.c $(vis_hide) -save-temps
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8120 libgcc-objects += $(lib2funcs-o)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8121
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8122 ifeq ($(enable_shared),yes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8123 @@ -410,8 +410,9 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8124 # Build LIB2_DIVMOD_FUNCS.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8125 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8126 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8127 - $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8128 - -fexceptions -fnon-call-exceptions $(vis_hide)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8129 + ln -sf $(gcc_srcdir)/libgcc2.c $*.c && \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8130 + $(gcc_compile) -DL$* -c $*.c \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8131 + -fexceptions -fnon-call-exceptions $(vis_hide) -save-temps
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8132 libgcc-objects += $(lib2-divmod-o)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8133
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8134 ifeq ($(enable_shared),yes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8135 @@ -443,7 +444,8 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8136 ifneq ($(FPBIT),)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8137 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8138 $(fpbit-o): %$(objext): $(FPBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8139 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8140 + ln -sf $(FPBIT) $*.c && \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8141 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8142 libgcc-objects += $(fpbit-o)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8143
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8144 ifeq ($(enable_shared),yes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8145 @@ -458,7 +460,8 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8146 ifneq ($(DPBIT),)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8147 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8148 $(dpbit-o): %$(objext): $(DPBIT)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8149 - $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8150 + ln -sf $(DPBIT) $*.c && \
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8151 + $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $*.c $(vis_hide) -save-temps
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8152 libgcc-objects += $(dpbit-o)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8153
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8154 ifeq ($(enable_shared),yes)
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8155 diff -urN gcc-4.6.4-clean/README.LW gcc-4.6.4/README.LW
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8156 --- gcc-4.6.4-clean/README.LW 1969-12-31 17:00:00.000000000 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8157 +++ gcc-4.6.4/README.LW 2017-11-29 17:11:09.189248596 -0700
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8158 @@ -0,0 +1,14 @@
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8159 +This is a port of gcc6809 which is designed to work with the lwtools
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8160 +cross-assembler and linker package. You will need several scripts from that
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8161 +package, available at http://lost.l-w.ca/coco/lwtools/, in order to use
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8162 +this. Instructions for building are present in the lwtools package.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8163 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8164 +This work is based extensively on the gcc6809 4.3.4-3 release by Brian
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8165 +Dominy (brian@oddchange.com) with some significant renovations to make it
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8166 +work with gcc 4.6.4.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8167 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8168 +There is no guarantee that it will work for any particular purpose you
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8169 +choose to put it to.
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8170 +
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8171 +If you run into any problems, contact William Astle (lost@l-w.ca). DO NOT
639d19f5fb8e Source cleanups and "prototype" target for gcc6809
William Astle <lost@l-w.ca>
parents:
diff changeset
8172 +contact the main GCC developers!