Commit Graph

124 Commits

Author SHA1 Message Date
Jonas Maebe
dd733bd5b5 * changed all size parameters in the temp manager from longint to asizeint
git-svn-id: branches/hlcgllvm@28488 -
2014-08-19 20:22:42 +00:00
Jonas Maebe
344acef9b5 * separate tracking the def of a temp and whether or not it needs to be
finalised (for llvm, we always keep track of the def)

git-svn-id: branches/hlcgllvm@28485 -
2014-08-19 20:22:34 +00:00
Jonas Maebe
3b7f43ad77 * renamed (hl)gettemptyped() to (hl)gettempmanaged() to better indicate the
meaning

git-svn-id: branches/hlcgllvm@28484 -
2014-08-19 20:22:32 +00:00
Jonas Maebe
9d118567cd + support for a_call_reg() on the llvm target (can call simple procvars now)
git-svn-id: branches/hlcgllvm@28480 -
2014-08-19 20:22:21 +00:00
Jonas Maebe
bd3f0b3ada * factored out the common calling code from a_call_name (to reuse in
a_call_reg()

git-svn-id: branches/hlcgllvm@28478 -
2014-08-19 20:22:16 +00:00
Jonas Maebe
b6fc2f1542 * don't emit the */pointer suffix for procdefs in llvmaddencodedtype_intern(),
so that if a_loadaddr_ref_reg() is used to load the address of a procdef
    into a register, the getpointerdef(procdef) won't (wrongly) result in two
    *'s
   o the previous behaviour was necessary for the tck_simple_procvar2proc
     special case that was removed in the previous commit

git-svn-id: branches/hlcgllvm@28477 -
2014-08-19 20:22:13 +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
4e3f504caa * don't try to check whether the last parameter of a cdecl function is a
varargs parameter if it doesn't have any parameters

git-svn-id: branches/hlcgllvm@28399 -
2014-08-12 23:17:43 +00:00
Jonas Maebe
6aafe209d0 + llvm second_length() implementation (can't use generic one because of its
use of cg.makeregsize())

git-svn-id: branches/hlcgllvm@28389 -
2014-08-12 18:59:19 +00:00
Jonas Maebe
a2e0f729c6 * use the correct opcode when loading integer pointer constants (such as nil)
git-svn-id: branches/hlcgllvm@28386 -
2014-08-12 18:59:10 +00:00
Jonas Maebe
0867b6e4f8 * added missing {$i fpcdefs.inc}
git-svn-id: branches/hlcgllvm@28378 -
2014-08-10 19:40:34 +00:00
Jonas Maebe
4acd43c643 * don't force simple function results in memory
o results in simpler code, and more importantly is required for some code
     that expects a LOC_REGISTER after calling certain system unit helpers
     (e.g. in ncgutil.new_exception)

git-svn-id: branches/hlcgllvm@28375 -
2014-08-10 19:40:26 +00:00
Jonas Maebe
ac4c455991 * handle non-integer/non-record memory destinations in gen_load_cgpara_loc()
git-svn-id: branches/hlcgllvm@28374 -
2014-08-10 19:40:24 +00:00
Jonas Maebe
50274f58b6 * ignore get/unget/alloc/dealloc of cpu registers when generating llvm code
o there are no cpu registers on the llvm target, but generic code may still
     occasionally allocate them via the generic routines in case of e.g. a
     hardcoded use of a function return register

git-svn-id: branches/hlcgllvm@28373 -
2014-08-10 19:40:21 +00:00
Jonas Maebe
0aab46b97f + tllvmtypeconvnode.second_int_to_bool() implementation
git-svn-id: branches/hlcgllvm@28370 -
2014-08-10 19:40:13 +00:00
Jonas Maebe
53e1d5c26f * fixed optimised form of a_cmp_const_reg_label(): when inverting the branch, we still
have to emit the label we originally allocated for the fallthrough path (otherwise
    the branch is not inverted at all, and moreover the caller will also emit the
    original target label somewhere so it will be doubly defined)

git-svn-id: branches/hlcgllvm@28367 -
2014-08-10 19:40:06 +00:00
Jonas Maebe
6ab2c00ac6 * recognise LOC_CREFERENCE in tllvmsubscriptnode.handle_platform_subscript()
git-svn-id: branches/hlcgllvm@28364 -
2014-08-10 19:39:58 +00:00
Jonas Maebe
f70865fc1f * moved tjvmnotnode implementation to generic ncghlmat unit, and also use it
for llvm

git-svn-id: branches/hlcgllvm@28363 -
2014-08-10 19:39:55 +00:00
Jonas Maebe
39fa81eaa0 * fixed passing of C-style varargs parameters
git-svn-id: branches/hlcgllvm@28357 -
2014-08-10 13:19:29 +00:00
Jonas Maebe
db54588afa * when calling a procdef that either returns a procvardef or that accepts
(C-style) varargs, you have to specify the full function definition
    rather than only its result

git-svn-id: branches/hlcgllvm@28356 -
2014-08-10 13:19:26 +00:00
Jonas Maebe
bae1f72896 * handle cdecl varargs parameters in llvm procdef string representations
git-svn-id: branches/hlcgllvm@28355 -
2014-08-10 13:19:24 +00:00
Jonas Maebe
9225d43ccf * free temporary return parameter instance
git-svn-id: branches/hlcgllvm@28354 -
2014-08-10 13:19:10 +00:00
Jonas Maebe
ec77e64adc * fixed returns from functions that return their result in a parameter
git-svn-id: branches/hlcgllvm@28353 -
2014-08-10 13:18:59 +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
9e074d036b * migrated the handling of ansi/unicodestring constants to the high level
typed constant builder + llvm implementation

git-svn-id: branches/hlcgllvm@28327 -
2014-08-06 18:04:40 +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
c84a8a4bc2 * separate methods to get the size of the ansistring/unicode header and to
get the offset relative from the returned label from
    emit_(ansi|unicode)_string() to the start of the string data
   o corrected return value for the offset on LLVM: it's always equal to the
     header size, since we can't emit labels in the middle of structured data
     there

git-svn-id: branches/hlcgllvm@28324 -
2014-08-06 18:04:31 +00:00
Jonas Maebe
7a10959aa0 + support for parsing structured data for which no tdef is available in
advance (e.g. ansistring constants, as they consist of a header
    followed by an array of char equal to the string length, or RTTI data)
   o use begin_anonymous_record() to start recording the field types (if
     necessary for the current target), and end_anonymous_record() at the
     end to generate the recorddef

git-svn-id: branches/hlcgllvm@28323 -
2014-08-06 18:04:28 +00:00
Jonas Maebe
5a49727cdf * moved functionality to create a global recorddef based on a tfplist of
tdefs to the new trecorddef.create_global_from_deflist() constructor

git-svn-id: branches/hlcgllvm@28322 -
2014-08-06 18:04:24 +00:00
Jonas Maebe
4f906fb9c9 * fixed datadef for untyped string constants (terminating #0 is one
character, not two)

git-svn-id: branches/hlcgllvm@28320 -
2014-08-06 18:04:19 +00:00
Jonas Maebe
2a45b57504 * removed todo comment, the "constant" information is already propagated in
the mean time via the section type (sec_rodata/sec_rodata_norel ->
    constant)

git-svn-id: branches/hlcgllvm@28212 -
2014-07-12 22:42:37 +00:00
Jonas Maebe
5c8e723cf8 * handle the fact that we emit constant strings that can be longer or shorter
than their type at the Pascal level

git-svn-id: branches/hlcgllvm@28211 -
2014-07-12 22:42:31 +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
9fada1a238 * don't internalerror when typecasting voidpointer^ or formaldef
git-svn-id: branches/hlcgllvm@28208 -
2014-07-12 22:42:15 +00:00
Jonas Maebe
27e350fa9a + llvm implementation of second_int_to_real()
git-svn-id: branches/hlcgllvm@28207 -
2014-07-12 22:42:11 +00:00
Jonas Maebe
4746e17be5 * implemented second_int_to_int() for llvm
o the generic implementation ignores the need for bitcasts from pointers to
     ordinals and vice versa, and also hacks around with offsets

git-svn-id: branches/hlcgllvm@28206 -
2014-07-12 22:14:37 +00:00
Jonas Maebe
1c9932d921 * llvm implementation of tmoddivnode
o doesn't reuse the generic code generator methods, as the div-to-mul/shift
     optimization can be performed by llvm if necessary

git-svn-id: branches/hlcgllvm@28205 -
2014-07-12 22:14:22 +00:00
Jonas Maebe
8ca4c80785 * mark tasmsymbols as declared in the taillvmdecl constructor so that we
don't have to do this everywhere such a declaration is generated

git-svn-id: branches/hlcgllvm@28202 -
2014-07-12 22:13:50 +00:00
Jonas Maebe
b494f76b81 * made internalerror unique
git-svn-id: branches/hlcgllvm@28201 -
2014-07-12 22:13:39 +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
e18e98b540 * changed the type of the forcesize parameter of gethltemp() and friends
from aint to asizeint (fixes range check warning/error when compiling
    the AVR backend)

git-svn-id: branches/hlcgllvm@28147 -
2014-07-03 22:28:43 +00:00
Jonas Maebe
fc7d5e2254 * insert a type conversion if the final result of an queued expression is
different from the type of typed constant/initialised data

git-svn-id: branches/hlcgllvm@28146 -
2014-07-03 22:28:40 +00:00
Jonas Maebe
ab186e8d75 * override queue_emit_staticvar() and set the offset to 0 there for the same
reason as with queue_emit_asmsym()

git-svn-id: branches/hlcgllvm@28145 -
2014-07-03 22:28:38 +00:00
Jonas Maebe
b520fb12be * call def2regtyp via the chlcgobj class reference so it also works when
hlcg is nil

git-svn-id: branches/hlcgllvm@28144 -
2014-07-03 22:28:35 +00:00
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