Commit Graph

54 Commits

Author SHA1 Message Date
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
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
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
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
702715a518 * generalised llvmgettemprecorddef() so it works for almost all types
git-svn-id: trunk@34513 -
2016-09-11 17:11:57 +00:00
Jonas Maebe
0311528502 * always write bitpacked typed constant arrays as a multiple of bytes rather
than of their loadsize, because otherwise if they are e.g. part of a record
    they would occupy more space than allowed
   o adapted llvm code to deal with the fact that bitpacked arrays are now
     always arrays of bytes rather than arrays of integers with the same size
     as their loadsize -- this also fixes several type inconsistencies
     detected by llvm

git-svn-id: trunk@34125 -
2016-07-14 15:23:07 +00:00
Jonas Maebe
0cce590982 * encode the result type of functions returning a zero-sized value
using their actual type (array/record) rather than using the
    simplified type (void), so we can also return an actual value and
    assign it to something (void means that nothing is returned and
    cannot be assigned to anything) (completes fixing
    tests/test/tnoext4.pp for llvm)

git-svn-id: trunk@34120 -
2016-07-14 15:19:45 +00:00
Jonas Maebe
cdfe299f23 * encode extended in a dynamic array the same as in regular arrays and
records: as an array of 10 bytes. We handle indexing dynamic arrays
    the same as indexing other arrays, and hence that code expects extended
    to be encoded the same way.

git-svn-id: trunk@34116 -
2016-07-14 15:17:27 +00:00
Jonas Maebe
ea54b6b2c5 * factored comp/currency-in-register handling out of a_loadfpu_reg_reg()
into llvmconvop() so it's also used by code using that routine

git-svn-id: trunk@33938 -
2016-06-09 21:59:58 +00:00
Jonas Maebe
7f2d970a1e * fixed type encoding of C-style blocks for LLVM
git-svn-id: trunk@33926 -
2016-06-05 21:34:47 +00:00
Jonas Maebe
9d2bba1917 * create a separate type and def for the LLVM "i1" type, because reusing
pasbool8type for this results in too much trouble (we mustn't use i1
    for parameters, because then LLVM will try to apply the ABI convention
    for passing "1 bit" values, or in records because then this may
    result in unwanted bitpacking). Downside: the new LLVMBool1 type is
    also exposed in the system unit, because we need it to define LLVM
    intrinsics...

git-svn-id: trunk@33726 -
2016-05-20 20:51:44 +00:00
Jonas Maebe
90071e04c4 * encode objc classrefdefs as objc_idtype as that is how they are typed
elsewhere in the compiler as well

git-svn-id: trunk@32914 -
2016-01-10 17:22:11 +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
015a864db1 * def.fullownerhierarchyname() already ends in a '.', so don't append another
one

git-svn-id: trunk@32783 -
2015-12-28 15:06:55 +00:00
Jonas Maebe
787caf4dda * treat records with {$packrecords c} the same as other records for LLVM
o while in principle LLVM can layout those the same as we do, this would
     require special treatment in case some fields are not initialised in
     a typed record declaration (because then we have to emit padding only
     for the skipped fields, and not for any padding between them)
   o exception: records we create to represent parameters, as those have to
     match the ABI definitions exactly for them to be treated as expected

git-svn-id: trunk@32714 -
2015-12-25 21:05:22 +00:00
Jonas Maebe
f57a94b5aa * explicitly name the fields we add in llvmgettemprecorddef()
* use those field names when loading their addresses in
    thlcgllvm.a_load_ref_cgpara()/gen_load_cgpara_loc(), instead of
    assuming the field indices in the llvm representation of those
    records matches the parameter location order (it currently does
    because we let llvm lay out C-packed records, but that will
    change)

