Commit Graph

35 Commits

Author SHA1 Message Date
Jonas Maebe
d5de84c6c5 * use typenames in more cases in the generated LLVM IR (results in smaller
IR in textual form)

git-svn-id: trunk@44518 -
2020-04-02 21:21:44 +00:00
Jonas Maebe
853e622fb7 * fix case completeness warnings
git-svn-id: branches/debug_eh@42051 -
2019-05-12 18:46:47 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +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
3fa6838815 * basic llvm metadata support
git-svn-id: branches/debug_eh@41978 -
2019-05-02 19:45:26 +00:00
Jonas Maebe
3a1fb45315 * synchronised with trunk till r41976
git-svn-id: branches/debug_eh@41977 -
2019-05-02 19:44:41 +00:00
Jonas Maebe
97a144ea6a - removed ttypedconstkind parameter from tai_simpletypedconst constructor,
as it always has to be tck_simple anyway

git-svn-id: trunk@41975 -
2019-05-02 19:39:56 +00:00
Jonas Maebe
a0831b058a * fixed LLVM para loading for byval paralocs that are preceded by other
paralocs

git-svn-id: branches/debug_eh@41217 -
2019-02-03 21:10:18 +00:00
Jonas Maebe
8eb07ed7b1 * add support for custom calling conventions to LLVM function declarations
git-svn-id: branches/debug_eh@41211 -
2019-02-03 21:09:58 +00:00
Jonas Maebe
fceb34dbd5 * converted tllvmpara contents from tlocation to toper, so we can also
store tai in them
  + support for direct symbol parameters to llvm routines (without first
    loading them into register)
   o needed to pass such symbols to llvm intrinsics

git-svn-id: branches/debug_eh@40414 -
2018-11-29 21:31:27 +00:00
Jonas Maebe
d363acbe77 * when inserting a reference to an external procdef, also process its
parameter types in case it hasn't been called (because in that case
    the defs of those parameters won't have been used and hence they
    won't have been recorded for writing either)

git-svn-id: branches/debug_eh@40413 -
2018-11-29 21:31:24 +00:00
Jonas Maebe
077d7e8551 * fixed handling of LLVM invoke instruction in the assembler writer and
type inference

git-svn-id: branches/debug_eh@40403 -
2018-11-29 21:30:53 +00:00
Jonas Maebe
5b8f7224af * set the dummy exception handling personality function for functions using
exceptions for LLVM (except on Windows targets, since they (will) use
    their own kind of exception handling)
   o ensure we generate an external function symbol definition for such
     personality functions on LLVM

git-svn-id: branches/debug_eh@40402 -
2018-11-29 21:30:49 +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
31b70ecfd3 * don't perform the automatic insertion of typecasts in case register
allocation hasn't been performed, because then reused "registers"
    could have multiple types

git-svn-id: trunk@34121 -
2016-07-14 15:20:19 +00:00
Jonas Maebe
3f7169e250 * treat Objective-C metaclasses (classrefdefs) as voidpointertype at the
LLVM type level

git-svn-id: trunk@32884 -
2016-01-07 22:06:13 +00:00
Jonas Maebe
cd5db0d186 * register the types for the cgparas instead of for the parameters of
procvardefs, as it's those types that we use in the LLVM IR

git-svn-id: trunk@32734 -
2015-12-26 20:00:18 +00:00
Jonas Maebe
1dcd312ca5 * don't handle Objective-C or dispinterfaces like Pascal interfaces (we
don't generated a vmtdef for those)

git-svn-id: trunk@32685 -
2015-12-20 20:56:02 +00:00
Jonas Maebe
ef3bafd67c * fixed resetting defs after generating the llvm "type" instructions: the
dbg_state is not sufficient to determine whether or not a def has
    already been processed or not -> use stab_number (and reset it)
   o also record all defs we don't emit "type" instruction for, but which
     we still process to find other defs, so we reset those too

