return true;
}
+ bool isImmSExt32() const {
+ // Accept immediates which fit in 32 bits when sign extended, and
+ // non-absolute immediates.
+ if (!isImm())
+ return false;
+
+ if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm())) {
+ int64_t Value = CE->getValue();
+ return Value == (int64_t) (int32_t) Value;
+ }
+
+ return true;
+ }
+
bool isMem() const { return Kind == Memory; }
bool isAbsMem() const {
addExpr(Inst, getImm());
}
+ void addImmSExt32Operands(MCInst &Inst, unsigned N) const {
+ // FIXME: Support user customization of the render method.
+ assert(N == 1 && "Invalid number of operands!");
+ addExpr(Inst, getImm());
+ }
+
void addMemOperands(MCInst &Inst, unsigned N) const {
assert((N == 5) && "Invalid number of operands!");
Inst.addOperand(MCOperand::CreateReg(getMemBaseReg()));
//
// 64-bits but only 32 bits are significant.
-def i64i32imm : Operand<i64>;
+def i64i32imm : Operand<i64> {
+ let ParserMatchClass = ImmSExt32AsmOperand;
+}
// 64-bits but only 32 bits are significant, and those bits are treated as being
// pc relative.
let PrintMethod = "printSSECC";
}
+def ImmSExt32AsmOperand : AsmOperandClass {
+ let Name = "ImmSExt32";
+ let SuperClass = ImmAsmOperand;
+}
+
def ImmSExt8AsmOperand : AsmOperandClass {
let Name = "ImmSExt8";
- let SuperClass = ImmAsmOperand;
+ let SuperClass = ImmSExt32AsmOperand;
}
// A couple of more descriptive operand definitions.