mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
llvm-mc/AsmParser: Implement user defined super classes.
- We can now discriminate SUB32ri8 from SUB32ri, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -137,6 +137,19 @@ struct X86Operand {
|
||||
|
||||
bool isImm() const { return Kind == Immediate; }
|
||||
|
||||
bool isImmSExt8() const {
|
||||
// Accept immediates which fit in 8 bits when sign extended, and
|
||||
// non-absolute immediates.
|
||||
if (!isImm())
|
||||
return false;
|
||||
|
||||
if (!getImm().isAbsolute())
|
||||
return true;
|
||||
|
||||
int64_t Value = getImm().getConstant();
|
||||
return Value == (int64_t) (int8_t) Value;
|
||||
}
|
||||
|
||||
bool isMem() const { return Kind == Memory; }
|
||||
|
||||
bool isReg() const { return Kind == Register; }
|
||||
@@ -151,6 +164,12 @@ struct X86Operand {
|
||||
Inst.addOperand(MCOperand::CreateMCValue(getImm()));
|
||||
}
|
||||
|
||||
void addImmSExt8Operands(MCInst &Inst, unsigned N) {
|
||||
// FIXME: Support user customization of the render method.
|
||||
assert(N == 1 && "Invalid number of operands!");
|
||||
Inst.addOperand(MCOperand::CreateMCValue(getImm()));
|
||||
}
|
||||
|
||||
void addMemOperands(MCInst &Inst, unsigned N) {
|
||||
assert((N == 4 || N == 5) && "Invalid number of operands!");
|
||||
|
||||
|
Reference in New Issue
Block a user