Commit Graph

421 Commits

Author SHA1 Message Date
Nikolay Nikolov
e237da95d2 * most of tcgcallparanode.secondcallparan's code was moved into two new methods:
secondcallparan_do_secondpass and secondcallparan_after_secondpass. These are
  protected methods, meant to be called in secondcallparan's descendants, to
  provide alternative parameter handling algorithms (needed for WebAssembly). No
  functional changes.
2025-02-25 07:21:13 +02:00
Pierre Muller
dce70b3b70 Short version of the mips code genration bug 2022-10-29 21:34:00 +01:00
florian
8d864559b7 * overleft cosmetics 2022-03-01 22:55:27 +01:00
Nikolay Nikolov
074ce9c50f + added call to g_maybe_checkforexceptions after generating call to fpc_iocheck 2021-10-05 18:02:11 +03: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
453bfcd370 * emit the correct declaration for procdefs used to force a procname in LLVM
o fixes lazarus startup on macOS/AArch64 when compiled with the LLVM cg

git-svn-id: trunk@46675 -
2020-08-23 21:11:09 +00:00
yury
de3a479be3 * Added assembler comments about unused parameters.
git-svn-id: trunk@46522 -
2020-08-20 20:08:10 +00:00
yury
e28fca9729 * If parentfp is passed in the stack it can be skipped only if po_delphi_nested_cc is set for the routine.
git-svn-id: trunk@46520 -
2020-08-20 18:30:09 +00:00
Jonas Maebe
cc14f06677 * when a function returns a value in a register, but normally that type
would never be put in that kind of register by the compiler, store
    it to memory to avoid issues down the line
   o fixes tcalext6 on darwin/i386

git-svn-id: trunk@46449 -
2020-08-15 15:13:08 +00:00
yury
aefc1be555 * Reverted accidentally committed files.
git-svn-id: trunk@46416 -
2020-08-13 18:48:19 +00:00
yury
7b65f85a0b * Accidental commit.
git-svn-id: trunk@46415 -
2020-08-13 18:46:57 +00:00
yury
7bffafdf8b * Improved the parentfp optimization to properly handle cases when a nested routine calls other nested routines.
git-svn-id: trunk@45665 -
2020-06-20 18:34:26 +00:00
yury
11fd466394 * Optimize parentfp when optimization level 1 and higher to be debugger friendly.
git-svn-id: trunk@45661 -
2020-06-20 11:14:43 +00:00
yury
627fcb4354 * Do not use the LOC_VOID location to indicate unused parameters.
* Added the tprocdef.parentfpsym property. Set parentfpsym.varstate to vs_read instead of using the pio_needs_parentfp flag.
* Replaced tcgcallparanode.push_zero_sized_value_para by tparamanager.has_strict_proc_signature.

git-svn-id: trunk@45454 -
2020-05-21 09:36:40 +00:00
yury
9d1c814387 * Added the thlcgobj.a_load_undefined_cgpara() method to pass an undefined value as a parameter to a routine. The generic version passes the 0/nil value if the parameter's location is not a register.
* Use a_load_undefined_cgpara() to load values for unused parameters.

git-svn-id: trunk@45439 -
2020-05-19 14:14:16 +00:00
yury
2808873d1b * Reworked the optimization of unused $parentfp for nested routines.
- Do not remove the $parentfp parameter as was done in the previous optimization approach. Instead when $parentfp is unused to the following:
      - On the caller side: Omit passing the value for $parentfp for targets where tcgcallparanode.push_zero_sized_value_para=false (classic CPU targets). 
          Pass 0/nil as $parentfp for targets where tcgcallparanode.push_zero_sized_value_para=true;
      - On the callee side: Prevent allocation of registers/resources for $parentfp.
  - When possible keep $parentfp in a register.
  - Set the pio_nested_access flag in tprocinfo.set_needs_parentfp() to properly handle deep nesting levels;

git-svn-id: trunk@45436 -
2020-05-19 13:17:47 +00:00
yury
7dc6049de9 * Release registers which have been used for a function call before adjusting the stack pointer. On i386 this allows to use eax,ecx,edx in POP instructions for stack adjustment.
git-svn-id: trunk@45271 -
2020-05-05 21:56:34 +00:00
Jonas Maebe
4ba19f5418 * add support for creating non-address-only procvars to
cprocvar.getreusableprocaddr()

git-svn-id: trunk@44516 -
2020-04-02 21:21:36 +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
Jonas Maebe
54d3c26e27 * renamed abi_linux386_sysv to abi_i386_dynalignedstack, and also use it
for Darwin-based i386 platforms

git-svn-id: trunk@43650 -
2019-12-05 19:38:01 +00:00
Jonas Maebe
e775ecdc43 * cleaned up safecall support: use a hidden localvarsym instead of result
register hacking
   o this also allowed fixing/adding safecall support for LLVM