git-svn-id: trunk@32520 -
2015-11-24 20:10:35 +00:00
Jonas Maebe
e90af5d7c0 * fixed collection of types from tai_*typedconst
git-svn-id: trunk@32469 -
2015-11-22 11:49:28 +00:00
Jonas Maebe
c17458149c - removed accidentally committed debug code
git-svn-id: trunk@32468 -
2015-11-22 11:49:25 +00:00
Jonas Maebe
8cebb76572 * corrected llvm level type of interfaces
git-svn-id: trunk@32425 -
2015-11-21 12:37:47 +00:00
Jonas Maebe
abd79d275f * always emit the procdef when calling a routine in llvm; this is
only required when calling a routine that returns a procvardef or
    if it's a C-style varargs routine, but it's always allowed and
    always doing it simplifies procvar handling

git-svn-id: trunk@32416 -
2015-11-21 12:37:17 +00:00
Jonas Maebe
cf0164b460 + support for classrefdef
git-svn-id: trunk@32163 -
2015-10-26 21:24:33 +00:00
Jonas Maebe
d7bda793f2 * record rather than immediately append encountered defs, so that we don't
emit the same def multiple times

git-svn-id: trunk@32162 -
2015-10-26 21:24:29 +00:00
Jonas Maebe
c80fb6a20e * explicitly specify whether an llvm specification is a definition (= locally
defined) or a declaration (external symbol), instead of deriving it from
    from the bind of the tasmsymbol. The reason is that with module-level
    inline assembly, some locally implemented functions (in pure assembler)
    won't have an LLVM IR body

git-svn-id: trunk@31629 -
2015-09-12 23:32:17 +00:00
Jonas Maebe
4c5191f5d7 * generate LLVM typedefs for file-typed data
git-svn-id: trunk@31344 -
2015-08-18 16:10:29 +00:00
Jonas Maebe
bfa94ae908 * further (final?) reworking of llvm external symbol handling:
o all external symbol definitions are now inserted in the llvmtype post pass
     based on all declarations and types used in llvm instructions
   o this means we don't have to use the workaround with the Pascal mangled
     names anymore for all external names, as we now insert the external
     references only once we know all type information

git-svn-id: trunk@31287 -
2015-08-05 21:06:01 +00:00
Jonas Maebe
6dcf61f057 * an alias is an explicit definition of a symbol -> override types gleaned
from implicit ones

git-svn-id: trunk@31286 -
2015-08-05 21:05:58 +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
cf2e46c2c1 * reworked external symbol handling on llvm to deal with the fact that
a single external symbol may be used with multiple declarations that
    have different types:
   o always declare an alias with the Pascal-mangled name that aliases the
     external symbol, with the type of that Pascal declaration
   o if the external symbol is not actually external but in the same unit,
     we will determine the type of that symbol via its declaration and
     insert type conversions in the alias declarations in case they use a
     different type
   o if it is external (so there is no declaration from which we can determine
     its real type) and there are nevertheless multiple aliases for it with
     different types, we just take the type of the first alias and insert
     type conversions for the other aliases. LLVM will take care of the
     conflicting types in multiple modules when performing WPO if necessary

git-svn-id: trunk@31054 -
2015-06-13 22:48:20 +00:00
Jonas Maebe
033c28e5ac * removed unnecessary and potentially wrong typecast
git-svn-id: trunk@30946 -
2015-05-31 16:50:36 +00:00
Jonas Maebe
8f1fb60f61 * also collect the llvm type info from the initialisation data of typed
constants

git-svn-id: trunk@30782 -
2015-05-03 16:51:06 +00:00
Jonas Maebe
74da8720c5 * insert type conversions in case a symbol is declared via 'external' as an
alias for another symbol with a different type (such as
    FPC_ANSISTR_UNIQUE, which is defined as a function and referenced as a
    procedure)

git-svn-id: trunk@30781 -
2015-05-03 16:51:02 +00:00
Jonas Maebe
e2cf90ad8a * add type declarations for structure types in the llvm code so that we can
handle recursive record references (rec= record prec: ^rec)
   o llvm unfortunately does not support recursive references to array types
     or function pointers, so those will currently still result in endless
     recursion when the compiler tries to write them out. Solving those
     will require a lot of typecasting in the generated code

git-svn-id: trunk@30675 -
2015-04-19 21:37:46 +00:00