summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReed Kotler <rkotler@mips.com>2013-05-03 23:17:24 +0000
committerReed Kotler <rkotler@mips.com>2013-05-03 23:17:24 +0000
commit2bb955a6931580c9bb0472aa29b3fbbabe263295 (patch)
tree894e8f0b2a84a0b073152b4d8525497546005539
parent3170ad7dd47e2584c44aad7455b161a92058f84a (diff)
downloadllvm-2bb955a6931580c9bb0472aa29b3fbbabe263295.tar.gz
llvm-2bb955a6931580c9bb0472aa29b3fbbabe263295.tar.bz2
llvm-2bb955a6931580c9bb0472aa29b3fbbabe263295.tar.xz
Remove some uneeded pseudos in the presence of the naked function attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181072 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/Mips/MipsAsmPrinter.cpp10
-rw-r--r--test/CodeGen/Mips/tnaked.ll29
2 files changed, 37 insertions, 2 deletions
diff --git a/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp
index f4f71cbccb..6e4feda4f5 100644
--- a/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -249,12 +249,18 @@ void MipsAsmPrinter::EmitFunctionEntryLabel() {
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"));
diff --git a/test/CodeGen/Mips/tnaked.ll b/test/CodeGen/Mips/tnaked.ll
new file mode 100644
index 0000000000..f5bdd915b2
--- /dev/null
+++ b/test/CodeGen/Mips/tnaked.ll
@@ -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" }