Commit Graph

34617 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
e4d322bcdb + default implementation for for the *_checkoverflow() methods in case
setflags is false
  * don't call the *_checkoverflow() methods from ncgadd with setflags
    = true in case cs_check_overflow is disabled

git-svn-id: branches/jvmbackend@18314 -
2011-08-20 07:38:01 +00:00
Jonas Maebe
4ff56b2471 + jvm compiler target
git-svn-id: branches/jvmbackend@18313 -
2011-08-20 07:37:52 +00:00
Jonas Maebe
20c577103f + list of keywords that are reserved in Java and the JVM, for future
checking by the parser

git-svn-id: branches/jvmbackend@18312 -
2011-08-20 07:37:47 +00:00
Jonas Maebe
94ed2ac649 + jvm/java target support
git-svn-id: branches/jvmbackend@18311 -
2011-08-20 07:37:42 +00:00
Jonas Maebe
9eca0dc1c2 - disabled RTTI generation for the jvm target (Delphi-style RTTI
is not (yet) supported there, use Java-style RTTI instead)

git-svn-id: branches/jvmbackend@18310 -
2011-08-20 07:37:38 +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
fe99c93619 + pbestrealtype for JVM
git-svn-id: branches/jvmbackend@18304 -
2011-08-20 07:36:59 +00:00
Jonas Maebe
9fc3616179 * put the code to generate the default mangled name for procdefs into
a separate method (defaultmangledname)
  * for the jvm target, call jvmmangledname() instead of defaultmangledname()
    from mangledname()
  * make non-strict private and protected methods "public" in the Java bytecode,
    because a single Java class file contains only code from one class, and such
    methods can be accessed from other classes in the same unit too
  * minor fixes to the jvm mangled name generation

git-svn-id: branches/jvmbackend@18303 -
2011-08-20 07:36:54 +00:00
Jonas Maebe
35ca5b799b * list -> current_asmdata.CurrAsmList for cpuhighleveltarget code
git-svn-id: branches/jvmbackend@18302 -
2011-08-20 07:36:48 +00:00
Jonas Maebe
07130a0c71 + added register allocation methods from cgobj also to hlcgobj,
call through to cgobj

git-svn-id: branches/jvmbackend@18301 -
2011-08-20 07:36:42 +00:00
Jonas Maebe
09ac60b084 + a_call_name_inherited(), by default calls a_call_name() (for the JVM
target you have to use a different opcode for calling inherited methods
    than for regular methods)

git-svn-id: branches/jvmbackend@18300 -
2011-08-20 07:36:35 +00:00
Jonas Maebe
9022370bde + basic defines for jvm target (CPUJVM, ...)
* disable most features for jvm target (compiler-only port)

git-svn-id: branches/jvmbackend@18299 -
2011-08-20 07:36:29 +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
dc8df7fe79 * define cpu32bit for the JVM target (used by psystem to initialise
default integer types)
  * define CPUDEFINED in pp.pas if JVM is defined
  * initialise the fpu types and currency in psystem for the JVM target

  * set uinttype/sinttype to 32 bit types also for all cpu32bitaddr cpus
    by default (required for JVM, which has a 64 bit alu but 32 bit
    "addresses" -- an address takes up 1 stack slot, a 64 bit int two;
    also, array indices are limited to 32 bit)

git-svn-id: branches/jvmbackend@18296 -
2011-08-20 07:36:08 +00:00
Jonas Maebe
a19220f106 * cpu64bitaddr -> cpu64bitalu in location.free (whether or not
64 bit registers are represented as a pair of 32 bit registers
    in a register64 struct depends on whether or not the ALU can
    perform 64 bit operations -- if it can, assume there are 64
    bit registers)

git-svn-id: branches/jvmbackend@18295 -
2011-08-20 07:35:59 +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
19275d1a4c + single, double, string and widestring operand support for jvm
git-svn-id: branches/jvmbackend@18293 -
2011-08-20 07:35:45 +00:00
Jonas Maebe
c373748e26 + some Jasmin directives (class, interface, super, field, limit)
git-svn-id: branches/jvmbackend@18292 -
2011-08-20 07:35:39 +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
a2890f4463 + basic implementation of concatcopy based on a_load(fpu)_ref_ref
git-svn-id: branches/jvmbackend@18290 -
2011-08-20 07:35:25 +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
0ee702b3a2 * tprocdef.mangledname now gets an extra boolean parameter indicating
whether the mangled name is for defining a symbol, or for referencing
    it later (e.g. for a call or load of its address). The reason is that
    on the JVM both cases are different.
  + jvmdef unit to encode types according to the JVM rules
  + tprocdef.jvmmangledname() to encode a procdef's JVM mangled name
    (the common part of defining/referencing it; tprocdef.mangledname
     afterwards adorns it as required)

