Commit Graph

50 Commits

Author SHA1 Message Date
florian
657f3c52bf * according to Jonas iOS doesn't zero extend results in the callee either, so check removed 2023-09-12 23:05:48 +02:00
florian
a517ada539 * on aarch64-darwin, the unused part of function results is not cleared 2023-09-10 19:27:21 +02:00
Jonas Maebe
851af5033f Darwin/AArch64: adjust alignment info of custom-aligned paralocs
Resolves #40019
2022-12-06 21:46:26 +01:00
florian
6404478ea4 * cleanup of VER3_0 defines 2021-11-17 22:19:57 +01:00
pierre
44b325ec3e * Initialize result out parameter by caling the constructor Init, not the method Reset.
This out parameter called 'result' is of type tcgpara, which is an object, but not a class,
      it has no virtual method, which means that the VMT is never used, and thus the
      fact that the object is not 'constructed' can be easily missed.
      Nevertheless, it could generate problems as the different fields have unassigned
      and thus random value, while reset method can dereference location field
      if not nil.
      Issue found by using -gttt compiler option.

git-svn-id: trunk@47711 -
2020-12-07 16:35:46 +00:00
Jonas Maebe
9376f5a43a * AArch64: added SIMD instructions (only plain ARMv8-A for now)
o added AArch64 regset parsing support in assembler reader, means that "{"
     no longer starts comments there (like in the ARM assembler reader)
   o added AArch64 indexed SIMD register support and removed old cg hacks
     that worked around its absence

git-svn-id: trunk@47116 -
2020-10-15 20:29:36 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
Jonas Maebe
69129f38e2 * aarch64: correct paraloc^.def for LOC_REFERENCE parameters
o fixes LLVM parameter information for such parameters (e.g. tw36934)

git-svn-id: trunk@46235 -
2020-08-04 21:07:06 +00:00
Jonas Maebe
a534fb9acd * fixed allocation of function result location
git-svn-id: trunk@45858 -
2020-07-25 20:26:24 +00:00
Jonas Maebe
3abdec9c95 * LLVM/AArch64: don't perform the parameter location extension workarounds
for LLVM, as that results in LLVM assuming exactly the opposite of
    what's intended (namely that the extended locations contain valid
    rather than invalid bits)

git-svn-id: trunk@43886 -
2020-01-07 20:22:20 +00:00
Jonas Maebe
a75247d9b0 * AArch64: fixed parameter defs for smallsets passed in registers whose size
is not a power of two

