Commit Graph

432 Commits

Author SHA1 Message Date
Jonas Maebe
7e2c3b39ec * fixed LLVM compilation after r43860
git-svn-id: trunk@43862 -
(cherry picked from commit f659e91a95)
2024-06-09 17:51:39 +02:00
Jonas Maebe
76045bfc04 * merged macOS/AArch64 support + revisions these changes depended on
git-svn-id: branches/fixes_3_2@46866 -
2020-09-15 19:40:36 +00:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
Jonas Maebe
fc9e9e804a --- Merging r40512 into '.':
A    tests/webtbs/tw33607.pp
U    compiler/aarch64/hlcgcpu.pas
--- Recording mergeinfo for merge of r40512 into '.':
 U   .
--- Merging r40566 into '.':
U    compiler/aarch64/cpupara.pas
--- Recording mergeinfo for merge of r40566 into '.':
 G   .
--- Merging r40567 into '.':
G    compiler/aarch64/cpupara.pas
--- Recording mergeinfo for merge of r40567 into '.':
 G   .
--- Merging r40573 into '.':
G    compiler/aarch64/cpupara.pas
--- Recording mergeinfo for merge of r40573 into '.':
 G   .
--- Merging r40629 into '.':
U    compiler/ncnv.pas
U    compiler/llvm/nllvmcnv.pas
--- Recording mergeinfo for merge of r40629 into '.':
 G   .
--- Merging r40637 into '.':
U    compiler/ncon.pas
A    tests/webtbs/tw33666.pp
--- Recording mergeinfo for merge of r40637 into '.':
 G   .
--- Merging r40729 into '.':
U    compiler/ncal.pas
U    compiler/jvm/njvminl.pas
U    compiler/ninl.pas
--- Recording mergeinfo for merge of r40729 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40735 -
2019-01-01 16:49:46 +00:00
Jonas Maebe
807fcb3371 * support pasbool8 as type for a record field when a record is passed/
returned in multiple registers (llvm)

git-svn-id: trunk@38862 -
2018-04-28 16:17:37 +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
3da67019e5 * fixed llvm compiler compilation after r38814 (crashes in "make cycle", but
that was already the case before)

git-svn-id: trunk@38815 -
2018-04-22 20:40:19 +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
94de872927 * fix compilation for llvm as proposed by Karl-Michael Schindler, resolves #31969
git-svn-id: trunk@37842 -
2017-12-28 14:57:35 +00:00
Jonas Maebe
e4dbd24a49 + inline trunc() support for the LLVM backend when using -Oofastmath (because
the behaviour of LLVM's fptosi instruction is undefined in case of
    overflow)

git-svn-id: trunk@36275 -
2017-05-20 19:28:15 +00:00
Jonas Maebe
04ac44cd37 - removed dependency of hlcgllvm on llvmpara, so that cpupara no longer
indirectly depends on llvmpara and hence is initialised after instead
    of before it (since llvmpara should override cpupara in its init code)

git-svn-id: trunk@36264 -
2017-05-19 21:52:37 +00:00
svenbarth
c16238e8dd * fix for Mantis #31464: add an entry for the WebAssembly CPU (this is already the target name that LLVM uses)
git-svn-id: trunk@35507 -
2017-03-03 16:14:52 +00:00
Jonas Maebe
4b9179636b + support for creating and writing LLVM landingpad instructions
git-svn-id: trunk@35161 -
2016-12-18 13:57:42 +00:00
Jonas Maebe
28e5636daa + support for LLVM nil assembler symbols in instructions (write as "null")
+ support for LLVM nil tai operands (will be used for terminating a daisy
    chain of catch/filter clauses of landingpads): don't try to write it

git-svn-id: trunk@35160 -
2016-12-18 13:57:39 +00:00
Jonas Maebe
7503c2bd3e * changed llvmgettemprecorddef() to take an open array instead of a tfplist
as list of defs to be stored in the record, so we don't need to create and
    free a class instance every time we call this routine

git-svn-id: trunk@35155 -
2016-12-18 13:57:22 +00:00
Jonas Maebe
b936d8f012 * don't internalerror when performing an LLVM tc_equal conversion from one
TP-style object to another and the sizes differ, at least if they are
    related
  * restructured and commented the LLVM type conversion checks

