diff options
| author | Jim Grosbach <grosbach@apple.com> | 2011-10-28 22:36:30 +0000 | 
|---|---|---|
| committer | Jim Grosbach <grosbach@apple.com> | 2011-10-28 22:36:30 +0000 | 
| commit | b009a872d7a3fde0933eb2d89ccca2cb1e584654 (patch) | |
| tree | 53bb7c06cf614bc586e1c96bd517588d95fb10b3 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
| parent | 254a73d636645a9375dec1b8e2564e21a5c08a27 (diff) | |
| download | bcm5719-llvm-b009a872d7a3fde0933eb2d89ccca2cb1e584654.tar.gz bcm5719-llvm-b009a872d7a3fde0933eb2d89ccca2cb1e584654.zip | |
Add Thumb2 alias for "mov Rd, #imm" to "mvn Rd, #~imm".
When '~imm' is encodable as a t2_so_imm but plain 'imm' is not. For example,
  mov r2, #-3
becomes
  mvn r2, #2
rdar://10349224
llvm-svn: 143235
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
| -rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index dbdce29e107..ad5f061eaba 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -665,6 +665,14 @@ public:      int64_t Value = CE->getValue();      return ARM_AM::getT2SOImmVal(Value) != -1;    } +  bool isT2SOImmNot() const { +    if (Kind != k_Immediate) +      return false; +    const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm()); +    if (!CE) return false; +    int64_t Value = CE->getValue(); +    return ARM_AM::getT2SOImmVal(~Value) != -1; +  }    bool isSetEndImm() const {      if (Kind != k_Immediate)        return false; @@ -1241,6 +1249,14 @@ public:      addExpr(Inst, getImm());    } +  void addT2SOImmNotOperands(MCInst &Inst, unsigned N) const { +    assert(N == 1 && "Invalid number of operands!"); +    // The operand is actually a t2_so_imm, but we have its bitwise +    // negation in the assembly source, so twiddle it here. +    const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm()); +    Inst.addOperand(MCOperand::CreateImm(~CE->getValue())); +  } +    void addSetEndImmOperands(MCInst &Inst, unsigned N) const {      assert(N == 1 && "Invalid number of operands!");      addExpr(Inst, getImm()); | 

