Commit Graph

101 Commits

Author SHA1 Message Date
J. Gareth "Curious Kit" Moreton
fe39f9ca21 Fixed bug on x86 platforms where the stack pointer was not allocated if it was different to the frame pointer 2022-02-08 20:47:47 +00:00
Florian Klämpfl
49af134ba7 * compilation of x86_64-win64 fixed 2021-12-04 16:21:29 +01:00
florian
0b3fb55c6a * generate no exit code at all on x86-64 if the subroutine is compiled with po_noreturn 2021-12-03 23:26:28 +01:00
florian
a3666aa8c9 o manually applied merge request 46 by J. Gareth "Kit" Moreton:
+ x86_64: XMM-based block move optimisation
2021-09-24 20:10:38 +02:00
florian
84a1f614d9 * fix several double ;
git-svn-id: trunk@45488 -
2020-05-24 17:52:09 +00:00
florian
82a3877126 + x86: track use of full ymm registers and generate vzeroupper if needed
git-svn-id: trunk@45484 -
2020-05-24 17:52:05 +00:00
florian
8f0a3cfce7 * x86-64: adjust stack by push/pop if possible
git-svn-id: trunk@45476 -
2020-05-23 17:50:13 +00:00
florian
ef3155c2ef * there is no exit stackframe needed if a subroutine never returns
git-svn-id: trunk@44191 -
2020-02-16 13:06:19 +00:00
Jonas Maebe
1e3f72403e * renamed getintparaloc to getcgtempparaloc
o it can be used for more than integer parameters

git-svn-id: trunk@43781 -
2019-12-24 22:12:25 +00:00
florian
ba203c0564 + x86 makes use of fpu_capabilities
* moved CPUX86_HAS_AVXUNIT to FPUX86_HAS_AVXUNIT
+ mm register allocator can be initialized with 32 mm registers of AVX512

git-svn-id: trunk@42707 -
2019-08-16 11:35:03 +00:00
florian
367bc18bc5 * cfa for x86-64 fixed
git-svn-id: branches/debug_eh@41563 -
2019-03-02 23:03:32 +00:00
florian
ded001753d + initial native x86-64 support
git-svn-id: branches/debug_eh@41499 -
2019-02-26 22:08:20 +00:00
florian
64ad48e89e * forgotten part of r39750
git-svn-id: trunk@39752 -
2018-09-13 20:20:40 +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
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
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Jonas Maebe
265c8e7bbc + support for specifying ms_abi_default, ms_abi_cdelc, sysv_abi_default, and
sysv_abi_cdecl calling conventions on x86-64 to force using the SYSV/
    Microsoft ABI on platforms that don't use it by default (mainly to ease
    porting pure assembler routines)

git-svn-id: trunk@35425 -
2017-02-11 19:57:12 +00:00
Jonas Maebe
880d438704 * renamed t<cpuname>procinfo to tcpuprocinfo for all targets, so we can
inherit from it for LLVM without a thousand ifdefs

git-svn-id: trunk@35141 -
2016-12-16 22:41:21 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
sergei
eb86cd47c6 * tcgx86_64.g_proc_entry: Don't crash if 'list' is initially empty. Went unnoticed this far because ncgutil.gen_proc_entry_code adds some items before calling cg.g_proc_entry.
git-svn-id: trunk@32670 -
2015-12-16 11:13:24 +00:00
sergei
1b965e6766 * x86: Don't save/restore integer registers that are volatile per calling convention of current procedure. It implies that nothing will be saved for procedures with OLDFPCCALL, FAR16 and PASCAL and calling conventions. OLDFPCCALL restores behavior that was in effect before r25224.
git-svn-id: trunk@32542 -
2015-11-27 05:48:49 +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
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
79a06b1514 + iphonesim/x86_64 target (64 bit iOS simulator)
git-svn-id: trunk@29970 -
2015-02-23 22:56:09 +00:00
florian
35a04ad095 * modified patch of Paul W to replace leave by mov/pop, resolves #26455
git-svn-id: trunk@29633 -
2015-02-05 20:51:12 +00:00
Jonas Maebe
d8c898742a * handle the fact that records containing a single extended value are
returned on the x87 fpu stack on x86-64
   o also handle the fact that this means that we'll generated float
     loads/stores with OS_128/OS_F128 in case the surrounding record
     is padded to a multiple of its alignment

