diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-07-13 22:01:08 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-07-13 22:01:08 +0000 |
commit | 31756c2283b99b7eecd1547a7888ac70254534fd (patch) | |
tree | c272940023e122f8d8aca158ce50635d09bdd69b /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | 98154a76fd5e5427410cd1f8690e34f7a9c02a61 (diff) | |
download | bcm5719-llvm-31756c2283b99b7eecd1547a7888ac70254534fd.tar.gz bcm5719-llvm-31756c2283b99b7eecd1547a7888ac70254534fd.zip |
Range checking for CDP[2] immediates.
llvm-svn: 135092
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 0ce4b4c1282..499c95440c4 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -386,6 +386,22 @@ public: int64_t Value = CE->getValue(); return Value >= 0 && Value < 256; } + bool isImm0_7() 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 < 8; + } + bool isImm0_15() 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 < 16; + } bool isImm0_65535() const { if (Kind != Immediate) return false; @@ -585,6 +601,16 @@ public: addExpr(Inst, getImm()); } + void addImm0_7Operands(MCInst &Inst, unsigned N) const { + assert(N == 1 && "Invalid number of operands!"); + addExpr(Inst, getImm()); + } + + void addImm0_15Operands(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()); |