git-svn-id: branches/jvmbackend@18288 -
2011-08-20 07:22:00 +00:00
Jonas Maebe
0e16369906 * moved gen_proc_symbol() and gen_proc_symbol_end() from ncgutil to hlcgobj
git-svn-id: branches/jvmbackend@18287 -
2011-08-20 07:21:52 +00:00
Jonas Maebe
f67919e9f5 + odt_javaclass, odt_interfacejava objectdef types
+ it_interfacejava type (not explicitly selectable via -SI nor
    {$interfaces xxx}, but default for jvm target)
  * disable it_interfacecom/corba for jvm target
  + init_settings for jvm that select it_interfacejava as default interface
    type
  + default_class_type constant (in symconst) that is odt_javaclass for the jvm
    target and odt_class for other targets (used to determine the meaning of
    "type x = class" declarations)

git-svn-id: branches/jvmbackend@18286 -
2011-08-20 07:21:46 +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
d18cda2939 + support for tt_regallocator/tt_freeregallocator temps; these will be used
by the JVM register allocator to store register values in, instead of
    tt_noreuse (because almost all registers have to be mapped to temps,
    no reusing these temps will blow up the stack frame a lot)
  * documented the meaning of the tt_* values
  * temp growing direction for jvm is also positive

git-svn-id: branches/jvmbackend@18284 -
2011-08-20 07:21:36 +00:00
Jonas Maebe
e3e4d365c8 * converted the parts of tcgloadnode.pass_generate_code() and
tcgassignmentnode.pass_generate_code() for simple symbols and
    for simple assignments from tcgobj to thlcgobj

git-svn-id: branches/jvmbackend@18283 -
2011-08-20 07:21:31 +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
Jonas Maebe
2cb4514c07 * converted all non-x86-specific and non-32bit-specific code to use hlcgobj
git-svn-id: branches/jvmbackend@18281 -
2011-08-20 07:21:21 +00:00
Jonas Maebe
72e9cfee24 * create/destroy also the high level code generator for all architectures,
so it can be used in generic code

git-svn-id: branches/jvmbackend@18280 -
2011-08-20 07:21:16 +00:00
Jonas Maebe
db203431b2 + hlcgobj: high level code generator class. It has basically the same
interface as cgobj, except that all type parameters are defs instead
    of tcgsize. Also includes some procedures from ncgutil (over time,
    all of ncgutil will probably integrated here so it can be easily
    overridden)
  + hlcg2ll: pass-through implementation of thlcg that forwards everything
    either to cgobj or ncgutil, for use by the classic code generator
    clients (all current platforms)
  + added "def" field to tcgpara to record the tdef of the parameter
    (used by the high level code generator)

git-svn-id: branches/jvmbackend@18279 -
2011-08-20 07:21:09 +00:00
Jonas Maebe
d885bb66a0 + branch for jvm code generator backend
git-svn-id: branches/jvmbackend@18276 -
2011-08-19 21:21:36 +00:00
Jonas Maebe
baf2a3f1fb * fixed copy/paste error that didn't disable default inline support when
switching from a mode that has it to a mode that doesn't have it (which
    meant that all modes had it, since the default FPC mode has it)
  * added default inline support to mode macpas to minimize breaking existing
    code due to this switch (only TP and ISO modes now don't have it by
    default)

git-svn-id: trunk@18265 -
2011-08-18 18:12:09 +00:00
Jonas Maebe
cbb3e5700d * now also includes univint directory for Darwin if necessary, not sure
why it wasn't in the version committed int r18251

git-svn-id: trunk@18264 -
2011-08-18 18:09:33 +00:00
Jonas Maebe
8c7f1e1013 * only transform multiplication nodes to sqr, not any kind of addnode
(fix for 18252)

git-svn-id: trunk@18263 -
2011-08-18 12:47:41 +00:00
Jonas Maebe
3abfec476a * fixed range checke errors after aint->tcgint change
git-svn-id: trunk@18262 -
2011-08-18 11:53:34 +00:00
Jonas Maebe
3b9e1a4398 * fixed wrong class cast in r18226
git-svn-id: trunk@18261 -
2011-08-18 11:53:02 +00:00
sekelsenmat
658be2b0b7 fpvectorial: Adds multiline support for text, adds a new translate function to entities
git-svn-id: trunk@18260 -
2011-08-18 11:41:22 +00:00
marco
4c64519f31 * fix for yet another -j 2 issue. This time fcl-passrc dependency on fcl-base
git-svn-id: trunk@18259 -
2011-08-18 10:18:29 +00:00
sekelsenmat
cc8854b0bc fpvectorial: Removes unused Z coordinates and makes the entity classes smarter, adds support for searching for elements
git-svn-id: trunk@18258 -
2011-08-18 09:13:47 +00:00
Jonas Maebe
b5fc32750b * check whether both left and right are reals rather than twice whether left
is real before transforming a multiply into an sqr operation (fixes make
    cycle after r18252, don't know where or even how it caused a wrong
    optimization)

git-svn-id: trunk@18257 -
2011-08-18 09:12:13 +00:00
florian
41f25c2b21 * fixes cmem.malloc et al. for windows as proposed by Ludo Brands, resolves #15571
git-svn-id: trunk@18256 -
2011-08-18 08:47:44 +00:00