Commit Graph

182 Commits

Author SHA1 Message Date
Jonas Maebe
864f9b24cc * handle indexing implicit pointer types on llvm
git-svn-id: trunk@30723 -
2015-04-25 15:51:39 +00:00
Jonas Maebe
98c5f7d20f * simplify references before generating getelementptr instructions with them
git-svn-id: trunk@30722 -
2015-04-25 15:51:36 +00:00
Jonas Maebe
78e68b89df * gen_load_cgpara_loc() should only honour reusepara if it's a memory
parameter

git-svn-id: trunk@30721 -
2015-04-25 15:51:33 +00:00
Jonas Maebe
03a3136525 * since extended values are represented as "array[1..10] of byte" in records
for llvm in order to ensure that it doesn't allocate the ABI-specified
    size, we have to convert the resulting pointer to an array of 10 bytes
    into a pointer to extended when we subscript the record (like is already
    done for arrays)

git-svn-id: trunk@30720 -
2015-04-25 15:51:30 +00:00
Jonas Maebe
b9138a1c90 * changed the llvm type of comp/currency in parameter and return type
on platforms that use the x87 for these types to extended in order
    to gaurantee the expected parameter passing conventions

git-svn-id: trunk@30719 -
2015-04-25 15:51:27 +00:00
Jonas Maebe
491d9cfff1 * fixed reuse of the same register for different types in
a_loadaddr_ref_reg()

git-svn-id: trunk@30718 -
2015-04-25 15:51:25 +00:00
Jonas Maebe
b3e786eb77 - don't specify lef_inaggregate when getting the llvm type representation
for function results and parameters (they're not in an aggregate, and this
    caused 80 bits extended floating point types to be translated into arrays
    of 10 bytes, which have different ABI meanings)

git-svn-id: trunk@30714 -
2015-04-25 15:51:13 +00:00
Jonas Maebe
bb4f8e62bf * sign/zero-extend a Pascal boolean (translated to i1) when assigning to
an i8, even though both have byte size 1

git-svn-id: trunk@30713 -
2015-04-25 15:51:09 +00:00
Jonas Maebe
394091ab75 * don't generate parameter attributes for llvm function alias declarations
git-svn-id: trunk@30712 -
2015-04-25 15:51:06 +00:00
Jonas Maebe
70ffaba901 * ensure that the loading of the uninitialised function result for llvm
doesn't result in a temp allocation, since this can happen while
    generating the exit code

git-svn-id: trunk@30711 -
2015-04-25 15:51:04 +00:00
Jonas Maebe
f7b5ee64ae * always insert type conversion for pasbool to int on llvm, as pasbool is
represented by i1 while equally sized integers are i8

