Commit Graph

326 Commits

Author SHA1 Message Date
svenbarth
e4feacf29d Load global variables and typed constants from different units using indirect references if necessary.
ncgld.pas, tcgloadnode:
  + new method use_indirect_symbol to determine whether using an indirect reference is necessary at all
  * generate_threadvar_access & pass_generate_code: pass result of use_indirect_code() to RefAsmSymbol() for using an indirect access if needed

git-svn-id: trunk@33282 -
2016-03-18 22:27:28 +00:00
Jonas Maebe
4643913d58 - disable x86-specific workarounds when using LLVM (even when targeting x86)
git-svn-id: trunk@32782 -
2015-12-28 15:06:50 +00:00
Jeppe Johansen
f21f9ab930 Fix issue with absolute offsets being sign extended from aint to asizeint.
git-svn-id: trunk@32576 -
2015-12-03 21:43:39 +00:00
Jonas Maebe
0c4edd2aa9 * fixed getting address of interface methods after r32414: interfaces are not
a pointer to a vmt, but a pointer to a pointer to vmt (mantis #29086)
   o also adjusted the llvm type for interfaces accordingly

git-svn-id: trunk@32530 -
2015-11-25 19:28:17 +00:00
Jonas Maebe
554be0c301 * fixed hlcg type correctness when getting the address of a virtual method
o handle interfaces like classrefdef, since they also point to the vmt

git-svn-id: trunk@32414 -
2015-11-21 12:37:11 +00:00
Jonas Maebe
a3cdf466e3 * fixed type of proc address when loading a complex procvar
git-svn-id: trunk@32413 -
2015-11-21 12:37:08 +00:00
Jonas Maebe
eaeb9d8351 * renamed thlcgobj.g_set_addr_nonbitpacked_record_field_ref() to
thlcgobj.g_set_addr_nonbitpacked_field_ref() and adjusted it so that
    it also works for objects/classes (if the incoming reference points
    to the start of the class contents)
   o factored out the related code from tllvmsubscriptnode

git-svn-id: trunk@32411 -
2015-11-21 12:37:01 +00:00
Jonas Maebe
7ce34ac7d2 * fixed code generator type correctness when loading a resourcestring
git-svn-id: trunk@32403 -
2015-11-21 12:36:35 +00:00
Jonas Maebe
98c08dee1a * fixed indentation
git-svn-id: trunk@32246 -
2015-11-04 22:23:44 +00:00
Jonas Maebe
22d8b273bd * the type of tvarrec fields that are passed by address is already a pointer
-> don't make a double pointer

git-svn-id: trunk@32245 -
2015-11-04 22:23:41 +00:00
Jonas Maebe
9914f02faa * always set the resultdef for variant array constructors correctly, so we
don't need to pull all kinds of special tricks pass_generate_code

git-svn-id: trunk@32233 -
2015-11-04 20:46:10 +00:00
Jonas Maebe
2c5187cb97 * fixed size when storing arrayconstructor vtype field
git-svn-id: trunk@32215 -
2015-10-31 14:25:56 +00:00
Jonas Maebe
af4d69f446 * always write the entire integer field when storing a value < integer in an
arrayconstructor, so the upper bits get zeroed (tbs/tb0581)

git-svn-id: trunk@32214 -
2015-10-31 14:25:54 +00:00
nickysn
94a5364c2c * fixed 'array of const' in the i8086 tiny/small/medium memory models
git-svn-id: trunk@32212 -
2015-10-31 11:43:04 +00:00
Jonas Maebe
4670e0abc9 * converted "array of const" handling to the high level code generator
git-svn-id: trunk@32207 -
2015-10-30 20:45:15 +00:00
Jonas Maebe
3b2bd718d8 * corrected the def of the temp for array constructor nodes in case of
an array of const

git-svn-id: trunk@31777 -
2015-09-22 19:59:37 +00:00
yury
374148b966 * fixed compilation of 8086 compiler.
git-svn-id: trunk@31746 -
2015-09-17 16:30:02 +00:00
yury
47b316d0e2 * Removed unused vars for x86-64 compiler.
git-svn-id: trunk@31744 -
2015-09-17 15:26:31 +00:00
nickysn
c7ecf84fc0 * fixed compilation of threadvars in i8086 far data memory models
git-svn-id: trunk@31662 -
2015-09-13 12:52:23 +00:00
Jonas Maebe
19882aea7e * converted threadvar loading to high level code generator and updated/added
comments

git-svn-id: trunk@31644 -
2015-09-12 23:33:10 +00:00
Jonas Maebe
3c6aa91a96 * factored out the loading of threadvars in its own method, and put the
x86-specific part in nx86ld

git-svn-id: trunk@31639 -
2015-09-12 23:32:53 +00:00
Jonas Maebe
0fc1fd6ac1 * replaced current_procinfo.currtrue/falselabel with storing the true/false
labels of LOC_JUMP in the node's location. This generates some extra jumps
    for short circuit boolean and/or-expressions if optimizations are off, but
    with optimisations enabled the generated code is the same (except for JVM
    because the jump threading optimisation isn't enabled there yet).

git-svn-id: trunk@31431 -
2015-08-27 18:28:57 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
388cef8a34 * fixed types for shortstring handling in tcgassignmentnode.pass_generate_code
git-svn-id: trunk@30716 -
2015-04-25 15:51:19 +00:00
Jonas Maebe
61e4a1b811 + added tasmlist parameter to getintparaloc() (needed for llvm)
git-svn-id: trunk@30429 -
2015-04-04 14:29:16 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
290e3f5ff8 * fixed assigning one float loc_reference to another of a different size if a
platform does not support (hl)cg.a_loadfpu_*, but only (hl)cg.a_loadmm_*

git-svn-id: trunk@29820 -
2015-02-23 22:47:47 +00:00
Jonas Maebe
ac02c92a0d * disable cg64/cg128 special cases for high level targets
git-svn-id: branches/hlcgllvm@28365 -
2014-08-10 19:40:00 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
svenbarth
441e6c6083 Fix for Mantis #26177. Use the correct value for the method data when using a method pointer of a type or record helper.
Please note that Delphi has the exact same bug as we have and thus code working in FPC will not work in Delphi.
Additionally taking the method address of a local variable or a local/global constant for a method pointer is dangerous as the variable (in case of constants is a temporary local variable) will go out of scope once the containing procedure/function/method exits!

ncgld.pas, tcgloadnode.pass_generate_code:
  * only use the value of Self if it is an implicit pointer object (class instance) or a class reference, but not for everything else (objects, records, primitive types)

+added test

git-svn-id: trunk@28160 -
2014-07-05 08:54:10 +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
nickysn
24bf272c69 * fixed the passing of array of const parameters in i8086 far data memory models
git-svn-id: trunk@27700 -
2014-05-01 12:46:29 +00:00
nickysn
40a6a9c820 + added i8086 specific implementation of thlcgcpu.a_load_loc_ref, which handles
6-byte method pointers and other i8086 types that use loc.registerhi
* changed the i8086 specific code in tcgassignmentnode.pass_generate_code to
  use hlcg.a_load_loc_ref

git-svn-id: trunk@27555 -
2014-04-13 01:38:43 +00:00
nickysn
02988023b7 * tcgloadnode.pass_generate_code: fixes for i8086 far data model fixes in the
handling of method procsyms + even more ifdef i8086s removed

git-svn-id: trunk@27551 -
2014-04-12 19:59:04 +00:00
nickysn
68ff3fb1e2 * tcgloadnode.pass_generate_code: rm the ifdef'd i8086 code from the handling of
non-method procsyms by using def_cgsize(pd.address_type) to determine the
  address size

git-svn-id: trunk@27550 -
2014-04-12 16:26:51 +00:00
nickysn
9ae26316e8 * fixed the handling of const resourcestrings in the i8086 far data memory models
git-svn-id: trunk@27380 -
2014-03-30 16:30:51 +00:00
Jonas Maebe
4a79481c51 * isolated segment-related functionality of tabsolutevarsym into i386/i8086-
specific descendent classes and moved the code that deals with this in the
    code generator also to target-specific classes -> only ifdefs left in
    pdecvar

git-svn-id: trunk@27379 -
2014-03-30 15:42:53 +00:00
nickysn
0082db46ea * i8086 far data memory model fix in tcgloadnode.generate_nested_access.
The system unit now compiles in the compact and large memory models again.

git-svn-id: trunk@27341 -
2014-03-29 18:32:01 +00:00
nickysn
d43d7e59b5 * partially converted the threadvar handling in tcgloadnode.pass_generate_code
to use the hlcg in order to support the i8086 far data memory models. Only the
  instructions that handle the case when there's no thread manager installed
  (FPC_THREADVAR_RELOCATE=nil) are converted, since that's what's used on the
  msdos target. The rest still uses the low level code generator.

git-svn-id: trunk@27336 -
2014-03-29 16:22:48 +00:00
nickysn
7f014c5040 * replaced ifdef i8086 with hlcg.reference_reset_base in tcgloadnode.pass_generate_code
git-svn-id: trunk@27327 -
2014-03-28 23:38:57 +00:00
nickysn
897802c7c4 + fill the treference segment correctly in the load node for localvarsyms and
paravarsyms that are passed by reference in a i8086 far data memory model

git-svn-id: trunk@27277 -
2014-03-25 00:50:18 +00:00
Jonas Maebe
73a3f5ced4 * moved ncgutil.maybechangeloadnodereg() to hlcg.maybe_change_load_node_reg()
and moved ifdef'd jvm code to overridden method

git-svn-id: trunk@27153 -
2014-03-16 11:24:40 +00:00
Jonas Maebe
d8e228e82d - removed unnecessary JVM-specific code
git-svn-id: trunk@27151 -
2014-03-16 11:24:32 +00:00
Jonas Maebe
e9268a0a14 * synchronised with trunk up till r26975
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
nickysn
9eb4419ba3 * fixed the conversion and assignment to the 64-bit boolean types on the i8086
git-svn-id: trunk@26343 -
2013-12-31 17:18:20 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
Jonas Maebe
967354bb4c * corrected def used for loads of the address of pass-by-reference
parameters

git-svn-id: branches/hlcgllvm@26034 -
2013-11-11 11:15:05 +00:00
nickysn
b8de1370a0 * fixed assignment of i8086 method pointers, when the source is in a register
git-svn-id: trunk@25999 -
2013-11-09 16:50:56 +00:00
nickysn
7ff97d9b7d * specify AT_DATA when refering to the 'RESSTR' symbols; among other things,
this fixes resourcestring constants in the i8086 memory model.

git-svn-id: trunk@25796 -
2013-10-15 22:06:16 +00:00
nickysn
f2763b98fa + implemented absolute seg:ofs vars on i8086
git-svn-id: trunk@25666 -
2013-10-05 22:16:33 +00:00