@@ -95,10 +95,27 @@ def HasFSMULD : Predicate<"!Subtarget->hasNoFSMULD()">;
9595// will pick deprecated instructions.
9696def 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.
103120def uimm3 : PatLeaf<(imm), [{ return isUInt<3>(N->getZExtValue()); }]>;
104121
@@ -178,12 +195,12 @@ def simm13Op : Operand<iPTR> {
178195
179196def 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}
184201def 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