[LLVMdev] [RFC] Embedding command line options in bitcode (PR21471)

Eric Christopher echristo at gmail.com
Fri Nov 14 15:07:33 PST 2014


>
>
> > Yes. These are some of the important questions. I think you're missing a
> few things to take into consideration:
> >
> > a) How does this change the pass manager? Some of the command line
> options (many) change which passes are run when.
>
> Unfortunately the pass manager isn't a safe place to hack right now.
>
>
*shrug* Just hack it if necessary.


> > It should be as simple as checking the function attribute for each pass
> to decide when to run,
>
> Right, these are easy.
>

Yep.


>
> > but if one invokes a chain then you might have other issues
>
> Just for clarity, if an option changes the passes from:
>
>     -instcombine
>
> to:
>
>     -instcombine -some-pass1 -some-pass2 -instcombine
>
> then ideally, we'd attach an attribute to the functions affected by
> that option, and `-some-pass1 -some-pass2 -instcombine` would be
> skipped for functions without that attribute.
>
> IIUC, you're saying that skipping the second -instcombine is hard,
> which I agree with.
>
> Agreed.  I'm comfortable leaving that to be solved later, once the
> new pass manager is in place.  Thoughts?
>

Agreed, I don't know of many of these anyhow outside of the atomic lowering.


>
> > or if the command line option invokes module/cgscc passes (see c below).
> >
> > b) Right now I'm using a combination of stringified target-cpu and
> target-features with each target's cpu specific attributes (i.e. something
> like mips16) being a separate option that gets plugged into the subtarget -
> if it controls the creation of a subtarget. I don't know that any do (at
> least a quick glance didn't seem to say), but if a command line option
> controls any of the initialization in the subtarget dependent features
> it'll need to be part of the key to look up the subtarget. If it doesn't
> then you'll just need to check the attribute, as you said, in the
> pass/lowering/thingy.
> >
> > c) Which command line options need to be part of this interface? I don't
> necessarily think all of them should which could turn some of these into
> subtarget features that can just be added on to the functions as they go.
>
> Can you give an example of these?
>

-mips16 is the trivial example that already exists. -mabi= would probably
be another when you can change it per function.
(__attribute__((pcs("aapcs")))). Probably more, just those are the ones
that come to mind.


>
> > If anything can't change between translation units then a module level
> flag that errors on merge would be applicable. I'd prefer not to use module
> level flags for things that can just be put on every function. The module
> level flags could be read into a subtarget specific global target options
> flag (ala soft-float).
>
> Agreed.
>
> > d) linkonce_odr functions with different attributes
>
> Doesn't this just get handled by lib/Linker?  I figure we keep the
> attributes of the version of the function that "wins".
>
>
Right. Which one wins? You'll get inconsistent results depending on
ordering. Of course, you'd get that without linking them, but we should do
some sort of checking ideally.

Not necessarily objecting to Akira's plan at the moment in case that was a
concern.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141114/9d5787e4/attachment.html>


More information about the llvm-dev mailing list