Commit Graph

72 Commits

Author SHA1 Message Date
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