git-svn-id: trunk@30709 -
2015-04-25 15:50:58 +00:00
Jonas Maebe
62239ba890 * handle named registers correctly for fpu and mm loads
git-svn-id: trunk@30677 -
2015-04-19 21:37:52 +00:00
Jonas Maebe
3496129f79 * only handle a_load_const_ref() directly when storing ordinals, as in case
of pointers llvm only supports 0 (as null, which we don't generate either)

git-svn-id: trunk@30676 -
2015-04-19 21:37:49 +00:00
Jonas Maebe
e2cf90ad8a * add type declarations for structure types in the llvm code so that we can
handle recursive record references (rec= record prec: ^rec)
   o llvm unfortunately does not support recursive references to array types
     or function pointers, so those will currently still result in endless
     recursion when the compiler tries to write them out. Solving those
     will require a lot of typecasting in the generated code

git-svn-id: trunk@30675 -
2015-04-19 21:37:46 +00:00
Jonas Maebe
2bb4a729c0 * procvardefs must be encoded without any parameter attributes
git-svn-id: trunk@30673 -
2015-04-19 21:37:40 +00:00
Jonas Maebe
c8e44e4a7c * keep track of whether we're in an inline assembly block in the llvm
assembler writer, and for now skip writing labels if we are (they
    will have to emitted as part of an actual inline assembly block,
    not as llvm-style labels)

git-svn-id: trunk@30672 -
2015-04-19 21:37:37 +00:00
Jonas Maebe
4a25afb839 * load an undef value in the function result in the exit code of a pure
assembler function, as the inline assembly code itself will be
    responsible for returning the function result (we will have to add
    the "return" instruction to it) while llvm requires a terminator
    at the end of the function and it must return something

git-svn-id: trunk@30671 -
2015-04-19 21:37:34 +00:00
Jonas Maebe
ff3061a7cf + thlcgllvm.gen_load_uninitialized_function_result
git-svn-id: trunk@30670 -
2015-04-19 21:37:31 +00:00
Jonas Maebe
07141e92d3 + support for llvm "undef" operand
git-svn-id: trunk@30669 -
2015-04-19 21:37:27 +00:00
Jonas Maebe
6391794958 * fixed -Oodfa warnings
git-svn-id: trunk@30500 -
2015-04-08 19:08:39 +00:00
Jonas Maebe
af61923dc3 * don't write parameter attributes in procvardefs
git-svn-id: trunk@30499 -
2015-04-08 19:08:36 +00:00
Jonas Maebe
a8cefa8fcd - removed aggas.pas leftovers
git-svn-id: trunk@30498 -
2015-04-08 19:08:33 +00:00
Jonas Maebe
101fc3d4ec * translate formaldef into "i8*", as intended, instead of "i8**" due to
the fact that this type is always passed by reference

git-svn-id: trunk@30486 -
2015-04-07 19:35:22 +00:00
Jonas Maebe
f94f9f44e4 * convert all arguments to integers in case of comparisons of pointers with
constants on llvm, as you can only compare with "null" in that case
  * convert all arguments to integers in case of pointer subtractions,
    as pointer subtractions are not supported by llvm

git-svn-id: trunk@30485 -
2015-04-07 19:35:08 +00:00
Jonas Maebe
94aadb23ab + implemented getintparaloc() for llvm
git-svn-id: trunk@30430 -
2015-04-04 14:29:19 +00:00
Jonas Maebe
2336d22985 * override instr_get_oper_spilling_info and substitute_spilled_registers for
llvm (add support for top_para)

git-svn-id: trunk@30428 -
2015-04-04 14:29:12 +00:00
Jonas Maebe
e12dff9a5e * support top_para in trgllvm.get_spill_temp()
git-svn-id: trunk@30426 -
2015-04-04 14:29:06 +00:00
Jonas Maebe
ee7198aa57 * fixed memory leak in case one tai operand is replaced by another
git-svn-id: trunk@30424 -
2015-04-04 14:29:00 +00:00
Jonas Maebe
3279cc052a * moved llvm-specific code from aasmtai to aasmllvm
* call add_reg_instruction_hook() for top_para parameters

git-svn-id: trunk@30423 -
2015-04-04 14:28:57 +00:00
Jonas Maebe
2ef753faae * support llvm spilling_get_reg_type() for the destination of call/invoke
git-svn-id: trunk@30422 -
2015-04-04 14:28:54 +00:00
Jeppe Johansen
e2272c8a7e Added aitconst_gs for AVR pointer references to Flash.
git-svn-id: trunk@30419 -
2015-04-04 10:29:11 +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
e12bd99b59 * fixed compilation with -dllvm after r30343
git-svn-id: branches/hlcgllvm@30347 -
2015-03-28 11:34:02 +00:00
Jonas Maebe
5a2609933f * fixed crash in r30244 (we only have to get a new elementdef if we didn't
already initialise the location, and we won't get a new elementdef if
    the location is already assigned)

git-svn-id: branches/hlcgllvm@30346 -
2015-03-28 11:33:59 +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
bc7ba58798 * fixed compilation after removal of ait_set, ait_thumb_set and ait_symbol_pair
git-svn-id: branches/hlcgllvm@30243 -
2015-03-15 21:10:47 +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
eba3f534de * correctly handle empty ansistring constants for llvm
git-svn-id: branches/hlcgllvm@30127 -
2015-03-07 21:43:52 +00:00
Jonas Maebe
935c0c86aa * write all ait_const's of value 0 as 'zeroinitializer' so they also work
for pointer constants

git-svn-id: branches/hlcgllvm@30126 -
2015-03-07 21:43:47 +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
511e878606 * fixed pointer plus/minus integer on llvm (since a_op_* only gets a single
def, we have to ensure that both arguments have in fact the same type)

git-svn-id: branches/hlcgllvm@30108 -
2015-03-05 22:45:32 +00:00
Jonas Maebe
f9ae2aadac * fixed llvm unsigned greater/lower than condition mnemoniics
git-svn-id: branches/hlcgllvm@30107 -
2015-03-05 22:20:50 +00:00
Jonas Maebe
ea00e559f8 * fixed compilation after previous merge
git-svn-id: branches/hlcgllvm@30106 -
2015-03-05 22:20:45 +00:00
Jonas Maebe
cc596225fa + thlcg.g_ptrtypecast_reg/ref() to typecast a pointer in a register, or the
pointer type describing a reference, to another pointer type

git-svn-id: branches/hlcgllvm@28781 -
2014-10-06 20:54:33 +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
bdb22772d9 * fixed whitespace
git-svn-id: branches/hlcgllvm@28756 -
2014-10-06 20:53:28 +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