blob: 24be1eb6c0dbb4e19a2e20c7035bfa74e28beab4 (
plain)
1
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
150
151
152
153
154
155
156
157
158
159
160
|
-- Mcode back-end for ortho - X86 common definitions.
-- Copyright (C) 2006 Tristan Gingold
--
-- GHDL is free software; you can redistribute it and/or modify it under
-- the terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 2, or (at your option) any later
-- version.
--
-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with GCC; see the file COPYING. If not, write to the Free
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
with Ortho_Code.Exprs; use Ortho_Code.Exprs;
package Ortho_Code.X86 is
-- Registers.
R_Nil : constant O_Reg := 0;
-- Not a value. Used for statements.
R_None : constant O_Reg := 1;
-- Memory.
R_Mem : constant O_Reg := 2;
-- Spilled out.
R_Spill : constant O_Reg := 3;
-- Register or memory.
-- THis can only be requested.
R_Rm : constant O_Reg := 48;
-- Immediat
R_Imm : constant O_Reg := 49;
-- Immediat, register or memory.
-- This can be requested.
R_Irm : constant O_Reg := 50;
-- Immediat or register.
-- This can be requested.
R_Ir : constant O_Reg := 51;
-- BASE + OFFSET
R_B_Off : constant O_Reg := 52;
-- BASE+INDEX*SCALE+OFFSET
-- This can be requested.
R_Sib : constant O_Reg := 53;
-- INDEX*SCALE + OFFSET
-- This can be requested.
R_I_Off : constant O_Reg := 54;
-- BASE + INDEX*SCALE
R_B_I : constant O_Reg := 55;
-- INDEX*SCALE
R_I : constant O_Reg := 56;
subtype Regs_Imm32 is O_Reg range R_Irm .. R_I_Off;
R_Any8 : constant O_Reg := 6;
R_Any32 : constant O_Reg := 7;
R_Ax : constant O_Reg := 8;
R_Cx : constant O_Reg := 9;
R_Dx : constant O_Reg := 10;
R_Bx : constant O_Reg := 11;
R_Sp : constant O_Reg := 12;
R_Bp : constant O_Reg := 13;
R_Si : constant O_Reg := 14;
R_Di : constant O_Reg := 15;
subtype Regs_R8 is O_Reg range R_Ax .. R_Bx;
subtype Regs_R32 is O_Reg range R_Ax .. R_Di;
R_St0 : constant O_Reg := 16;
R_St1 : constant O_Reg := 17;
R_St2 : constant O_Reg := 18;
R_St3 : constant O_Reg := 19;
R_St4 : constant O_Reg := 20;
R_St5 : constant O_Reg := 21;
R_St6 : constant O_Reg := 22;
R_St7 : constant O_Reg := 23;
--R_Any_Fp : constant O_Reg := 24;
subtype Regs_Fp is O_Reg range R_St0 .. R_St7;
-- Any condition register.
R_Any_Cc : constant O_Reg := 32;
R_Ov : constant O_Reg := 32;
R_Ult : constant O_Reg := 34;
R_Uge : constant O_Reg := 35;
R_Eq : constant O_Reg := 36;
R_Ne : constant O_Reg := 37;
R_Ule : constant O_Reg := 38;
R_Ugt : constant O_Reg := 39;
R_Slt : constant O_Reg := 44;
R_Sge : constant O_Reg := 45;
R_Sle : constant O_Reg := 46;
R_Sgt : constant O_Reg := 47;
subtype Regs_Cc is O_Reg range R_Ov .. R_Sgt;
R_Edx_Eax : constant O_Reg := 64;
R_Ebx_Ecx : constant O_Reg := 65;
R_Esi_Edi : constant O_Reg := 66;
R_Any64 : constant O_Reg := 67;
subtype Regs_R64 is O_Reg range R_Edx_Eax .. R_Esi_Edi;
R_Any_Xmm : constant O_Reg := 79;
R_Xmm0 : constant O_Reg := 80;
R_Xmm1 : constant O_Reg := R_Xmm0 + 1;
R_Xmm2 : constant O_Reg := R_Xmm0 + 2;
R_Xmm3 : constant O_Reg := R_Xmm0 + 3;
R_Xmm4 : constant O_Reg := R_Xmm0 + 4;
R_Xmm5 : constant O_Reg := R_Xmm0 + 5;
R_Xmm6 : constant O_Reg := R_Xmm0 + 6;
R_Xmm7 : constant O_Reg := R_Xmm0 + 7;
R_Xmm8 : constant O_Reg := R_Xmm0 + 8;
R_Xmm9 : constant O_Reg := R_Xmm0 + 9;
R_Xmm10 : constant O_Reg := R_Xmm0 + 10;
R_Xmm11 : constant O_Reg := R_Xmm0 + 11;
R_Xmm12 : constant O_Reg := R_Xmm0 + 12;
R_Xmm13 : constant O_Reg := R_Xmm0 + 13;
R_Xmm14 : constant O_Reg := R_Xmm0 + 14;
R_Xmm15 : constant O_Reg := R_Xmm0 + 15;
subtype Regs_X86_64_Xmm is O_Reg range R_Xmm0 .. R_Xmm15;
subtype Regs_X86_Xmm is O_Reg range R_Xmm0 .. R_Xmm7;
subtype Regs_Xmm is O_Reg range R_Xmm0 .. R_Xmm15;
function Get_R64_High (Reg : Regs_R64) return Regs_R32;
function Get_R64_Low (Reg : Regs_R64) return Regs_R32;
function Inverse_Cc (R : O_Reg) return O_Reg;
-- Intrinsic subprograms.
Intrinsic_Mul_Ov_U64 : constant Int32 := 1;
Intrinsic_Div_Ov_U64 : constant Int32 := 2;
Intrinsic_Mod_Ov_U64 : constant Int32 := 3;
Intrinsic_Mul_Ov_I64 : constant Int32 := 4;
Intrinsic_Div_Ov_I64 : constant Int32 := 5;
Intrinsic_Mod_Ov_I64 : constant Int32 := 6;
Intrinsic_Rem_Ov_I64 : constant Int32 := 7;
subtype Intrinsics_X86 is Int32
range Intrinsic_Mul_Ov_U64 .. Intrinsic_Rem_Ov_I64;
-- Convert a KIND to a reg.
function Ekind_Unsigned_To_Cc (Kind : OE_Kind_Cmp) return O_Reg;
function Ekind_Signed_To_Cc (Kind : OE_Kind_Cmp) return O_Reg;
end Ortho_Code.X86;
|