diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:41:05 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:41:05 +0000 | 
| commit | 01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch) | |
| tree | 4def12e759965de927d963ac65840d663ef9d1ea /lib/Target/Mips/Mips16HardFloat.cpp | |
| parent | f0f4822ed4b66e3579e92a89f368f8fb860e218e (diff) | |
Diffstat (limited to 'lib/Target/Mips/Mips16HardFloat.cpp')
| -rw-r--r-- | lib/Target/Mips/Mips16HardFloat.cpp | 28 | 
1 files changed, 10 insertions, 18 deletions
| diff --git a/lib/Target/Mips/Mips16HardFloat.cpp b/lib/Target/Mips/Mips16HardFloat.cpp index b2bc7e74c706d..d2d1c65e40d94 100644 --- a/lib/Target/Mips/Mips16HardFloat.cpp +++ b/lib/Target/Mips/Mips16HardFloat.cpp @@ -261,7 +261,7 @@ static std::string swapFPIntParams(FPParamVariant PV, Module *M, bool LE,  static void assureFPCallStub(Function &F, Module *M,                               const MipsTargetMachine &TM) {    // for now we only need them for static relocation -  if (TM.getRelocationModel() == Reloc::PIC_) +  if (TM.isPositionIndependent())      return;    LLVMContext &Context = M->getContext();    bool LE = TM.isLittleEndian(); @@ -387,11 +387,9 @@ static bool fixupFPReturnAndCall(Function &F, Module *M,    bool Modified = false;    LLVMContext &C = M->getContext();    Type *MyVoid = Type::getVoidTy(C); -  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) -    for (BasicBlock::iterator I = BB->begin(), E = BB->end(); -         I != E; ++I) { -      Instruction &Inst = *I; -      if (const ReturnInst *RI = dyn_cast<ReturnInst>(I)) { +  for (auto &BB: F) +    for (auto &I: BB) { +      if (const ReturnInst *RI = dyn_cast<ReturnInst>(&I)) {          Value *RVal = RI->getReturnValue();          if (!RVal) continue;          // @@ -425,17 +423,11 @@ static bool fixupFPReturnAndCall(Function &F, Module *M,          A = A.addAttribute(C, AttributeSet::FunctionIndex,                             Attribute::NoInline);          Value *F = (M->getOrInsertFunction(Name, A, MyVoid, T, nullptr)); -        CallInst::Create(F, Params, "", &Inst ); -      } else if (const CallInst *CI = dyn_cast<CallInst>(I)) { -        const Value* V = CI->getCalledValue(); -        Type* T = nullptr; -        if (V) T = V->getType(); -        PointerType *PFT = nullptr; -        if (T) PFT = dyn_cast<PointerType>(T); -        FunctionType *FT = nullptr; -        if (PFT) FT = dyn_cast<FunctionType>(PFT->getElementType()); +        CallInst::Create(F, Params, "", &I); +      } else if (const CallInst *CI = dyn_cast<CallInst>(&I)) { +        FunctionType *FT = CI->getFunctionType();          Function *F_ =  CI->getCalledFunction(); -        if (FT && needsFPReturnHelper(*FT) && +        if (needsFPReturnHelper(*FT) &&              !(F_ && isIntrinsicInline(F_))) {            Modified=true;            F.addFnAttr("saveS2"); @@ -447,7 +439,7 @@ static bool fixupFPReturnAndCall(Function &F, Module *M,              Modified=true;              F.addFnAttr("saveS2");            } -          if (TM.getRelocationModel() != Reloc::PIC_ ) { +          if (!TM.isPositionIndependent()) {              if (needsFPHelperFromSig(*F_)) {                assureFPCallStub(*F_, M, TM);                Modified=true; @@ -461,7 +453,7 @@ static bool fixupFPReturnAndCall(Function &F, Module *M,  static void createFPFnStub(Function *F, Module *M, FPParamVariant PV,                             const MipsTargetMachine &TM) { -  bool PicMode = TM.getRelocationModel() == Reloc::PIC_; +  bool PicMode = TM.isPositionIndependent();    bool LE = TM.isLittleEndian();    LLVMContext &Context = M->getContext();    std::string Name = F->getName(); | 
