Commit Graph

123 Commits

Author SHA1 Message Date
Jonas Maebe
1a0ffbc82b * fixed llvm compiler compilation with -O3/-Oodfa
git-svn-id: branches/debug_eh@40590 -
2018-12-18 21:13:56 +00:00
Jonas Maebe
b41cd1eb6a * synchronised with trunk till r40575
git-svn-id: branches/debug_eh@40576 -
2018-12-16 20:45:55 +00:00
Jonas Maebe
e69b4d2d9a * replaced some stray cpointerdef.create() calls with cpointerdef.getreusable()
git-svn-id: trunk@40572 -
2018-12-16 20:44:31 +00:00
Jonas Maebe
440026bb25 * synchronised with trunk till r40503
git-svn-id: branches/debug_eh@40504 -
2018-12-08 15:33:36 +00:00
Jonas Maebe
8a4947dba2 * don't do anything in thlcgllvm.allocallcpuregisters() like in
deallocallcpuregisters()

git-svn-id: trunk@40499 -
2018-12-08 15:31:41 +00:00
Jonas Maebe
fceb34dbd5 * converted tllvmpara contents from tlocation to toper, so we can also
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 -
2018-11-29 21:31:27 +00:00
Jonas Maebe
4cd6f59bc3 * changed create_hlcodegen into a procvar, so that we don't have to insert
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 -
2018-11-29 21:31:15 +00:00
Jonas Maebe
ccb7231744 * generate invoke instead of call when calling a function in a block that
catches exceptions

git-svn-id: branches/debug_eh@40405 -
2018-11-29 21:30:59 +00:00
Jonas Maebe
50ab607676 + customint torddef type to create arbitraty bit-width integers
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 -
2018-11-29 20:57:08 +00:00
Jonas Maebe
413a3599c1 * thlcgobj.g_unreachable() dummy implementation + llvm override
git-svn-id: trunk@40382 -
2018-11-28 19:23:22 +00:00
Jonas Maebe
20fea3607c * pass volatility information to llvm.memcpy
git-svn-id: trunk@40376 -
2018-11-26 22:30:05 +00:00
Jonas Maebe
0b246f3dbd * converted Boolean8 to an internal type, and mapped Boolean to the
new internal pasbool1(type) (part of mantis #34411)
   o apply the _Bool x86-64 parameter passing rules only to pasbool1

git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +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