git-svn-id: trunk@32713 -
2015-12-25 21:05:17 +00:00
Jonas Maebe
477e087857 * only check the shiftval in llvmbyvalparaloc() if it's a register parameter
location (it's invalid for other locations)

git-svn-id: trunk@32600 -
2015-12-05 18:04:02 +00:00
Jonas Maebe
b5c9a20d3f * fixed range of llvm definition of bitpacked arrays
git-svn-id: trunk@32572 -
2015-12-02 22:29:26 +00:00
Jonas Maebe
da8d276766 * correctly encode bitpacked arrays of elements that can't be bitpacked
git-svn-id: trunk@32555 -
2015-11-29 21:46:06 +00:00
Jonas Maebe
0c4edd2aa9 * fixed getting address of interface methods after r32414: interfaces are not
a pointer to a vmt, but a pointer to a pointer to vmt (mantis #29086)
   o also adjusted the llvm type for interfaces accordingly

git-svn-id: trunk@32530 -
2015-11-25 19:28:17 +00:00
Jonas Maebe
2342ee467b * don't write the parameter names for external function declarations in llvm,
because the names we assign to parameter locations are no longer valid after
    a module has been compiled (they are tasmsymbols), and they're not necessary
    for declarations either; this also avoids generating calleeside parameter
    information for imported routines just to write the external declaration
    (the callerside information will already be available from when the routines
     were called)

git-svn-id: trunk@32518 -
2015-11-24 20:10:28 +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
d02eb7059b + pointerdef support in llvmgettemprecorddef()
git-svn-id: trunk@32314 -
2015-11-13 17:48:19 +00:00
Jonas Maebe
bf10ae45de * only add the llvm "sret" attribute to "struct return" parameters if they
are the first parameter (as required by llvm)
   o ensure that for AArch64, "struct return" the parameter always is the first
     parameter, as it needs to be returned in a special register there

git-svn-id: trunk@31676 -
2015-09-14 16:10:48 +00:00
Jonas Maebe
ba9d54beb5 * don't mangle symbol names for llvm intrinsics
git-svn-id: trunk@31406 -
2015-08-24 22:06:53 +00:00
Jonas Maebe
a722b5dbc5 * add alignment padding to internally constructed llvm records
git-svn-id: trunk@31290 -
2015-08-05 21:06:09 +00:00
Jonas Maebe
b55c7df996 * factored out internal type prefixes
git-svn-id: trunk@31248 -
2015-07-30 16:57:55 +00:00
Jonas Maebe
6c5f1327f4 * generate the correct llvm type description for classrefdef
git-svn-id: trunk@30956 -
2015-05-31 16:51:04 +00:00
Jonas Maebe
b9138a1c90 * changed the llvm type of comp/currency in parameter and return type
on platforms that use the x87 for these types to extended in order
    to gaurantee the expected parameter passing conventions

git-svn-id: trunk@30719 -
2015-04-25 15:51:27 +00:00
Jonas Maebe
b3e786eb77 - don't specify lef_inaggregate when getting the llvm type representation
for function results and parameters (they're not in an aggregate, and this
    caused 80 bits extended floating point types to be translated into arrays
    of 10 bytes, which have different ABI meanings)

git-svn-id: trunk@30714 -
2015-04-25 15:51:13 +00:00
Jonas Maebe
bb4f8e62bf * sign/zero-extend a Pascal boolean (translated to i1) when assigning to
an i8, even though both have byte size 1

git-svn-id: trunk@30713 -
2015-04-25 15:51:09 +00:00
Jonas Maebe
394091ab75 * don't generate parameter attributes for llvm function alias declarations
git-svn-id: trunk@30712 -
2015-04-25 15:51:06 +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
Jonas Maebe
2bb4a729c0 * procvardefs must be encoded without any parameter attributes
git-svn-id: trunk@30673 -
2015-04-19 21:37:40 +00:00
Jonas Maebe
af61923dc3 * don't write parameter attributes in procvardefs
git-svn-id: trunk@30499 -
2015-04-08 19:08:36 +00:00
Jonas Maebe
101fc3d4ec * translate formaldef into "i8*", as intended, instead of "i8**" due to
the fact that this type is always passed by reference

git-svn-id: trunk@30486 -
2015-04-07 19:35:22 +00:00
Jonas Maebe
e12bd99b59 * fixed compilation with -dllvm after r30343
git-svn-id: branches/hlcgllvm@30347 -
2015-03-28 11:34:02 +00:00
Jonas Maebe
864b36fbe5 * create the recorddef at the start when building an anonymous recorddef,
so that we can already refer to its def while we are sill parsing
    individual elements

git-svn-id: branches/hlcgllvm@28750 -
2014-10-06 20:53:12 +00:00
Jonas Maebe
b6fc2f1542 * don't emit the */pointer suffix for procdefs in llvmaddencodedtype_intern(),
so that if a_loadaddr_ref_reg() is used to load the address of a procdef
    into a register, the getpointerdef(procdef) won't (wrongly) result in two
    *'s
   o the previous behaviour was necessary for the tck_simple_procvar2proc
     special case that was removed in the previous commit

git-svn-id: branches/hlcgllvm@28477 -
2014-08-19 20:22:13 +00:00
Jonas Maebe
bae1f72896 * handle cdecl varargs parameters in llvm procdef string representations
git-svn-id: branches/hlcgllvm@28355 -
2014-08-10 13:19:24 +00:00
Jonas Maebe
5a49727cdf * moved functionality to create a global recorddef based on a tfplist of
tdefs to the new trecorddef.create_global_from_deflist() constructor

git-svn-id: branches/hlcgllvm@28322 -
2014-08-06 18:04:24 +00:00
Jonas Maebe
39074edf10 - removed the globalsymbolmangleprefix/suffix constants that were added for
llvm
  * instead, add LLVM-specific name mangling based on the asmsymbol's bind
    and typ whenever we write out its name

git-svn-id: branches/hlcgllvm@28166 -
2014-07-05 15:44:16 +00:00
Jonas Maebe
b520fb12be * call def2regtyp via the chlcgobj class reference so it also works when
hlcg is nil

git-svn-id: branches/hlcgllvm@28144 -
2014-07-03 22:28:35 +00:00
Jonas Maebe
7ca4ebee9d * fixed end of shortstring llvm def after r27015
git-svn-id: branches/hlcgllvm@28130 -
2014-07-02 17:24:44 +00:00
Jonas Maebe
a0c39220b1 * fixed (harmless) typecast errors when creating a string representation of
a procvardef
  * handle procdefs like procvardefs when getting their string representation
    in arbitrary expressions

git-svn-id: branches/hlcgllvm@28123 -
2014-07-01 16:30:55 +00:00
Jonas Maebe
a8b2b576ca + new llvmconvop() routine that determines the conversion operation to
convert one def to another, including information regarding whether
    it should be done via an intermediate integer typecast
  * use this routine in hlcgllvm

git-svn-id: branches/hlcgllvm@28116 -
2014-07-01 16:30:34 +00:00
Jonas Maebe
2cb84bda6e * generate integer type definitions for smallsets
git-svn-id: branches/hlcgllvm@27016 -
2014-03-06 21:42:24 +00:00
Jonas Maebe
7d61ecf5ba * changed shortstring llvm representation to a plain array of bytes, so
it can be directly indexed rather than that we need to separately
    select the byte or data (just like at the Pascal level, and how it
    is/will be handled in the code generator)

git-svn-id: branches/hlcgllvm@27015 -
2014-03-06 21:42:21 +00:00
Jonas Maebe
bdc2aaec47 * fixed ansistring and unicodestring llvm defs (pointer indirection was
missing, and replaced by plain pointer because the array definition does
    not add any useful information)

git-svn-id: branches/hlcgllvm@27012 -
2014-03-06 21:42:10 +00:00