Skip to content

Commit 7827021

Browse files
committed
SPARC: Use RegClassByHwMode instead of PointerLikeRegClass
1 parent 480926a commit 7827021

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

llvm/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,6 @@ static DecodeStatus DecodeI64RegsRegisterClass(MCInst &Inst, unsigned RegNo,
159159
return DecodeIntRegsRegisterClass(Inst, RegNo, Address, Decoder);
160160
}
161161

162-
// This is used for the type "ptr_rc", which is either IntRegs or I64Regs
163-
// depending on SparcRegisterInfo::getPointerRegClass.
164-
static DecodeStatus DecodePointerLikeRegClass0(MCInst &Inst, unsigned RegNo,
165-
uint64_t Address,
166-
const MCDisassembler *Decoder) {
167-
return DecodeIntRegsRegisterClass(Inst, RegNo, Address, Decoder);
168-
}
169-
170162
static DecodeStatus DecodeFPRegsRegisterClass(MCInst &Inst, unsigned RegNo,
171163
uint64_t Address,
172164
const MCDisassembler *Decoder) {

llvm/lib/Target/Sparc/SparcInstrInfo.td

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,27 @@ def HasFSMULD : Predicate<"!Subtarget->hasNoFSMULD()">;
9595
// will pick deprecated instructions.
9696
def UseDeprecatedInsts : Predicate<"Subtarget->useV8DeprecatedInsts()">;
9797

98+
//===----------------------------------------------------------------------===//
99+
// HwModes Pattern Stuff
100+
//===----------------------------------------------------------------------===//
101+
102+
defvar SPARC32 = DefaultMode;
103+
def SPARC64 : HwMode<[Is64Bit]>;
104+
98105
//===----------------------------------------------------------------------===//
99106
// Instruction Pattern Stuff
100107
//===----------------------------------------------------------------------===//
101108

109+
def sparc_ptr_rc : RegClassByHwMode<
110+
[SPARC32, SPARC64],
111+
[IntRegs, I64Regs]>;
112+
113+
// Both cases can use the same decoder method, so avoid the dispatch
114+
// by hwmode by setting an explicit DecoderMethod
115+
def ptr_op : RegisterOperand<sparc_ptr_rc> {
116+
let DecoderMethod = "DecodeIntRegsRegisterClass";
117+
}
118+
102119
// FIXME these should have AsmOperandClass.
103120
def uimm3 : PatLeaf<(imm), [{ return isUInt<3>(N->getZExtValue()); }]>;
104121

@@ -178,12 +195,12 @@ def simm13Op : Operand<iPTR> {
178195

179196
def MEMrr : Operand<iPTR> {
180197
let PrintMethod = "printMemOperand";
181-
let MIOperandInfo = (ops ptr_rc, ptr_rc);
198+
let MIOperandInfo = (ops ptr_op, ptr_op);
182199
let ParserMatchClass = SparcMEMrrAsmOperand;
183200
}
184201
def MEMri : Operand<iPTR> {
185202
let PrintMethod = "printMemOperand";
186-
let MIOperandInfo = (ops ptr_rc, simm13Op);
203+
let MIOperandInfo = (ops ptr_op, simm13Op);
187204
let ParserMatchClass = SparcMEMriAsmOperand;
188205
}
189206

0 commit comments

Comments
 (0)