Commit Graph

68 Commits

Author SHA1 Message Date
Jonas Maebe
ad0299e0cd * cleanup of r34444
git-svn-id: trunk@34482 -
2016-09-10 16:16:48 +00:00
Jonas Maebe
997a958f72 * fixed r34439 for big endian
git-svn-id: trunk@34444 -
2016-09-07 16:09:10 +00:00
Jonas Maebe
473cec9d85 * converted tnodeutils.InsertRuntimeInits() to the high level typed const
builder

git-svn-id: trunk@34443 -
2016-09-07 16:09:06 +00:00
Jonas Maebe
26f6d2f39d * emit smallsets as a single byte/word/cardinal, since that is how they
are handled in the code generator (and ncgcon) as well

git-svn-id: trunk@34439 -
2016-09-06 21:28:30 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
Jonas Maebe
68cbbe677a * fixed type information for C-block typed constants (fixes
tests/test/tblock1.pp for llvm)

git-svn-id: trunk@34152 -
2016-07-19 14:30:33 +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
c71bc54785 * when emitting the procedure address part of a complex procvar, type
that address as an "address-only" procvar instead of supposedly
    emitting a complex procvar itself as the address part of that same
    complex procvar type (part of fixing test/tmaclocalprocparam4e.pp
    for llvm)

git-svn-id: trunk@34117 -
2016-07-14 15:18:01 +00:00
Jonas Maebe
8e2607d96d * data for bitpacked arrays is part of an aggregate
git-svn-id: trunk@34032 -
2016-06-30 15:33:40 +00:00
Jonas Maebe
b8ed0fac5d * give an error when trying to get the address of an element of a dynamic
string in a typed constant, like Delphi (instead of generating a bogus
    address)

