Commit Graph

55 Commits

Author SHA1 Message Date
florian
b777dc21d7 * fix PowerPC compilation
git-svn-id: trunk@44097 -
2020-02-02 15:20:28 +00:00
florian
679c4454c4 * fixes copying of tcgpara
git-svn-id: trunk@44095 -
2020-02-02 14:30:45 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
fcde89cb26 * support forcing to write the parameter alignment for parameters for LLVM,
even when it's the same as the stack alignment (it can also refer to the
    alignment of the data pointed to by pointer parameters)

git-svn-id: branches/debug_eh@41729 -
2019-03-17 15:28:27 +00:00
Jonas Maebe
a0d796e98d * synchronised with trunk till r41159
git-svn-id: branches/debug_eh@41160 -
2019-02-01 17:01:54 +00:00
Jonas Maebe
04d295f186 * first step towards supporting 32 bit targets with the LLVM code generator:
use the generic code in more cases when cpuhighleveltarget is defined

git-svn-id: trunk@41133 -
2019-01-29 21:39:09 +00:00
Jonas Maebe
14cc517f40 * synchronised with trunk till r40724
git-svn-id: branches/debug_eh@40737 -
2019-01-01 17:15:29 +00:00
Jonas Maebe
a72a12eef6 * don't emit 0-sized parameters for LLVM: clang doesn't either, and some
LLVM backends (like the AArch64 one) trigger internal errors when
    encountering them

git-svn-id: trunk@40736 -
2019-01-01 16:55:41 +00:00
Jonas Maebe
fceb34dbd5 * converted tllvmpara contents from tlocation to toper, so we can also
store tai in them
  + support for direct symbol parameters to llvm routines (without first
    loading them into register)
   o needed to pass such symbols to llvm intrinsics

git-svn-id: branches/debug_eh@40414 -
2018-11-29 21:31:27 +00:00
Jonas Maebe
d69ad8fa41 * removed temppos field again from parameter locations: they're not allocated
by the temp manager of the current procedure

