source: mainline/uspace/app/pcc/cc/ccom/arch/ia32/external.c@ 5974661

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5974661 was 5974661, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 14 years ago

Add a separate directory for each platform's external.{c,h}. Add mkext utility for generating those to the build.

  • Property mode set to 100755
File size: 7.2 KB
Line 
1#include "pass2.h"
2static int op0[] = { -1 };
3static int op1[] = { -1 };
4static int op2[] = { 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 231, 233, -1 };
5static int op3[] = { -1 };
6static int op4[] = { 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 231, 233, -1 };
7static int op5[] = { 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 231, 233, -1 };
8static int op6[] = { 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 231, 233, -1 };
9static int op7[] = { 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 231, 233, -1 };
10static int op8[] = { 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 231, 233, -1 };
11static int op9[] = { 232, 233, -1 };
12static int op10[] = { 68, 69, 70, 71, 72, 73, 74, 75, 76, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 233, -1 };
13static int op11[] = { 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96, 233, -1 };
14static int op12[] = { 151, 152, 153, 154, 155, 156, 157, 233, -1 };
15static int op13[] = { 158, 159, 160, 161, 162, 233, -1 };
16static int op14[] = { 163, 164, 165, 166, 167, 168, 233, -1 };
17static int op15[] = { 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 183, 184, 185, 186, 187, 188, 189, 233, -1 };
18static int op16[] = { 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 233, -1 };
19static int op17[] = { 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 233, -1 };
20static int op18[] = { 97, 98, 99, 100, 101, 102, 103, 233, -1 };
21static int op19[] = { 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 233, -1 };
22static int op20[] = { 210, 211, 212, 213, 232, 233, -1 };
23static int op21[] = { -1 };
24static int op22[] = { -1 };
25static int op23[] = { 169, 170, 171, 172, 173, 174, 175, 227, 232, 233, -1 };
26static int op24[] = { 205, 206, 207, 208, 209, 232, 233, -1 };
27static int op25[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
28static int op26[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
29static int op27[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
30static int op28[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
31static int op29[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
32static int op30[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
33static int op31[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
34static int op32[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
35static int op33[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
36static int op34[] = { 176, 177, 178, 179, 180, 181, 182, 233, -1 };
37static int op35[] = { 233, -1 };
38static int op36[] = { 230, 232, 233, -1 };
39static int op37[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 232, 233, -1 };
40static int op38[] = { 1, 232, 233, -1 };
41static int op39[] = { 233, -1 };
42static int op40[] = { 233, -1 };
43static int op41[] = { 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 233, -1 };
44static int op42[] = { 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 232, 233, -1 };
45static int op43[] = { 233, -1 };
46static int op44[] = { 232, 233, -1 };
47static int op45[] = { 65, 66, 67, 233, -1 };
48static int op46[] = { 62, 63, 64, 232, 233, -1 };
49static int op47[] = { 231, 233, -1 };
50static int op48[] = { 233, -1 };
51static int op49[] = { 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 228, -1 };
52static int op50[] = { 150, 229, -1 };
53static int op51[] = { 226, 232, 233, -1 };
54static int op52[] = { 232, 233, -1 };
55static int op53[] = { 233, -1 };
56static int op54[] = { 190, 232, 233, -1 };
57static int op55[] = { -1 };
58static int op56[] = { 233, -1 };
59static int op57[] = { 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 232, 233, -1 };
60static int op58[] = { 232, 233, -1 };
61
62int *qtable[] = {
63 op0,
64 op1,
65 op2,
66 op3,
67 op4,
68 op5,
69 op6,
70 op7,
71 op8,
72 op9,
73 op10,
74 op11,
75 op12,
76 op13,
77 op14,
78 op15,
79 op16,
80 op17,
81 op18,
82 op19,
83 op20,
84 op21,
85 op22,
86 op23,
87 op24,
88 op25,
89 op26,
90 op27,
91 op28,
92 op29,
93 op30,
94 op31,
95 op32,
96 op33,
97 op34,
98 op35,
99 op36,
100 op37,
101 op38,
102 op39,
103 op40,
104 op41,
105 op42,
106 op43,
107 op44,
108 op45,
109 op46,
110 op47,
111 op48,
112 op49,
113 op50,
114 op51,
115 op52,
116 op53,
117 op54,
118 op55,
119 op56,
120 op57,
121 op58,
122};
123int tempregs[] = { 0, 1, 2, -1 };
124int permregs[] = { 3, 4, 5, -1 };
125bittype validregs[] = {
126 0xffffff3f,
127 0x0000007f,
128};
129static int amap[MAXREGS][NUMCLASS] = {
130 /* 0 */{ 0x1,0x3,0x1f,0x0 },
131 /* 1 */{ 0x2,0xc,0x1e1,0x0 },
132 /* 2 */{ 0x4,0x30,0xe22,0x0 },
133 /* 3 */{ 0x8,0xc0,0x3244,0x0 },
134 /* 4 */{ 0x10,0x0,0x5488,0x0 },
135 /* 5 */{ 0x20,0x0,0x6910,0x0 },
136 /* 6 */{ 0x0,0x0,0x0,0x0 },
137 /* 7 */{ 0x0,0x0,0x0,0x0 },
138 /* 8 */{ 0x1,0x1,0x1f,0x0 },
139 /* 9 */{ 0x1,0x2,0x1f,0x0 },
140 /* 10 */{ 0x2,0x4,0x1e1,0x0 },
141 /* 11 */{ 0x2,0x8,0x1e1,0x0 },
142 /* 12 */{ 0x4,0x10,0xe22,0x0 },
143 /* 13 */{ 0x4,0x20,0xe22,0x0 },
144 /* 14 */{ 0x8,0x40,0x3244,0x0 },
145 /* 15 */{ 0x8,0x80,0x3244,0x0 },
146 /* 16 */{ 0x3,0xf,0x1ff,0x0 },
147 /* 17 */{ 0x5,0x33,0xe3f,0x0 },
148 /* 18 */{ 0x9,0xc3,0x325f,0x0 },
149 /* 19 */{ 0x11,0x3,0x549f,0x0 },
150 /* 20 */{ 0x21,0x3,0x691f,0x0 },
151 /* 21 */{ 0x6,0x3c,0xfe3,0x0 },
152 /* 22 */{ 0xa,0xcc,0x33e5,0x0 },
153 /* 23 */{ 0x12,0xc,0x55e9,0x0 },
154 /* 24 */{ 0x22,0xc,0x69f1,0x0 },
155 /* 25 */{ 0xc,0xf0,0x3e66,0x0 },
156 /* 26 */{ 0x14,0x30,0x5eaa,0x0 },
157 /* 27 */{ 0x24,0x30,0x6f32,0x0 },
158 /* 28 */{ 0x18,0xc0,0x76cc,0x0 },
159 /* 29 */{ 0x28,0xc0,0x7b54,0x0 },
160 /* 30 */{ 0x30,0x0,0x7d98,0x0 },
161 /* 31 */{ 0x0,0x0,0x0,0x1 },
162 /* 32 */{ 0x0,0x0,0x0,0x2 },
163 /* 33 */{ 0x0,0x0,0x0,0x4 },
164 /* 34 */{ 0x0,0x0,0x0,0x8 },
165 /* 35 */{ 0x0,0x0,0x0,0x10 },
166 /* 36 */{ 0x0,0x0,0x0,0x20 },
167 /* 37 */{ 0x0,0x0,0x0,0x40 },
168 /* 38 */{ 0x0,0x0,0x0,0x80 },
169};
170int
171aliasmap(int class, int regnum)
172{
173 return amap[regnum][class-1];
174}
175static int rmap[NUMCLASS][15] = {
176 { 0, 1, 2, 3, 4, 5, },
177 { 8, 9, 10, 11, 12, 13, 14, 15, },
178 { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, },
179 { 31, 32, 33, 34, 35, 36, 37, 38, },
180};
181
182int
183color2reg(int color, int class)
184{
185 return rmap[class-1][color];
186}
187int regK[] = { 0, 6, 8, 15, 8, 0, 0, 0 };
188int
189classmask(int class)
190{
191 if(class == CLASSA) return 0x3f;
192 if(class == CLASSB) return 0xff;
193 if(class == CLASSC) return 0x7fff;
194 if(class == CLASSD) return 0xff;
195 if(class == CLASSE) return 0x0;
196 if(class == CLASSF) return 0x0;
197 return 0x0;
198}
199static bittype ovlarr[MAXREGS][2] = {
200{ 0x1f0301, 0x0, },
201{ 0x1e10c02, 0x0, },
202{ 0xe223004, 0x0, },
203{ 0x3244c008, 0x0, },
204{ 0x54880010, 0x0, },
205{ 0x69100020, 0x0, },
206{ 0x40, 0x0, },
207{ 0x80, 0x0, },
208{ 0x1f0101, 0x0, },
209{ 0x1f0201, 0x0, },
210{ 0x1e10402, 0x0, },
211{ 0x1e10802, 0x0, },
212{ 0xe221004, 0x0, },
213{ 0xe222004, 0x0, },
214{ 0x32444008, 0x0, },
215{ 0x32448008, 0x0, },
216{ 0x1ff0f03, 0x0, },
217{ 0xe3f3305, 0x0, },
218{ 0x325fc309, 0x0, },
219{ 0x549f0311, 0x0, },
220{ 0x691f0321, 0x0, },
221{ 0xfe33c06, 0x0, },
222{ 0x33e5cc0a, 0x0, },
223{ 0x55e90c12, 0x0, },
224{ 0x69f10c22, 0x0, },
225{ 0x3e66f00c, 0x0, },
226{ 0x5eaa3014, 0x0, },
227{ 0x6f323024, 0x0, },
228{ 0x76ccc018, 0x0, },
229{ 0x7b54c028, 0x0, },
230{ 0x7d980030, 0x0, },
231{ 0x80000000, 0x0, },
232{ 0x0, 0x1, },
233{ 0x0, 0x2, },
234{ 0x0, 0x4, },
235{ 0x0, 0x8, },
236{ 0x0, 0x10, },
237{ 0x0, 0x20, },
238{ 0x0, 0x40, },
239};
240int
241interferes(int reg1, int reg2)
242{
243return (TESTBIT(ovlarr[reg1], reg2)) != 0;
244}
Note: See TracBrowser for help on using the repository browser.