6
6
//
7
7
//===----------------------------------------------------------------------===//
8
8
9
+ def x86_ptr_rc : RegClassByHwMode<
10
+ [X86_32, X86_64, X86_64_X32],
11
+ [GR32, GR64, LOW32_ADDR_ACCESS]>;
12
+
9
13
// A version of ptr_rc which excludes SP, ESP, and RSP. This is used for
10
14
// the index operand of an address, to conform to x86 encoding restrictions.
11
- def ptr_rc_nosp : PointerLikeRegClass<1>;
15
+ def ptr_rc_nosp : RegClassByHwMode<
16
+ [X86_32, X86_64, X86_64_X32],
17
+ [GR32_NOSP, GR64_NOSP, GR32_NOSP]>;
12
18
13
19
// *mem - Operand definitions for the funky X86 addressing mode operands.
14
20
//
@@ -53,7 +59,7 @@ class X86MemOperand<string printMethod,
53
59
AsmOperandClass parserMatchClass = X86MemAsmOperand,
54
60
int size = 0> : Operand<iPTR> {
55
61
let PrintMethod = printMethod;
56
- let MIOperandInfo = (ops ptr_rc , i8imm, ptr_rc_nosp, i32imm, SEGMENT_REG);
62
+ let MIOperandInfo = (ops x86_ptr_rc , i8imm, ptr_rc_nosp, i32imm, SEGMENT_REG);
57
63
let ParserMatchClass = parserMatchClass;
58
64
let OperandType = "OPERAND_MEMORY";
59
65
int Size = size;
@@ -63,7 +69,7 @@ class X86MemOperand<string printMethod,
63
69
class X86VMemOperand<RegisterClass RC, string printMethod,
64
70
AsmOperandClass parserMatchClass, int size = 0>
65
71
: X86MemOperand<printMethod, parserMatchClass, size> {
66
- let MIOperandInfo = (ops ptr_rc , i8imm, RC, i32imm, SEGMENT_REG);
72
+ let MIOperandInfo = (ops x86_ptr_rc , i8imm, RC, i32imm, SEGMENT_REG);
67
73
}
68
74
69
75
def anymem : X86MemOperand<"printMemReference">;
@@ -113,8 +119,14 @@ def sdmem : X86MemOperand<"printqwordmem", X86Mem64AsmOperand>;
113
119
114
120
// A version of i8mem for use on x86-64 and x32 that uses a NOREX GPR instead
115
121
// of a plain GPR, so that it doesn't potentially require a REX prefix.
116
- def ptr_rc_norex : PointerLikeRegClass<2>;
117
- def ptr_rc_norex_nosp : PointerLikeRegClass<3>;
122
+ def ptr_rc_norex : RegClassByHwMode<
123
+ [X86_32, X86_64, X86_64_X32],
124
+ [GR32_NOREX, GR64_NOREX, GR32_NOREX]>;
125
+
126
+ def ptr_rc_norex_nosp : RegClassByHwMode<
127
+ [X86_32, X86_64, X86_64_X32],
128
+ [GR32_NOREX_NOSP, GR64_NOREX_NOSP, GR32_NOREX_NOSP]>;
129
+
118
130
119
131
def i8mem_NOREX : X86MemOperand<"printbytemem", X86Mem8AsmOperand, 8> {
120
132
let MIOperandInfo = (ops ptr_rc_norex, i8imm, ptr_rc_norex_nosp, i32imm,
@@ -123,7 +135,9 @@ def i8mem_NOREX : X86MemOperand<"printbytemem", X86Mem8AsmOperand, 8> {
123
135
124
136
// GPRs available for tailcall.
125
137
// It represents GR32_TC, GR64_TC or GR64_TCW64.
126
- def ptr_rc_tailcall : PointerLikeRegClass<4>;
138
+ def ptr_rc_tailcall : RegClassByHwMode<
139
+ [X86_32, X86_64, X86_64_X32],
140
+ [GR32_TC, GR64_TC, GR64_TC]>;
127
141
128
142
// Special i32mem for addresses of load folding tail calls. These are not
129
143
// allowed to use callee-saved registers since they must be scheduled
@@ -270,12 +284,12 @@ let RenderMethod = "addMemOffsOperands" in {
270
284
271
285
class X86SrcIdxOperand<string printMethod, AsmOperandClass parserMatchClass>
272
286
: X86MemOperand<printMethod, parserMatchClass> {
273
- let MIOperandInfo = (ops ptr_rc , SEGMENT_REG);
287
+ let MIOperandInfo = (ops x86_ptr_rc , SEGMENT_REG);
274
288
}
275
289
276
290
class X86DstIdxOperand<string printMethod, AsmOperandClass parserMatchClass>
277
291
: X86MemOperand<printMethod, parserMatchClass> {
278
- let MIOperandInfo = (ops ptr_rc );
292
+ let MIOperandInfo = (ops x86_ptr_rc );
279
293
}
280
294
281
295
def srcidx8 : X86SrcIdxOperand<"printSrcIdx8", X86SrcIdx8Operand>;
0 commit comments