[llvm] r187555 - Fix some misc. issues with Mips16 fp stubs.

Reed Kotler rkotler at mips.com
Wed Jul 31 19:26:31 PDT 2013


Author: rkotler
Date: Wed Jul 31 21:26:31 2013
New Revision: 187555

URL: http://llvm.org/viewvc/llvm-project?rev=187555&view=rev
Log:
Fix some misc. issues with Mips16 fp stubs.
1) They should never be inlined.
2) A naming inconsistency with gcc mips16
3) Stubs should not have the global attribute


Modified:
    llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp
    llvm/trunk/test/CodeGen/Mips/hf16call32.ll

Modified: llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp?rev=187555&r1=187554&r2=187555&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp (original)
+++ llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp Wed Jul 31 21:26:31 2013
@@ -247,7 +247,7 @@ static void assureFPCallStub(Function &F
   bool LE = Subtarget.isLittle();
   std::string Name = F.getName();
   std::string SectionName = ".mips16.call.fp." + Name;
-  std::string StubName = "__call_stub_" + Name;
+  std::string StubName = "__call_stub_fp_" + Name;
   //
   // see if we already have the stub
   //
@@ -257,11 +257,13 @@ static void assureFPCallStub(Function &F
                            Function::InternalLinkage, StubName, M);
   FStub->addFnAttr("mips16_fp_stub");
   FStub->addFnAttr(llvm::Attribute::Naked);
+  FStub->addFnAttr(llvm::Attribute::NoInline);
   FStub->addFnAttr(llvm::Attribute::NoUnwind);
   FStub->addFnAttr("nomips16");
   FStub->setSection(SectionName);
   BasicBlock *BB = BasicBlock::Create(Context, "entry", FStub);
   InlineAsmHelper IAH(Context, BB);
+  IAH.Out(".set reorder");
   FPReturnVariant RV = whichFPReturnVariant(FStub->getReturnType());
   FPParamVariant PV = whichFPParamVariantNeeded(F);
   swapFPIntParams(PV, M, IAH, LE, true);
@@ -361,6 +363,8 @@ static bool fixupFPReturnAndCall
                            "__Mips16RetHelper");
         A = A.addAttribute(C, AttributeSet::FunctionIndex,
                            Attribute::ReadNone);
