Commit Graph

89 Commits

Author SHA1 Message Date
Jonas Maebe
d99d18e258 - removed useless empty asmwrite statement
git-svn-id: trunk@35037 -
2016-12-02 12:32:51 +00:00
Jonas Maebe
26f9dabf56 * write the volatile flag for LLVM load/store operations if set
git-svn-id: trunk@35004 -
2016-11-27 21:44:32 +00:00
Jonas Maebe
4d951780d1 + support for LLVM 3.8 and LLVM 3.9 IR to the llvm assembler writer
git-svn-id: trunk@35003 -
2016-11-27 21:44:29 +00:00
Jonas Maebe
ef90b46e52 * comment fix
git-svn-id: trunk@34958 -
2016-11-24 19:47:48 +00:00
Jonas Maebe
3b7d9447ae * blockaddress creates a constant operand for another opcode, it's not an
independent operation
   o additionally, it does not take a "label" qualifier for its label argument

git-svn-id: trunk@34944 -
2016-11-21 07:39:05 +00:00
Jonas Maebe
e1e3ad15f0 * escape all occurrences of '$' in function-level inline assembly
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 -
2016-11-13 22:10:00 +00:00
Jonas Maebe
43e599d6be * fixed function-level inline assembly constraints in case there are no
parameters

git-svn-id: trunk@34897 -
2016-11-13 22:09:57 +00:00
Jonas Maebe
c4ae040258 + support for writing LLVM function-level inline assembly blocks
git-svn-id: trunk@34891 -
2016-11-13 16:06:29 +00:00
Jonas Maebe
1c23218375 * pass the parameter list directly to getparas()
git-svn-id: trunk@34888 -
2016-11-13 16:06:20 +00:00
Jonas Maebe
bdfd588b47 * free the temporary assembler writer created for writing the code of pure
assembler routines

git-svn-id: trunk@34887 -
2016-11-13 16:06:17 +00:00
Jonas Maebe
af297e849c + function-level LLVM inline assembly decorator
git-svn-id: trunk@34855 -
2016-11-09 19:51:30 +00:00
Jonas Maebe
646385e966 * support for overriding the line ending character in external assembler
writer decorators (for LLVM function-level inline assembly: there
    newline has to be replaced by the character sequence '\0A')

git-svn-id: trunk@34854 -
2016-11-09 19:51:27 +00:00
Jonas Maebe
74a49b5f91 * restructured the the TExternalAssembler constructors so that the
hack for the Jasmin descendent is no longer needed

git-svn-id: trunk@34852 -
2016-11-09 19:51:20 +00:00
Jonas Maebe
999cb7de6d + LLVM 3.7 support in the LLVM IR writer
git-svn-id: trunk@34550 -
2016-09-20 21:44:06 +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
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
14ab43626f * don't write initialisation values for AB_EXTERNAL_INDIRECT
git-svn-id: trunk@33956 -
2016-06-12 09:20:51 +00:00
Jonas Maebe
44839ba0c0 * handle AB_INDIRECT and AB_EXTERNAL_INDIRECT in the llvm assembler writer
git-svn-id: trunk@33721 -
2016-05-20 20:51:28 +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
nickysn
e1f21fb1e3 + handle the asd_cpu directive (commented out, but without producing an internal
error) on all the remaining external assemblers, so it is safe to emit on all
  platforms

git-svn-id: trunk@33122 -
2016-02-26 20:50:41 +00:00
Jonas Maebe
e3f8f8c974 * fixed position of "weak" linkage flag
git-svn-id: trunk@32915 -
2016-01-10 17:22:14 +00:00
Jonas Maebe
5959f45694 * emit custom Objective-C names in the LLVM assembler writer
git-svn-id: trunk@32912 -
2016-01-10 17:22:06 +00:00
Jonas Maebe
53bf43983a + support for emitting weak symbols with the high level typed constant builder
git-svn-id: trunk@32883 -
2016-01-07 22:06:06 +00:00
Jonas Maebe
58ae32e2d1 * factored out writing the LLVM linkage flags, take into account version
differences and also write them for procdefs

git-svn-id: trunk@32882 -
2016-01-07 22:06:00 +00:00
Jonas Maebe
110a5642c0 - removed ait_weak/tai_weak, and replaced it with the previously existing
asd_weak_reference/asd_weak_definition directives

git-svn-id: trunk@32879 -
2016-01-07 22:05:38 +00:00
Jonas Maebe
c452e70f74 + support for a reference without base or symbol, if the offset is 0
(for @ptrtype(0)^.field expressions)

