66//
77//===----------------------------------------------------------------------===//
88
9+ def x86_ptr_rc : RegClassByHwMode<
10+ [X86_32, X86_64, X86_64_X32],
11+ [GR32, GR64, LOW32_ADDR_ACCESS]>;
12+
913// A version of ptr_rc which excludes SP, ESP, and RSP. This is used for
1014// 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]>;
1218
1319// *mem - Operand definitions for the funky X86 addressing mode operands.
1420//
@@ -53,7 +59,7 @@ class X86MemOperand<string printMethod,
5359 AsmOperandClass parserMatchClass = X86MemAsmOperand,
5460 int size = 0> : Operand<iPTR> {
5561 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);
5763 let ParserMatchClass = parserMatchClass;
5864 let OperandType = "OPERAND_MEMORY";
5965 int Size = size;
@@ -63,7 +69,7 @@ class X86MemOperand<string printMethod,
6369class X86VMemOperand<RegisterClass RC, string printMethod,
6470 AsmOperandClass parserMatchClass, int size = 0>
6571 : 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);
6773}
6874
6975def anymem : X86MemOperand<"printMemReference">;
@@ -113,8 +119,14 @@ def sdmem : X86MemOperand<"printqwordmem", X86Mem64AsmOperand>;
113119
114120// A version of i8mem for use on x86-64 and x32 that uses a NOREX GPR instead
115121// 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+
118130
119131def i8mem_NOREX : X86MemOperand<"printbytemem", X86Mem8AsmOperand, 8> {
120132 let MIOperandInfo = (ops ptr_rc_norex, i8imm, ptr_rc_norex_nosp, i32imm,
@@ -123,7 +135,9 @@ def i8mem_NOREX : X86MemOperand<"printbytemem", X86Mem8AsmOperand, 8> {
123135
124136// GPRs available for tailcall.
125137// 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]>;
127141
128142// Special i32mem for addresses of load folding tail calls. These are not
129143// allowed to use callee-saved registers since they must be scheduled
@@ -270,12 +284,12 @@ let RenderMethod = "addMemOffsOperands" in {
270284
271285class X86SrcIdxOperand<string printMethod, AsmOperandClass parserMatchClass>
272286 : X86MemOperand<printMethod, parserMatchClass> {
273- let MIOperandInfo = (ops ptr_rc , SEGMENT_REG);
287+ let MIOperandInfo = (ops x86_ptr_rc , SEGMENT_REG);
274288}
275289
276290class X86DstIdxOperand<string printMethod, AsmOperandClass parserMatchClass>
277291 : X86MemOperand<printMethod, parserMatchClass> {
278- let MIOperandInfo = (ops ptr_rc );
292+ let MIOperandInfo = (ops x86_ptr_rc );
279293}
280294
281295def srcidx8 : X86SrcIdxOperand<"printSrcIdx8", X86SrcIdx8Operand>;
0 commit comments