Commit Graph

42 Commits

Author SHA1 Message Date
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
Jonas Maebe
02ca215272 * reworked and fixed llvm procdef handling (except for variadic C functions):
o handle parameters and function results divided over multiple paralocs,
     including generating fake recorddefs that represent
   o fixed zero/sign extension handling
   o properly handle difference between procdefs as printed for the
    implementation, an alias declaration or a procvar definition

git-svn-id: branches/hlcgllvm@27009 -
2014-03-06 21:42:00 +00:00
Jonas Maebe
532d623be7 + support for encoding records/objectdefs in LLVM-speak
git-svn-id: branches/hlcgllvm@26991 -
2014-03-06 21:40:52 +00:00
Jonas Maebe
43e0eb3cfd + llvmaggregatetype() helper that returns whether a def is represented by an
aggregate type in llvm

git-svn-id: branches/hlcgllvm@26986 -
2014-03-06 21:40:36 +00:00
Jonas Maebe
d13b510144 + helpers to convert tdefs to strings describing the types in llvm syntax.
Other than arrays and complex procvardefs, all aggregates are currently
    handled as opaque arrays of bytes
   o special case: s80real (x87 extended type) is encoded as "array[0..9] of
     byte" inside arrays, because when using the llvm type describing
     "extended" llvm will handle it in an ABI-compliant way (allocating e.g.
     16 bytes for it on Darwin and x86-64 platforms). Loading/storing them
     always happens using instructions that only read/write 10 bytes, so
     we only have to take care to convert them to the actual extended type
     when indexing arrays/subscripting records (when records are no longer
     handled in an opaque way)

git-svn-id: branches/hlcgllvm@26041 -
2013-11-11 11:15:35 +00:00