[LLVMdev] Inline Assembly (unique arch string for llvm)

Chris Lattner sabre at nondot.org
Thu Sep 16 22:38:42 PDT 2004


On Fri, 17 Sep 2004, Chris Lattner wrote:

> > Why don't we have platform independence as an optional bytecode feature
> > for well behaved programs?  A couple intrinsics to do htonl and friends
> > would let a peice of bytecode be endian agnostic.
>
> LLVM bytecode files produced from portable languages (e.g. Java,
> verifiable MSIL, or many others) should be portable, assuming the
> front-end isn't doing something silly.  The problem with C is C, not LLVM.

Actually, I should clarify something there.  You're right that *many* C
programs might be portable.  For example, this is a portable C program:

int main() { return 42; }

The problem is that you want to be able to guarantee that a program, if
accepted by the compiler, is portable.  This is not something we have
today.

Another problem is that most C programs use more of the standard library
than this program.  The problem with the C standard library is that the
headers often include a ton of implementation details as inline functions
or macros.  This is why you need to control the headers as well as the
language dialect being compiled.

I'm afraid that I'm sounding too negative about this idea, but I don't
mean to.  If this was implemented, it would be a huge boon to the free
software and open source communities: suddenly programs could be
distributed in binary form instead of source form, easing distribution.
Getting to this point though will take a lot of work.  :)

-Chris

-- 
http://llvm.org/
http://nondot.org/sabre/




More information about the llvm-dev mailing list