[LLVMdev] Re: variable sized structs in LLVM

Misha Brukman brukman at cs.uiuc.edu
Tue Jun 21 11:31:08 PDT 2005


On Tue, Jun 21, 2005 at 02:11:22PM -0400, Ed Cogburn wrote:
> Reid Spencer wrote:
> > Its certainly possible to generate .ll files but its probably about
> > the same amount of work to use the LLVM API and there are
> > significant speed and validity benefits to doing so.
> 
> Does this mean that LLVM is moving away from the idea of a truly
> abstract IR language, to being a set of development libraries for use
> by build-time-dependent frontends?

LLVM is still an abstract IR.  LLVM does not specify struct sizes, the
alignment is a property of the target.  In LLVM, you can do
target-independent array and struct element accesses, which get code
generated to correct numeric offsets by the backends which know their
target.

If you are writing an LLVM pass and you absolutely NEED to know the
numeric size of a struct, you must use the TargetData object which is
target-specific.  If you want to get the numeric size of a struct
without using the LLVM API, it will require you to eesentially
reimplement TargetData yourself in your programming language of choice.

However, it does not change the fact that LLVM is and continues to be an
abstraction of target machines.

What do you mean by "build-time-dependent frontends"?  Frontends can be
completely separate from the LLVM infrastructure and do not even need to
be linked with any LLVM classes to create LLVM code from source
languages.

-- 
Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu




More information about the llvm-dev mailing list