git-svn-id: trunk@28985 -
2014-11-04 21:16:27 +00:00
Jonas Maebe
8244d366d0 - moved deallocation of NR_PIC_OFFSET_REG from the x86_64 to the i386 code
generator (as it's also allocated for i386 rather than for x86_64)

git-svn-id: trunk@28928 -
2014-10-25 17:47:44 +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
florian
d8c0f11ff9 + cs_userbp optimizer switch, so on x86-64 the compiler can make use of rbp if it is not needed as frame pointer
git-svn-id: trunk@26633 -
2014-01-30 19:44:17 +00:00
sergei
f508442a7e * Emit everything to the same asmlist (fixing copy-paste error).
git-svn-id: trunk@26187 -
2013-12-06 07:10:39 +00:00
sergei
409e176ded * Factored reusable (SEH-related) piece of code into separate procedure.
git-svn-id: trunk@26157 -
2013-12-01 11:47:12 +00:00
sergei
da2887a4ec * x86_64-win64: SEH finalization procedures have frame pointer set to RBP but since r25389 they save registers relative to RSP. Fixed offsets for .seh_savereg/.seh_savexmm directives.
* In epilogue, deallocate current_procinfo.framepointer, not RBP.

git-svn-id: trunk@25414 -
2013-09-04 15:31:55 +00:00
sergei
e41149a7ec * x86_64: reworked register saving/restoring to use PUSH/POP instructions for procedures with RSP-based frame and SEH finalization procedures. XMM registers are also saved/restored without involving tempgen in mentioned cases. This prevents SEH finalization procedures from saving registers in stack frame of their parent procedures, fixing incorrect unwind bytecode (Mantis #24791). It also reduces executable size (for compiler itself, by about 100Kb).
git-svn-id: trunk@25389 -
2013-08-30 07:54:02 +00:00
sergei
5dda96bdfe - Tcgx86_64.init_register_allocators: removed 'preserved_by_proc' parameter, because it isn't used by RA in any way.
* tcgx86_64.g_intf_wrapper: jump directly to reference without loading its content into RAX, this saves an instruction.

git-svn-id: trunk@25381 -
2013-08-28 09:10:57 +00:00
sergei
1f72143eef * In preparation for fixing Mantis #24791: Copy related code from tcgx86.g_proc_entry to tcgx86_64.g_proc_entry, and remove win64-specific stuff from tcgx86 version.
git-svn-id: trunk@25218 -
2013-08-06 07:34:50 +00:00
florian
94cf650d9a * use lea to adjust stack pointer, this is equal or faster on all modern CPUs than add/sub
git-svn-id: trunk@25010 -
2013-06-28 17:06:57 +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
2e7fe1aebd * support of avx register requires now proper usage of R_SUBMMWHOLE
git-svn-id: trunk@22574 -
2012-10-07 18:47:17 +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
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
sergei
cbad0abab5 + Platform-specific exception support for x86_64-win64. Enable by cycling with OPT=-dTEST_WIN64_SEH.
git-svn-id: trunk@20098 -
2012-01-16 23:13:31 +00:00
sergei
fde1695961 * tcgx86_64.g_proc_exit: restore stack pointer using value that was calculated and stored in tcgx86.g_proc_entry, instead of recalculating it again.
git-svn-id: trunk@20078 -
2012-01-14 18:04:45 +00:00
sergei
fffa4a35a0 * x86_64: Don't waste time initializing/finalizing saved_standard_registers and saved_mm_registers arrays on every procedure. Initialize once, reinitialize if target system happens to change, and let finalization happen implicitly on shutdown.
git-svn-id: trunk@19672 -
2011-11-23 20:06:38 +00:00
sergei
85f7914906 * Don't generate .seh_endprologue if SEH directives are present in the text of (pure assembler) procedure, as it results in duplicate .seh_endprologue.
* Added checks for .seh_endprologue presence and correct position.

git-svn-id: trunk@19388 -
2011-10-06 03:29:35 +00:00
sergei
4c21beb48e win64 unwinding, misc fixes:
* Insert seh_endprologue directive after the last prologue instruction, not before it
* Omit seh_stackalloc for zero bytes
* (For now) ignore SEH directives in NASM and MASM writers, instead of failing with internal error.

git-svn-id: trunk@19246 -
2011-09-26 13:55:21 +00:00
sergei
b997094755 + Generate unwind bytecode for function prologues on win64.
* For now placed actual processing of unwind info under {$ifdef TEST_WIN64_UNWIND}, because in the current state it doesn't add much value.

git-svn-id: trunk@19200 -
2011-09-23 21:22:25 +00:00
sergei
9608c4eabe * Interface wrappers must be global when linking smart, Mantis #19462. Other targets already have this condition in place.
git-svn-id: trunk@17631 -
2011-06-02 10:49:28 +00:00
svenbarth
35b47e491c Rebase to revision 17306
git-svn-id: branches/svenbarth/classhelpers@17314 -
2011-04-13 10:04:14 +00:00
sergei
c939beee70 * Changed register allocation order for x86_64, putting first registers that don't need to be preserved by procedure. This way registers needing preservation are allocated less frequently (and for non-complex leaf functions not allocated at all), reducing amount of entry/exit code.
git-svn-id: trunk@17284 -
2011-04-10 18:04:17 +00:00
svenbarth
96116a6c3a Several adjustments because virtual methods in helpers are just normal methods and a VMT isn't generated for them either.
* $CPU/cgcpu.pas: disable the generation of VMT loading code
* dbgstabs.pas, dbgdwarf.pas: treat virtual methods of helpers as normal methods
* ncgcal.pas: don't register virtual helper methods for WPO 
* ncgrtti.pas: write virtual helper methods as normal methods to RTTI
* nobj.pas: correctly handle final and override cases in helpers
* pdecvar.pas: property getters
* rautils.pas: no VMT offset in records

git-svn-id: branches/svenbarth/classhelpers@17150 -
2011-03-20 10:41:45 +00:00