git-svn-id: trunk@32777 -
2015-12-28 15:06:15 +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
787caf4dda * treat records with {$packrecords c} the same as other records for LLVM
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 -
2015-12-25 21:05:22 +00:00
Jonas Maebe
2342ee467b * don't write the parameter names for external function declarations in llvm,
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 -
2015-11-24 20:10:28 +00:00
Jonas Maebe
1284032765 + llvm blockaddress() intrinsic (supported as of LLVM 3.5.1)
git-svn-id: trunk@32409 -
2015-11-21 12:36:55 +00:00
Jonas Maebe
91e8f4c439 + custom section name support for llvm
git-svn-id: trunk@32400 -
2015-11-21 12:36:26 +00:00
Jonas Maebe
1675c27e59 * fixed writing of procvardef records (they're also written as tck_record)
git-svn-id: trunk@32298 -
2015-11-12 22:00:25 +00:00
Jonas Maebe
75012405fa * add some llvm function flags
o in particular, mark fpc_setjmp as "returns_twice" so calls to it are
     never converted into tail calls

git-svn-id: trunk@31659 -
2015-09-12 23:34:04 +00:00
Jonas Maebe
2741b37f28 * only specify the "unnamed_addr" flag for initialised data if its symbol is
a tasmlabel, since otherwise the address needs to remain unique

git-svn-id: trunk@31654 -
2015-09-12 23:33:46 +00:00
Jonas Maebe
7a08319d2e * converted taillvmdecl properties to a set
git-svn-id: trunk@31653 -
2015-09-12 23:33:42 +00:00
Jonas Maebe
839482751d * when generating code for a pure assembler routine with LLVM, instantiate
a code and temp generator for the architectural target instead of for LLVM
  * write the code for pure assembler routines using a GNU-style external
    assembler writer for the target, with a decorator to wrap it in
    LLVM module-level assembly statements

git-svn-id: trunk@31633 -
2015-09-12 23:32:31 +00:00
Jonas Maebe
5c69d57674 + TLLVMModuleInlineAssemblyDecorator to decorate inline module-level
assembly

git-svn-id: trunk@31632 -
2015-09-12 23:32:28 +00:00
Jonas Maebe
c80fb6a20e * explicitly specify whether an llvm specification is a definition (= locally
defined) or a declaration (external symbol), instead of deriving it from
    from the bind of the tasmsymbol. The reason is that with module-level
    inline assembly, some locally implemented functions (in pure assembler)
    won't have an LLVM IR body

git-svn-id: trunk@31629 -
2015-09-12 23:32:17 +00:00
Jonas Maebe
991e1f49bd * store a pointer to the used tasminfo record in every assembler writer, so
that we can use assembler writers with different conventions from the
    currently set target_asm (e.g. an x86 assembler writer for inline assembly
    in LLVM IR)

git-svn-id: trunk@31628 -
2015-09-12 23:32:13 +00:00
Jonas Maebe
b3d0197f98 * factored out the output file handling (mostly writing data) from the
external assembler writer, so we can reuse the archtecture-specific
    writers to write inline assembly in LLVM IR files

git-svn-id: trunk@31625 -
2015-09-12 23:32:01 +00:00
Jonas Maebe
1cdaf8e332 * don't write external linkage for aliases: llvm 3.6 has a bug that rejects
linkage types for aliases (or its documentation hasn't been updated), and
    external linkage is the default so it doesn't matter for earlier versions

git-svn-id: trunk@31284 -
2015-08-05 21:05:52 +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
54dd25b448 * support llvm aliases for defs other than procdef
git-svn-id: trunk@31052 -
2015-06-13 22:48:14 +00:00
Jonas Maebe
4eea652576 * fixed writing non-default linkage and visibility of llvm alias declarations
git-svn-id: trunk@31051 -
2015-06-13 22:48:11 +00:00
Jonas Maebe
d546e74d1c * don't write newlines after nested taillvm instructions (since they're
embedded in the middle of another instruction)

git-svn-id: trunk@30779 -
2015-05-03 16:50:55 +00:00
Jonas Maebe
72277f5098 * store the used tabstractprocdef when generating an llvm call instruction,
because due to aliasing symbols a single symbol may be called using
    different procdefs (e.g. FPC_ANSISTR_UNIQUE in the system unit is defined
    as an alias for a function and called as a procedure). This means we have
    to insert extra type conversions for llvm, which requires both the source
    and destination type

git-svn-id: trunk@30776 -
2015-05-03 16:50:43 +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
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
07141e92d3 + support for llvm "undef" operand
git-svn-id: trunk@30669 -
2015-04-19 21:37:27 +00:00