Commit Graph

465 Commits

Author SHA1 Message Date
Jonas Maebe
71deda6f50 + added interface to ncgutil.gen_load_loc_cgpara() to hlcgobj + generic
implementation (without loc_©mmregister support)
  * moved ncgutil.gen_load_return_value() to hlcgobj, and factored out
    architecture-specific behaviour to load an uninitialised function result
    into a virtual method (+ JVM-specific implementation of that method),
    gen_load_uninitialized_function_result()
  + added hlcgx86 unit and thlcgx86 type to override the
    thlcgobj.gen_load_uninitialized_function_result() method for x87
    function results; the i386 and x86_64 units now instantiate thlcgx86
    instead of thlcg2ll
  * moved calling of ncgutil.gen_load_loc_cgpara() from ncgcal also to hlcgobj
  -> returning function results works for JVM

git-svn-id: branches/jvmbackend@18317 -
2011-08-20 07:38:16 +00:00
Jonas Maebe
00cb8f5725 * made maxregs related information protected instead of private in trgobj,
as well as insert_regalloc_info_all()
  + "register" allocator for the jvm target, which simply replaces every
    virtual register with a temp. This is done for all register types in
    one pass, so that the temps can be easily reused without worrying
    about conflicts. Small optimisation: alloc/store/dealloc/load
    sequences for a single reg are removed (many of these are generated
    because most cg nodes return their value in a register which is then
    immediately consumed by the parent)
  * map addressregisters to integer registers with size R_SUBD, because
    they require one stackslot (the subregister type is used by rgcpu
    to determine the size of the temp it has to allocate)

git-svn-id: branches/jvmbackend@18316 -
2011-08-20 07:38:11 +00:00
Jonas Maebe
8439e1472e * moved def2regtyp() from jvm/hlcgcpu to defutil, and extended it to
handle vectorfpu (floatdef->MMREG) and softfloat (floatdef->INTREG)
  + thlcg.getregisterfordef(), which uses def2regtyp() to allocate a register
    appropriate to hold values of that tdef type
  + generic thlcg.location_force_reg() implementation. Note that for
    low-level code generator targets it may be slightly less efficient than
    the implementation in hlcg2ll (from ncgutil) because it does not play
    any tricks with the register or location size, or with reference offsets,
    to truncate values

git-svn-id: branches/jvmbackend@18315 -
2011-08-20 07:38:06 +00:00
Jonas Maebe
1e2c70796e + jvm (cpu architecure) and java ("OS"/target) identifiers
+ basic target information for jvm target (assembling/linking
    helpers are still dummies for now)
  + basic jasmin assembler writer
  + cpunode and cputarg units to include the target units in the
    compiler

git-svn-id: branches/jvmbackend@18309 -
2011-08-20 07:37:33 +00:00
Jonas Maebe
742f4ee12e + first (partial) implementation of thlcg for the jvm
+ added arrayreftype field to treference for the jvm, because
    array loads have to be performed using special instructions,
    so this information has to be passed on to the code generator.
    This information will have to be added in t(cg)vecnode.
  * moved concatenating the generated code for a procedure to the
    al_procedures list to thlcg.record_generated_code_for_procdef(),
    which is overridden by jvm/hlcgcpu to attach that code to the
    procdef it belongs with. The reason is that a Java class file
    can only contain code for one class, so we have to write out
    the assembler grouped per class instead of in the order the
    routines appear in the source code
  * also committed forgotten changes in psub after moving the
    register allocator initialisation to hlcgobj

git-svn-id: branches/jvmbackend@18308 -
2011-08-20 07:37:26 +00:00
Jonas Maebe
4446be97b7 + tjvmprocinfo, only overrides set_first_temp_offset() and sets it to
procdef.calleeargareasize (since all arguments are placed on the
    locals stack on the calleeside)

git-svn-id: branches/jvmbackend@18307 -
2011-08-20 07:37:20 +00:00
Jonas Maebe
72fc911dcf + jvm parameter manager: on the caller side, all arguments are pushed
on the evaluation stack, while on the callee side they are placed
    in local variables 1..n
   o the jvm only supports call-by-value. call-by-reference parameters
     will have to be emulated at a higher level
   o similarly, ret_in_param() always returns false
   o all function results are returned on the evaluation stack (both
     on the caller and callee side)

git-svn-id: branches/jvmbackend@18306 -
2011-08-20 07:37:12 +00:00
Jonas Maebe
05b919b821 + very basic tcgjvm (basically only implements the register allocator
initialisation in addition to what tcg already supports)

git-svn-id: branches/jvmbackend@18305 -
2011-08-20 07:37:04 +00:00
Jonas Maebe
0b7687f4f5 * fixed compilation
git-svn-id: branches/jvmbackend@18298 -
2011-08-20 07:36:22 +00:00
Jonas Maebe
c84ec623dd * made setfirsttemp() virtual and override it in jvm/tgcpu so it no
longer aligns the temp offset in case it's odd (not required for
    jvm)
  * ignore the "def" argument in alloctemp() for the jvm since all stack
    slots can be reused for anything there, and reformatted its alloctemp()

git-svn-id: branches/jvmbackend@18297 -
2011-08-20 07:36:14 +00:00
Jonas Maebe
0c5b48372b + basic implementation: support for loading jvm-specific operands
(single, double, string, widestring), basic constructors,
    spilling_get_operation_type() implementation
  o special: O_MOV_SOURCE/O_MOV_DEST don't make sense for this target,
    since it's stack based

git-svn-id: branches/jvmbackend@18294 -
2011-08-20 07:35:53 +00:00
Jonas Maebe
d0a22d16b5 + cpubase for jvm: opcodes, basic register definitions, ...
o special things:
    * no tasmcond (conditions are currently encoded in opcode names,
      may be changed later)
    * no actual registers, just a couple of fake ones to indicate
      the locals stack and the operands/evaluation stack
    * no registers for the return value; they're returned on the
      evaluation stack; may be handled like the x87 in the future

git-svn-id: branches/jvmbackend@18291 -
2011-08-20 07:35:32 +00:00
Jonas Maebe
85e866a121 + (mostly fake) register definitions for the JVM
git-svn-id: branches/jvmbackend@18289 -
2011-08-20 07:35:17 +00:00
Jonas Maebe
fdeebb482b * basic jvm "cpu" info file (no special cpu or fpu types, no
cpu-specific optimisations)

git-svn-id: branches/jvmbackend@18285 -
2011-08-20 07:21:41 +00:00
Jonas Maebe
1e96eab55d * made ttgobj.alloctemp/freetemp protected, and alloctemp also virtual
* made ttgobj.create virtual, added a "tgobjclass: class of ttgobj = ttgobj"
    variable and use that one to instantiate new temp allocators
  * created ttgjvm descendant that only allows allocations of 4 or 8 bytes
    (rounding allocations < 4 bytes up to 4 bytes), and that divides the
    offsets/sizes by 4 so we get stack slot numbers

git-svn-id: branches/jvmbackend@18282 -
2011-08-20 07:21:26 +00:00