Commit Graph

121 Commits

Author SHA1 Message Date
florian
1142fdeccd * initialize variables to avoid warnings
git-svn-id: trunk@32428 -
2015-11-21 14:14:30 +00:00
Jonas Maebe
f60a33f5af * moved darwin/aix-specific code for resource string sections to
ttai_lowleveltypedconstbuilder (will have to be handled differently
    for llvm)

git-svn-id: trunk@32427 -
2015-11-21 12:37:53 +00:00
Jonas Maebe
4974201d7f + provide way to specify a custom section name for vectorized dead strippable
sections
   o does nothing by default, will be used by llvm

git-svn-id: trunk@32398 -
2015-11-21 12:36:20 +00:00
Jonas Maebe
91abc54314 * implemented emitting items in a vectorized dead strippable section to
high level typed constant builder
  * converted resource string emission to this system

git-svn-id: trunk@32395 -
2015-11-21 12:36:10 +00:00
Jonas Maebe
96b529072a * factored out generating the start and end of a vectorized dead strippable
section to the high level typed const builder, and use this functionality
    for the resource strings (generating items: todo)
  * fixed dead stripping unused resource strings (all string data was put in the
    same section since r30342)

git-svn-id: trunk@32394 -
2015-11-21 12:36:06 +00:00
Jonas Maebe
964f8c9f9b * factored out the creation of start/end symbols of vectorized dead strippable
sections such as the resourcestring data

git-svn-id: trunk@32391 -
2015-11-21 12:35:56 +00:00
Jonas Maebe
998cdbfe79 - removed useless ansistring pointer def creation from r32209
git-svn-id: trunk@32210 -
2015-10-30 20:56:34 +00:00
Jonas Maebe
0dee7cb4a0 * converted emitting resourcestring references to the high level typed
constant builder

