diff options
| author | Jim Grosbach <grosbach@apple.com> | 2011-10-11 21:55:36 +0000 | 
|---|---|---|
| committer | Jim Grosbach <grosbach@apple.com> | 2011-10-11 21:55:36 +0000 | 
| commit | 9398141c487804d0914c9f4dcc64f108b5ce407c (patch) | |
| tree | 49829f42d022e890b3ad23ae33f42d8b16684a12 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
| parent | 10ae11fd57ae78d34502b41e86d68a4d6d9ab9c2 (diff) | |
| download | bcm5719-llvm-9398141c487804d0914c9f4dcc64f108b5ce407c.tar.gz bcm5719-llvm-9398141c487804d0914c9f4dcc64f108b5ce407c.zip | |
ARM assembly parsing and encoding for LDC{2}{L}/STC{2}{L} instructions.
Fill out the rest of the encoding information, update to properly mark
the LDC/STC instructions as predicable while the LDC2/STC2 instructions are
not, and adjust the parser accordingly.
llvm-svn: 141721
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
| -rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 26 | 
1 files changed, 24 insertions, 2 deletions
| diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index bdebc76a9b1..afb6e5684dd 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -874,6 +874,15 @@ public:      int64_t Val = CE->getValue();      return (Val > -256 && Val < 256) || (Val == INT32_MIN);    } +  bool isPostIdxImm8s4() const { +    if (Kind != k_Immediate) +      return false; +    const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm()); +    if (!CE) return false; +    int64_t Val = CE->getValue(); +    return ((Val & 3) == 0 && Val >= -1020 && Val <= 1020) || +      (Val == INT32_MIN); +  }    bool isMSRMask() const { return Kind == k_MSRMask; }    bool isProcIFlags() const { return Kind == k_ProcIFlags; } @@ -1356,6 +1365,18 @@ public:      Inst.addOperand(MCOperand::CreateImm(Imm));    } +  void addPostIdxImm8s4Operands(MCInst &Inst, unsigned N) const { +    assert(N == 1 && "Invalid number of operands!"); +    const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm()); +    assert(CE && "non-constant post-idx-imm8s4 operand!"); +    int Imm = CE->getValue(); +    bool isAdd = Imm >= 0; +    if (Imm == INT32_MIN) Imm = 0; +    // Immediate is scaled by 4. +    Imm = ((Imm < 0 ? -Imm : Imm) / 4) | (int)isAdd << 8; +    Inst.addOperand(MCOperand::CreateImm(Imm)); +  } +    void addPostIdxRegOperands(MCInst &Inst, unsigned N) const {      assert(N == 2 && "Invalid number of operands!");      Inst.addOperand(MCOperand::CreateReg(PostIdxReg.RegNum)); @@ -3539,8 +3560,9 @@ getMnemonicAcceptInfo(StringRef Mnemonic, bool &CanAcceptCarrySet,        Mnemonic == "dsb" || Mnemonic == "isb" || Mnemonic == "setend" ||        (Mnemonic == "clrex" && !isThumb()) ||        (Mnemonic == "nop" && isThumbOne()) || -      ((Mnemonic == "pld" || Mnemonic == "pli" || Mnemonic == "pldw") && -       !isThumb()) || +      ((Mnemonic == "pld" || Mnemonic == "pli" || Mnemonic == "pldw" || +        Mnemonic == "ldc2" || Mnemonic == "ldc2l" || +        Mnemonic == "stc2" || Mnemonic == "stc2l") && !isThumb()) ||        ((Mnemonic.startswith("rfe") || Mnemonic.startswith("srs")) &&         !isThumb()) ||        Mnemonic.startswith("cps") || (Mnemonic == "movs" && isThumbOne())) { | 

