[LLVMdev] design questions

Adam Megacz megacz at cs.berkeley.edu
Wed May 4 23:27:16 PDT 2005


Hey, I'm curious about two of the design questions in LLVM after
reading the language reference.  If there's preexisting material
explaining this, just point me at it (looked and couldn't find any).

  - Why unsigned types rather than signed-only like Java/JVM?  If I
    understand correctly, their behavior is only distinguishable in
    overflow situations, and the availability of hardware-assisted
    overflow detection varies quite a bit across platforms.

    In other words, abandoning overflow detection makes the
    duplication of types redundant, while requiring it would be a
    great burden on CPUs that don't have overflow exception hardware.

  - Why identify functions by their type signatures?  I have to assume
    that this is meant to allow overloading, but overloading is
    generally a higher-level concept (at the "language-aware" level).

    Chances are quite good that the sets of arguments to two different
    overloads of a function would wind up mapping down to the same
    LLVM-level types (since type information is partially lost in the
    transition).  For example, the types for polar coordinates and
    cartesian coordinates are both {float,float}.  So most languages
    will need to mangle symbols anyways.

    Actually, having an equal-by-name (in addition to the
    equal-by-structure array/struct type operators) type in LLVM would
    let compilers encode the distinction.  But it might complicate
    linking conventions.

Thanks!  Overall I was hugely impressed.  I'd had my attention focused
on architecture-independant code generation libraries for a while, but
being able to specify an IR outside of the language used to manipulate
it opens up way more possibilities.  Neat stuff.

  - a





More information about the llvm-dev mailing list