Commit Graph

611 Commits

Author SHA1 Message Date
Jonas Maebe
da696057ab * converted register_maybe_adjust_setbase() to the high level code generator
git-svn-id: trunk@32591 -
2015-12-05 18:03:37 +00:00
Jeppe Johansen
14020b044c Fix bug in gen_load_cgpara_loc for 64bit registers on 8bit architectures.
Added a workaround in a_load_const_reg to allow compilation for AVR.

git-svn-id: trunk@32090 -
2015-10-18 11:36:58 +00:00
yury
d8542bf778 * Do not remove a ret-in-param value from the stack by callee for safecall function when safecall exception check is enabled for a target.
The bug has been triggered only with the following conditions: 
    - tf_safecall_exceptions, tf_safecall_clearstack in target flags;
    - fixed stack is used.
  Since only the i386-android target meets these conditions atm, the bug has been unnoticed.

git-svn-id: trunk@32005 -
2015-10-10 20:40:33 +00:00
yury
11a9ff4a43 * Removed unused vars for mipsel compiler.
git-svn-id: trunk@31745 -
2015-09-17 15:46:30 +00:00
yury
432248cbf1 * Removed lot of unused vars.
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +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
3f736f6114 * handle the loading of VMT entries at the node level, so it's done in a
type-safe way (for LLVM, and also internal consistency checking between
    the VMT as generated in nobj.pas and ncgvmt.pas)
   o also converted the VMT validity checking to the node level