git-svn-id: trunk@35137 -
2016-12-16 22:38:01 +00:00
Jonas Maebe
f55d962e40 * use system.round() instead of LLVM's fptosui operation for converting a
floating point type to currency, as fptosui is defined as always rounding
    to zero while on other platforms we use the FPU's current rounding mode
    (fixes webtbs/tw21449 for LLVM, and also webtbs/tw24197 because LLVM's
     code generated for fptosui temporarily changes the FPU control word so
     it rounds to zero and also to disable FPU exceptions)

git-svn-id: trunk@35061 -
2016-12-04 11:15:22 +00:00
Jonas Maebe
8b1c90124e * support encoding helper types for LLVM (encode the same type as the
extended class) (fixes webtbs/tw21457 for LLVM)

git-svn-id: trunk@35060 -
2016-12-04 11:15:19 +00:00
Jonas Maebe
a0b537bc7b * fixed typed constants that use an integer number to initialise a procvar or
pointer on LLVM (fixes webtbs/tw21267)

git-svn-id: trunk@35059 -
2016-12-04 11:15:15 +00:00
Jonas Maebe
a8e107bb4b * fix memory leak: free rg[R_MMREGISTER]
git-svn-id: trunk@35056 -
2016-12-04 11:15:05 +00:00
Jonas Maebe
8c167f4e40 * handle already quoted symbol names for LLVM (like for Objective-C)
git-svn-id: trunk@35045 -
2016-12-02 18:04:14 +00:00
Jonas Maebe
876e5eab56 * fixed "smart linking" parameters to llc
git-svn-id: trunk@35044 -
2016-12-02 17:45:12 +00:00
Jonas Maebe
02e4a27a35 * print internalerrors in case we still encounter stray constants not part of
a typed constants
  * don't print superfluous newlines in typed constant definitions

git-svn-id: trunk@35042 -
2016-12-02 12:33:09 +00:00
Jonas Maebe
db40e1575d + support for handling the tcalo_no_dead_strip flag when targeting LLVM:
add such symbols to the pseudo-arrays llvm.compiler.used or llvm.used
    depending on their nature (fixes compiling Objective-C programs with
    optimization, and keeps the FPC ident in the linked binary)

git-svn-id: trunk@35041 -
2016-12-02 12:33:05 +00:00
Jonas Maebe
e62cb7917e + support for setting the "appending" flag of declaration generated via an
LLVM typed constant builder through a new appendingdef property

git-svn-id: trunk@35040 -
2016-12-02 12:33:02 +00:00
Jonas Maebe
97d6f17cc8 + add support for marking an LLVM definition as using "appending" linkage
git-svn-id: trunk@35039 -
2016-12-02 12:32:58 +00:00
Jonas Maebe
d328d7d95d * don't write an alignment for symbols in internal llvm sections (sections
whose name starts with 'llvm.')

