[llvm] r234316 - [mips] [IAS] Allow .set assignments for already defined symbols.
Toma Tabacu
toma.tabacu at imgtec.com
Tue Apr 7 06:59:39 PDT 2015
Author: tomatabacu
Date: Tue Apr 7 08:59:39 2015
New Revision: 234316
URL: http://llvm.org/viewvc/llvm-project?rev=234316&view=rev
Log:
[mips] [IAS] Allow .set assignments for already defined symbols.
Summary:
This is not possible when using the IAS for MIPS, but it is possible when using the IAS for other architectures and when using GAS for MIPS.
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8578
Added:
llvm/trunk/test/MC/Mips/set-defined-symbol.s
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=234316&r1=234315&r2=234316&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Tue Apr 7 08:59:39 2015
@@ -3579,11 +3579,7 @@ bool MipsAsmParser::parseSetAssignment()
if (Parser.parseExpression(Value))
return reportParseError("expected valid expression after comma");
- // Check if the Name already exists as a symbol.
- MCSymbol *Sym = getContext().LookupSymbol(Name);
- if (Sym)
- return reportParseError("symbol already defined");
- Sym = getContext().GetOrCreateSymbol(Name);
+ MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
Sym->setVariableValue(Value);
return false;
Added: llvm/trunk/test/MC/Mips/set-defined-symbol.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/set-defined-symbol.s?rev=234316&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/set-defined-symbol.s (added)
+++ llvm/trunk/test/MC/Mips/set-defined-symbol.s Tue Apr 7 08:59:39 2015
@@ -0,0 +1,18 @@
+# RUN: llvm-mc %s -arch=mips -mcpu=mips32 -filetype=obj -o - | \
+# RUN: llvm-objdump -d -r -arch=mips - | FileCheck %s
+
+ .global foo
+ .weak bar
+ .set bar, b
+ .set foo, b
+ .set foo, a
+a:
+ nop
+# CHECK-NOT: a:
+# CHECK: foo:
+
+b:
+ nop
+# CHECK-NOT: b:
+# CHECK-NOT: foo:
+# CHECK: bar:
More information about the llvm-commits
mailing list