git-svn-id: trunk@38858 -
2018-04-27 19:18:55 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
Jonas Maebe
9787c5dd82 * fix compilation of LLVM backend (mantis #31794)
git-svn-id: trunk@36267 -
2017-05-19 21:52:49 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
417f1cd49d + initial implementation of the RTTI for parameter locations (not *yet* used by anything)
The parameter manager converts from the internal compiler representation of
a parameter's location to an RTTI representation. As the general implementation
more or less directly uses the compiler structures for this a platform specific
parameter manager may override this functionality in case some parameter
information changed in a non-backwards compatible way.
The RTTI parameter location has a layout that allows for an easy enumeration
as the size is fixed for all locations. Additionally there are properties that
allow for easy access to the information stored in them.

git-svn-id: trunk@35250 -
2017-01-06 22:21:37 +00:00
Jonas Maebe
7ebbb744e9 * also specify sret attribute at the caller side
git-svn-id: trunk@34302 -
2016-08-13 14:47:42 +00:00
Jonas Maebe
b4fe4789d6 + support for constant call parameters on LLVM
o reduces the size of the generated LLVM IR, but mainly important for LLVM
     intrinsics such as llvm.memcpy.*(), as llc complains if some of their
     parameters are not constants (you could work around it by first running
     opt or by using clang with optimizations so that the constants, which
     were loaded in registers until now, were propagated to the intrinsics
     by the time llc saw them)

git-svn-id: trunk@32776 -
2015-12-28 15:06:07 +00:00
Jonas Maebe
02ca215272 * reworked and fixed llvm procdef handling (except for variadic C functions):
o handle parameters and function results divided over multiple paralocs,
     including generating fake recorddefs that represent
   o fixed zero/sign extension handling
   o properly handle difference between procdefs as printed for the
    implementation, an alias declaration or a procvar definition

git-svn-id: branches/hlcgllvm@27009 -
2014-03-06 21:42:00 +00:00
Jonas Maebe
81427523ab * pass a list of (pointers to) the paralocs to hlcgobj.a_call/g_call*, as
required for the LLVM support (LLVM parameter support is not yet
    included)
  * always return the function return loc from a_call*, again as required
    for the LLVM support

git-svn-id: branches/hlcgllvm@26992 -
2014-03-06 21:40:57 +00:00
Jonas Maebe
8ede313ba1 + llvm parameter manager: it reuses the native parameter manager to create
the paraloc information, and then adds llvm-specific information to the
    paralocs
   o only partially implemented, in particular function result handling is
     not yet there

git-svn-id: branches/hlcgllvm@26040 -
2013-11-11 11:15:31 +00:00
Jonas Maebe
7566ddcc8f * add a tdef to each parameter location and set it for all target
backends (not yet used, will be used in high level code generator)

git-svn-id: trunk@24761 -
2013-06-02 10:24:02 +00:00
sergei
4714dc2218 + paramgr.pas: provide generic implementation of getintparaloc(). Once this method has been changed to use the procdef, it can reuse 'regular' parameter locations created by create_paraloc_info, so separate cpu-specific implementations of getintparaloc are no longer necessary.
* parabase.pas: fixed tcgpara.getcopy, it should not modify the source object.

git-svn-id: trunk@24716 -
2013-06-01 13:47:33 +00:00
nickysn
3e22ec43b5 + added method TCGPara.locations_count
git-svn-id: trunk@24530 -
2013-05-19 18:37:55 +00:00
Jonas Maebe
2b78bb1674 - removed ppc-specific tcgpara.composite field, it's no longer used or
necessary

git-svn-id: trunk@23581 -
2013-02-06 15:37:50 +00:00
Jonas Maebe
0a1157da38 * fixed memory leaks in the compiler introduced in r21862 by marking and
releasing temporarily created function result locations

git-svn-id: trunk@21953 -
2012-07-23 13:49:29 +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
dc70db9402 * parameter passing support for AIX:
o the last bytes of records passed by value whose size is not a multiple
     of the register size must be passed in the upper (leftmost) bytes of
     a register

git-svn-id: trunk@20804 -
2012-04-11 18:02:13 +00:00
Jonas Maebe
90d82ad826 * fixed unit reloading after the addition of the def field to tcgpara
as used in the function return location (and loading in case of
    an explicit para location)

git-svn-id: branches/jvmbackend@18636 -
2011-08-20 08:17:17 +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
florian
fcd3872d88 + introduction of tcgint
git-svn-id: trunk@17017 -
2011-02-26 20:15:53 +00:00
Károly Balogh
f634ef6640 + Workaround for IE2010053115 internal errors while writing PPU with explicitparaloc functions.
* MorphOS cycles again now at least, someone with clue might want to take a look if this is the proper way to fix this.

git-svn-id: trunk@16154 -
2010-10-13 19:58:44 +00:00
Jonas Maebe
c8d75245a9 + extra sanity checks in TCGPara.ppuwrite()
git-svn-id: trunk@15358 -
2010-05-31 20:48:35 +00:00
Jonas Maebe
6fa584fc12 * fixed endless loop in TCGPara.ppuwrite
git-svn-id: trunk@15355 -
2010-05-31 16:15:12 +00:00
Jonas Maebe
283018a3bf * changed tprocdef.funcretloc[] from a tlocation into a tcgpara so it can
represent complex locations (required for full x86-64 ABI support,
    which is not yet implemented) -> lots of special result handling
    code has been removed and replaced by the parameter handling
    routines
  + added support for composite parameters (and hence function
    results) to tcg.a_load_ref_cgpara() (so it can be used for
    handling, e.g., 64 bit parameters on 32 bit platforms)
  * the above fixed writing past the end of allocated memory when
    handling records returned in registers on x86-64 whose size is
    not a multiple of 8 bytes (mantis #16357)
  - removed the x86-64 and PPC specific versions of a_load_ref_cgpara(),
    as they are now handled correctly by the generic version
  * moved the responsibility of allocating tcgpara cpu registers
    (using paramanager.allocparaloc()) from the callers of
    cg.a_load*_cgpara() to the cg.a_load*_cgpara() methods
    themselves (so the register allocation can be done efficiently
    when dealing with function results)
  * for the above, renamed paramanager.alloc/freeparaloc() to
    paramanager.alloc/freecgpara(), and use paramanager.allocparaloc()
    to allocate individual pcgparalocations instead
  * fixed the register size of SSE2 function result registers for
    x86-64 (when used for floating point), which results in removing
    a few superfluous "movs? %xmm0,%xmm0" instructions
  * fixed compilation of paramanagers of avr, m68k and mips after r13695
    and also updated them for these new changes

git-svn-id: trunk@15350 -
2010-05-30 21:12:57 +00:00
Jonas Maebe
7d459cf12a * the compiler now explicitly keeps track of the minimally guaranteed
alignment for each memory reference (mantis #12137, and
    test/packages/fcl-registry/tregistry1.pp on sparc). This also
    enables better code generation for packed records in many cases.
  o several changes were made to the compiler to minimise the chances
    of accidentally forgetting to set the alignment of memory references
    in the future:
    - reference_reset*() now has an extra alignment parameter
    - location_reset() can now only be used for non LOC_(C)REFERENCE,
      use location_reset_ref() for those (split the tloc enum so the
      compiler can catch errors using range checking)

git-svn-id: trunk@12719 -
2009-02-08 13:00:24 +00:00
Jonas Maebe
f36e5411af * split cpu64bit compiler define into
a) cpu64bitaddr, which means that we are generating a compiler which
       will generate code for targets with a 64 bit address space/abi
    b) cpu64bitalu, which means that we are generating a compiler which
       will generate code for a cpu with support for 64 bit integer
       operations (possibly running in a 32 bit address space, depending
       on the cpu64bitaddr define)
   All cpus which had cpu64bit set now have both the above defines set,
   and none of the 32 bit cpus have cpu64bitalu set (and none will
   compile with it currently)
  + pint and puint types, similar to aint/aword (not pword because that
    that conflicts with pword=^word)
  * several changes from aint/aword to pint/pword
  * some changes of tcgsize2size[OS_INT] to sizeof(pint)

