AMDGPU: Use getAsInteger instead of atoi

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault 2015-06-23 02:05:55 +00:00
parent c49542e5bb
commit 080d72c9a5

View File

@ -2211,8 +2211,9 @@ SDValue SITargetLowering::CreateLiveInRegister(SelectionDAG &DAG,
std::pair<unsigned, const TargetRegisterClass *>
SITargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
const std::string &Constraint,
const std::string &Constraint_,
MVT VT) const {
StringRef Constraint(Constraint_);
if (Constraint == "r") {
switch(VT.SimpleTy) {
default: llvm_unreachable("Unhandled type for 'r' inline asm constraint");
@ -2232,8 +2233,9 @@ SITargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
}
if (RC) {
unsigned Idx = std::atoi(Constraint.substr(2).c_str());
if (Idx < RC->getNumRegs())
uint32_t Idx;
bool Failed = Constraint.substr(2).getAsInteger(10, Idx);
if (!Failed && Idx < RC->getNumRegs())
return std::make_pair(RC->getRegister(Idx), RC);
}
}