Commit Graph

37 Commits

Author SHA1 Message Date
Jonas Maebe
7d9f98e516 + def_cgmmsize() that returns a vector tcgsize for arraydefs (as generated
for certain parameter locations in the x86-64 parameter manager)
  * full support for vector types in the high level code generator by
    translating arraydefs passed to a_*mm*() methods into vector tcgsizes

git-svn-id: trunk@24762 -
2013-06-02 10:24:08 +00:00
Jonas Maebe
978b5530ec * renamed getmmcgsize to getintmmcgsize + comment
git-svn-id: trunk@24744 -
2013-06-01 18:32:14 +00:00
Jonas Maebe
2dd75e707e * renamed thlcgobj.tcgsize2orddef to defutil.cgsize_orddef
git-svn-id: trunk@24743 -
2013-06-01 18:28:15 +00:00
Jonas Maebe
3456f20546 * changed checks for support of opmm* calls in hlcg2ll from mms_movescalar
to whether the argument is a float type (the check is there to determine
    whether def_cgsize() can give us a correct result, which it can for
    floating point types but not yet for arrays used as vectors)

git-svn-id: trunk@24685 -
2013-06-01 08:28:32 +00:00
Jonas Maebe
1551c773e0 - removed no longer necessary thlcg2ll.initialize_regvars override and
commented dummy location_force_mmregscalar (fully implemented in r24661)

git-svn-id: trunk@24663 -
2013-05-31 12:21:53 +00:00
Jonas Maebe
5051453806 + support for LOC_(C)MMREGISTER in hlcg
o migrated location_force_mmregister_scalar from ncgutil to hlcgobj

git-svn-id: trunk@24661 -
2013-05-31 12:05:14 +00:00
nickysn
cbf3b14e20 * yet another 8/16-bit ALU fix in thlcg2ll.location_force_reg
git-svn-id: branches/i8086@23887 -
2013-03-17 12:55:06 +00:00
nickysn
a03f0d84ea high level code generator: const types changed from aint to tcgint to avoid problems on < 32-bit cpus; ppcjvm should also be updated, but isn't yet
git-svn-id: branches/i8086@23761 -
2013-03-09 22:16:03 +00:00
nickysn
27e4048ed6 16-bit and 8-bit alu fix in thlcg2ll.location_force_reg
git-svn-id: branches/i8086@23719 -
2013-03-08 00:10:10 +00:00
florian
d93cee995b * fix register method pointer for ppc64 and x86_64-linux
git-svn-id: trunk@22351 -
2012-09-07 15:15:10 +00:00
florian
7361e19799 + support for handling OS_128/OS_S128 on 64 Bit CPUs as far as needed for method pointers in registers
git-svn-id: trunk@22344 -
2012-09-06 15:12:12 +00:00
florian
d6b548ce13 * don't force parameters into memory when loading them if both have the size OS_64/OS_S64
git-svn-id: trunk@22339 -
2012-09-06 15:11:50 +00:00
florian
d8161c185c + track usage of flags by using a new register RS_/NR_DEFAULTFLAGS
git-svn-id: trunk@22179 -
2012-08-22 19:37:51 +00:00
Jonas Maebe
7717e43929 * moved setting the call result to a separate method, so it can still be
used across multiple levels of inheritance such as on MIPS (and the code
    has to be reusable for a_call_ref/reeg in the future anyway)

git-svn-id: trunk@21906 -
2012-07-12 20:56:25 +00:00
Jonas Maebe
be8f8fec76 * converted tcg.g_releasevaluepara_openarray() to thlcg
git-svn-id: trunk@21879 -
2012-07-11 15:23:18 +00:00
Jonas Maebe
9197ce100e * converted tcg.g_copyvaluepara_openarray() to thlcg
git-svn-id: trunk@21878 -
2012-07-11 15:23:08 +00:00
Jonas Maebe
1955255dda * let thlcg.a_call_name() return the tcgpara representing the function
result location (NR_FUNCTION_RESULT_REG is not valid on all platforms)
   o this requires passing the forced function result type (if any) to this
     method
   o a generic, basic thlcg.a_call_name() is now available that sets the
     function result location; can be called by descendants
  * the availability under all circumstances of the correct function return
    type enables g_call_system_proc() on the JVM platform to now determine
    by itself how many stack slots are removed by the call -> do so, instead
    of manually counting them (or forgetting to do so and messing up the
    maximum evaluation stack height calculations)

