r176985 - Have these attriubtes set to 'true' or 'false'.

David Blaikie dblaikie at gmail.com
Wed Mar 13 15:31:49 PDT 2013


On Wed, Mar 13, 2013 at 3:24 PM, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Wed Mar 13 17:24:33 2013
> New Revision: 176985
>
> URL: http://llvm.org/viewvc/llvm-project?rev=176985&view=rev
> Log:
> 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.

I'm not sure I follow - are these tri-state values? (ie: the backend
has 3 distinct behaviors: when the value is not present, when the
value is present and 'true', and when the value is present and
'false') Otherwise I'd expect the frontend would only need to set the
values whenever they're the non-default value (either true or false,
whichever is appropriate for the particular parameter)

>
> Modified:
>     cfe/trunk/lib/CodeGen/CGCall.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=176985&r1=176984&r2=176985&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Mar 13 17:24:33 2013
> @@ -1027,63 +1027,27 @@ void CodeGenModule::ConstructAttributeLi
>        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();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list