1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[mips][ias] Integers are not registers.

Summary:
When parseAnyRegister() encounters a symbol alias, it parses integers and adds
a corresponding expression to the operand list. This is clearly wrong since the
only operands that parseAnyRegister() should be accepting are registers.

It's not clear why this code was added and there are no test cases that cover
it. I think it might be leftover from when searchSymbolAlias() was more widely
used.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

Differential Revision: http://reviews.llvm.org/D21377

llvm-svn: 273555
This commit is contained in:
Daniel Sanders 2016-06-23 10:54:09 +00:00
parent 91b64d2b23
commit 2790c5281d
2 changed files with 30 additions and 6 deletions

View File

@ -4461,12 +4461,6 @@ bool MipsAsmParser::searchSymbolAlias(OperandVector &Operands) {
llvm_unreachable("Should never ParseFail");
return false;
}
} else if (Expr->getKind() == MCExpr::Constant) {
Parser.Lex();
const MCConstantExpr *Const = static_cast<const MCConstantExpr *>(Expr);
Operands.push_back(
MipsOperand::CreateImm(Const, S, Parser.getTok().getLoc(), *this));
return true;
}
}
return false;

View File

@ -160,3 +160,33 @@ t5:
# ALL-NEXT: nop
t1b:
IMM_8 = 8
.cpsetup $25, IMM_8, __cerror
nop
.cpreturn
nop
# ALL-LABEL: t1b:
# ASM-NEXT: IMM_8 = 8
# O32-NOT: __cerror
# NXX-NEXT: sd $gp, 8($sp)
# NXX-NEXT: lui $gp, 0
# N32-NEXT: R_MIPS_HI16/R_MIPS_NONE/R_MIPS_NONE __gnu_local_gp
# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 __cerror
# NXX-NEXT: addiu $gp, $gp, 0
# N32-NEXT: R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE __gnu_local_gp
# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 __cerror
# N64-NEXT: daddu $gp, $gp, $25
# ASM-NEXT: .cpsetup $25, 8, __cerror
# ALL-NEXT: nop
# ASM-NEXT: .cpreturn
# NXX-NEXT: ld $gp, 8($sp)
# ALL-NEXT: nop