git-svn-id: trunk@10320 -
2008-02-13 20:44:00 +00:00
peter
38c0ae73da Merged revisions 2775,2788-2789 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2775 | peter | 2006-03-05 22:43:30 +0100 (Sun, 05 Mar 2006) | 2 lines

  * merge ppu changes to keep ppus the same

........
r2788 | peter | 2006-03-06 12:59:14 +0100 (Mon, 06 Mar 2006) | 2 lines

  * Add TFPList and TFPObjectList

........
r2789 | peter | 2006-03-06 13:01:37 +0100 (Mon, 06 Mar 2006) | 2 lines

  * fix powerpc

........

git-svn-id: trunk@2790 -
2006-03-06 12:04:44 +00:00
tom_at_work
c887507adf * generic compiler patches for ppc64/linux PIC code
git-svn-id: trunk@2222 -
2006-01-08 13:27:31 +00:00
tom_at_work
8c8e25353b * reverted changes from 2214, needs to be split into several commits
git-svn-id: trunk@2215 -
2006-01-08 01:03:15 +00:00
tom_at_work
6313a9be7b * basic code generation for dynamic linking code for ppc64
git-svn-id: trunk@2214 -
2006-01-07 22:16:33 +00:00
tom_at_work
b53ee04f98 * base compiler patches to improve C parameter passing compatibility on powerpc64/linux
git-svn-id: trunk@1983 -
2005-12-18 22:07:24 +00:00
peter
6cc6711cc2 * fix range error in paracompare
git-svn-id: trunk@537 -
2005-06-30 07:34:17 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
peter
5edffaf371 * remove is_single_reference
* revert loading of ref-to-ref para valu
2005-02-15 21:39:48 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
Jonas Maebe
2e944b3b71 * fixed darwin cycle 2005-01-30 21:51:57 +00:00
peter
b9ca478f50 * multiple location support for i386 a_param_ref
* remove a_param_copy_ref for i386
2005-01-18 22:19:20 +00:00
Jonas Maebe
9c22d594b0 + support for passing records in registers under darwin
* tcgpara now also has an intsize field, which contains the size in
    bytes of the whole parameter
2005-01-10 21:50:05 +00:00
florian
fcfbc935a1 + implemented abi compliant handling of strucutured functions results on sparc platform 2005-01-07 16:22:54 +00:00