Commit Graph

153 Commits

Author SHA1 Message Date
pierre
40193ea1db Add pi_has_open_array_parameter to proc_info.flags as this requires special handling for i8086 huge memory model to restore DS register correctly
git-svn-id: trunk@32922 -
2016-01-11 15:02:10 +00:00
Jonas Maebe
1a09209659 * fixed type correctness of array parameter handling for calls to
fpc_addref_array/fpc_finalize_array (those helpers expect a pointer
    to the elements of the array, not a pointer to the array)

git-svn-id: trunk@32779 -
2015-12-28 15:06:29 +00:00
Jonas Maebe
7a8079cfb4 * removed DLLsource global variable and replaced its uses with
current_module.islibrary

git-svn-id: trunk@32676 -
2015-12-17 15:23:05 +00:00
Jonas Maebe
2046220f56 + helper methods to load a field into a register
git-svn-id: trunk@32596 -
2015-12-05 18:03:51 +00:00
Jonas Maebe
a9498b6735 * fixed the parameter order for thlcgobj.g_load_const_field_by_name()
git-svn-id: trunk@32595 -
2015-12-05 18:03:48 +00:00
Jonas Maebe
4f4d4d9456 * also support non-pointerdefs as first argument for g_ptrtypecast_ref()
via internal restructuring of the llvm code generator (so we can
    typecast e.g. a procvardef to a pointerdef)

git-svn-id: trunk@32550 -
2015-11-29 21:45:50 +00:00
Jonas Maebe
688b9c0a69 * use the correctly typecasted reference in a_bit_set_reg_ref
git-svn-id: trunk@32463 -
2015-11-22 11:49:07 +00:00
Jeppe Johansen
5ec4d38231 Add support for ram-less AVR chips and simultanously optimize flash/ram size the initfinal calling sequence.
git-svn-id: trunk@32448 -
2015-11-22 00:37:10 +00:00
Jonas Maebe
be69fbef4f * fixed type used to store copied open array value parameters
git-svn-id: trunk@32424 -
2015-11-21 12:37:43 +00:00
Jonas Maebe
00a5dd87c9 * allow g_ptrtypecast_reg() to allocate a new register, because spilling
a bitcast that reads from and writes to the same register doesn't
    work well
  * changed pointerdef parameters of g_ptrtypecast_reg()/ref() to regular tdef
    so that these routines can also be used with procvardefs (which are pointers,
    but not pointerdefs), except for the fromdef of g_ptrtypecast_ref() as this
    one has to call a_loadaddr_ref_reg() (which needs the pointeddef, and getting
    that is not possible for non-pointerdefs)

git-svn-id: trunk@32417 -
2015-11-21 12:37:20 +00:00
Jonas Maebe
eaeb9d8351 * renamed thlcgobj.g_set_addr_nonbitpacked_record_field_ref() to
thlcgobj.g_set_addr_nonbitpacked_field_ref() and adjusted it so that
    it also works for objects/classes (if the incoming reference points
    to the start of the class contents)
   o factored out the related code from tllvmsubscriptnode

git-svn-id: trunk@32411 -
2015-11-21 12:37:01 +00:00
Jonas Maebe
949fd53a0a - reverted r32315: targets using the high level code generator should keep
complex procvars either in a single "register", or in memory

git-svn-id: trunk@32408 -
2015-11-21 12:36:51 +00:00
Jonas Maebe
ae5a355f06 * helpers to load registers/constants into a record field at the hlcg level
git-svn-id: trunk@32406 -
2015-11-21 12:36:45 +00:00
Jonas Maebe
cf925a108d * support multiple paralocs, force the source to memory in
thlcgobj.gen_load_loc_cgpara as only a_load_ref_cgpara supports
    multiple locations

git-svn-id: trunk@32316 -
2015-11-13 17:48:24 +00:00
Jonas Maebe
d99de6d8f5 * support complex procvardefs in thlcgobj.location_force_mem() in case they
are located in multiple registers

git-svn-id: trunk@32315 -
2015-11-13 17:48:21 +00:00
Jonas Maebe
faf4a9cb38 * moved the generation of the "main" stub for libc-based platforms from
hlcgobj to pmodules/symcreat/ngenutil, so that it also works for llvm

git-svn-id: trunk@31658 -
2015-09-12 23:34:01 +00:00
Jonas Maebe
9ee2a0f71c + g_set_addr_nonbitpacked_record_field_ref() thlcgobj method to make a
reference pointing to the base address of a record point to a field
    of that same record

