[llvm] r181072 - Remove some uneeded pseudos in the presence of the naked function attribute.
Reed Kotler
rkotler at mips.com
Fri May 3 16:17:24 PDT 2013
Author: rkotler
Date: Fri May 3 18:17:24 2013
New Revision: 181072
URL: http://llvm.org/viewvc/llvm-project?rev=181072&view=rev
Log:
Remove some uneeded pseudos in the presence of the naked function attribute.
Added:
llvm/trunk/test/CodeGen/Mips/tnaked.ll
Modified:
llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=181072&r1=181071&r2=181072&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Fri May 3 18:17:24 2013
@@ -249,12 +249,18 @@ void MipsAsmPrinter::EmitFunctionEntryLa
void MipsAsmPrinter::EmitFunctionBodyStart() {
MCInstLowering.Initialize(Mang, &MF->getContext());
- emitFrameDirective();
+ bool IsNakedFunction =
+ MF->getFunction()->
+ getAttributes().hasAttribute(AttributeSet::FunctionIndex,
+ Attribute::Naked);
+ if (!IsNakedFunction)
+ emitFrameDirective();
if (OutStreamer.hasRawTextSupport()) {
SmallString<128> Str;
raw_svector_ostream OS(Str);
- printSavedRegsBitmask(OS);
+ if (!IsNakedFunction)
+ printSavedRegsBitmask(OS);
OutStreamer.EmitRawText(OS.str());
if (!Subtarget->inMips16Mode()) {
OutStreamer.EmitRawText(StringRef("\t.set\tnoreorder"));
Added: llvm/trunk/test/CodeGen/Mips/tnaked.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/tnaked.ll?rev=181072&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/tnaked.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/tnaked.ll Fri May 3 18:17:24 2013
@@ -0,0 +1,29 @@
+; RUN: llc -march=mipsel < %s | FileCheck %s
+
+
+define void @tnaked() #0 {
+entry:
+ ret void
+}
+
+; CHECK: .ent tnaked
+; CHECK: tnaked:
+; CHECK-NOT: .frame {{.*}}
+; CHECK-NOT: .mask {{.*}}
+; CHECK-NOT: .fmask {{.*}}
+; CHECK-NOT: addiu $sp, $sp, -8
+
+define void @tnonaked() #1 {
+entry:
+ ret void
+}
+
+; CHECK: .ent tnonaked
+; CHECK: tnonaked:
+; CHECK: .frame $fp,8,$ra
+; CHECK: .mask 0x40000000,-4
+; CHECK: .fmask 0x00000000,0
+; CHECK: addiu $sp, $sp, -8
+
+attributes #0 = { naked noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
More information about the llvm-commits
mailing list