git-svn-id: trunk@30950 -
2015-05-31 16:50:47 +00:00
Jonas Maebe
32501834c9 * fixed memory leaks due to missing frees of temporary tcgpara locations
git-svn-id: trunk@30854 -
2015-05-14 14:42:35 +00:00
florian
f95d5e0de6 + support 8 locations in gen_load_cgpara_loc
git-svn-id: trunk@30534 -
2015-04-10 20:33:11 +00:00
Jonas Maebe
8fc562a2f8 * fixed def used for saving the result of fpc_setjmp() after r30497, fixes
cycle for x86-86 (mantis #27812)

git-svn-id: trunk@30506 -
2015-04-09 07:36:45 +00:00
Jonas Maebe
a674804869 * made fpc_setjmp() code generic and fixed it for llvm
git-svn-id: trunk@30497 -
2015-04-08 19:08:30 +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
florian
f07969245b * fix warning about uninitialized variable
git-svn-id: trunk@30240 -
2015-03-15 17:10:01 +00:00
Jonas Maebe
0c394eb6f4 * ensure we don't call a_load_cgparaloc_anyreg() to move an fpu register
into an integer register

git-svn-id: trunk@30227 -
2015-03-14 18:36:57 +00:00
Jonas Maebe
fc21845686 * fixed the allocation of R12 on ppc32/ppc64 when used to hold the value of
the stack pointer during the prolog. This was done previously in
    tcg.g_proc_entry(), but that routine is called after register allocation
    and hence has no influence. Also cleaned up the deallocation of that
    register by moving the previously ifdef'd code to thlcgppcgen
    (mantis #27634)

git-svn-id: trunk@30164 -
2015-03-11 17:49:44 +00:00
Károly Balogh
0021ad714f * fixed some ancient code behind cpu_uses_separate_address_registers define to at least compile again, for some m68k experiment
git-svn-id: trunk@30130 -
2015-03-07 22:11:43 +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
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
Jonas Maebe
bc3d495285 * extra error checking in gen_load_cgpara_loc
git-svn-id: trunk@29824 -
2015-02-23 22:47:59 +00:00
Jonas Maebe
b8c8ef8489 * support transfering a cgpara that is stored in multiple paralocs into a
single register, by first storing everything consecutively to memory and
    then loading it. Required for "homogeneous float aggregates" on AArch64

git-svn-id: trunk@29815 -
2015-02-23 22:47:32 +00:00
pierre
9b468ba728 Change code so that the condition to use global or local symbol matches
the code written in hlcg.gen_proc_symbol to avoid change from AB_LOCAL
to AB_GLOBAL, which generates erroneous code (at least for targets using GOT)

git-svn-id: trunk@29450 -
2015-01-12 12:24:15 +00:00
florian
6e671e2e85 * gen_load_cgpara_loc with OS_(S)32 for 8 bit ALUs fixed
git-svn-id: trunk@28746 -
2014-10-04 18:28:21 +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
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
6e1d370417 * split off the texceptaddr declaration into rtl/inc/excepth.inc, so it can
be included at the start of the implementation of the system unit (before
    the rest of except.inc)
  * catch declarations in/loading from the system unit of the TExceptAddr type
  * use this type instead of hardcoded size constants in the compiler
  * in generic code that is active for all targets, puts its use in a virtual
    method since it's only valid for targets using setjmp/longjmp-style
    exception handling (and the record is not defined at all in the JVM RTL)

git-svn-id: branches/hlcgllvm@28376 -
2014-08-10 19:40:29 +00:00
Jonas Maebe
142d5d6d06 - removed get_jumpbuf_size/align, use rec_jmp_buf instead
git-svn-id: branches/hlcgllvm@28371 -
2014-08-10 19:40:16 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
sergei
53b0ef1f61 - Removed superfluous tai_align, the new_section procedure creates one itself.
git-svn-id: trunk@28027 -
2014-06-21 22:36:17 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
nickysn
9da1ee0138 * i8086 far data model fixes in the copying of openarray value params
git-svn-id: trunk@27470 -
2014-04-04 20:18:47 +00:00
nickysn
36aae69e2b + initialize the initialloc for push_addr_param parameters correctly in i8086
far data memory models

git-svn-id: trunk@27455 -
2014-04-03 17:24:41 +00:00
nickysn
cf1d60b8eb + added size info to the 'Var X located at' comment generated in the asm output
git-svn-id: trunk@27454 -
2014-04-03 16:54:01 +00:00
nickysn
66d7beb7fe * i8086 far data memory model fix for except_buf_size
git-svn-id: trunk@27371 -
2014-03-30 12:00:20 +00:00
nickysn
5ae9443d66 * moved the EXCEPT_BUF_SIZE const to be local to ncgutils.get_exception_temps,
because that's the only place where it's used

git-svn-id: trunk@27369 -
2014-03-30 11:27:07 +00:00
florian
a4b6e99db1 * increase refs of hidden high parameter if the corresponding open/const array is used
git-svn-id: trunk@27331 -
2014-03-29 13:10:54 +00:00
nickysn
891ab86254 * fixed ncgutil.gen_load_vmt_register and tcgloadvmtaddrnode.pass_generate_code
for i8086 far data memory models by using the high level code generator

git-svn-id: trunk@27326 -
2014-03-28 23:16:14 +00:00
nickysn
149db35910 * i8086 far data memory model fix in ncgutil.new_exception
git-svn-id: trunk@27242 -
2014-03-23 18:11:50 +00:00
Jonas Maebe
73a3f5ced4 * moved ncgutil.maybechangeloadnodereg() to hlcg.maybe_change_load_node_reg()
and moved ifdef'd jvm code to overridden method

git-svn-id: trunk@27153 -
2014-03-16 11:24:40 +00:00
Jonas Maebe
4065483a50 * completed thlcgobj.location_force_fpureg(), use it everywhere and removed
ncgutil/thlcg2ll.location_force_fpureg()

git-svn-id: trunk@27071 -
2014-03-10 09:01:05 +00:00
Jonas Maebe
e9268a0a14 * synchronised with trunk up till r26975
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
Jeppe Johansen
2227045e23 Replace forbidden chars in more places in the GAS assembler writer.
Add support for .set and .weak on AVR.
Fix 64 bit negation on AVR.
Add cpu_capabilities to cpuinfo.pas and fixed some peephole optimizations.
Pass >4 byte parameters by reference.

git-svn-id: trunk@26943 -
2014-03-04 08:01:23 +00:00
Jeppe Johansen
66f5b71fe9 Fixed passing of 32bit arguments on 8-bit architectures.
Added initial RTL startup code for AVR.

git-svn-id: trunk@26931 -
2014-03-02 20:53:21 +00:00
sergei
53556f529d * gen_alloc_symtable: don't use current_procinfo.procdef, the necessary procdef is passed in 'pd' parameter.
git-svn-id: trunk@26663 -
2014-02-03 10:21:56 +00:00