git-svn-id: trunk@31641 -
2015-09-12 23:33:00 +00:00
Jonas Maebe
6dd06a1aae * put the code for pure assembler routines in a separate asmlist, so
we can easily use a different assembler writer for them on the
    llvm target

git-svn-id: trunk@31630 -
2015-09-12 23:32:21 +00:00
Jonas Maebe
0fc1fd6ac1 * replaced current_procinfo.currtrue/falselabel with storing the true/false
labels of LOC_JUMP in the node's location. This generates some extra jumps
    for short circuit boolean and/or-expressions if optimizations are off, but
    with optimisations enabled the generated code is the same (except for JVM
    because the jump threading optimisation isn't enabled there yet).

git-svn-id: trunk@31431 -
2015-08-27 18:28:57 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
b39bc5888a * moved the import name handling entirely to hlcgobj so it can be
overridden

git-svn-id: trunk@31053 -
2015-06-13 22:48:17 +00:00
Jonas Maebe
1019a6b090 * use the def of the paraloc rather than the parasym's vardef in
gen_load_para_value(), as this may be different depending on
    the calling conventions
  * adapt llvm's gen_load_cgpara_loc() to use this passed def rather
    than hardcoding the para's def (although these will normally match)

git-svn-id: trunk@31050 -
2015-06-13 22:48:08 +00:00
Jonas Maebe
c3233b21e8 * fixed reference/register types for thlcgobj.a_bit_test_*
git-svn-id: trunk@30717 -
2015-04-25 15:51:22 +00:00
Jonas Maebe
5418978415 * fixed types in thlcgobj.location_get_data_ref
git-svn-id: trunk@30710 -
2015-04-25 15:51:01 +00:00
Jonas Maebe
61e4a1b811 + added tasmlist parameter to getintparaloc() (needed for llvm)
git-svn-id: trunk@30429 -
2015-04-04 14:29:16 +00:00
Jonas Maebe
bd203a5b57 * synchronised with trunk till r30240
git-svn-id: branches/hlcgllvm@30241 -
2015-03-15 19:44:58 +00:00
Jeppe Johansen
914e9e7b49 Merged from trunk
git-svn-id: branches/laksen/armiw@30146 -
2015-03-08 12:33:46 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
2ab7f5c35d * moved x86-specific requirements from the generic bsr/bsf code to the
x86 code generator (register size constraints)

git-svn-id: trunk@29984 -
2015-02-23 22:57:18 +00:00
Jonas Maebe
edb3124ae8 * copy arrays passed by value to cdecl routines on the callee side even on
platforms that normally must copy value parameters on the caller side,
    because
   o if we copy them on the caller side, then the behaviour will be different
     compared to other platforms if the called routine is implemented in C
     (since they are passed by reference, changes to the array contents will
      be visible on other platforms, while they wouldn't be visible if the
      copy is made on the caller side)
   o if we don't copy them on the caller nor on the callee side, then behaviour
     will be different compared to other platforms if the called routine is
     implemented in Pascal and modifies the array (since then changes won't be
     visible on the caller side, except on platforms that normally perform
     the copy on the caller side)

git-svn-id: trunk@29873 -
2015-02-23 22:50:29 +00:00
Jonas Maebe
2dbfbd40ab * unified hlcg.g_copyvalueparas and ncgutil.copyvalueparas, they have the
same functionality in the mean time

git-svn-id: trunk@29872 -
2015-02-23 22:50:26 +00:00
Jonas Maebe
6e12ad817f * don't make copies of arrays passed as value parameters to cdecl routines
(since C compilers don't copy such arrays either, as they're implciitly
     pointers)

git-svn-id: trunk@29871 -
2015-02-23 22:50:23 +00:00
Jonas Maebe
c6ba0bb6fb + support for targets that require by-reference value parameters to be
be copied on the caller instead of callee side
   o mark Darwin/Aarch64 as such a target (any AArch64 target will be like
     that normally, as its ABI specifies this behaviour)
   o don't mark by-reference value parameters on such targets as
     vo_has_local_copy, since a) they don't have one (the copy is on the
     caller side), and b) this ensures that all code handling such
     parameters automatically knows that they are still by reference
     after the init code has run
   o when making the copies on the caller side, don't increase the
     reference count for managed types except for variants, just like
     is done when making the copies on the callee side. This is because
     the reference count increasing code on the callee side only runs
     for non-assembler functions, and we cannot know 100% certain on the
     caller side whether the called function is assembler or not (e.g. in
     case of externally declared functions)
   o maybe over time we can reuse the Pascal code in
     tcallparanode.copy_value_by_ref_para to replace the equivalent code
     in hlcgobj and ncgutil also on the caller side for other targets

