[cfe-dev] LangOptions & CodeGenOptions over-ride

Robert Lytton robert at xmos.com
Tue Jul 30 10:34:53 PDT 2013


Hi Ben,

I've added xcore to return appropriate boolean to: 
    isSignedCharDefault()
    shouldUseFramePointer()
    shouldUseLeafFramePointer()

also added a call in Clang::ConstructJob() to:
    void Clang::AddXCoreTargetArgs(const ArgList &Args,
                                     ArgStringList &CmdArgs) const {
      CmdArgs.push_back("-fno-common");
    }


This is almost what I want - I'll follow up problem with bitfield chars in another email thread!

robert

________________________________________
From: Benjamin Kramer [benny.kra at gmail.com]
Sent: 29 July 2013 18:38
To: Robert Lytton
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] LangOptions & CodeGenOptions over-ride

On 29.07.2013, at 19:14, Robert Lytton <robert at xmos.com> wrote:

> Hi,
>
> I am working on a clang frontend for the XCore processor.
>
>
> The XCore ABI requires that 'char' is unsigned.
> I notice the C99 standard does not require it to be signed - contrary to the comment:
>       /// isSignedIntegerType - Return true if this is an integer type that is
>       /// signed, according to C99 6.2.5p4 [char, signed char, short, int, long..],
>       /// or an enum decl which has a signed representation.
>
> Thus I would like to over-ride the default setting in LangOptions.def:
>         LANGOPT(CharIsSigned      , 1, 1, "signed char")
>
> I had considered using setForcedLangOptions() - but assume this is the wrong way to use it!
>       virtual void XCoreTargetInfo::setForcedLangOptions(LangOptions &Opts) {
>         ...
>        Opts.CharIsSigned = false;
>       }
>
>
>
> I would also like to make -fomit-frame-pointer" the default behaviour for the target:
>     CODEGENOPT(DisableFPElim     , 1, 0) ///< Set when -fomit-frame-pointer is enabled.
> And the same for -fno-common
>     CODEGENOPT(NoCommon          , 1, 0) ///< Set when -fno-common or C++ is enabled.
>
>
>
> What is the correct place (TargetInfo constructor?) and mechanism to specify alternative default options?
> Is there a target-option.def over-rides mechanism?

We have a couple of ad-hoc hooks in Tools.cpp for this, e.g. shouldUseFramePointer and isSignedCharDefault. It's not a particularly nice solution but adding support for xcore would be easy.

- Ben

>
> Thank you
>
> robert
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list