[cfe-dev] Passing StructType arguments directly

Reid Kleckner reid.kleckner at gmail.com
Tue Sep 20 07:07:25 PDT 2011


On Sun, Sep 18, 2011 at 10:48 PM, David Meyer <pdox at google.com> wrote:
> One idea would be to have a bitcode -> bitcode pass which is
> responsible for lowering the higher-level representations (structs,
> unions, complex) down to simple types, in a target-specific way. This
> includes coercing parameters, expanding va_arg, and so on. This would
> move the target-specific lowering into LLVM and out of the front-ends.
> (This pass would be idempotent)

This idea of a ABI-neutral IR layer has come up before (can't find the
link), which probably means that it's worth considering.  I don't know
if it means it's a good idea or if it's just a bad idea that looks
good.  :)

In any case, the ability to generate target-neutral bitcode seems to
me like the most commonly requested enhancement.  I think the LLVM
project should either reject it outright as a non-goal or decide on
the future direction for how to achieve it.  OTOH this is an open
source project with many stakeholders with different priorities, so
it's hard to make that kind of decision.

...

If you do want to add the target-neutral IR layer, it's probably best
to completely avoid optimizing such bitcode, because it's likely to
create bugs in the optimizers that don't expect FCAs, unions,
bitfields, pointer-sized integers, etc to be there.

Reid



More information about the cfe-dev mailing list