Skip to content

Commit

Permalink
[mips][ias] Integers are not registers.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dsandersllvm committed Jun 23, 2016
1 parent 8e6aab3 commit 8e17bea
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
6 changes: 0 additions & 6 deletions llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Expand Up @@ -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;
Expand Down
30 changes: 30 additions & 0 deletions llvm/test/MC/Mips/cpsetup.s
Expand Up @@ -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

0 comments on commit 8e17bea

Please sign in to comment.