git-svn-id: trunk@43883 -
2020-01-07 20:22:10 +00:00
Jonas Maebe
77658b925b * disable regular array -> dynamic array type coversion support unless
{$modeswitch arraytodynarray} is active (mantis #35576)
   o changed compiler to compile without this modeswitch
   o added the modeswitch to a test that depends on it

git-svn-id: trunk@42118 -
2019-05-25 12:31:32 +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
8b9e90dc7a * keep track of whether a routine has a C-style variadic parameter in the
procoptions even when it's through an array-of-const parameter
  * always call create_varargs_paraloc_info() instead of create_paraloc_info()
    in the former case, even when no varargs parameters are specified (because
    on some platforms even some non-variadic parameters need to be passed
    differently, such as on ARM with gnueabihf)

git-svn-id: trunk@41420 -
2019-02-23 15:42:45 +00:00
Jonas Maebe
1a559f5c60 * move the homogenous float aggregate determination function to a common
unit for ARM and AArch64

git-svn-id: trunk@41419 -
2019-02-23 15:42:39 +00:00
yury
382d5060a0 * aarch64: According to ARM64 ABI, function's arguments and the result are not required to be sign/zero extended to a full register size. Obey this rule for all targets except iOS where sign/zero extension is required.
git-svn-id: trunk@41412 -
2019-02-22 17:59:54 +00:00
Jonas Maebe
ac8411f3cf * pass dynamic array parameters of cdecl routines by value on AArch64
(like on onther platforms)
   o it was passed by reference as a side effect of the fact arrays in C are
     pointers, but a dynamic array already is a pointer

git-svn-id: trunk@40573 -
2018-12-16 20:44:35 +00:00
Jonas Maebe
95171a1e22 * initialise cgpara with valid data for the C-style "array of const" para
(necessary for the LLVM backend)

git-svn-id: trunk@40571 -
2018-12-16 20:44:28 +00:00
Jonas Maebe
ff002e2664 * set paralocations correctly for LLVM/AArch (must be register-type instead
of parameter-type based)

git-svn-id: trunk@40568 -
2018-12-16 20:44:18 +00:00
Jonas Maebe
6b58185bda * fixed shifval for big endian (bits instead of bytes)
git-svn-id: trunk@40567 -
2018-12-16 20:44:15 +00:00
Jonas Maebe
6e453a1477 * fixed paraloc def when changing the size to OS_32
git-svn-id: trunk@40566 -
2018-12-16 20:44:12 +00:00
nickysn
518cdf9674 * replaced the saved_XXX_registers arrays with virtual methods inside
tcpuparamanager, very similar to the existing get_volatile_registers_XXX. The
  new methods are called get_saved_registers_XXX, where XXX is the register
  type ("int", "address", "fpu" or "mm")

git-svn-id: trunk@38794 -
2018-04-19 21:22:16 +00:00
Jonas Maebe
f891788a86 * simplification of and fix for AArch64 cpupara.is_hfa_internal() (patch by
modulo7, mantis #30381)
   o check for array elements of size 0 does not make sense after we've
     established it's an array of floats
   o since the recursive call to is_hfa_internal() already checks for
     floats, we don't have to do it before calling it again for the
     elements of an array
   o set the result to "true" if the array is small enough to be a HFA

git-svn-id: trunk@34293 -
2016-08-12 16:53:02 +00:00
Jonas Maebe
0ed6c3d80e * also use the last floating point parameter register on AArch64 in case of
a HFA type (which in practice also applies to plain floating point types)
    (patch by Alfred, mantis #30207)

git-svn-id: trunk@33922 -
2016-06-05 20:18:24 +00:00
Jonas Maebe
fa3b0ca312 * support marking defs created via the getreusable*() class methods as
"don't free even if not registered"; use for defs that may not be written
    to a ppu file, but that must nevertheless survive the compilation of the
    current module
  * mark all defs created for para locations as "don't free even if not
    registered", because we don't discard and recalculate all para locations
    after a module has been compiled (since that's not needed)
   o solves issues if the paralocations for a routine in the interface of
     unit A are calculated while the implementation of unit B gets
     compiled, and a new reusable type is allocated at that point which
     is not used anywhere else (after r32160)

git-svn-id: trunk@32235 -
2015-11-04 20:46:18 +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
bd203a5b57 * synchronised with trunk till r30240
git-svn-id: branches/hlcgllvm@30241 -
2015-03-15 19:44:58 +00:00
Jonas Maebe
8334597476 * a homogeneous float aggregate can maximally contain 4 elements
(mantis #27665)

git-svn-id: trunk@30229 -
2015-03-14 21:46:45 +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
42aca4db46 * pass managed function result addresses as a hidden first parameter instead
of in X8, as the ABI allows this deviation (see added comments) and it's
    required for some internal RTL code to call interface methods via RTTI

git-svn-id: trunk@29953 -
2015-02-23 22:55:08 +00:00
Jonas Maebe
e2d21a5716 * reuse simple memory paralocs, since we always setup a stack frame and
we can address them via the frame pointer

git-svn-id: trunk@29941 -
2015-02-23 22:54:12 +00:00
Jonas Maebe
41fba0c4f7 * switched to using the stack pointer as base register for the temp allocator
instead of the frame pointer register:
      1) we exactly know the offsets of the temps from the stack pointer
         after pass 1 (based on the require parameter stack size for called
         routines), while we don't know it for the frame pointer (it depends
         on the number of saved registers)
      2) temp offsets from the stack pointer are positive while those from
         the frame pointer are negative, and we can directly encode much
         bigger positive offsets in the instructions
   o move the stack pointer register to a virtual register in
     loadparentfpn, because many instructions cannot directly operate
     on/with the stack pointer
   o add the necessary register interference edges for the stack pointer
     register

git-svn-id: trunk@29938 -
2015-02-23 22:54:03 +00:00
Jonas Maebe
70fc5dcee3 * don't pass TP-style objects as HFA or similar, because the calling
convention code is triggered before the object structure has been
    finalised, so the result can be different in the interface and
    implementation. To solve this, something like r20161 has to be
    implemented for TP-style objects

git-svn-id: trunk@29930 -
2015-02-23 22:53:29 +00:00
Jonas Maebe
820de6a17b * pass "const" arrays always by reference, because there is a lot of hacky
code out there that relies on this, even though it's not supposed to be
    guaranteed in any way :(

git-svn-id: trunk@29874 -
2015-02-23 22:50:32 +00:00
Jonas Maebe
1c8eb58792 * adapted copyright statement
git-svn-id: trunk@29863 -
2015-02-23 22:49:58 +00:00
Jonas Maebe
2214966f26 * implemented parameter passing and function result locations
git-svn-id: trunk@29862 -
2015-02-23 22:49:55 +00:00
Jonas Maebe
7fbc44471b * made getparaloc ABI-compliant
git-svn-id: trunk@29860 -
2015-02-23 22:49:49 +00:00
Jonas Maebe
232599b429 * made push_addr_param() ABI-compliant
git-svn-id: trunk@29859 -
2015-02-23 22:49:46 +00:00
Jonas Maebe
e2c30eb0a1 * return base type from is_hfa()
git-svn-id: trunk@29858 -
2015-02-23 22:49:43 +00:00
Jonas Maebe
e7bbb31080 * implemented ret_in_param() according to the ABI
git-svn-id: trunk@29857 -
2015-02-23 22:49:40 +00:00
Jonas Maebe
4562731ad9 - removed custom getintparaloc()
git-svn-id: trunk@29856 -
2015-02-23 22:49:37 +00:00
Jonas Maebe
60768fcffe + implemented is_hfa()
git-svn-id: trunk@29855 -
2015-02-23 22:49:34 +00:00
Jonas Maebe
cd6e3d5622 * fixed another compilation error
git-svn-id: trunk@29838 -
2015-02-23 22:48:43 +00:00
florian
76c179fae8 * aarch64 compilation fixes
git-svn-id: trunk@28931 -
2014-10-26 08:35:13 +00:00
Jonas Maebe
99de108c68 * renamed all paramanagers to tcpuparamanager so the llvm paramanager can
derive from them without ifdefs

git-svn-id: branches/hlcgllvm@26039 -
2013-11-11 11:15:27 +00:00
svenbarth
7bad1763b8 Decrease amount of code duplication regarding handling of safecall and record constructors.
paramgr.pas, tparamanager:
    + add new method "handle_common_ret_in_param"
    * extract common code (safecall + record constructor handling) from "ret_in_param" to "handle_common_ret_in_param" and call the latter in "ret_in_param"
[aarch64,arm,avr,i386,x86_64]/cpupara.pas, tCPUparamanager.ret_in_param:
    * call "handle_common_ret_in_param" instead of implementing the same check again and again
ncgcal.pas, tcgcallnode.handle_return_value:
    * move the check for (record) constructors to "tparamanager.handle_common_ret_in_param"

git-svn-id: trunk@23520 -
2013-01-25 20:39:28 +00:00
paul
b2a613c17f compiler: implement record constructors + tests
git-svn-id: trunk@23395 -
2013-01-16 02:07:42 +00:00
paul
51825b6f2e compiler: change ret_in_param to accept tabstractprocdef instead of tproccalloption to allow check more options (required for record constructor implementation)
git-svn-id: trunk@23394 -
2013-01-16 01:14:23 +00:00
Jonas Maebe
69c29a415f * pass the procdef to getintparaloc instead of only the proccalloption, so
that the type of the parameters can be determined automatically
   o added compilerproc declarations for all helpers called in the compiler
     via their assembler name, so we can look up the corresponding procdef

git-svn-id: trunk@23325 -
2013-01-06 15:05:40 +00:00
florian
2aaa7514f4 + started cpupara for aarch64
git-svn-id: trunk@23029 -
2012-11-18 20:42:11 +00:00