[LLVMdev] Parametric polymorphism
DeLesley Hutchins
delesley.spambox at googlemail.com
Wed Feb 18 12:57:02 PST 2009
> It's done by the front-end. There are a variety of attributes and
> mechanisms which are used to convolute data and marshall it through
> call sites in an ABI-conformant manner.
Oh dear. :-( Do the attributes change depending on the type?
I would assume that attributes like "ccc" are type-invariant; i.e.
every instantiation should use the C-calling convention, whatever
that happens to be for the types in question.
>> I want llvm to do the specialization, because specialization is
>> inextricably tied to similar optimizations, like inlining and
>> partial evaluation. Doing it within llvm has many advantages, such
>> as JIT support and link-time optimization.
>
> These are IR-level optimizations, which LLVM does not magically do of
> its own accord. If LLVM transparently performs specialization, then no
> post-specialization IR optimizations can be performed.
Since these are IR-level optimizations, the logical place to put type
variables is in the IR. If type variables only exist in the high-level
language, then it's impossible for the llvm linker, JIT, or optimizers,
or code generators to do anything intelligent with them. :-)
I don't expect magic. If type specialization is implemented as an IR
pass, then why couldn't post-specialization IR optimizations be
performed?
-DeLesley
More information about the llvm-dev
mailing list