From: Daniel Sanders Date: Thu, 23 Jun 2016 10:54:09 +0000 (+0000) Subject: [mips][ias] Integers are not registers. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47c3c00ec301357d340dbc5f0b1e6f4c209c4e85;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273555 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 2ab78490c5a..7a48ad627c2 100644 --- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -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(Expr); - Operands.push_back( - MipsOperand::CreateImm(Const, S, Parser.getTok().getLoc(), *this)); - return true; } } return false; diff --git a/test/MC/Mips/cpsetup.s b/test/MC/Mips/cpsetup.s index f858b21ee87..155ed6beeb4 100644 --- a/test/MC/Mips/cpsetup.s +++ b/test/MC/Mips/cpsetup.s @@ -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 +