Commit Graph

378 Commits

Author SHA1 Message Date
florian
6c4d218b8d * use for threadvars on RiscV always the size optimization code path as loading addresses is expensive 2025-04-03 23:14:43 +02:00
florian
9d7ea2c069 * revert check for boolean type when handling LOC_FLAG in tcgassignmentnode.pass_generate_code. This makes pas boolean the default,
resolves #40908
2024-09-16 22:48:18 +02:00
J. Gareth "Curious Kit" Moreton
179fc5848b * Flags specific to TArrayConstructorNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
ecc16278f0 * Flags specific to TAssignmentNode have been moved to their own field 2024-03-02 21:31:21 +01:00
Michaël Van Canneyt
fe62b3ace8 * Introduce constwresourcestring - in unicode mode, resource strings are unicode strings, and must be streamed differently 2024-02-13 19:44:36 +01:00
Jonas Maebe
49cb7b2564 LLVM: use llvm.dbg.declare instead of llvm.dbg.addr for variable declarations
Even though it's supposedly deprecated, clang also still uses it and without
the declaration ranges of local variables are sometimes cut off
2023-12-06 22:57:16 +01:00
florian
f562a8d9fd * hopefully final fix after 9848349610 2022-09-14 22:34:50 +02:00
florian
cc7d67d08c * i8086 compiler fixed after 9848349610 2022-09-13 22:30:52 +02:00
florian
9848349610 * allocate registers correctly for method pointers on 16 bit address cpus, resolves #39603 2022-09-12 23:08:34 +02:00
florian
a401898139 * spelling fixes 2022-08-04 23:01:35 +02:00
Jonas Maebe
a76038e1d1 hlcgobj: new getlocal and recordnewsymloc methods
Call hlcg.getlocal instead of tg.getlocal when used for actual parameters/local
variables. Has an extra tsym parameter, which will enable the LLVM backend to
insert debug information.

Call hlcg.recordnewsymloc when the location of a (local/para) symbol changes,
so debug info tracking can be updated (only done for LLVM currently)
2022-06-04 22:26:40 +02:00
Nikolay Nikolov
0a383d8c0f * fixed WebAssembly method pointer assignment 2021-10-03 02:27:19 +03:00
florian
cc64d9eb4e * do not swap left/right code generation for assignment nodes if
conditional expressions are involved, resolves #38129

git-svn-id: trunk@49095 -
2021-03-31 20:53:18 +00:00
florian
69fcacc948 * use fld/fst on i386 to copy doubles
git-svn-id: trunk@47009 -
2020-09-29 20:59:29 +00:00
pierre
5d6d47bad1 Amend commit 46484: Do not accept LOC_CSUBSETREF location type as this represents read-only memory region which should never be modified
git-svn-id: trunk@46487 -
2020-08-18 21:58:19 +00:00
pierre
a4cfade86b Avoid internalerror 200203273 by handling LOC_CSUBSETREG and LOC_CSUBSETREF as LOC_SUBSETREG in tcgassignmentnode.pass_generate_code
git-svn-id: trunk@46484 -
2020-08-18 20:52:47 +00:00
pierre
57b8f28574 Avoid overflow errors on z80 CPU by changing local variable type from aint to tcgint
git-svn-id: trunk@45816 -
2020-07-21 05:23:36 +00:00
florian
8f91920c9b * use the fpu on suitable x86 targets to copy extended values
git-svn-id: trunk@45718 -
2020-07-01 20:45:58 +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
svenbarth
da1312698b * correctly check for the system unit
git-svn-id: trunk@43540 -
2019-11-21 21:44:36 +00:00
svenbarth
6151f7af29 * check the localswitches of the node instead of the global ones
git-svn-id: trunk@43539 -
2019-11-21 21:44:33 +00:00
florian
4064c5f39b * section thread vars need to be access with the symbol type AT_TLS
git-svn-id: trunk@43073 -
2019-09-25 21:19:05 +00:00
Jonas Maebe
eb0f02348d * fixed loading parent frame pointer for nested procvars on targets that
that use explicit parentfp structs (fixes webtbs/tw17379 for llvm)

git-svn-id: trunk@42100 -
2019-05-19 19:20:29 +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
9c3e9e80a3 * fixed type correctness of and simplified the threadvar loading size
optimisation

git-svn-id: trunk@41135 -
2019-01-29 21:39:16 +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
f98a9bea3c * cap the assumed alignment of pass-by-reference parameters to the minimum of
their default alignment, the alignment of locals, globals and constants
    (so that we don't overestimate the alignment of global normal set
     constants to 32 bytes, while the maximum const alignment is often only
     8 bytes)