git-svn-id: trunk@43578 -
2019-11-24 20:23:22 +00:00
florian
52cc02aa3b * values passed to const parameters are not limited to registers and constants
git-svn-id: trunk@43500 -
2019-11-16 17:16:15 +00:00
florian
fabe4cc067 * patch by Christo Crause: reg. allocation information if non-volatile registers
are used for parameter passing as it is might happen on avr, resolves #36079

git-svn-id: trunk@43390 -
2019-11-04 20:14:46 +00:00
Jonas Maebe
dadeff5b09 * fixed Darwin/i386 after r43176
git-svn-id: trunk@43185 -
2019-10-13 10:47:25 +00:00
florian
fb91899457 * adapted 16 byte alignment handling on linux: it is now assumed that the callee tries to clear the stack, so in the caller, the stack is re-adjusted
git-svn-id: trunk@43176 -
2019-10-12 21:51:13 +00:00
florian
02deb7d954 * try to avoid to use pic based calls
git-svn-id: trunk@43054 -
2019-09-22 15:27:50 +00:00
florian
b3ed34592f + software handling of exceptions on arm
* reworked software handling of exceptions so they can be check lazily

git-svn-id: trunk@42525 -
2019-07-28 21:06:36 +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
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
florian
4f052e4f90 o fix several issues with floating point exceptions
+ mask underflow and precision on startup
  + check for floating point exceptions after inlined float routine helpers
  - do not check for floating point exceptions after floating point moves 

git-svn-id: branches/laksen/riscv_new@39645 -
2018-08-19 15:26:00 +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
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Károly Balogh
f5f895e2a3 syscalls: unify call reference creation across 4 different CPU archs. less copypasted code, brings x86_64 AROS support up to speed
git-svn-id: trunk@35034 -
2016-12-02 09:29:09 +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
Jonas Maebe
66be068365 * set the correct resultdef after converting a dynamic array to an open array
in ncnv
  * handle the fact that we overwrite the open array resultdef of a parameters'
    left node with the original resultdef (i.e., also for dynamic arrays) with
    regards to LLVM type rules
   o use the parameter's formal type (open array) instead of the value's type
     (dynamic array) when loading/using its value, since that's the type the
     value has been converted to
   o this change is not really nice since it adds several independent checks in
     different places, but I can't find a way to nicely unify the code to work
     around this (nor one to get rid of that hack in the first place)

git-svn-id: trunk@34515 -
2016-09-11 17:12:04 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
Jonas Maebe
f5e4265b1e * "push" zero-sized value parameters for LLVM and JVM, because all parameters
are part of the signature on those platforms (fixes e.g. tbs/tb0408.pp for
    LLVM)

git-svn-id: trunk@34128 -
2016-07-14 15:24:50 +00:00
Jonas Maebe
951ca4e62b * fixed procdef used to call C-style blocks (only relevant for LLVM)
git-svn-id: trunk@33925 -
2016-06-05 21:34:45 +00:00
svenbarth
d2a7f17d8c Fix for Mantis #29372.
compiler/ncgcal.pas:
  * tchcallnode.release_para_temps: don't release temps of a constructor's self parameter

+ added test

git-svn-id: trunk@32990 -
2016-01-23 22:19:00 +00:00
Jonas Maebe
a249950a45 * fixed types in tcgcallnode.load_block_invoke()
o made the method non-virtual, as there is no reason to override it
     anymore (it was virtual to be able to override it with a typesafe
     LLVM-specific version)

git-svn-id: trunk@32597 -
2015-12-05 18:03:54 +00:00
Jonas Maebe
ea0c8e6f38 - reverted accidentally committed code with r32463
git-svn-id: trunk@32476 -
2015-11-22 11:52:30 +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
Jonas Maebe
83521e7d1f * ensure that the def used when calling virtual methods matches the
procdefinition (e.g. regarding the self parameter type)

git-svn-id: trunk@32419 -
2015-11-21 12:37:27 +00:00
Jonas Maebe
32796f4af9 * ensure that the def used when calling procvars matches the value in
the register (e.g., change it to only the procedure address in case of
    a complex procvar)

git-svn-id: trunk@32418 -
2015-11-21 12:37:24 +00:00
yury
b26fa07f1a * Fixed notes "var is assigned but not used".
git-svn-id: trunk@31734 -
2015-09-17 13:03:04 +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
e06181749c * guarantee the order of parameter pushes again after r31201 on platforms
that don't use a fixed stack (mantis #28454)
   o moved the code to finalise managed out parameters from ncgcal to ncal,
     and add it to the init code of the call node (so it's evaluated before
     any parameters are processed, ensuring that mantis #28390 stays fixed)

git-svn-id: trunk@31328 -
2015-08-16 12:47:09 +00:00
Jonas Maebe
508828958c * changed getprocaddressprocvar() into a tprocvardef.getreusableprocaddr()
class method

git-svn-id: trunk@31148 -
2015-06-23 21:23:22 +00:00