Commit Graph

78 Commits

Author SHA1 Message Date
Jonas Maebe
1516661249 + new chlcgobj class reference variable that can be used to call thlcg*
virtual methods even when hlcg doesn't contain a valid instance

git-svn-id: branches/hlcgllvm@28143 -
2014-07-03 22:28:31 +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
8afffdb176 * moved get_string_symofs() to a virtual class method of
ttai_typedconstbuilder so that it can be overridden by other platforms
  * override get_string_symofs() for LLVM and always return 0, as you can't
    have labels in the middle of a declaration on that platform

git-svn-id: branches/hlcgllvm@28140 -
2014-07-03 22:28:21 +00:00
Jonas Maebe
a284902813 * emit the current offset when flushing tasmsymbols in the
ttai_lowleveltypedconstbuilder
   o set the offset to 0 in the llvm constbuilder before calling
     the lowlevel one, because it incorporates this offset already
     via getelementptr instructions

git-svn-id: branches/hlcgllvm@28136 -
2014-07-02 17:25:02 +00:00
Jonas Maebe
e0c1c4d3bf + support for merging multiple tai_strings/tai_consts emitted as part of the
same string constant to be merged together into a single tai_string
    (required to efficiently represent string constants in llvm assembler
     --i.e., without splitting them into bytes--, while keeping the
     flexibility in the typed constant parser to mix individual elements
     and strings)

git-svn-id: branches/hlcgllvm@28135 -
2014-07-02 17:24:59 +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
7ca4ebee9d * fixed end of shortstring llvm def after r27015
git-svn-id: branches/hlcgllvm@28130 -
2014-07-02 17:24:44 +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
5b884c96f2 + initial llvm implementation of the ttai_typedconstbuilder class
o now simple typed constants (integer, floating pointer, pchar)
     and (non-variant) record typed constants containing such
     elements work for llvm

git-svn-id: branches/hlcgllvm@28124 -
2014-07-01 16:30:57 +00:00
Jonas Maebe
a0c39220b1 * fixed (harmless) typecast errors when creating a string representation of
a procvardef
  * handle procdefs like procvardefs when getting their string representation
    in arbitrary expressions

git-svn-id: branches/hlcgllvm@28123 -
2014-07-01 16:30:55 +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
a8b2b576ca + new llvmconvop() routine that determines the conversion operation to
convert one def to another, including information regarding whether
    it should be done via an intermediate integer typecast
  * use this routine in hlcgllvm

git-svn-id: branches/hlcgllvm@28116 -
2014-07-01 16:30:34 +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
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
Jonas Maebe
0283670041 * set location.size if we handle a subscript access in
handle_platform_subscript()

git-svn-id: branches/hlcgllvm@27136 -
2014-03-14 18:22:12 +00:00
Jonas Maebe
482eb86047 - disabled can_call_ref() for llvm
git-svn-id: branches/hlcgllvm@27017 -
2014-03-06 21:42:27 +00:00
Jonas Maebe
2cb84bda6e * generate integer type definitions for smallsets
git-svn-id: branches/hlcgllvm@27016 -
2014-03-06 21:42:24 +00:00
Jonas Maebe
7d61ecf5ba * changed shortstring llvm representation to a plain array of bytes, so
it can be directly indexed rather than that we need to separately
    select the byte or data (just like at the Pascal level, and how it
    is/will be handled in the code generator)

git-svn-id: branches/hlcgllvm@27015 -
2014-03-06 21:42:21 +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
bdc2aaec47 * fixed ansistring and unicodestring llvm defs (pointer indirection was
missing, and replaced by plain pointer because the array definition does
    not add any useful information)

git-svn-id: branches/hlcgllvm@27012 -
2014-03-06 21:42:10 +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
abee66b611 * optimized a_loadaddr_ref_reg() in cases where an offset is added to a
symbol or base register and the offset is a multiple of the def's size

git-svn-id: branches/hlcgllvm@27007 -
2014-03-06 21:41:53 +00:00
Jonas Maebe
c4869980e8 * fixed typo in comment
git-svn-id: branches/hlcgllvm@27006 -
2014-03-06 21:41:50 +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
161647f965 * simplified (incomplete) implementation of g_concatcopy() that simply calls
a_load_ref_ref (the llvm memcpy intrinsic can be lowered into a libc call,
    so we can't use it)

git-svn-id: branches/hlcgllvm@27004 -
2014-03-06 21:41:43 +00:00
Jonas Maebe
366baac98d * optimized version of a_load_ref_ref() in case the source has refaddr_full
(= "named register" in case of llvm)

git-svn-id: branches/hlcgllvm@27003 -
2014-03-06 21:41:40 +00:00
Jonas Maebe
fcbde1d6e9 + hlcg/llvm support for unary minus
o converted tcgunaryminusnode.emit_float_sign_change() to use a tdef instead
     of tcgsize

git-svn-id: branches/hlcgllvm@27002 -
2014-03-06 21:41:36 +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
cdfb23bf6c * converted some leftovers in tcgtypeconvnode.second_int_to_int/
second_real_to_real to thlcgobj
  + added type conversion to second_pointer_to_array for llvm

git-svn-id: branches/hlcgllvm@27000 -
2014-03-06 21:41:27 +00:00
Jonas Maebe
8cc9b64ad7 * don't discard typeconversion nodes that only change the result type when
compiling for llvm, because this type change also needs to be modelled in
    llvm IR

git-svn-id: branches/hlcgllvm@26999 -
2014-03-06 21:41:24 +00:00
Jonas Maebe
5e79789f9e + dummy mmregister allocator for platforms that use such registers
git-svn-id: branches/hlcgllvm@26998 -
2014-03-06 21:41:19 +00:00
Jonas Maebe
bc0d4bbc87 + support second_cmpfloat (just call through to second_addfloat, where the
comparisons are already implemented)

git-svn-id: branches/hlcgllvm@26997 -
2014-03-06 21:41:16 +00:00
Jonas Maebe
532d623be7 + support for encoding records/objectdefs in LLVM-speak
git-svn-id: branches/hlcgllvm@26991 -
2014-03-06 21:40:52 +00:00
Jonas Maebe
20a8175bf1 + support for subscript nodes in LLVM
git-svn-id: branches/hlcgllvm@26990 -
2014-03-06 21:40:49 +00:00
Jonas Maebe
e70175a10e * added extra boolean parameter to getelementptr taillvm constructors to
indicate whether or not an implicit indirection should be added (always
    was done until now)

git-svn-id: branches/hlcgllvm@26989 -
2014-03-06 21:40:46 +00:00
Jonas Maebe
98be5b0825 * correctly handle loads/stores of aggregate types if the source and
destination types are different: the pointer types of the load/store must
    be converted in that case, rather than the loaded/to be stored value
    (you can't bitcast aggregates in LLVM)

git-svn-id: branches/hlcgllvm@26987 -
2014-03-06 21:40:39 +00:00