git-svn-id: trunk@21862 -
2012-07-11 08:25:58 +00:00
Jonas Maebe
aba6923187 * moved g_test_self() from cgobj to hlcgobj
git-svn-id: trunk@21861 -
2012-07-11 08:25:51 +00:00
Jonas Maebe
7c21cba1e2 * migrated g_copyshortstring, g_incrrefcount and g_array_rtti_helper to thlcg
git-svn-id: trunk@21699 -
2012-06-24 21:36:28 +00:00
Jonas Maebe
7a0ae38700 + also specify the parameter def when allocating a parameter via
getintparaloc + adapted all call sites of getintparaloc. This
    led to a number of additional, related changes:
   o corrected the type information for some getintparaloc parameters
   o don't allocate some intparalocs in cases they aren't used
   o changed "const tvardata" parameter into "constref tvardata" for
     fpc_variant_copy_overwrite to make pass-by-reference semantics
     explicit
   o moved a number of routines that now have to call find_system_type()
     from cgobj to hlcgobj so that cgobj doesn't have to start depending
     on the symtable unit
   o added versions of the cpureg alloc/dealloc methods to hlcgobj that
     call through to their cgobj counter parts, so we can call save/restore
     the cpu registers before/after calling system helpers from hlcgobj
     (not implemented in hlcgobj itself, because all basic register
      allocator functionality is still part of cgobj/cgcpu)

git-svn-id: trunk@21696 -
2012-06-24 15:02:12 +00:00
Jonas Maebe
325c60866f * use tcgpara.def instead of extra size parameters
git-svn-id: trunk@21694 -
2012-06-24 15:01:59 +00:00
Jonas Maebe
f2c82e32cd - removed g_indirect_sym_load() from hlcgobj/hlcg2ll because this cgobj
method is only used anymore internally in cgobj.tcg and its descendants
  * made tcg.g_indirect_sym_load() protected to ensure it stays that way

git-svn-id: trunk@21392 -
2012-05-26 11:32:33 +00:00
Jonas Maebe
9e51b0837c * avoid problems when using a_load*loc* calls with 3-byte-sized parameters
(fix internalerror when compiling webtbs/tw16163 on non-Darwin/ARM)

git-svn-id: trunk@21330 -
2012-05-19 10:19:53 +00:00
Jonas Maebe
edd42aa42a * moved subsetref/reg and bit_set/test support from cgobj to hlcgobj for
future use by high level code generator targets
   o this in turn required that all a_load*_loc* methods are called via
     hlcg rather than via cg, since a location can be a subsetref/reg and
     and those are no longer handled in tcg
   o that then required moving several force_location_* routines into
     thlcg because they use a_load_loc*, but did not take tdef size
     parameters (which are required by the thlcg a_load_loc* routines)
   o the only practical consequence is that from now on, you have to
     use hlcg.location_force_mem/reg() (fpureg not yet) and
     hlcg.gen_load_loc_cgpara() instead of the removed versions from ncgutil,
     and hlcg.a_load*loc*() instead of cg.a_load*loc* if a subsetref/reg
     might be involved

git-svn-id: trunk@21287 -
2012-05-13 12:33:10 +00:00
Jonas Maebe
641b259aed * adjusted thlcg.g_rangecheck() implementation so it can be used for all
targets and removed (the almost identical) tcg.g_rangecheck()

