they're an exact multiple of the ialignment size on LLVM. This prevents
both overalignment (e.g. remainder of 8 individual bytes on ARM
would be aligned to 8 bytes instead of 4 if typed as int64) and
underalignment (e.g. 32 bytes remainder of a record that needs to be
aligned to 8 bytes would be aligned to 1 or 4 bytes if types as
array of resp. bytes or longints)
git-svn-id: trunk@41444 -
* nested exception handling statments in one procedure need to be fixed
* clean up, finally factor out tcgprocinfo from psub at least
* extensive testing
git-svn-id: branches/debug_eh@41289 -
single ordinal, as such splitting is handled by LLVM itself (and handling
such split locations is currently not supported by our LLVM code generator)
git-svn-id: trunk@41199 -
hiding the method name of the wrapped routine
o also add a few more '&' prefixes to the generated wrapper code to
prevent issues when keywords are used as identifiers
git-svn-id: trunk@40634 -
size doesn't match the number of remaining bytes
o prevents a second "single" field of a record getting interpreted as a
"cardinal"
git-svn-id: trunk@40569 -
o also allow freeing temps in the middle of a routine for llvm (we won't
reuse them, but it results in better lifetime information)
git-svn-id: trunk@40502 -
* adapted string used for macOS/iOS version in triple in llvm IR files to
what clang expects (always a single digit patch version)
git-svn-id: branches/debug_eh@40431 -
texceptionstatehandler class + llvm overrides
+ added FPC_DummyPotentialRaise routine that gets called at the begin and end
of try-blocks to be able to catch hardware exceptions to a limited extent
with LLVM
git-svn-id: branches/debug_eh@40418 -
the parent exception frame (-> pop current exception label, invoke/call
reraise, push current exception label again)
git-svn-id: branches/debug_eh@40417 -
o use this flag to set the personality routine of a function if it uses
exception handlinga
o also define FPC_USE_PSABIEH if this target flag is set
o set this target flag for darwin/x86-64 if the compiler is compiled with
-dllvm
git-svn-id: branches/debug_eh@40415 -
store tai in them
+ support for direct symbol parameters to llvm routines (without first
loading them into register)
o needed to pass such symbols to llvm intrinsics
git-svn-id: branches/debug_eh@40414 -
parameter types in case it hasn't been called (because in that case
the defs of those parameters won't have been used and hence they
won't have been recorded for writing either)
git-svn-id: branches/debug_eh@40413 -
spilling, but we may need the type to insert bitcasts)
* load the la_catch symbol operand with loadref instead of loadsymbol,
as the latter sets refaddr_full and with llvm we use that to indicated
symbol names of named registers rather than data symbols (which in turn
prevents it from being processed for inserting bitcasts if necessary)
git-svn-id: branches/debug_eh@40412 -
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
o prevents dependency cycles that can cause llvm codegen units to init
before the cpu variants, which is bad since the llvm versions have to
override the cpu variants in their init code (+ added checks in the
init code that they are in fact initialised later)
git-svn-id: branches/debug_eh@40410 -
exceptions for LLVM (except on Windows targets, since they (will) use
their own kind of exception handling)
o ensure we generate an external function symbol definition for such
personality functions on LLVM
git-svn-id: branches/debug_eh@40402 -
referred by invoke instructions in exception catching blocks
o for now we won't actually use ABI-compliant exception handling, but we
need invoke/landingpad combinations for LLVM's control flow analyses to
correctly handle code involving exception handling
git-svn-id: branches/debug_eh@40401 -
o use this to handle non-power-of-two-sized parameters for llvm
o no general support in the parser/code generator, so don't expose
git-svn-id: trunk@40398 -
so that they can still be freed after the reference has been changed
(e.g. in case of array indexing or record field accesses) (mantis #33628)
git-svn-id: trunk@38814 -
indirectly depends on llvmpara and hence is initialised after instead
of before it (since llvmpara should override cpupara in its init code)
git-svn-id: trunk@36264 -
+ support for LLVM nil tai operands (will be used for terminating a daisy
chain of catch/filter clauses of landingpads): don't try to write it
git-svn-id: trunk@35160 -
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 -
TP-style object to another and the sizes differ, at least if they are
related
* restructured and commented the LLVM type conversion checks
git-svn-id: trunk@35137 -
floating point type to currency, as fptosui is defined as always rounding
to zero while on other platforms we use the FPU's current rounding mode
(fixes webtbs/tw21449 for LLVM, and also webtbs/tw24197 because LLVM's
code generated for fptosui temporarily changes the FPU control word so
it rounds to zero and also to disable FPU exceptions)
git-svn-id: trunk@35061 -
add such symbols to the pseudo-arrays llvm.compiler.used or llvm.used
depending on their nature (fixes compiling Objective-C programs with
optimization, and keeps the FPC ident in the linked binary)
git-svn-id: trunk@35041 -
typed constant does not match the equivalent LLVM definition (it's only
used to check whether any emitted data's type differs from the LLVM
definition's field types)
o fixed a potential out-of-bounds access related to this: the index of the
equivalent LLVM field kept getting increased and at some point we checked
whether the current emitted data's type was different from the LLVM field
type without verifying first that the LLVM equivalent field index was not
yet beyond the number of LLVM equivalent fields
git-svn-id: trunk@35018 -
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 -
o separate information for reading and writing, because e.g. in a
try-block, only the writes to local variables and parameters are
volatile (they have to be committed immediately in case the next
instruction causes an exception)
o for now, only references to absolute memory addresses are marked
as volatile
o the volatily information is (should be) properly maintained throughout
all code generators for all archictures with this patch
o no optimizers or other compiler infrastructure uses the volatility
information yet
o this functionality is not (yet) exposed at the language level, it
is only for internal code generator use right now
git-svn-id: trunk@34996 -
stored in more than one register (has a self and a code pointer), instead
of assuming it always occupies more than one register if the original
procdef had a self pointer (can be different when getting the address
of a static class procedure)
git-svn-id: trunk@34976 -
get randomly passed as either byval or not (while they don't contain any
data and hence this can't cause bugs in the generated code, it can cause
signature mismatches in llvm)
git-svn-id: trunk@34956 -
o ensure that the label's local "jumpbuf" variable gets moved to the
parentfpstruct soon enough
o don't generate global symbols for interprocedural labels: they're not
necessary if they are only used via setjmp/longjmp (all references are
local in that case), and if they are referenced via an assembler block
then we'll have to handle them by passing a blockaddress() expression
as parameter to that assembler block (which does not require a global
symbol, but which is not yet implemented)
git-svn-id: trunk@34946 -
o temporarily encode the uses of '$' for references to function-level inline
assembly arguments as '^', because those have to remain/become a single
'$'
git-svn-id: trunk@34898 -
writer decorators (for LLVM function-level inline assembly: there
newline has to be replaced by the character sequence '\0A')
git-svn-id: trunk@34854 -
string constants instead of giving an internal error if we can't find it in
the current context (in most cases it will exist, but not when inlining a
routine from another unit that accesses a locally declared string constant)
git-svn-id: trunk@34373 -
it was AT_NONE, which is invalid and should never be used
* explicitly pass the correct value for all calls to those methods elsewhere
in the compiler
git-svn-id: trunk@34250 -
symbol is defined
o removed all places where AB_INDIRECT symbols were explicitly generated
o only generate AB_INDIRECT symbols for AT_DATA on systems_indirect_var_imports
o for some symbols an indirect symbol is always required (because they are
dereferenced by code in RTL units) -> use new AT_DATA_FORCEINDIRECT type
git-svn-id: trunk@34165 -
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 -
list, so that the assembler directives generated for Darwin are emitted
correctly for LLVM
o extracted the library init code generation from hlcgobj to pmodules so
we don't add things to another list than what's passed to
gen_proc_symbol_end(), and so it's done where we generate the init
routine for libraries (rather then checking for every routine whether
it's the init routine for a library)
o removed the llvm-specific gen_proc_symbol_end() because the regular one
now does the same
git-svn-id: trunk@34134 -
moved the code to create the procedure start/end etc. that was at the
call sites of g_external_wrapper() into the new g_external_wrapper()
-> got rid of the x86-specific code in expunix, and fixed expunix for
llvm (e.g. tests/test/tlib1{a,b})
git-svn-id: trunk@34131 -
methods. Implementing a fully functional g_external_wrapper() for llvm is
quite hard, and the regular wrapper method that calls FPC_ABSTRACTERROR can
in principle be optimized to a plain jump by tail call optimisation on other
targets (to the extent that this matters, because most of them will be
smartlinked away, and the ones that are executed will trigger an exception)
o this means that the synthetic method generation needs to be run for all
objectdefs on all platforms now, rather than only for Java classes
git-svn-id: trunk@34127 -
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 -
of the same size -> ensure that this is the case for the shifts in
a_bit_test/set_reg_reg_reg() (fixes tests/tbs/tb0219.pp for llvm)
git-svn-id: trunk@34123 -
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 -
(e.g. an empty record): return an "undefined" instance of the result
type (since it's empty, its contents are irrelevant). Before, we
returned "void", but that means returning nothing rather than returning
something empty (part of fixing test/tnoext4 for llvm)
git-svn-id: trunk@34119 -
const builder, it can only initialise the function pointer part of the
complex procvar -> convert the to-size to an address-only version of
the complex procvar to avoid us trying to bitcast an address into a
record containing both the function and self/nestedfp pointer
(fixes test/tmaclocalprocparam4e for llvm)
git-svn-id: trunk@34118 -
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 -
always be different from the old location, since we just allocated
the registers for the new one above. Should the old registers ever
be needed again for tai_varloc: rr.old/rr.oldhi contains it
git-svn-id: trunk@34086 -
are the same in case of open arrays (their size can't be determined at
compile time) -- this is just a sanity check, which can't be performed in
this case
git-svn-id: trunk@33979 -
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 -
inserttypeconv()
o keep typeconversions between structurally equivalent but semantically
different procvardefs for LLVM and JVM, because they're different
types there
git-svn-id: trunk@32904 -
o individual elements are not (yet) dead-strippable on LLVM though,
there doesn't seem to be a way to encode the necessary information
in LLVM (so e.g. all resource strings from a unit are currently
always linked in if at least one is referenced)
git-svn-id: trunk@32802 -
o reduces the size of the generated LLVM IR, but mainly important for LLVM
intrinsics such as llvm.memcpy.*(), as llc complains if some of their
parameters are not constants (you could work around it by first running
opt or by using clang with optimizations so that the constants, which
were loaded in registers until now, were propagated to the intrinsics
by the time llc saw them)
git-svn-id: trunk@32776 -
than the one we use to construct the LLVM equivalent (which doesn't support
variants), or in case the complete record is not defined in the source and
has to be padded with zeroes
o we do this by creating a new recorddef in this case with as elements the
defs of the actually emitted constant data, and replacing the original
def with this new def; note that this can also replace arrays in case of,
e.g., an array of a variant record type
o the pass in llvmtype takes care of inserting type conversions (bitcasts)
when these constants are accessed using the original def
git-svn-id: trunk@32719 -
def representing that string type, instead of using p(wide)char
o these string types are represented the same in llvm as p(wide)char,
but this way we can check whether the emitted data type matches the
expected one in the future
git-svn-id: trunk@32715 -
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 -
* 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 -
as bytes in the LLVM type, so typecast them to the correct type (which is
the size that will be used by hlcg.a_load*subsetref*)
git-svn-id: trunk@32565 -
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 -
if the it's an addn/subn. For comparisons, the resultdef is boolean, and
left and right will already have the same type (with addn/subn, one could
be a pointer and the other an integer)
git-svn-id: trunk@32523 -
dbg_state is not sufficient to determine whether or not a def has
already been processed or not -> use stab_number (and reset it)
o also record all defs we don't emit "type" instruction for, but which
we still process to find other defs, so we reset those too
git-svn-id: trunk@32520 -
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 -
afterwards use hlcg.gen_load_cgpara_loc() to convert it to the Pascal
level tdef (and otherwise we try to do this twice). For non-Pascal
level calls, the code generator will automatically convert the
type if necessary when using the function result location, because
its def is (now) set to llvmretdef
git-svn-id: trunk@32475 -
they exist even if we try to read them before writing to them (e.g.
because they represent the uninitialised function result of an
inlined function)
git-svn-id: trunk@32465 -
a bitcast that reads from and writes to the same register doesn't
work well
* changed pointerdef parameters of g_ptrtypecast_reg()/ref() to regular tdef
so that these routines can also be used with procvardefs (which are pointers,
but not pointerdefs), except for the fromdef of g_ptrtypecast_ref() as this
one has to call a_loadaddr_ref_reg() (which needs the pointeddef, and getting
that is not possible for non-pointerdefs)
git-svn-id: trunk@32417 -
only required when calling a routine that returns a procvardef or
if it's a C-style varargs routine, but it's always allowed and
always doing it simplifies procvar handling
git-svn-id: trunk@32416 -
thlcgobj.g_set_addr_nonbitpacked_field_ref() and adjusted it so that
it also works for objects/classes (if the incoming reference points
to the start of the class contents)
o factored out the related code from tllvmsubscriptnode
git-svn-id: trunk@32411 -