diff options
| author | Alex Bradbury <asb@lowrisc.org> | 2017-12-13 09:41:21 +0000 | 
|---|---|---|
| committer | Alex Bradbury <asb@lowrisc.org> | 2017-12-13 09:41:21 +0000 | 
| commit | 581d6b081debcd8496de2c796d1e25014b9dc13a (patch) | |
| tree | f837461f5d38e998a74b6dcafb7ee0f48e3dc7d9 /llvm/lib/Target | |
| parent | 60714f98baed163ef013512baa5ef368cdf04bbe (diff) | |
| download | bcm5719-llvm-581d6b081debcd8496de2c796d1e25014b9dc13a.tar.gz bcm5719-llvm-581d6b081debcd8496de2c796d1e25014b9dc13a.zip  | |
[RISCV][NFC] Put isSImm6 and simm6 td definition in correct sorted position
We sort these helper functions and td definitions by bit width. simm6 was
previously out-of-order with respect to the others.
llvm-svn: 320559
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 32 | ||||
| -rw-r--r-- | llvm/lib/Target/RISCV/RISCVInstrInfoC.td | 12 | 
2 files changed, 22 insertions, 22 deletions
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp index 0cf97f88fc6..1bae18bca92 100644 --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -235,6 +235,19 @@ public:             VK == RISCVMCExpr::VK_RISCV_None;    } +  bool isSImm6() const { +    RISCVMCExpr::VariantKind VK; +    int64_t Imm; +    bool IsValid; +    bool IsConstantImm = evaluateConstantImm(Imm, VK); +    if (!IsConstantImm) +      IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm); +    else +      IsValid = isInt<6>(Imm); +    return IsValid && +           (VK == RISCVMCExpr::VK_RISCV_None || VK == RISCVMCExpr::VK_RISCV_LO); +  } +    bool isUImm6NonZero() const {      int64_t Imm;      RISCVMCExpr::VariantKind VK; @@ -285,19 +298,6 @@ public:             VK == RISCVMCExpr::VK_RISCV_None;    } -  bool isSImm6() const { -    RISCVMCExpr::VariantKind VK; -    int64_t Imm; -    bool IsValid; -    bool IsConstantImm = evaluateConstantImm(Imm, VK); -    if (!IsConstantImm) -      IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK, Imm); -    else -      IsValid = isInt<6>(Imm); -    return IsValid && -           (VK == RISCVMCExpr::VK_RISCV_None || VK == RISCVMCExpr::VK_RISCV_LO); -  } -    bool isSImm12() const {      RISCVMCExpr::VariantKind VK;      int64_t Imm; @@ -596,6 +596,9 @@ bool RISCVAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,      return generateImmOutOfRangeError(Operands, ErrorInfo, 0, (1 << 5) - 1);    case Match_InvalidUImm5NonZero:      return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 5) - 1); +  case Match_InvalidSImm6: +    return generateImmOutOfRangeError(Operands, ErrorInfo, -(1 << 5), +                                      (1 << 5) - 1);    case Match_InvalidUImm6NonZero:      return generateImmOutOfRangeError(Operands, ErrorInfo, 1, (1 << 6) - 1);    case Match_InvalidUImm7Lsb00: @@ -622,9 +625,6 @@ bool RISCVAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,      return generateImmOutOfRangeError(          Operands, ErrorInfo, 4, (1 << 10) - 4,          "immediate must be a multiple of 4 bytes in the range"); -  case Match_InvalidSImm6: -    return generateImmOutOfRangeError(Operands, ErrorInfo, -(1 << 5), -                                      (1 << 5) - 1);    case Match_InvalidSImm10Lsb0000:      return generateImmOutOfRangeError(          Operands, ErrorInfo, -(1 << 9), (1 << 9) - 16, diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td index d0634a395d3..04d1e1bbdb8 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td @@ -13,18 +13,18 @@ include "RISCVInstrFormatsC.td"  // Operand definitions.  //===----------------------------------------------------------------------===// -def simm6 : Operand<XLenVT>, ImmLeaf<XLenVT, [{return isInt<6>(Imm);}]> { -  let ParserMatchClass = SImmAsmOperand<6>; -  let EncoderMethod = "getImmOpValue"; -  let DecoderMethod = "decodeSImmOperand<6>"; -} -  def uimm5nonzero : Operand<XLenVT>,                     ImmLeaf<XLenVT, [{return isUInt<5>(Imm) && (Imm != 0);}]> {    let ParserMatchClass = UImmAsmOperand<5, "NonZero">;    let DecoderMethod = "decodeUImmOperand<5>";  } +def simm6 : Operand<XLenVT>, ImmLeaf<XLenVT, [{return isInt<6>(Imm);}]> { +  let ParserMatchClass = SImmAsmOperand<6>; +  let EncoderMethod = "getImmOpValue"; +  let DecoderMethod = "decodeSImmOperand<6>"; +} +  def uimm6nonzero : Operand<XLenVT>,                     ImmLeaf<XLenVT, [{return isUInt<6>(Imm) && (Imm != 0);}]> {    let ParserMatchClass = UImmAsmOperand<6, "NonZero">;  | 