git-svn-id: trunk@35038 -
2016-12-02 12:32:54 +00:00
Jonas Maebe
d99d18e258 - removed useless empty asmwrite statement
git-svn-id: trunk@35037 -
2016-12-02 12:32:51 +00:00
Jonas Maebe
006c7e1ccf * apply localalignmin/max to local variables for LLVM (fixes webtbs/tw15582)
git-svn-id: trunk@35020 -
2016-11-29 21:54:30 +00:00
Jonas Maebe
8cd84bd8e8 * stop updating llvmnextfieldindex once we have established that the current
typed constant does not match the equivalent LLVM definition (it's only
    used to check whether any emitted data's type differs from the LLVM
    definition's field types)
   o fixed a potential out-of-bounds access related to this: the index of the
     equivalent LLVM field kept getting increased and at some point we checked
     whether the current emitted data's type was different from the LLVM field
     type without verifying first that the LLVM equivalent field index was not
     yet beyond the number of LLVM equivalent fields

git-svn-id: trunk@35018 -
2016-11-29 21:54:25 +00:00
Jonas Maebe
ee014fa4ff * fixed handling of typed files for LLVM when ISO-like I/O is active: encode
the buffer in the type, and support typecasting the typed file to a
    different size (needed to be able to pass it to the compiler helpers that
    expected a "TypedFile", whose buffer is 0 bytes and which hence will
    always have a smaller size than the original type) (fixes test/tisoext1)

git-svn-id: trunk@35017 -
2016-11-29 21:54:21 +00:00
svenbarth
ee466b9a28 * extend tdef.fullownerhierarchyname() with a parameter that skips the inclusion of a procdef's parameter declaration using the new pno_noparams option
git-svn-id: trunk@35009 -
2016-11-28 18:06:35 +00:00
Jonas Maebe
26f9dabf56 * write the volatile flag for LLVM load/store operations if set
git-svn-id: trunk@35004 -
2016-11-27 21:44:32 +00:00
Jonas Maebe
4d951780d1 + support for LLVM 3.8 and LLVM 3.9 IR to the llvm assembler writer
git-svn-id: trunk@35003 -
2016-11-27 21:44:29 +00:00
Jonas Maebe
3ea976fd2d * fixed compilation of llvm compiler after r34996
git-svn-id: trunk@35002 -
2016-11-27 21:44:26 +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
26a05518f8 * implement unary minus for floating point via -1.0*x instead of 0-x,
because otherwise -0.0 stays 0.0 (fixes webtbs/tw4534 for llvm)

git-svn-id: trunk@34990 -
2016-11-27 17:17:02 +00:00
Jonas Maebe
b2e99da3e6 * use tabstractprocdef.is_addressonly to determine whether a procvar is
stored in more than one register (has a self and a code pointer), instead
    of assuming it always occupies more than one register if the original
    procdef had a self pointer (can be different when getting the address
    of a static class procedure)

git-svn-id: trunk@34976 -
2016-11-26 21:51:18 +00:00
Jonas Maebe
ef90b46e52 * comment fix
git-svn-id: trunk@34958 -
2016-11-24 19:47:48 +00:00
Jonas Maebe
d39db60934 * initialise the llvmvalueloc field for LOC_VOID locations, so they don't
get randomly passed as either byval or not (while they don't contain any
    data and hence this can't cause bugs in the generated code, it can cause
    signature mismatches in llvm)

git-svn-id: trunk@34956 -
2016-11-24 08:57:09 +00:00
Jonas Maebe
280a6e15b7 * fixed invalid memory reads and potential double freeing when removing
superfluous temporary paralocs for llvm

git-svn-id: trunk@34955 -
2016-11-24 08:57:05 +00:00
Jonas Maebe
48ef33a8b3 * fixed interprocedural gotos for llvm
o ensure that the label's local "jumpbuf" variable gets moved to the
     parentfpstruct soon enough
   o don't generate global symbols for interprocedural labels: they're not
     necessary if they are only used via setjmp/longjmp (all references are
     local in that case), and if they are referenced via an assembler block
     then we'll have to handle them by passing a blockaddress() expression
     as parameter to that assembler block (which does not require a global
     symbol, but which is not yet implemented)

git-svn-id: trunk@34946 -
2016-11-21 07:39:13 +00:00
Jonas Maebe
ade45eb31a + support for llvm load nodes of labelsym using blockaddress()
git-svn-id: trunk@34945 -
2016-11-21 07:39:09 +00:00
Jonas Maebe
3b7d9447ae * blockaddress creates a constant operand for another opcode, it's not an
independent operation
   o additionally, it does not take a "label" qualifier for its label argument

git-svn-id: trunk@34944 -
2016-11-21 07:39:05 +00:00
Jonas Maebe
e1e3ad15f0 * escape all occurrences of '$' in function-level inline assembly
o temporarily encode the uses of '$' for references to function-level inline
     assembly arguments as '^', because those have to remain/become a single
     '$'

git-svn-id: trunk@34898 -
2016-11-13 22:10:00 +00:00
Jonas Maebe
43e599d6be * fixed function-level inline assembly constraints in case there are no
parameters

git-svn-id: trunk@34897 -
2016-11-13 22:09:57 +00:00
Jonas Maebe
c3aa9e2890 * generate LLVM function-level inline assembly blocks, replacing
references to local variables and parameters with references to
    assembler block constraints/parameters

git-svn-id: trunk@34892 -
2016-11-13 16:06:32 +00:00
Jonas Maebe
c4ae040258 + support for writing LLVM function-level inline assembly blocks
git-svn-id: trunk@34891 -
2016-11-13 16:06:29 +00:00
Jonas Maebe
f3409b4c9d + new la_asm LLVM pseudo-instruction to represent function-level inline
assembly blocks

git-svn-id: trunk@34890 -
2016-11-13 16:06:26 +00:00
Jonas Maebe
d2873e433e + top_asmlist operand type for LLVM inline assembly "call" instructions
git-svn-id: trunk@34889 -
2016-11-13 16:06:23 +00:00