git-svn-id: trunk@33958 -
2016-06-12 09:20:57 +00:00
Jonas Maebe
092a0af0ec * removed special-purpose code for constant chars while parsing typed string
constants: it did not properly handle ansistring code pages, and was just a
    hack to speed things up a bit (mantis #29153)

git-svn-id: trunk@32636 -
2015-12-11 15:33:28 +00:00
Jonas Maebe
8f57609ef2 * fixed types for classrefdef typed constants
git-svn-id: trunk@32471 -
2015-11-22 11:49:36 +00:00
Jeppe Johansen
0046af39eb Fixed #29025.
Some architecture bit-nesses were missing.

git-svn-id: trunk@32442 -
2015-11-21 17:05:00 +00:00
Jonas Maebe
8d8851afd6 * set minimum alignment for pchar to 1 instead of 0 (llvm doesn't
support alignment 0)

git-svn-id: trunk@32405 -
2015-11-21 12:36:42 +00:00
svenbarth
0ff87336aa Convert the Boolean parameters accept_equal, typeonly and hadspecialize of comp_expr(), sub_expr() and factor() to a set parameter and adjust all calls.
pexpr.pas:
  + new enum texprflag and corresponding set texprflags
  * comp_expr: replace accept_equal and typeonly with texprflags parameter
  * factor: replace typeonly and hadspecialize with texprflags parameter
  * sub_expr: replace accept_equal and typeonly with texprflags parameter
  * adjust calls to comp_expr(), factor() and sub_expr()
other units:
  * adjust calls to comp_expr(), factor() and sub_expr() 

git-svn-id: trunk@32269 -
2015-11-07 21:45:03 +00:00
nickysn
072139cdb7 * fixed ofs(procedure) as well
git-svn-id: trunk@32205 -
2015-10-30 19:30:33 +00:00
Jonas Maebe
e93660c170 - removed ttai_lowleveltypedconstbuilder.queue_addrn(), as we are always
implicitly taking the address of a complex expression in a typed constant
    (you cannot put the contents of another memory location in a typed
    constant)

git-svn-id: trunk@31252 -
2015-07-30 16:58:07 +00:00
Jonas Maebe
f40ea04540 * changed getarraydef() into a tarraydef.getreusable() class method
git-svn-id: trunk@31147 -
2015-06-23 21:23:18 +00:00
Jonas Maebe
9ceddf9b16 * fix tasmlisttypedconstbuilder memory leaks
git-svn-id: trunk@30851 -
2015-05-14 14:42:25 +00:00
Jonas Maebe
93fcdb9a5a * fixed initialisation of procvar typed const with a pointerconstn:
we start a typeconversion queue before, so we have to emit to that
    queue as well (to get all the type conversions)

git-svn-id: trunk@30850 -
2015-05-14 14:42:22 +00:00
Jonas Maebe
d71f6e9840 - removed extraneous maybe_begin_aggregate() when a procvar is initialised
with a pointerconstn, and moved the maybe_end_aggregate() for all procvar
    initialisation cases to a common location

git-svn-id: trunk@30849 -
2015-05-14 14:42:19 +00:00
Jonas Maebe
3be51e1455 * fixed endless recursion in tabstractrecorddef.contains_float_field() in
case a record contains an internal typed constant of its own type
    (which happened becuase such a typed constant is also fieldvarsym, solved
     by checking for sp_static) (mantis #27880)
  * fixed several other similar cases in the compiler where we are only
    interested in instance fields, but processed all fieldvarsyms

git-svn-id: trunk@30614 -
2015-04-16 21:25:22 +00:00
Jonas Maebe
419a97cce8 * changed emit_ansistring_const() and emit_unicodestring_const() into
instance methods that make use of the internal data builder
    functionality so they automatically place all string data in the
    same section if possible

git-svn-id: branches/hlcgllvm@30342 -
2015-03-27 21:25:53 +00:00
Jonas Maebe
6ed273eec5 * support specifying the name of an internal data section
git-svn-id: branches/hlcgllvm@30341 -
2015-03-27 21:25:50 +00:00
Jonas Maebe
a76aba4a20 * converted a number of string data generators to the internal data builder
functionality

git-svn-id: branches/hlcgllvm@30340 -
2015-03-27 21:25:47 +00:00
Jonas Maebe
5e1bb8e408 + tcalo_make_dead_strippable to indicate that a typed constant data block
should be dead-strippable; may imply the creation of a separate section
    (on platforms that dead-strip data based on sections), but does not
    require it
  * replaced all existing tcalo_new_section uses with
    tcalo_make_dead_strippable, as that is their meaning/purpose

git-svn-id: branches/hlcgllvm@30335 -
2015-03-27 21:25:30 +00:00
Jonas Maebe
e924dbed90 * moved the specification of the options for a ttai_typedconstbuilder from
get_final_asmlist() to the constructor, in preparation of supporting the
    creation of internal builders for local data that will ignore some of the
    irrelevant flags (at creation time)

git-svn-id: branches/hlcgllvm@30334 -
2015-03-27 21:25:27 +00:00
Jonas Maebe
765044aede * fixed a number of (mostly false) warnings regarding uninitialised
variables with -Oodfa

git-svn-id: branches/hlcgllvm@30244 -
2015-03-15 21:10:50 +00:00
Jonas Maebe
b931f78b4b * insert a type conversion from ordinal to pointer for pointerconstn
git-svn-id: branches/hlcgllvm@30129 -
2015-03-07 21:44:01 +00:00
Jonas Maebe
9c42437326 * moved tasmlisttypedconstbuilder.tc_emit_string_offset() to
ttai_typedconstbuilder.emit_string_offset() so it can also be used outside
    the context of parsing a Pascal-level typed constant

git-svn-id: branches/hlcgllvm@30111 -
2015-03-06 19:45:04 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
florian
461821d1a5 * read array initializations in generic subroutines without fixed limits, resolves #25602
git-svn-id: trunk@29598 -
2015-02-01 17:09:00 +00:00
Károly Balogh
37cf157d7d initialize pd to fix a warning with O3+
git-svn-id: trunk@29518 -
2015-01-22 12:07:50 +00:00
Jonas Maebe
146e3bcb9e * synchronised with trunk till r29513
git-svn-id: branches/blocks@29516 -
2015-01-21 23:28:34 +00:00
Jonas Maebe
e97f31541e - reverted partial commit of merge
git-svn-id: branches/blocks@29515 -
2015-01-21 23:24:37 +00:00
Jonas Maebe
a76bbf363d * synchronised with trunk r29513
git-svn-id: branches/blocks@29514 -
2015-01-21 23:18:29 +00:00
sergei
6708b83a16 * Refactor tasmlisttypedconstbuilder so it emits string/PChar data, if any, into a second asmlist, instead of appending it directly to global asmlist.
git-svn-id: trunk@29513 -
2015-01-20 15:14:38 +00:00
Jonas Maebe
634d2931e2 * use ttai_typedconstbuilder.emit_ord_const() when emitting ordinal constants
git-svn-id: branches/hlcgllvm@28776 -
2014-10-06 20:54:20 +00:00
Jonas Maebe
e07933212b * factored out emitting a guid const
git-svn-id: branches/hlcgllvm@28773 -
2014-10-06 20:54:12 +00:00
Jonas Maebe
5a9b931e5c * renamed ttai_lowleveltypedconstbuilder to ttai_typedconstbuilder
git-svn-id: branches/hlcgllvm@28764 -
2014-10-06 20:53:49 +00:00
Jonas Maebe
d2b55b6f07 * moved the recording of aggregate type information during typed constant
parsing from nllvmtcon to aasmcnst
   o added automatic insertion of padding bytes when fields need to be aligned,
     so that once ncgvmt (and hopefully ncgrtti) are converted to the typed
     constant builder class, we can get rid of all the explicit alignment
     directives (only supported for non-bitpacked records for now)

git-svn-id: branches/hlcgllvm@28763 -
2014-10-06 20:53:46 +00:00
Jonas Maebe
bdfb6d81e5 * don't emit padding bytes if there was an error parsing a typed constant
record

git-svn-id: branches/hlcgllvm@28758 -
2014-10-06 20:53:33 +00:00
Jonas Maebe
210b532832 * split up specifying the type of the section of a typed constant and whether
it should be put in a new section

git-svn-id: branches/hlcgllvm@28753 -
2014-10-06 20:53:20 +00:00
sergei
d88e0df1ba * Fixed another case of emitting data without defining a section. Mantis #26473.
git-svn-id: trunk@28730 -
2014-10-03 11:19:25 +00:00
Jonas Maebe
d26e6278ba * don't free node before using its resultdef in an error message
git-svn-id: trunk@28699 -
2014-09-20 23:08:22 +00:00
Jonas Maebe
9e074d036b * migrated the handling of ansi/unicodestring constants to the high level
typed constant builder + llvm implementation

git-svn-id: branches/hlcgllvm@28327 -
2014-08-06 18:04:40 +00:00
Jonas Maebe
bd09b88a5b + support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension)
o blocks are implemented as a variation of procedure variables
   o declaration of a block variable: "test: procedure(c: char) is block;"
     (C equivalent: (void)(^test)(char c) )
   o the compiler automatically converts procedures/functions whose address
     is passed to a block parameter or assigned to a block variable into
     a "block". This consists of
    1) generating a block descriptor (containing the size of the "block
       literal" (see below) and the signature of the invocation function
       encoded as an Objective-C selector)
    2) generating a wrapper function around the original funcion (with C
       calling convention), that has an extra first hidden parameter
       (marked as vo_is_parentfp in the compiler) whose type is a pointer
       to the describing "block literal"
    3) generating the "block literal", which contains a pointer to an
       external variable indicating whether this block captures context or
       not, some flags (see compiler/blockutl.get_block_literal_flags for
       info), a pointer to the wrapper function and a pointer to the
       descriptor. In the future, it will also contain captured variables.
   o right now, only global procedures/functions can be converted to blocks
     (because they don't require state capturing). The next steps are (Object
     Pascal) methods (not Objective-C methods, because Objective-C method
     procvars don't exist) and finally nested functions
   o on Mac OS X, the functionality will only work on Mac OS X 10.7 and later,
     because we have to use the so-called "ABI.2010.3.16" to ensure that
     our blocks aren't called as variadic functions by the runtime (which
     came out after the Mac OS X 10.6 release)
   o while the currently implemented functionality does not require any
     library support at all, there's no use enabling it on other platforms
     because unless it has been confirmed to work with a blocks runtime,
     there's no point in using blocks (they're just somewhat bulky procvars
     right now). Enabling it on other platforms (in combination with the
     GNUStep Objective-C run time), should simply be a matter of adding
     the right {$linklib xxx} statement to rtl/inc/blockrtl.pp file, adding
     that file to Makefile.fpc for that platform and adding that platform
     to the compiler/systems.systems_blocks_supported set

git-svn-id: branches/blocks@28232 -
2014-07-18 09:15:22 +00:00
Jonas Maebe
063d50b4c9 * make the string data of p(wide)char string constants local (except when
using library-based smartlinking), as it is not exported

git-svn-id: branches/hlcgllvm@28167 -
2014-07-05 15:44:26 +00:00
Jonas Maebe
b94a524556 * converted emitting pwidechar typed constants to the typed constant builder
git-svn-id: branches/hlcgllvm@28141 -
2014-07-03 22:28:25 +00:00
Jonas Maebe
2d335baab8 * create only a single tai_string for shortstrings typed constants
whose type length is larger than the specified string
  * corrected place of ftcb.maybe_end_aggregate() call

git-svn-id: branches/hlcgllvm@28134 -
2014-07-02 17:24:56 +00:00