mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-27 15:29:51 +00:00
ARM Asm parser range checking for [0,31] immediates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135719 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8409f04731
commit
7c6e42e927
@ -497,6 +497,7 @@ def imm0_15 : Operand<i32>, ImmLeaf<i32, [{
|
||||
}
|
||||
|
||||
/// imm0_31 predicate - True if the 32-bit immediate is in the range [0,31].
|
||||
def Imm0_31AsmOperand: AsmOperandClass { let Name = "Imm0_31"; }
|
||||
def imm0_31 : Operand<i32>, ImmLeaf<i32, [{
|
||||
return Imm >= 0 && Imm < 32;
|
||||
}]>;
|
||||
|
@ -418,6 +418,14 @@ public:
|
||||
int64_t Value = CE->getValue();
|
||||
return Value >= 0 && Value < 16;
|
||||
}
|
||||
bool isImm0_31() const {
|
||||
if (Kind != Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value >= 0 && Value < 32;
|
||||
}
|
||||
bool isImm0_65535() const {
|
||||
if (Kind != Immediate)
|
||||
return false;
|
||||
@ -672,6 +680,11 @@ public:
|
||||
addExpr(Inst, getImm());
|
||||
}
|
||||
|
||||
void addImm0_31Operands(MCInst &Inst, unsigned N) const {
|
||||
assert(N == 1 && "Invalid number of operands!");
|
||||
addExpr(Inst, getImm());
|
||||
}
|
||||
|
||||
void addImm0_65535Operands(MCInst &Inst, unsigned N) const {
|
||||
assert(N == 1 && "Invalid number of operands!");
|
||||
addExpr(Inst, getImm());
|
||||
|
Loading…
Reference in New Issue
Block a user