mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
[mips] Report correct location when "erroring" about the use of $at when it's not available.
Summary: This removes the FIXMEs from test/MC/Mips/mips-noat.s. Reviewers: dsanders Reviewed By: dsanders Differential Revision: http://reviews.llvm.org/D4172 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -203,7 +203,7 @@ class MipsAsmParser : public MCTargetAsmParser {
|
|||||||
|
|
||||||
unsigned getGPR(int RegNo);
|
unsigned getGPR(int RegNo);
|
||||||
|
|
||||||
int getATReg();
|
int getATReg(SMLoc Loc);
|
||||||
|
|
||||||
bool processInstruction(MCInst &Inst, SMLoc IDLoc,
|
bool processInstruction(MCInst &Inst, SMLoc IDLoc,
|
||||||
SmallVectorImpl<MCInst> &Instructions);
|
SmallVectorImpl<MCInst> &Instructions);
|
||||||
@@ -1149,9 +1149,15 @@ void MipsAsmParser::expandMemInst(MCInst &Inst, SMLoc IDLoc,
|
|||||||
// but for stores we must use $at.
|
// but for stores we must use $at.
|
||||||
if (isLoad && (BaseRegNum != RegOpNum))
|
if (isLoad && (BaseRegNum != RegOpNum))
|
||||||
TmpRegNum = RegOpNum;
|
TmpRegNum = RegOpNum;
|
||||||
else
|
else {
|
||||||
TmpRegNum = getReg(
|
int AT = getATReg(IDLoc);
|
||||||
(isGP64()) ? Mips::GPR64RegClassID : Mips::GPR32RegClassID, getATReg());
|
// At this point we need AT to perform the expansions and we exit if it is
|
||||||
|
// not available.
|
||||||
|
if (!AT)
|
||||||
|
return;
|
||||||
|
TmpRegNum =
|
||||||
|
getReg((isGP64()) ? Mips::GPR64RegClassID : Mips::GPR32RegClassID, AT);
|
||||||
|
}
|
||||||
|
|
||||||
TempInst.setOpcode(Mips::LUi);
|
TempInst.setOpcode(Mips::LUi);
|
||||||
TempInst.addOperand(MCOperand::CreateReg(TmpRegNum));
|
TempInst.addOperand(MCOperand::CreateReg(TmpRegNum));
|
||||||
@@ -1408,10 +1414,11 @@ bool MipsAssemblerOptions::setATReg(unsigned Reg) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MipsAsmParser::getATReg() {
|
int MipsAsmParser::getATReg(SMLoc Loc) {
|
||||||
int AT = Options.getATRegNum();
|
int AT = Options.getATRegNum();
|
||||||
if (AT == 0)
|
if (AT == 0)
|
||||||
TokError("Pseudo instruction requires $at, which is not available");
|
reportParseError(Loc,
|
||||||
|
"Pseudo instruction requires $at, which is not available");
|
||||||
return AT;
|
return AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,11 +10,10 @@
|
|||||||
test1:
|
test1:
|
||||||
lw $2, 65536($2)
|
lw $2, 65536($2)
|
||||||
|
|
||||||
# FIXME: It would be better if the error pointed at the mnemonic instead of the newline
|
|
||||||
# ERROR: mips-noat.s:[[@LINE+4]]:1: error: Pseudo instruction requires $at, which is not available
|
|
||||||
test2:
|
test2:
|
||||||
.set noat
|
.set noat
|
||||||
lw $2, 65536($2)
|
lw $2, 65536($2) # ERROR: mips-noat.s:[[@LINE]]:9: error: Pseudo instruction requires $at, which is not available
|
||||||
|
|
||||||
|
|
||||||
# Can we switch it back on successfully?
|
# Can we switch it back on successfully?
|
||||||
# CHECK-LABEL: test3:
|
# CHECK-LABEL: test3:
|
||||||
@@ -25,10 +24,6 @@ test3:
|
|||||||
.set at
|
.set at
|
||||||
lw $2, 65536($2)
|
lw $2, 65536($2)
|
||||||
|
|
||||||
# FIXME: It would be better if the error pointed at the mnemonic instead of the newline
|
|
||||||
# ERROR: mips-noat.s:[[@LINE+4]]:1: error: Pseudo instruction requires $at, which is not available
|
|
||||||
test4:
|
test4:
|
||||||
.set at=$0
|
.set at=$0
|
||||||
lw $2, 65536($2)
|
lw $2, 65536($2) # ERROR: mips-noat.s:[[@LINE]]:9: error: Pseudo instruction requires $at, which is not available
|
||||||
|
|
||||||
# ERROR-NOT: error
|
|
||||||
|
Reference in New Issue
Block a user