From 4159f05999914fc1d342131f64c1c37f00059288 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 13 Mar 2013 22:24:33 +0000 Subject: [PATCH] Have these attriubtes set to 'true' or 'false'. The back-end cannot differentiate between functions that are from a .ll file and those generated from the front-end. We cannot then take the non-precense of these attributes as a "false" value. Have the front-end explicitly set the value to 'true' or 'false' depending upon what is actually set. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176985 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGCall.cpp | 68 ++++++++++-------------------------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index fa5ce7fdca..9e97bce6c3 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1027,63 +1027,27 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, FuncAttrs.addAttribute(llvm::Attribute::NoBuiltin); } else { // Attributes that should go on the function, but not the call site. - if (!CodeGenOpts.CodeModel.empty()) - FuncAttrs.addAttribute("code-model", CodeGenOpts.CodeModel); - if (!CodeGenOpts.RelocationModel.empty()) - FuncAttrs.addAttribute("relocation-model", CodeGenOpts.RelocationModel); - - if (CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp") - FuncAttrs.addAttribute("float-abi", "soft"); - else if (CodeGenOpts.FloatABI == "hard") - FuncAttrs.addAttribute("float-abi", "hard"); - if (!CodeGenOpts.DisableFPElim) { - /* ignore */ ; + FuncAttrs.addAttribute("no-frame-pointer-elim", "false"); + FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf", "false"); } else if (CodeGenOpts.OmitLeafFramePointer) { - FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf"); + FuncAttrs.addAttribute("no-frame-pointer-elim", "false"); + FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf", "true"); } else { - FuncAttrs.addAttribute("no-frame-pointer-elim"); - FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf"); - } - - switch (CodeGenOpts.getFPContractMode()) { - case CodeGenOptions::FPC_Off: - FuncAttrs.addAttribute("fp-contract-model", "strict"); - break; - case CodeGenOptions::FPC_On: - FuncAttrs.addAttribute("fp-contract-model", "standard"); - break; - case CodeGenOptions::FPC_Fast: - FuncAttrs.addAttribute("fp-contract-model", "fast"); - break; + FuncAttrs.addAttribute("no-frame-pointer-elim", "true"); + FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf", "true"); } - if (CodeGenOpts.LessPreciseFPMAD) - FuncAttrs.addAttribute("less-precise-fpmad"); - if (CodeGenOpts.NoInfsFPMath) - FuncAttrs.addAttribute("no-infs-fp-math"); - if (CodeGenOpts.NoNaNsFPMath) - FuncAttrs.addAttribute("no-nans-fp-math"); - if (CodeGenOpts.NoZeroInitializedInBSS) - FuncAttrs.addAttribute("no-zero-init-in-bss"); - if (CodeGenOpts.UnsafeFPMath) - FuncAttrs.addAttribute("unsafe-fp-math"); - if (CodeGenOpts.SoftFloat) - FuncAttrs.addAttribute("use-soft-float"); - if (CodeGenOpts.StackAlignment) - FuncAttrs.addAttribute("stack-align-override", - llvm::utostr(CodeGenOpts.StackAlignment)); - if (CodeGenOpts.StackRealignment) - FuncAttrs.addAttribute("realign-stack"); - if (CodeGenOpts.DisableTailCalls) - FuncAttrs.addAttribute("disable-tail-calls"); - if (!CodeGenOpts.TrapFuncName.empty()) - FuncAttrs.addAttribute("trap-func-name", CodeGenOpts.TrapFuncName); - if (LangOpts.PIELevel != 0) - FuncAttrs.addAttribute("pie"); - if (CodeGenOpts.SSPBufferSize) - FuncAttrs.addAttribute("ssp-buffers-size", - llvm::utostr(CodeGenOpts.SSPBufferSize)); + FuncAttrs.addAttribute("less-precise-fpmad", + CodeGenOpts.LessPreciseFPMAD ? "true" : "false"); + FuncAttrs.addAttribute("no-infs-fp-math", + CodeGenOpts.NoInfsFPMath ? "true" : "false"); + FuncAttrs.addAttribute("no-nans-fp-math", + CodeGenOpts.NoNaNsFPMath ? "true" : "false"); + FuncAttrs.addAttribute("unsafe-fp-math", + CodeGenOpts.UnsafeFPMath ? "true" : "false"); + FuncAttrs.addAttribute("use-soft-float", + CodeGenOpts.SoftFloat ? "true" : "false"); } QualType RetTy = FI.getReturnType(); -- 2.40.0