Commit Graph

112 Commits

Author SHA1 Message Date
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
Jonas Maebe
d69ad8fa41 * removed temppos field again from parameter locations: they're not allocated
by the temp manager of the current procedure

git-svn-id: trunk@38858 -
2018-04-27 19:18:55 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
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 -
2018-04-22 17:03:16 +00:00
Jonas Maebe
04ac44cd37 - removed dependency of hlcgllvm on llvmpara, so that cpupara no longer
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 -
2017-05-19 21:52:37 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
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 -
2016-11-27 18:17:37 +00:00
Jonas Maebe
7ebbb744e9 * also specify sret attribute at the caller side
git-svn-id: trunk@34302 -
2016-08-13 14:47:42 +00:00
Jonas Maebe
819f0c39fa * specify the "byval" attribute also at the caller side
git-svn-id: trunk@34301 -
2016-08-13 14:47:39 +00:00
Jonas Maebe
f417ed6576 * internalerror in case a reference's alignment is not set in
thlcgllvm.make_simple_ref_ptr()

git-svn-id: trunk@34299 -
2016-08-13 14:47:34 +00:00
Jonas Maebe
2f0c3ce8cc * fixed updating the reference alignment in thlcgllvm.g_set_addr_nonbitpacked_field_ref()
git-svn-id: trunk@34298 -
2016-08-13 14:47:31 +00:00
Jonas Maebe
a83f3c1a45 * fix maximum common alignment calculation in g_concatcopy() (if the second
parameter of newalignment() is larger than the first, the result is always
    1)

git-svn-id: trunk@34295 -
2016-08-13 14:47:23 +00:00
Jonas Maebe
f4015f6ac9 * fixed wrong class cast in case arrays/records are passed to a_loadfpu*()
(fixes tests/webtbs/tw26993.pp for llvm)

git-svn-id: trunk@34280 -
2016-08-12 13:35:31 +00:00
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
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 -
2016-08-05 07:09:16 +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
687adbefd7 + support for LOC_VOID parameters in llvm for empty records (fixes
tests/test/tnoext4.)

git-svn-id: trunk@34136 -
2016-07-15 14:35:17 +00:00
Jonas Maebe
c05fa52775 * call g_concatcopy() from a_load_ref_ref() if the size of the to be copied
data is big, because large load/store operations result in very slow code
    (and takes forever to generate by llc)

