forked from OSchip/llvm-project
Change isUIntN/isIntN calls with constant N to use the template version. NFC
llvm-svn: 249952
This commit is contained in:
parent
798cc60ad9
commit
55b1f29203
|
@ -4488,7 +4488,7 @@ bool AsmParser::parseDirectiveMSEmit(SMLoc IDLoc, ParseStatementInfo &Info,
|
||||||
if (!MCE)
|
if (!MCE)
|
||||||
return Error(ExprLoc, "unexpected expression in _emit");
|
return Error(ExprLoc, "unexpected expression in _emit");
|
||||||
uint64_t IntValue = MCE->getValue();
|
uint64_t IntValue = MCE->getValue();
|
||||||
if (!isUIntN(8, IntValue) && !isIntN(8, IntValue))
|
if (!isUInt<8>(IntValue) && !isInt<8>(IntValue))
|
||||||
return Error(ExprLoc, "literal value out of range for directive");
|
return Error(ExprLoc, "literal value out of range for directive");
|
||||||
|
|
||||||
Info.AsmRewrites->emplace_back(AOK_Emit, IDLoc, Len);
|
Info.AsmRewrites->emplace_back(AOK_Emit, IDLoc, Len);
|
||||||
|
|
|
@ -1441,7 +1441,7 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
|
||||||
Offset = Inst.getOperand(1);
|
Offset = Inst.getOperand(1);
|
||||||
if (!Offset.isImm())
|
if (!Offset.isImm())
|
||||||
break; // We'll deal with this situation later on when applying fixups.
|
break; // We'll deal with this situation later on when applying fixups.
|
||||||
if (!isIntN(8, Offset.getImm()))
|
if (!isInt<8>(Offset.getImm()))
|
||||||
return Error(IDLoc, "branch target out of range");
|
return Error(IDLoc, "branch target out of range");
|
||||||
if (OffsetToAlignment(Offset.getImm(), 2LL))
|
if (OffsetToAlignment(Offset.getImm(), 2LL))
|
||||||
return Error(IDLoc, "branch to misaligned address");
|
return Error(IDLoc, "branch to misaligned address");
|
||||||
|
@ -1663,7 +1663,7 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
|
||||||
int MemOffset = Op.getImm();
|
int MemOffset = Op.getImm();
|
||||||
MCOperand &DstReg = Inst.getOperand(0);
|
MCOperand &DstReg = Inst.getOperand(0);
|
||||||
MCOperand &BaseReg = Inst.getOperand(1);
|
MCOperand &BaseReg = Inst.getOperand(1);
|
||||||
if (isIntN(9, MemOffset) && (MemOffset % 4 == 0) &&
|
if (isInt<9>(MemOffset) && (MemOffset % 4 == 0) &&
|
||||||
getContext().getRegisterInfo()->getRegClass(
|
getContext().getRegisterInfo()->getRegClass(
|
||||||
Mips::GPRMM16RegClassID).contains(DstReg.getReg()) &&
|
Mips::GPRMM16RegClassID).contains(DstReg.getReg()) &&
|
||||||
(BaseReg.getReg() == Mips::GP ||
|
(BaseReg.getReg() == Mips::GP ||
|
||||||
|
@ -1808,7 +1808,7 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
|
||||||
if (!Opnd.isImm())
|
if (!Opnd.isImm())
|
||||||
return Error(IDLoc, "expected immediate operand kind");
|
return Error(IDLoc, "expected immediate operand kind");
|
||||||
int Imm = Opnd.getImm();
|
int Imm = Opnd.getImm();
|
||||||
if ((Imm % 4 != 0) || !isIntN(25, Imm))
|
if ((Imm % 4 != 0) || !isInt<25>(Imm))
|
||||||
return Error(IDLoc, "immediate operand value out of range");
|
return Error(IDLoc, "immediate operand value out of range");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2461,13 +2461,13 @@ bool MipsAsmParser::expandUncondBranchMMPseudo(
|
||||||
Inst.addOperand(MCOperand::createExpr(Offset.getExpr()));
|
Inst.addOperand(MCOperand::createExpr(Offset.getExpr()));
|
||||||
} else {
|
} else {
|
||||||
assert(Offset.isImm() && "expected immediate operand kind");
|
assert(Offset.isImm() && "expected immediate operand kind");
|
||||||
if (isIntN(11, Offset.getImm())) {
|
if (isInt<11>(Offset.getImm())) {
|
||||||
// If offset fits into 11 bits then this instruction becomes microMIPS
|
// If offset fits into 11 bits then this instruction becomes microMIPS
|
||||||
// 16-bit unconditional branch instruction.
|
// 16-bit unconditional branch instruction.
|
||||||
if (inMicroMipsMode())
|
if (inMicroMipsMode())
|
||||||
Inst.setOpcode(hasMips32r6() ? Mips::BC16_MMR6 : Mips::B16_MM);
|
Inst.setOpcode(hasMips32r6() ? Mips::BC16_MMR6 : Mips::B16_MM);
|
||||||
} else {
|
} else {
|
||||||
if (!isIntN(17, Offset.getImm()))
|
if (!isInt<17>(Offset.getImm()))
|
||||||
Error(IDLoc, "branch target out of range");
|
Error(IDLoc, "branch target out of range");
|
||||||
if (OffsetToAlignment(Offset.getImm(), 1LL << 1))
|
if (OffsetToAlignment(Offset.getImm(), 1LL << 1))
|
||||||
Error(IDLoc, "branch to misaligned address");
|
Error(IDLoc, "branch to misaligned address");
|
||||||
|
|
|
@ -63,14 +63,14 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
|
||||||
// address range. Forcing a signed division because Value can be negative.
|
// address range. Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t)Value / 4;
|
Value = (int64_t)Value / 4;
|
||||||
// We now check if Value can be encoded as a 16-bit signed immediate.
|
// We now check if Value can be encoded as a 16-bit signed immediate.
|
||||||
if (!isIntN(16, Value) && Ctx)
|
if (!isInt<16>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC16 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC16 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_MIPS_PC19_S2:
|
case Mips::fixup_MIPS_PC19_S2:
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t)Value / 4;
|
Value = (int64_t)Value / 4;
|
||||||
// We now check if Value can be encoded as a 19-bit signed immediate.
|
// We now check if Value can be encoded as a 19-bit signed immediate.
|
||||||
if (!isIntN(19, Value) && Ctx)
|
if (!isInt<19>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC19 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC19 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_Mips_26:
|
case Mips::fixup_Mips_26:
|
||||||
|
@ -104,7 +104,7 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t) Value / 2;
|
Value = (int64_t) Value / 2;
|
||||||
// We now check if Value can be encoded as a 7-bit signed immediate.
|
// We now check if Value can be encoded as a 7-bit signed immediate.
|
||||||
if (!isIntN(7, Value) && Ctx)
|
if (!isInt<7>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC7 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC7 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_MICROMIPS_PC10_S1:
|
case Mips::fixup_MICROMIPS_PC10_S1:
|
||||||
|
@ -112,7 +112,7 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t) Value / 2;
|
Value = (int64_t) Value / 2;
|
||||||
// We now check if Value can be encoded as a 10-bit signed immediate.
|
// We now check if Value can be encoded as a 10-bit signed immediate.
|
||||||
if (!isIntN(10, Value) && Ctx)
|
if (!isInt<10>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC10 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC10 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_MICROMIPS_PC16_S1:
|
case Mips::fixup_MICROMIPS_PC16_S1:
|
||||||
|
@ -120,28 +120,28 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t)Value / 2;
|
Value = (int64_t)Value / 2;
|
||||||
// We now check if Value can be encoded as a 16-bit signed immediate.
|
// We now check if Value can be encoded as a 16-bit signed immediate.
|
||||||
if (!isIntN(16, Value) && Ctx)
|
if (!isInt<16>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC16 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC16 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_MIPS_PC18_S3:
|
case Mips::fixup_MIPS_PC18_S3:
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t)Value / 8;
|
Value = (int64_t)Value / 8;
|
||||||
// We now check if Value can be encoded as a 18-bit signed immediate.
|
// We now check if Value can be encoded as a 18-bit signed immediate.
|
||||||
if (!isIntN(18, Value) && Ctx)
|
if (!isInt<18>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC18 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC18 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_MIPS_PC21_S2:
|
case Mips::fixup_MIPS_PC21_S2:
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t) Value / 4;
|
Value = (int64_t) Value / 4;
|
||||||
// We now check if Value can be encoded as a 21-bit signed immediate.
|
// We now check if Value can be encoded as a 21-bit signed immediate.
|
||||||
if (!isIntN(21, Value) && Ctx)
|
if (!isInt<21>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC21 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC21 fixup");
|
||||||
break;
|
break;
|
||||||
case Mips::fixup_MIPS_PC26_S2:
|
case Mips::fixup_MIPS_PC26_S2:
|
||||||
// Forcing a signed division because Value can be negative.
|
// Forcing a signed division because Value can be negative.
|
||||||
Value = (int64_t) Value / 4;
|
Value = (int64_t) Value / 4;
|
||||||
// We now check if Value can be encoded as a 26-bit signed immediate.
|
// We now check if Value can be encoded as a 26-bit signed immediate.
|
||||||
if (!isIntN(26, Value) && Ctx)
|
if (!isInt<26>(Value) && Ctx)
|
||||||
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC26 fixup");
|
Ctx->reportFatalError(Fixup.getLoc(), "out of range PC26 fixup");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue