Commit Graph

51 Commits

Author SHA1 Message Date
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
Jonas Maebe
a8cefa8fcd - removed aggas.pas leftovers
git-svn-id: trunk@30498 -
2015-04-08 19:08:33 +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
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
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
6677e698cd * record the alignment in taillvmdecl, as it can be different from the
default

git-svn-id: branches/hlcgllvm@28752 -
2014-10-06 20:53:17 +00:00
Jonas Maebe
cc4482d6f8 - removed tck_simple_procvar2proc, instead use
procdef.getcopyas(procvardef,pc_address_only) as the def if we want to
    specify that we're interested in the address of a procedure/procvar of
    object

git-svn-id: branches/hlcgllvm@28476 -
2014-08-19 20:22:11 +00:00
Jonas Maebe
575911dcb0 + support for (section-based) threadvars for LLVM
git-svn-id: branches/hlcgllvm@28352 -
2014-08-10 13:18:46 +00:00
Jonas Maebe
099588aaf5 * don't write comments in the LLVM IR about ait_section/ait_align elements,
as these can appear in the middle of aggregate constants and hence
    otherwise break the definition

git-svn-id: branches/hlcgllvm@28326 -
2014-08-06 18:04:36 +00:00
Jonas Maebe
bfe431913d * fixed writing hex-encoded characters in string constants
git-svn-id: branches/hlcgllvm@28209 -
2014-07-12 22:42:20 +00:00
Jonas Maebe
39074edf10 - removed the globalsymbolmangleprefix/suffix constants that were added for
llvm
  * instead, add LLVM-specific name mangling based on the asmsymbol's bind
    and typ whenever we write out its name

git-svn-id: branches/hlcgllvm@28166 -
2014-07-05 15:44:16 +00:00
Jonas Maebe
eef6f05697 * specify the asm section type when creating an LLVM declaration
o in case it's a read-only section, mark the data as "constant"

git-svn-id: branches/hlcgllvm@28155 -
2014-07-04 20:30:24 +00:00
Jonas Maebe
394dfdd220 * ensure that all initialised items have a type (and only one):
o remove the accompanying tdef operands from tai operands, because such
     tai operands should have a tdef already
   o check that every queued tai is a tai_simpletypedconst (which have a
     type)
   o wrap queued bitcast/getelementptr tai instances with a
     tai_simpletypedconst

git-svn-id: branches/hlcgllvm@28154 -
2014-07-04 19:24:20 +00:00
Jonas Maebe
5cf52bb957 * fixed writing nested conversion operations such as bitcast (missing
opening bracket)

git-svn-id: branches/hlcgllvm@28142 -
2014-07-03 22:28:28 +00:00
Jonas Maebe
9f39188253 * moved the tai_*typedconst classes to aasmcnst to make use of def-related
helpers in a cleaner way (defutils would not belong in the uses clause of
    aasmtai)

git-svn-id: branches/hlcgllvm@28132 -
2014-07-02 17:24:50 +00:00
Jonas Maebe
2af0b46792 - removed unused variables
git-svn-id: branches/hlcgllvm@28131 -
2014-07-02 17:24:47 +00:00
Jonas Maebe
3511aa4878 * don't write a tab character before an instruction that's a nested operand
git-svn-id: branches/hlcgllvm@28126 -
2014-07-01 16:31:03 +00:00
Jonas Maebe
1a77bc952e * immediate write out partial string respresentations of instructions
rather than first concatenating everything, because in case of
    instructions that have other tai as operands we have to ensure that
    all previous output is flushed before the tai-operand is evaluated
    (and written/flushed)

git-svn-id: branches/hlcgllvm@28125 -
2014-07-01 16:31:00 +00:00
Jonas Maebe
0c10cbe63b + support for tai_symbol (in nested typed constant expressions)
git-svn-id: branches/hlcgllvm@28122 -
2014-07-01 16:30:52 +00:00
Jonas Maebe
f89b2e2b26 + support for tai_string (in nested typed constant expressions)
git-svn-id: branches/hlcgllvm@28121 -
2014-07-01 16:30:49 +00:00
Jonas Maebe
204adf82c7 * handle tai_const instances as operands to other tai
git-svn-id: branches/hlcgllvm@28120 -
2014-07-01 16:30:46 +00:00
Jonas Maebe
f8f7c30f14 * support non-taillvm tai instances as operands to taillvm instances
git-svn-id: branches/hlcgllvm@28119 -
2014-07-01 16:30:43 +00:00
Jonas Maebe
da3e931d68 + support for tai_realconst in llvm assembler writer
git-svn-id: branches/hlcgllvm@28114 -
2014-07-01 16:30:27 +00:00
Jonas Maebe
8043254461 * factored out generating string representations of floating point numbers
in the llvm assembler writer

git-svn-id: branches/hlcgllvm@28113 -
2014-07-01 16:30:24 +00:00
Jonas Maebe
1e7d9c9f0e + support for instruction operands that are tai themselves in the llvm
backend (required for inserting bitcasts/ptrtoint/... operations inside
    typed constant declarations)
   o taillvm constructors for creating bitcast-style and getlementptr
     operations that accept a tai as their source/base operand

git-svn-id: branches/hlcgllvm@28112 -
2014-07-01 16:30:22 +00:00
Jonas Maebe
7ebb1b813f + basic support infrastructure in the llvm assembler writer to write out
typed constant data
   o llvm declarations now get an extra "initdata" list that contains the
     typed constant data associated with this declaration (if any)

git-svn-id: branches/hlcgllvm@28111 -
2014-07-01 16:30:19 +00:00
Jonas Maebe
1fdb16b615 * fixed indentation
git-svn-id: branches/hlcgllvm@28110 -
2014-07-01 16:30:16 +00:00
Jonas Maebe
1047cdadcb * factored out writing of a single tai, so this routine can call itself
recursively when writing out typed constant data
   o basic support for tai_const

git-svn-id: branches/hlcgllvm@28109 -
2014-07-01 16:30:13 +00:00
Jonas Maebe
b0ff41406a * grouped all tai_real* types into a single tai_realconst type,
to free up space for more ait_* types in taitype (can't have
    more than 32 because they have to fit in a small set)
   o factored out writing of floating point numbers as an array of
     byte in the external assemblers

git-svn-id: branches/hlcgllvm@28105 -
2014-07-01 16:29:58 +00:00
Jonas Maebe
0fd172ddf6 * ignore global labels with a comment for now, they're generated for
function symbol aliases

git-svn-id: branches/hlcgllvm@27014 -
2014-03-06 21:42:17 +00:00
Jonas Maebe
6dcfd73d21 + support for a_call_name() on the llvm target:
o make use of the fact that callparanodes always first load everything
     in temporary parameters (allocated via paramanager.createtempparaloc)
     -> we pass those temporary paralocs to the llvm call nodes and ignore
     the "real" locations with physical registers
   o all function results are forced to memory before handing them back
     to the generic code generator to avoid having to deal with special
     result locations and llvm<->pascal type differences (llvm removes
     the extra temp stores/loads while optimising)
   o ideally, the llvm code generator should share the common code with
      the generic code generator for a_load_ref_cgpara() at some point in
      the future

git-svn-id: branches/hlcgllvm@27013 -
2014-03-06 21:42:14 +00:00
Jonas Maebe
b82053ef40 * reworked handling of defined/declared symbols in llvm: we now automatically
generate declarations when external symbols are referred in a taillvm
    instruction
  * added "declared" field to tasmsymbol for llvm to make avoid declaring a
    symbol multiple times (harmless, but unnecessary)
  * all kinds of declarations/definitions are now handled using the new
    taillvmdecl, the old separate types have been removed

git-svn-id: branches/hlcgllvm@27010 -
2014-03-06 21:42:03 +00:00
Jonas Maebe
02ca215272 * reworked and fixed llvm procdef handling (except for variadic C functions):
o handle parameters and function results divided over multiple paralocs,
     including generating fake recorddefs that represent
   o fixed zero/sign extension handling
   o properly handle difference between procdefs as printed for the
    implementation, an alias declaration or a procvar definition

git-svn-id: branches/hlcgllvm@27009 -
2014-03-06 21:42:00 +00:00
Jonas Maebe
dad45d63b1 * improved symbol alias handling (pass in old sym instead of name, add
pointer add end of aliased procdef)

git-svn-id: branches/hlcgllvm@27008 -
2014-03-06 21:41:56 +00:00
Jonas Maebe
358b346bbc * fixed writing of constant operands outside the longint range
git-svn-id: branches/hlcgllvm@27005 -
2014-03-06 21:41:46 +00:00
Jonas Maebe
227ff0ea48 * llvm requires that single precision constants are exactly representable
using single precision -> convert them to single precision in the code
    generator

git-svn-id: branches/hlcgllvm@27001 -
2014-03-06 21:41:32 +00:00
Jonas Maebe
9902864cce * don't output alignments for reference operands to bitcast & co
git-svn-id: branches/hlcgllvm@26984 -
2014-03-06 21:40:29 +00:00
Jonas Maebe
9c674ff444 * made internalerror unique
git-svn-id: branches/hlcgllvm@26982 -
2014-03-06 21:40:21 +00:00
Jonas Maebe
0cc581825f * enabled darwin/ppc64 for the llvm target
git-svn-id: branches/hlcgllvm@26072 -
2013-11-12 19:22:50 +00:00