git-svn-id: trunk@34135 -
2016-07-15 14:34:43 +00:00
Jonas Maebe
88a736c95a * moved the code generated for library init/fini to the al_pure_assembler
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 -
2016-07-15 14:34:11 +00:00
Jonas Maebe
c7ea921066 * renamed thlcgobj.g_external_wrapper() into a_jmp_external_name(), and
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 -
2016-07-14 15:26:40 +00:00
Jonas Maebe
9b7e7c5298 + support absolute addresses on llvm (fixes tests/webtbs/tw12685 for llvm)
git-svn-id: trunk@34124 -
2016-07-14 15:22:31 +00:00
Jonas Maebe
458ba2efac * unlike other architectures, llvm requires that both operands of shl/shr are
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 -
2016-07-14 15:21:37 +00:00
Jonas Maebe
2148a20d6a * fixed returning results from functions that have a zero-sized result
(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 -
2016-07-14 15:19:09 +00:00
Jonas Maebe
571d053a60 - removed tabstractnormalvarsym.currentregloc: the new location will
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 -
2016-07-08 07:46:51 +00:00
Jonas Maebe
b5cb7a5d4f * factored out loading of integers from memory into structs in registers or
vice versa, and generalised for floating point and mm registers
    (webtbs/tw26993.pp)

git-svn-id: trunk@34031 -
2016-06-30 15:33:37 +00:00
Jonas Maebe
eeae34ea7d * simplified handling of loading a reference into a register of a
larger size in case of structured types
   o also fixes the logic for big endian

git-svn-id: trunk@34029 -
2016-06-30 15:33:31 +00:00
Jonas Maebe
f2c1e4234f * use g_ptrtypecast_ref() in a_load_ref_reg() when we have to typecast
references

git-svn-id: trunk@34028 -
2016-06-30 15:33:27 +00:00
Jonas Maebe
c421171461 * fixed handling of fpu/mm loads from "named registers" in case they involve
a typecast from a struct to a scalar type (webtbs/tw26993)

git-svn-id: trunk@34027 -
2016-06-30 15:33:24 +00:00
Jonas Maebe
542b6b604e * missing closing comment
git-svn-id: trunk@34025 -
2016-06-30 15:32:50 +00:00
Jonas Maebe
5313db710b * override gen_stack_check_size_para() and gen_stack_check_call()
for llvm and do nothing (see comments in the code)

git-svn-id: trunk@33991 -
2016-06-15 18:31:58 +00:00
Jonas Maebe
b76539a049 * fixed handling of uninitialised complex function results
git-svn-id: trunk@33940 -
2016-06-09 22:00:05 +00:00
Jonas Maebe
ea54b6b2c5 * factored comp/currency-in-register handling out of a_loadfpu_reg_reg()
into llvmconvop() so it's also used by code using that routine

git-svn-id: trunk@33938 -
2016-06-09 21:59:58 +00:00
Jonas Maebe
9d2bba1917 * create a separate type and def for the LLVM "i1" type, because reusing
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 -
2016-05-20 20:51:44 +00:00
Jonas Maebe
4fff9645af * use tasmbind for llvm aliases and derive llvm flags from that
git-svn-id: trunk@33720 -
2016-05-20 20:51:25 +00:00
Jonas Maebe
d46fad1e7f * use provided name to a_call_name() instead of hardcoding pd.mangledname()
(so that Objective-C messaging and WPO procedure names are used)

git-svn-id: trunk@32910 -
2016-01-10 17:21:59 +00:00
Jonas Maebe
1c99adb411 * fix rol/ror for llvm
git-svn-id: trunk@32909 -
2016-01-10 14:02:06 +00:00
Jonas Maebe
0350369c6a * don't check for a simple result location when loading an uninitialised
function result: we always only use the first location's register

git-svn-id: trunk@32906 -
2016-01-10 14:01:54 +00:00
Jonas Maebe
ae7b17890a * support non-power-of-two records that have to be passed in MM registers
in a_load_ref_cgpara()

git-svn-id: trunk@32905 -
2016-01-10 14:01:50 +00:00
Jonas Maebe
35a170ed8e * don't internalerror when asked to set the function result of a function
returning an empty record to "uninitialized"

git-svn-id: trunk@32778 -
2015-12-28 15:06:22 +00:00
Jonas Maebe
b4fe4789d6 + support for constant call parameters on LLVM
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 -
2015-12-28 15:06:07 +00:00
Jonas Maebe
205136f924 * fixed the size used for setting uninitialised function results if it
has to be zero/sign-extended for ABI reasons

git-svn-id: trunk@32742 -
2015-12-26 20:01:38 +00:00
Jonas Maebe
4939c9a7b9 * implemented overflow checking for llvm
git-svn-id: trunk@32736 -
2015-12-26 20:00:44 +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
3ff265da88 * fixed rol/ror
git-svn-id: trunk@32556 -
2015-11-29 21:46:10 +00:00
Jonas Maebe
4f4d4d9456 * also support non-pointerdefs as first argument for g_ptrtypecast_ref()
via internal restructuring of the llvm code generator (so we can
    typecast e.g. a procvardef to a pointerdef)

git-svn-id: trunk@32550 -
2015-11-29 21:45:50 +00:00
Jonas Maebe
f97192edf9 * support typecasts in a_loadmm_ref_reg()
git-svn-id: trunk@32545 -
2015-11-27 14:44:35 +00:00
Jonas Maebe
4c720b8ba2 * fixed parameter order of llvm.memcpy call
git-svn-id: trunk@32533 -
2015-11-25 22:25:51 +00:00
Jonas Maebe
99c97c331a * keep the result type after a call as llvmretdef, because call nodes
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 -
2015-11-22 11:49:51 +00:00
Jonas Maebe
cc52730147 * typecast function results if an explicit type is forced
git-svn-id: trunk@32420 -
2015-11-21 12:37:30 +00:00
Jonas Maebe
00a5dd87c9 * allow g_ptrtypecast_reg() to allocate a new register, because spilling
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 -
2015-11-21 12:37:20 +00:00
Jonas Maebe
abd79d275f * always emit the procdef when calling a routine in llvm; this is
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 -
2015-11-21 12:37:17 +00:00
Jonas Maebe
eaeb9d8351 * renamed thlcgobj.g_set_addr_nonbitpacked_record_field_ref() to
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 -
2015-11-21 12:37:01 +00:00
Jonas Maebe
ba37a48bcb * support OS_32..OS_128 as source size for LOC_(C)MMREGISTER records
in a_load_ref_cgpara() (if a record is located in memory and needs
    to be passed in mmregisters)

git-svn-id: trunk@32402 -
2015-11-21 12:36:32 +00:00