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

llvm-svn: 187555
This commit is contained in:
Reed Kotler 2013-08-01 02:26:31 +00:00
parent a8d49794e4
commit 302ae6b002
2 changed files with 57 additions and 50 deletions

View File

@ -247,7 +247,7 @@ static void assureFPCallStub(Function &F, Module *M,
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, Module *M,
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, Module *M, FPParamVariant PV,
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);

View File

@ -752,60 +752,62 @@ land.end289: ; preds = %land.rhs286, %land.
declare void @v_sf(float) #1
; stel: .section .mips16.call.fp.v_sf,"ax",@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",@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",@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",@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",@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",@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",@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",@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",@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",@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",@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) #1
; 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",@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) #1
; 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",@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) #1
; 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",@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",@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",@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",@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) #1
; 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",@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) #1
; 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",@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) #1
; 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",@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) #1
; 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",@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",@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",@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",@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) #1
; 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" }