git-svn-id: trunk@32209 -
2015-10-30 20:45:22 +00:00
yury
b26fa07f1a * Fixed notes "var is assigned but not used".
git-svn-id: trunk@31734 -
2015-09-17 13:03:04 +00:00
Jonas Maebe
fa7ebba80d + new tcalo_no_dead_strip flag for the high level typed const builder to
indicate symbols that should never be removed by the linker
   o TODO for llvm, needs support for the @llvm.used array (only used for
     the compiler ident, so it's not that important

git-svn-id: trunk@31677 -
2015-09-14 16:10:51 +00:00
Jonas Maebe
f7948ff25f * removed outdated comment
git-svn-id: trunk@31650 -
2015-09-12 23:33:31 +00:00
Jonas Maebe
5a2217f645 + support for emitting simple placeholder elements in the high level
typed const builder, for use when e.g. emitting a table preceded by
    the number of elements in case that number is only known afterwards

git-svn-id: trunk@31648 -
2015-09-12 23:33:24 +00:00
Jonas Maebe
7def77dcc9 * we only support resourcestrings in ttai_typedconstbuilder.queue_emit_const()
right now, so give an internalerror if something else is passed
  * use the correct type when emitting a resourcestring like that (it will store
    the address of the resource string -> pointer to an ansistring)

git-svn-id: trunk@31646 -
2015-09-12 23:33:17 +00:00
Jonas Maebe
c946a85ae6 * give an internalerror if a typed const builder is finalised while there
is still an unfinished aggregate

git-svn-id: trunk@31254 -
2015-07-30 16:58:14 +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
0e42559047 * support for queueing an access to a series of fieldvarsyms by name in the
typed const builder

git-svn-id: trunk@31251 -
2015-07-30 16:58:04 +00:00
Jonas Maebe
6f4fe415e9 * support specifying the alignment of the start of an anonymous record
in the typed const builder (packrecords is not enough in case there are
    only fields smaller than the desired alignment)

git-svn-id: trunk@31250 -
2015-07-30 16:58:01 +00:00
Jonas Maebe
6f5905684f + support for specifying the name of fields added to anonymous record
types that are constructed on the fly by the high level typed const
    builder

git-svn-id: trunk@31249 -
2015-07-30 16:57:58 +00:00
Jonas Maebe
413680f593 * factored out getting a previously created internal type by name
git-svn-id: trunk@31247 -
2015-07-30 16:57:52 +00:00
Jonas Maebe
ddeab221c0 * when starting a queued expression, immediately emit any necessary padding
bytes,becayse if we emit them at the end then we may interpret the first
    padding byte as the final component of the queued expression

git-svn-id: trunk@31246 -
2015-07-30 16:57:49 +00:00
Jonas Maebe
7a8b5fd6c5 * several fixes for emitting aggregate typed constants with C/ABI packing:
o don't emit explicit padding bytes (LLVM adds them)
   o don't mark them in LLVM as packed either

git-svn-id: trunk@31187 -
2015-07-03 20:04:15 +00:00
Jonas Maebe
508828958c * changed getprocaddressprocvar() into a tprocvardef.getreusableprocaddr()
class method

git-svn-id: trunk@31148 -
2015-06-23 21:23:22 +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
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
8d0c5ecf5a * added protected queue_is_active() function to determine whether the
complex typed constant expressions queue is currently active

git-svn-id: trunk@31058 -
2015-06-13 22:48:31 +00:00
Jonas Maebe
b5081d76c6 * since we insert the internal ansistring record types in the symtable of
the current module, also search it only there so that it doesn't depend
    on the state of the symtablestack (hopefully fixes mantis #28109)

git-svn-id: trunk@30879 -
2015-05-17 18:11:13 +00:00
Jonas Maebe
bd8079f896 * cache and reuse procvardefs internally created to get the address of a
procdef (halves the amount of memory needed to compile the googlapi
    package using a build unit, as done by fpmake)

git-svn-id: trunk@30856 -
2015-05-14 15:36:20 +00:00
Jonas Maebe
65bcfdc42d * support changing the tai field of a tai_simpletypedconst afterwards,
so we can insert type conversions in llvmtype if necessary

git-svn-id: trunk@30780 -
2015-05-03 16:50:58 +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
a8db5e3dfb * fixed alignment of widestring on win64 after llvm branch merge (should use
packrecords 4) (mantis #27806)

git-svn-id: trunk@30501 -
2015-04-08 19:08:43 +00:00
Jonas Maebe
7b4bf9cc33 * fixed comment for emit_ansi/unicodestring_const() after changing those
class methods into instance methods

git-svn-id: trunk@30401 -
2015-04-01 15:43:07 +00:00
Jonas Maebe
a30f0bc289 * fixed -Oodfa warnings
git-svn-id: branches/hlcgllvm@30350 -
2015-03-28 12:28:21 +00:00
Jonas Maebe
f631430775 * made the allocation of labels for internal data in typed const builders
overridable, and implement those routines for llvm

git-svn-id: branches/hlcgllvm@30348 -
2015-03-28 11:34:04 +00:00
Jonas Maebe
25e6eaf07f * store the to be used recordalignmin and maxcrecordalign settings inside
(abstract)recordsymtables, so that these settings don't depend on the
    current user settings when internally creating record definitions

git-svn-id: branches/hlcgllvm@30343 -
2015-03-27 21:25:56 +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
158116392c + ttai_typedconstbuilder.start_internal_data_builder() and
ttai_typedconstbuilder.finish_internal_data_builder() to generate data
    will only be referenced by the typed const that we are currently
    generating. Takes care of creating an appropriate label/section for
    this data, avoiding needless global symbols and sections.

git-svn-id: branches/hlcgllvm@30339 -
2015-03-27 21:25:43 +00:00
Jonas Maebe
687bb15299 * renamed getdatalabel() to getglobaldatalabel
git-svn-id: branches/hlcgllvm@30336 -
2015-03-27 21:25:34 +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
c1e7c9de02 * support for flushing a ttai_typedconstbuilder queue with an ordinal
constant at the end (in case of e.g. ordinal -> pointer type
    conversions)

git-svn-id: branches/hlcgllvm@30128 -
2015-03-07 21:43:57 +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
Jonas Maebe
f6e486a8b5 + ttai_typedconstbuilder.emit_procdef_const() helper
git-svn-id: branches/hlcgllvm@28780 -
2014-10-06 20:54:31 +00:00
Jonas Maebe
b84e9a3577 * mark asmsymbols created for procdefs as AT_FUNCTION
git-svn-id: branches/hlcgllvm@28779 -
2014-10-06 20:54:28 +00:00
Jonas Maebe
3b6269c5d9 - removed unused list parameter from emit_string_const_common()
git-svn-id: branches/hlcgllvm@28778 -
2014-10-06 20:54:25 +00:00
Jonas Maebe
a0decd4a79 + ttai_typedconstbuilder.emit_ord_const() helper
git-svn-id: branches/hlcgllvm@28775 -
2014-10-06 20:54:17 +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
984491e435 * factored out emitting a shortstring constant via the typed constant builder
git-svn-id: branches/hlcgllvm@28771 -
2014-10-06 20:54:07 +00:00
Jonas Maebe
2ed100666d * pack ansi/wide/unicodestring "records" at 1 byte so that we don't "pad"
the string to a multiple of sizeof(pint) (the string record itself is still
    aligned to a multiple of that)

git-svn-id: branches/hlcgllvm@28766 -
2014-10-06 20:53:54 +00:00
Jonas Maebe
76e0ee7a41 * fixed adding padding bytes before anonymous records: the alignment of such
records is only known once we have completely parsed all of their data
    (the alignment of a record depends on the alignment requirements of its
     field with the largest alignment) -> only insert the padding bytes after
    completely parsing them

git-svn-id: branches/hlcgllvm@28765 -
2014-10-06 20:53:51 +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
6560b1dbd6 * emit alignment directive in the typed constant builder when starting a new
constant without putting it in a separate section

git-svn-id: branches/hlcgllvm@28755 -
2014-10-06 20:53:25 +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
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
6cc74cd115 + added missing begin_anonymous_record() for widestring constants (undetected
before because it only matters for the llvm target, and fpc+llvm+windows is
    not yet supported/tested)

git-svn-id: branches/hlcgllvm@28749 -
2014-10-06 20:53:09 +00:00
Jonas Maebe
cc4482d6f8 - removed tck_simple_procvar2proc, instead use
procdef.getcopyas(procvardef,pc_address_only) as the def if we want to
    specify that we're interested in the address of a procedure/procvar of
    object

git-svn-id: branches/hlcgllvm@28476 -
2014-08-19 20:22:11 +00:00
Jonas Maebe
6e09fcb744 * fixed ansi/unicodestring constants on non-llvm/darwin platforms after
r28327

git-svn-id: branches/hlcgllvm@28404 -
2014-08-13 19:25:45 +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
5144a0d1e6 * only start a new object file for typed const data if we are instructed
to start a new section (no smart linking in the middle of section data)

git-svn-id: branches/hlcgllvm@28325 -
2014-08-06 18:04:33 +00:00
Jonas Maebe
c84a8a4bc2 * separate methods to get the size of the ansistring/unicode header and to
get the offset relative from the returned label from
    emit_(ansi|unicode)_string() to the start of the string data
   o corrected return value for the offset on LLVM: it's always equal to the
     header size, since we can't emit labels in the middle of structured data
     there

git-svn-id: branches/hlcgllvm@28324 -
2014-08-06 18:04:31 +00:00
Jonas Maebe
7a10959aa0 + support for parsing structured data for which no tdef is available in
advance (e.g. ansistring constants, as they consist of a header
    followed by an array of char equal to the string length, or RTTI data)
   o use begin_anonymous_record() to start recording the field types (if
     necessary for the current target), and end_anonymous_record() at the
     end to generate the recorddef

git-svn-id: branches/hlcgllvm@28323 -
2014-08-06 18:04:28 +00:00
Jonas Maebe
53a5ccbfba * fixed some comments so they correspond to the current implementation
git-svn-id: branches/hlcgllvm@28319 -
2014-08-06 18:04:15 +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
8afffdb176 * moved get_string_symofs() to a virtual class method of
ttai_typedconstbuilder so that it can be overridden by other platforms
  * override get_string_symofs() for LLVM and always return 0, as you can't
    have labels in the middle of a declaration on that platform

git-svn-id: branches/hlcgllvm@28140 -
2014-07-03 22:28:21 +00:00
Jonas Maebe
a284902813 * emit the current offset when flushing tasmsymbols in the
ttai_lowleveltypedconstbuilder
   o set the offset to 0 in the llvm constbuilder before calling
     the lowlevel one, because it incorporates this offset already
     via getelementptr instructions

git-svn-id: branches/hlcgllvm@28136 -
2014-07-02 17:25:02 +00:00
Jonas Maebe
e0c1c4d3bf + support for merging multiple tai_strings/tai_consts emitted as part of the
same string constant to be merged together into a single tai_string
    (required to efficiently represent string constants in llvm assembler
     --i.e., without splitting them into bytes--, while keeping the
     flexibility in the typed constant parser to mix individual elements
     and strings)

git-svn-id: branches/hlcgllvm@28135 -
2014-07-02 17:24:59 +00:00
Jonas Maebe
9f39188253 * moved the tai_*typedconst classes to aasmcnst to make use of def-related
helpers in a cleaner way (defutils would not belong in the uses clause of
    aasmtai)

git-svn-id: branches/hlcgllvm@28132 -
2014-07-02 17:24:50 +00:00
Jonas Maebe
02ad2e4879 + unit with a buider class for typed constant/initialised data elements at
the assembler level
   o initially for use during the typed constant parsing, but usable anywhere
     we generate initialised data in the compiler

git-svn-id: branches/hlcgllvm@28117 -
2014-07-01 16:30:37 +00:00