Commit Graph

710 Commits

Author SHA1 Message Date
Jonas Maebe
d04e05ff82 + handling of floating point constants in llvm code (just load them in a
register, llvm will take care of putting them in memory if necessary)

git-svn-id: branches/hlcgllvm@26046 -
2013-11-11 11:15:54 +00:00
Jonas Maebe
9d4ea0337a + basic implementation of the LLVM high level code generator
git-svn-id: branches/hlcgllvm@26045 -
2013-11-11 11:15:51 +00:00
Jonas Maebe
b7803ab974 + llvm support for the register allocator. While llvm works with virtual
registers itself, it requires them to be in SSA form. Therefore we
    spill all registers that are written more than once to memory.
  + support in the generic register allocator for generating code that is
    SSA-safe
  + spilling helpers for llvm

git-svn-id: branches/hlcgllvm@26044 -
2013-11-11 11:15:47 +00:00
Jonas Maebe
d13b510144 + helpers to convert tdefs to strings describing the types in llvm syntax.
Other than arrays and complex procvardefs, all aggregates are currently
    handled as opaque arrays of bytes
   o special case: s80real (x87 extended type) is encoded as "array[0..9] of
     byte" inside arrays, because when using the llvm type describing
     "extended" llvm will handle it in an ABI-compliant way (allocating e.g.
     16 bytes for it on Darwin and x86-64 platforms). Loading/storing them
     always happens using instructions that only read/write 10 bytes, so
     we only have to take care to convert them to the actual extended type
     when indexing arrays/subscripting records (when records are no longer
     handled in an opaque way)

git-svn-id: branches/hlcgllvm@26041 -
2013-11-11 11:15:35 +00:00
Jonas Maebe
8ede313ba1 + llvm parameter manager: it reuses the native parameter manager to create
the paraloc information, and then adds llvm-specific information to the
    paralocs
   o only partially implemented, in particular function result handling is
     not yet there

git-svn-id: branches/hlcgllvm@26040 -
2013-11-11 11:15:31 +00:00
Jonas Maebe
d245228ba6 + tcgllvm.a_label() and tcgllvm.a_jmp_always(). Special for llvm: every
basic block must end with a terminator instruciton (such as a branch) ->
    when emitting a label, check whether the previous instruction is a
    terminator instruction and if not, add an unconditional branch to the
    label we are adding.
   o Implemented at the tcg instead of at the thlcgobj level because
    a) these methods don't need any high level type information
    b) implementing them in thlcgobj would require making thlcg.a_label()
       virtual and ensuring that no-one ever calls cg.a_label() in any
       generic code

git-svn-id: branches/hlcgllvm@26038 -
2013-11-11 11:15:20 +00:00
Jonas Maebe
7db9d4c7e9 + basic tcg unit for llvm: initialise register allocators and getint
fpuregister overloads that ignore subregisters (everything is
    handled via tdef at the thlcgobj level)

git-svn-id: branches/hlcgllvm@26037 -
2013-11-11 11:15:16 +00:00
Jonas Maebe
3296984bd9 + classes for llvm instructions (ait_llvmins), procedure definitions
(ait_llvmprocdef), global variable definitions (ait_llvmvarsym)
    and alias definitions (ait_llvmalias)

git-svn-id: branches/hlcgllvm@26036 -
2013-11-11 11:15:13 +00:00
Jonas Maebe
44b1996158 + base units for llvm:
o opcodes + string representation
   o llvm string representations of targets supported by fpc
   o supported fpc optimisations
   o list of supported LLVM versions (currently only targeting 3.3)

git-svn-id: branches/hlcgllvm@26035 -
2013-11-11 11:15:09 +00:00
Jonas Maebe
1df3039424 + LLVM temp allocator based on new R_TEMPREGISTER register class. For every
temp we allocate, we set the base register to a newly allocated
    R_TEMPREGISTER. This allows for uniquely identifying a temp even if its
    offset is modified.

git-svn-id: branches/hlcgllvm@26033 -
2013-11-11 11:14:59 +00:00