git-svn-id: trunk@29870 -
2015-02-23 22:50:20 +00:00
Jeppe Johansen
47dbec3111 Rebase to trunk revision
git-svn-id: branches/laksen/armiw@29708 -
2015-02-15 16:08:18 +00:00
Jonas Maebe
fde6448063 * don't directly add something to ref.index in get_bit_reg_ref_sref, as it
may be scaled

git-svn-id: trunk@29583 -
2015-01-30 19:31:18 +00:00
florian
69ac7dd7ef * limit initialization to register variables which really need to be initialized
git-svn-id: trunk@29569 -
2015-01-27 21:51:29 +00:00
Jeppe Johansen
6976af8365 Change .thumb_func to be an ait_directive instead of it's own tai type.
git-svn-id: branches/laksen/armiw@29334 -
2014-12-26 23:13:14 +00:00
Jonas Maebe
cc596225fa + thlcg.g_ptrtypecast_reg/ref() to typecast a pointer in a register, or the
pointer type describing a reference, to another pointer type

git-svn-id: branches/hlcgllvm@28781 -
2014-10-06 20:54:33 +00:00
Jonas Maebe
b745dcc64c * moved g_external_wrapper() to the hlcg, and also g_intf_wrapper() because
for some platforms it depends on that routine

git-svn-id: branches/hlcgllvm@28492 -
2014-08-19 20:22:54 +00:00
Jonas Maebe
0fbaa9e924 * record the alignment of temps, and set it when creating a reference based
on a temp instead of assuming it's always aligned to a multiple of
    the stackpointer size

git-svn-id: branches/hlcgllvm@28490 -
2014-08-19 20:22:48 +00:00
Jonas Maebe
830952cc3b * moved creating a reference based on a ttemprecord to a new virtual method
called temp_to_ref()

git-svn-id: branches/hlcgllvm@28487 -
2014-08-19 20:22:40 +00:00
Jonas Maebe
344acef9b5 * separate tracking the def of a temp and whether or not it needs to be
finalised (for llvm, we always keep track of the def)

git-svn-id: branches/hlcgllvm@28485 -
2014-08-19 20:22:34 +00:00
Jonas Maebe
a637fbe596 * moved all g_exception_*() methods to hlcgobj and cleaned them up (no more
hardcoded registers for the most part)
  + added extra g_exception_discard_reason() that can be called when we only
    want to get rid of the currently pushed exception reason, and don't have
    to load it (so it can do nothing on platforms that don't use push/pop)

git-svn-id: branches/hlcgllvm@28481 -
2014-08-19 20:22:24 +00:00
Jonas Maebe
9a683a0288 * converted new_exception to hlcgobj
o also gets rid of the ifdefs

git-svn-id: branches/hlcgllvm@28377 -
2014-08-10 19:40:32 +00:00
Jonas Maebe
a64897ddee + thlcgobj.a_loadfpu/mm_loc_ref()
git-svn-id: branches/hlcgllvm@28372 -
2014-08-10 19:40:19 +00:00
Jonas Maebe
4f2b77bc96 + support floating point reference -> integer parameter transfer in
thlcgobj.a_loadfpu_ref_cgpara()

git-svn-id: branches/hlcgllvm@28358 -
2014-08-10 13:19:37 +00:00
Jonas Maebe
8e3062b1b6 * fixed the type specified to reference_reset_base() in
thlcgobj.paravarsym_set_initialloc_to_paraloc(): it has to be the type of
    pointer in the base register, not the type of the variable (and since this
    is a parameter on the stack, use voidstackpointertype rather than
    getpointerdef() for i8086 compatibility)

git-svn-id: branches/hlcgllvm@28351 -
2014-08-10 13:18:34 +00:00
Jonas Maebe
2dfbee45b1 * generate the callerside para/return location info in g_call_system_proc,
so that platform-specific versions of g_call_system_proc_intern() don't
    have to take care of this (since these methods call random routines from
    the system unit, this info may not yet be available)

git-svn-id: branches/hlcgllvm@28203 -
2014-07-12 22:14:02 +00:00
Jonas Maebe
650fd162ea * fixed missing bracket in comment
git-svn-id: branches/hlcgllvm@28153 -
2014-07-04 19:24:17 +00:00
Jonas Maebe
1516661249 + new chlcgobj class reference variable that can be used to call thlcg*
virtual methods even when hlcg doesn't contain a valid instance

git-svn-id: branches/hlcgllvm@28143 -
2014-07-03 22:28:31 +00:00