git-svn-id: trunk@40374 -
2018-11-26 22:27:35 +00:00
florian
9f16c34329 + initial work for tls-based threadvar support on arm-linux
git-svn-id: trunk@40267 -
2018-11-07 22:02:58 +00:00
yury
7c94d00a4a * Fixed bug #17413 (and the tw17413 test) for aarch64 by adding additional check.
git-svn-id: trunk@39951 -
2018-10-16 21:16:30 +00:00
Jonas Maebe
52e7678033 * ensure that load nodes only substitute temps in case both references point
to the start of their respective temps

git-svn-id: trunk@38859 -
2018-04-27 19:18:59 +00:00
Jonas Maebe
5ca8893987 * fixed temppos of loaded nested variables: invalid rather than the temppos
in their parent frame (mantis #33636)

git-svn-id: trunk@38836 -
2018-04-24 19:28:20 +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
ad73453e64 * fixed alignment of threadvars (used uninitialised field value)
git-svn-id: trunk@38812 -
2018-04-22 17:03:07 +00:00
florian
31f78ea2b6 + implementation of the vectorcall calling convention by J. Gareth Moreton
+ tests

git-svn-id: trunk@38206 -
2018-02-11 17:50:37 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
florian
ea3495c20e * compilation with -Oodfa fixed
git-svn-id: trunk@35555 -
2017-03-09 22:09:43 +00:00
yury
9f3759bcb8 * Enable minor size optimization for thread var loading code when -Os is specified or PIC code is generated and PIC uses GOT.
git-svn-id: trunk@35551 -
2017-03-09 16:08:39 +00:00
Jonas Maebe
1c820e9c8e * similar change as in r34976 for the generic code: don't assume that if
a load node for a procsym has a self pointer, that we have to create
    a procvar with a self pointer (e.g. when loading the address of a
    static class method). Avoids the generation of superfluous code to
    load self which is then not used afterwards

git-svn-id: trunk@35005 -
2016-11-27 21:54:50 +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
0afbe85aab * various memory reference alignment fixes
git-svn-id: trunk@34544 -
2016-09-20 21:43:19 +00:00
Jonas Maebe
179c1ab328 * changed ttemp*node.tempinfo^.flags to a private field, and added setters
and getters for the ttemp*node classes instead
   o this will allow descendants to prevent certain flags from being added
     or removed. E.g. for LLVM, certain temps must never be put in registers
     because it cannot typecast a value in a register from a non-record/array
     type to an array type without forcing it to memory (so if that is done
     on an lvalue, the result will be written to the memory temp instead of
     to the register)

git-svn-id: trunk@34358 -
2016-08-21 14:23:09 +00:00
svenbarth
1c696b0e77 * use indirect reference for FPC_THREADVAR_RELOCATE if necessary
* reference FPC_THREADVAR_RELOCATE assembler symbol if necessary

git-svn-id: trunk@34339 -
2016-08-19 13:07:56 +00:00
Jonas Maebe
f0bf3b364a * fixed alignment of reference used to set the first char of a 1-byte
shortstring

git-svn-id: trunk@34300 -
2016-08-13 14:47:36 +00:00
Jonas Maebe
18580d3069 * when assigning a value to a temp marked as ti_const, do not immediately
release the source location in case it was also a temp. Reason: we
    don't increase reference counts when assigning to a ti_const (they are
    like const parameters), so the original value must stay alive until
    the ti_const temp is freed
   o free the original data in the ttempdelete node for the ti_const temp
   o don't increase reference counts when assigning composite types to
     ti_const temps either

git-svn-id: trunk@34287 -
2016-08-12 13:35:51 +00:00
Jonas Maebe
4e8bda76cb * update alignment when advancing offset to next element of array constructor node
git-svn-id: trunk@34279 -
2016-08-12 13:35:28 +00:00
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
  * explicitly pass the correct value for all calls to those methods elsewhere
    in the compiler

git-svn-id: trunk@34250 -
2016-08-05 07:09:16 +00:00
svenbarth
a173c34d96 * have tcgrttinode use the indirect RTTI labels if necessary
git-svn-id: trunk@34224 -
2016-07-29 14:03:31 +00:00
svenbarth
02ebae7658 * use the indirect symbol for resource strings if necessary
* have the unit import the resource string symbol if necessary

git-svn-id: trunk@34188 -
2016-07-22 16:04:51 +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