+        A = A.addAttribute(C, AttributeSet::FunctionIndex,
+                           Attribute::NoInline);
         Value *F = (M->getOrInsertFunction(Name, A, MyVoid, T, NULL));
         CallInst::Create(F, Params, "", &Inst );
       } else if (const CallInst *CI = dyn_cast<CallInst>(I)) {
@@ -389,10 +393,11 @@ static void createFPFnStub(Function *F,
   std::string LocalName = "__fn_local_" + Name;
   Function *FStub = Function::Create
     (F->getFunctionType(),
-     Function::ExternalLinkage, StubName, M);
+     Function::InternalLinkage, StubName, M);
   FStub->addFnAttr("mips16_fp_stub");
   FStub->addFnAttr(llvm::Attribute::Naked);
   FStub->addFnAttr(llvm::Attribute::NoUnwind);
+  FStub->addFnAttr(llvm::Attribute::NoInline);
   FStub->addFnAttr("nomips16");
   FStub->setSection(SectionName);
   BasicBlock *BB = BasicBlock::Create(Context, "entry", FStub);

Modified: llvm/trunk/test/CodeGen/Mips/hf16call32.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/hf16call32.ll?rev=187555&r1=187554&r2=187555&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/hf16call32.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/hf16call32.ll Wed Jul 31 21:26:31 2013
@@ -752,60 +752,62 @@ land.end289:
 
 declare void @v_sf(float) #1
 ; stel: .section	.mips16.call.fp.v_sf,"ax", at progbits
-; stel:	.ent	__call_stub_v_sf
+; stel:	.ent	__call_stub_fp_v_sf
 ; stel:	mtc1 $4,$f12
 ; stel:	lui  $25,%hi(v_sf)
 ; stel:	addiu  $25,$25,%lo(v_sf)
 ; stel:	jr $25
-; stel:	.end	__call_stub_v_sf
+; stel:	.end	__call_stub_fp_v_sf
 
 declare i32 @printf(i8*, ...) #1
 
 declare void @v_df(double) #1
 ; stel: .section	.mips16.call.fp.v_df,"ax", at progbits
-; stel:	.ent	__call_stub_v_df
+; stel:	.ent	__call_stub_fp_v_df
+; stel: #APP
+; setl: .set reorder
 ; stel:	mtc1 $4,$f12
 ; stel:	mtc1 $5,$f13
 ; stel:	lui  $25,%hi(v_df)
 ; stel:	addiu  $25,$25,%lo(v_df)
 ; stel:	jr $25
-; stel:	.end	__call_stub_v_df
+; stel:	.end	__call_stub_fp_v_df
 
 declare void @v_sf_sf(float, float) #1
 ; stel: .section	.mips16.call.fp.v_sf_sf,"ax", at progbits
-; stel:	.ent	__call_stub_v_sf_sf
+; stel:	.ent	__call_stub_fp_v_sf_sf
 ; stel:	mtc1 $4,$f12
 ; stel:	mtc1 $5,$f14
 ; stel:	lui  $25,%hi(v_sf_sf)
 ; stel:	addiu  $25,$25,%lo(v_sf_sf)
 ; stel:	jr $25
-; stel:	.end	__call_stub_v_sf_sf
+; stel:	.end	__call_stub_fp_v_sf_sf
 
 declare void @v_sf_df(float, double) #1
 ; stel: .section	.mips16.call.fp.v_sf_df,"ax", at progbits
-; stel:	.ent	__call_stub_v_sf_df
+; stel:	.ent	__call_stub_fp_v_sf_df
 ; stel:	mtc1 $4,$f12
 ; stel:	mtc1 $6,$f14
 ; stel:	mtc1 $7,$f15
 ; stel:	lui  $25,%hi(v_sf_df)
 ; stel:	addiu  $25,$25,%lo(v_sf_df)
 ; stel:	jr $25
-; stel:	.end	__call_stub_v_sf_df
+; stel:	.end	__call_stub_fp_v_sf_df
 
 declare void @v_df_sf(double, float) #1
 ; stel: .section	.mips16.call.fp.v_df_sf,"ax", at progbits
-; stel:	.ent	__call_stub_v_df_sf
+; stel:	.ent	__call_stub_fp_v_df_sf
 ; stel:	mtc1 $4,$f12
 ; stel:	mtc1 $5,$f13
 ; stel:	mtc1 $6,$f14
 ; stel:	lui  $25,%hi(v_df_sf)
 ; stel:	addiu  $25,$25,%lo(v_df_sf)
 ; stel:	jr $25
-; stel:	.end	__call_stub_v_df_sf
+; stel:	.end	__call_stub_fp_v_df_sf
 
 declare void @v_df_df(double, double) #1
 ; stel: .section	.mips16.call.fp.v_df_df,"ax", at progbits
-; stel:	.ent	__call_stub_v_df_df
+; stel:	.ent	__call_stub_fp_v_df_df
 ; stel:	mtc1 $4,$f12
 ; stel:	mtc1 $5,$f13
 ; stel:	mtc1 $6,$f14
@@ -813,52 +815,52 @@ declare void @v_df_df(double, double) #1
 ; stel:	lui  $25,%hi(v_df_df)
 ; stel:	addiu  $25,$25,%lo(v_df_df)
 ; stel:	jr $25
-; stel:	.end	__call_stub_v_df_df
+; stel:	.end	__call_stub_fp_v_df_df
 
 declare float @sf_v() #1
 ; stel: .section	.mips16.call.fp.sf_v,"ax", at progbits
-; stel:	.ent	__call_stub_sf_v
+; stel:	.ent	__call_stub_fp_sf_v
 ; stel: move $18, $31
 ; stel: jal sf_v
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_v
+; stel:	.end	__call_stub_fp_sf_v
 
 declare float @sf_sf(float) #1
 ; stel: .section	.mips16.call.fp.sf_sf,"ax", at progbits
-; stel:	.ent	__call_stub_sf_sf
+; stel:	.ent	__call_stub_fp_sf_sf
 ; stel: mtc1 $4,$f12
 ; stel: move $18, $31
 ; stel: jal sf_sf
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_sf
+; stel:	.end	__call_stub_fp_sf_sf
 
 declare float @sf_df(double) #1
 ; stel: .section	.mips16.call.fp.sf_df,"ax", at progbits
-; stel:	.ent	__call_stub_sf_df
+; stel:	.ent	__call_stub_fp_sf_df
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f13
 ; stel: move $18, $31
 ; stel: jal sf_df
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_df
+; stel:	.end	__call_stub_fp_sf_df
 
 declare float @sf_sf_sf(float, float) #1
 ; stel: .section	.mips16.call.fp.sf_sf_sf,"ax", at progbits
-; stel:	.ent	__call_stub_sf_sf_sf
+; stel:	.ent	__call_stub_fp_sf_sf_sf
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f14
 ; stel: move $18, $31
 ; stel: jal sf_sf_sf
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_sf_sf
+; stel:	.end	__call_stub_fp_sf_sf_sf
 
 declare float @sf_sf_df(float, double) #1
 ; stel: .section	.mips16.call.fp.sf_sf_df,"ax", at progbits
-; stel:	.ent	__call_stub_sf_sf_df
+; stel:	.ent	__call_stub_fp_sf_sf_df
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $6,$f14
 ; stel: mtc1 $7,$f15
@@ -866,11 +868,11 @@ declare float @sf_sf_df(float, double) #
 ; stel: jal sf_sf_df
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_sf_df
+; stel:	.end	__call_stub_fp_sf_sf_df
 
 declare float @sf_df_sf(double, float) #1
 ; stel: .section	.mips16.call.fp.sf_df_sf,"ax", at progbits
-; stel:	.ent	__call_stub_sf_df_sf
+; stel:	.ent	__call_stub_fp_sf_df_sf
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f13
 ; stel: mtc1 $6,$f14
@@ -878,11 +880,11 @@ declare float @sf_df_sf(double, float) #
 ; stel: jal sf_df_sf
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_df_sf
+; stel:	.end	__call_stub_fp_sf_df_sf
 
 declare float @sf_df_df(double, double) #1
 ; stel: .section	.mips16.call.fp.sf_df_df,"ax", at progbits
-; stel:	.ent	__call_stub_sf_df_df
+; stel:	.ent	__call_stub_fp_sf_df_df
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f13
 ; stel: mtc1 $6,$f14
@@ -891,32 +893,32 @@ declare float @sf_df_df(double, double)
 ; stel: jal sf_df_df
 ; stel:	mfc1 $2,$f0
 ; stel:	jr $18
-; stel:	.end	__call_stub_sf_df_df
+; stel:	.end	__call_stub_fp_sf_df_df
 
 declare double @df_v() #1
 ; stel: .section	.mips16.call.fp.df_v,"ax", at progbits
-; stel:	.ent	__call_stub_df_v
+; stel:	.ent	__call_stub_fp_df_v
 ; stel: move $18, $31
 ; stel: jal df_v
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_v
+; stel:	.end	__call_stub_fp_df_v
 
 declare double @df_sf(float) #1
 ; stel: .section	.mips16.call.fp.df_sf,"ax", at progbits
-; stel:	.ent	__call_stub_df_sf
+; stel:	.ent	__call_stub_fp_df_sf
 ; stel: mtc1 $4,$f12
 ; stel: move $18, $31
 ; stel: jal df_sf
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_sf
+; stel:	.end	__call_stub_fp_df_sf
 
 declare double @df_df(double) #1
 ; stel: .section	.mips16.call.fp.df_df,"ax", at progbits
-; stel:	.ent	__call_stub_df_df
+; stel:	.ent	__call_stub_fp_df_df
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f13
 ; stel: move $18, $31
@@ -924,11 +926,11 @@ declare double @df_df(double) #1
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_df
+; stel:	.end	__call_stub_fp_df_df
 
 declare double @df_sf_sf(float, float) #1
 ; stel: .section	.mips16.call.fp.df_sf_sf,"ax", at progbits
-; stel:	.ent	__call_stub_df_sf_sf
+; stel:	.ent	__call_stub_fp_df_sf_sf
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f14
 ; stel: move $18, $31
@@ -936,11 +938,11 @@ declare double @df_sf_sf(float, float) #
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_sf_sf
+; stel:	.end	__call_stub_fp_df_sf_sf
 
 declare double @df_sf_df(float, double) #1
 ; stel: .section	.mips16.call.fp.df_sf_df,"ax", at progbits
-; stel:	.ent	__call_stub_df_sf_df
+; stel:	.ent	__call_stub_fp_df_sf_df
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $6,$f14
 ; stel: mtc1 $7,$f15
@@ -949,11 +951,11 @@ declare double @df_sf_df(float, double)
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_sf_df
+; stel:	.end	__call_stub_fp_df_sf_df
 
 declare double @df_df_sf(double, float) #1
 ; stel: .section	.mips16.call.fp.df_df_sf,"ax", at progbits
-; stel:	.ent	__call_stub_df_df_sf
+; stel:	.ent	__call_stub_fp_df_df_sf
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f13
 ; stel: mtc1 $6,$f14
@@ -962,11 +964,11 @@ declare double @df_df_sf(double, float)
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_df_sf
+; stel:	.end	__call_stub_fp_df_df_sf
 
 declare double @df_df_df(double, double) #1
 ; stel: .section	.mips16.call.fp.df_df_df,"ax", at progbits
-; stel:	.ent	__call_stub_df_df_df
+; stel:	.ent	__call_stub_fp_df_df_df
 ; stel: mtc1 $4,$f12
 ; stel: mtc1 $5,$f13
 ; stel: mtc1 $6,$f14
@@ -976,32 +978,32 @@ declare double @df_df_df(double, double)
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_df_df_df
+; stel:	.end	__call_stub_fp_df_df_df
 
 declare { float, float } @sc_v() #1
 ; stel: .section	.mips16.call.fp.sc_v,"ax", at progbits
-; stel:	.ent	__call_stub_sc_v
+; stel:	.ent	__call_stub_fp_sc_v
 ; stel: move $18, $31
 ; stel: jal sc_v
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f2
 ; stel:	jr $18
-; stel:	.end	__call_stub_sc_v
+; stel:	.end	__call_stub_fp_sc_v
 
 declare { float, float } @sc_sf(float) #1
 ; stel: .section	.mips16.call.fp.sc_sf,"ax", at progbits
-; stel:	.ent	__call_stub_sc_sf
+; stel:	.ent	__call_stub_fp_sc_sf
 ; stel: mtc1 $4,$f12
 ; stel: move $18, $31
 ; stel: jal sc_sf
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f2
 ; stel:	jr $18
-; stel:	.end	__call_stub_sc_sf
+; stel:	.end	__call_stub_fp_sc_sf
 
 declare { double, double } @dc_v() #1
 ; stel: .section	.mips16.call.fp.dc_v,"ax", at progbits
-; stel:	.ent	__call_stub_dc_v
+; stel:	.ent	__call_stub_fp_dc_v
 ; stel: move $18, $31
 ; stel: jal dc_v
 ; stel:	mfc1 $4,$f2
@@ -1009,11 +1011,11 @@ declare { double, double } @dc_v() #1
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_dc_v
+; stel:	.end	__call_stub_fp_dc_v
 
 declare { double, double } @dc_sf(float) #1
 ; stel: .section	.mips16.call.fp.dc_sf,"ax", at progbits
-; stel:	.ent	__call_stub_dc_sf
+; stel:	.ent	__call_stub_fp_dc_sf
 ; stel: mtc1 $4,$f12
 ; stel: move $18, $31
 ; stel: jal dc_sf
@@ -1022,7 +1024,7 @@ declare { double, double } @dc_sf(float)
 ; stel:	mfc1 $2,$f0
 ; stel:	mfc1 $3,$f1
 ; stel:	jr $18
-; stel:	.end	__call_stub_dc_sf
+; stel:	.end	__call_stub_fp_dc_sf
 
 attributes #0 = { 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 = { "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