git-svn-id: trunk@21262 -
2012-05-08 20:02:36 +00:00
Jonas Maebe
1345b7d107 * changed ref parameter of thlcgobj.a_call_ref() into a const parameter
git-svn-id: trunk@21115 -
2012-04-29 13:13:42 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
Jonas Maebe
10efb5b6e2 * handle records returned in floating point registers in the high->low level
code generator translation (as done by some ABIs, such as most x86-64
    platforms and darwin/i386)
   -> all regressions in jvmbackend branch for darwin/i386 fixed

git-svn-id: branches/jvmbackend@18806 -
2011-08-23 15:25:01 +00:00
Jonas Maebe
ce88df680b + symansistr conditional define that, when activated, makes the symbol/
mangled name handling ansistring rather than pshortstring based (required
    for JVM target; little effect on speed, some extra memory usage)

git-svn-id: branches/jvmbackend@18597 -
2011-08-20 08:13:50 +00:00
Jonas Maebe
f57e9778d4 * migrated gen_initialize_code and gen_finalize_code from ncgutil to
hlcgobj so it can be overridden with target-specific code (e.g.,
    the JVM target has to add initialisation code to allocate regular
    arrays and records in constructors and unit/program initialisation)

git-svn-id: branches/jvmbackend@18452 -
2011-08-20 08:01:03 +00:00
Jonas Maebe
5abf6d0aa4 + thlcgobj support of the managed open array initialization fixes of
svn r17068,17071,17081,17136
  * changed all init_paras code in both thlcgobj and ncgutil to use
    location_get_data_ref() instead of direct a_load_loc_reg()/
    ref.base:=reg so it also works with the JVM target
  * changed all init_paras code so it works with targets that do
    not pass an implicit high parameter for open array (and a similar
    fix in ncgcal)
  + added support for initializing array (both regular and open)
    "out" parameters of reference counted types on the JVM target
    (the arrays will be initialised with nil rather than an empty
     array for implementation reasons, see comments in compproc.inc)
  * factored out calling of functions in the system unit directly
    from hlcgobj

git-svn-id: branches/jvmbackend@18421 -
2011-08-20 07:58:14 +00:00
Jonas Maebe
2c313e397e + support for regular arrays and open arrays
o support for copying value parameters at the callee side if they were
     passed by reference in hlcg
   o JVM g_concatcopy() implementation for arrays
   o moved code to get length of an array from njvminl to hlcgcpu so it can
     be reused elsewhere as well
   o export array copy helpers from system unit for use when assigning one
     array to another
   o some generic support for types that are normally not implicit pointers,
     but which are for the JVM target (such as normal arrays)
  * handle assigning nil to a dynamic array by generating a setlength(x,0)
    node instead of by hardcoding a call to fpc_dynarray_clear, so
    target-specific code can handle it if required
  * hook up gethltemp() for JVM ttgjvm so array temps are properly
    allocated

git-svn-id: branches/jvmbackend@18388 -
2011-08-20 07:55:27 +00:00
Jonas Maebe
09207563d5 + hlcg implementation of gen_load_para_value(); no support yet for copying
value parameters when necessary, nor for -gt variable trashing

git-svn-id: branches/jvmbackend@18367 -
2011-08-20 07:52:31 +00:00
Jonas Maebe
9a9ea1f257 + limited thlcg.gen_load_cgpara_loc() implementation (only loc_reference
support), passed through to original ncgutils version in thlcg2ll
  + thlcgobj.location_force_mem() implementation
  * order parameters for jvm similar to those for i386 without fixed_stack,
    so we don't need temporary paralocations
  * converted most of ncgcal to thlcg
  * disabled special handling for virtual methods for jvm in ncgcal, as all
    invocations are name-based there
  + njvmcal with special jvm callnode support:
   o always move the function result into a memory temp
   o when freeing an unused function result, use a_pop(2) and adjust
     the internal evaluation stack height counter
   o after the call instruction, adjust the evaluation stack height counter
     by subtracting the number of the pushed parameter slots, adjusted for
     the slots taken up by the function result

git-svn-id: branches/jvmbackend@18325 -
2011-08-20 07:46:22 +00:00
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
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
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