[llvm] r318948 - [mips] Set microMIPS ASE flag
Aleksandar Beserminji via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 24 06:00:48 PST 2017
Author: abeserminji
Date: Fri Nov 24 06:00:47 2017
New Revision: 318948
URL: http://llvm.org/viewvc/llvm-project?rev=318948&view=rev
Log:
[mips] Set microMIPS ASE flag
This patch fixes an issue where microMIPS ASE flag is not set
when a function has micromips attribute or when .set micromips
directive is used.
Differential Revision: https://reviews.llvm.org/D40316
Added:
llvm/trunk/test/CodeGen/Mips/micromips-ase-function-attribute.ll
llvm/trunk/test/MC/Mips/micromips-ase-directive.s
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/lib/Target/Mips/MipsAsmPrinter.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=318948&r1=318947&r2=318948&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Fri Nov 24 06:00:47 2017
@@ -2273,8 +2273,10 @@ bool MipsAsmParser::processInstruction(M
// We know we emitted an instruction on the MER_NotAMacro or MER_Success path.
// If we're in microMIPS mode then we must also set EF_MIPS_MICROMIPS.
- if (inMicroMipsMode())
+ if (inMicroMipsMode()) {
TOut.setUsesMicroMips();
+ TOut.updateABIInfo(*this);
+ }
// If this instruction has a delay slot and .set reorder is active,
// emit a NOP after it.
Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=318948&r1=318947&r2=318948&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Fri Nov 24 06:00:47 2017
@@ -361,6 +361,7 @@ void MipsAsmPrinter::EmitFunctionEntryLa
if (Subtarget->inMicroMipsMode()) {
TS.emitDirectiveSetMicroMips();
TS.setUsesMicroMips();
+ TS.updateABIInfo(*Subtarget);
} else
TS.emitDirectiveSetNoMicroMips();
Added: llvm/trunk/test/CodeGen/Mips/micromips-ase-function-attribute.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/micromips-ase-function-attribute.ll?rev=318948&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/micromips-ase-function-attribute.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/micromips-ase-function-attribute.ll Fri Nov 24 06:00:47 2017
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=mips-unknown-linux -filetype=obj %s -o - | \
+; RUN: llvm-readobj -mips-abi-flags | \
+; RUN: FileCheck --check-prefix=ASE-MICROMIPS %s
+
+define void @_Z3foov() #0 {
+entry:
+ ret void
+}
+attributes #0 = { "micromips" }
+
+; ASE-MICROMIPS: microMIPS (0x800)
Added: llvm/trunk/test/MC/Mips/micromips-ase-directive.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/micromips-ase-directive.s?rev=318948&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/micromips-ase-directive.s (added)
+++ llvm/trunk/test/MC/Mips/micromips-ase-directive.s Fri Nov 24 06:00:47 2017
@@ -0,0 +1,10 @@
+# RUN: llvm-mc -triple=mips-unknown-linux -filetype=obj %s -o - | \
+# RUN: llvm-readobj -mips-abi-flags | \
+# RUN: FileCheck --check-prefix=ASE-MICROMIPS %s
+
+ .set micromips
+ .ent _Z3foov
+_Z3foov:
+ addiu $sp, $sp, -8
+
+# ASE-MICROMIPS: microMIPS (0x800)
More information about the llvm-commits
mailing list