Commit Graph

39 Commits

Author SHA1 Message Date
Jonas Maebe
3fee990218 * on Mach-O, PECOFF and ELF platforms, write local symbols as hidden/
private_extern (or plain global in case of PECOFF, as the effect is
    the same there): visible across object files, but they become local
    when linked into a binary/library. This enables cross-unit inlining
    of functions accessig implementation-only symbols.

git-svn-id: trunk@42340 -
2019-07-07 21:33:43 +00:00
Jonas Maebe
4cd6f59bc3 * changed create_hlcodegen into a procvar, so that we don't have to insert
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
   o prevents dependency cycles that can cause llvm codegen units to init
     before the cpu variants, which is bad since the llvm versions have to
     override the cpu variants in their init code (+ added checks in the
     init code that they are in fact initialised later)

git-svn-id: branches/debug_eh@40410 -
2018-11-29 21:31:15 +00:00
Jonas Maebe
d69ad8fa41 * removed temppos field again from parameter locations: they're not allocated
by the temp manager of the current procedure

git-svn-id: trunk@38858 -
2018-04-27 19:18:55 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
nickysn
ddba821561 * GetNextReg(), used by 16-bit and 8-bit code generators (i8086 and avr) moved
from cpubase unit to a method in the tcg class. The reason for doing that is
  that this is now a standard part of the 16-bit and 8-bit code generators and
  moving to the tcg class allows doing extra checks (not done yet, but for
  example, in the future, we can keep track of whether there was an extra
  register allocated with getintregister and halt with an internalerror in case
  GetNextReg() is called for registers, which weren't allocated as a part of a
  sequence, therefore catching a certain class of 8-bit and 16-bit code
  generator bugs at compile time, instead of generating wrong code).
- removed GetLastReg() from avr's cpubase unit, because it isn't used for
  anything. It might be added to the tcg class, in case it's ever needed, but
  for now I've left it out.
* GetOffsetReg() and GetOffsetReg64() were also moved to the tcg unit.

git-svn-id: trunk@37180 -
2017-09-11 14:53:06 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
Jonas Maebe
0afbe85aab * various memory reference alignment fixes
git-svn-id: trunk@34544 -
2016-09-20 21:43:19 +00:00
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
  * explicitly pass the correct value for all calls to those methods elsewhere
    in the compiler

git-svn-id: trunk@34250 -
2016-08-05 07:09:16 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
nickysn
ce66597df8 * handle classrefdefs properly, according to the memory model in i8086's
thlcgobj.getaddressregister. This should fix several regressions in the
  compact, large and huge memory models after r33591

git-svn-id: trunk@33637 -
2016-05-03 15:11:32 +00:00
nickysn
1e33924f73 + support procvardefs (address only) in i8086's hlcgcpu.getaddressregister; this
fixes e.g. obtaining the address of a method in i8086 far code memory models
  after r32414

git-svn-id: trunk@32562 -
2015-12-01 15:58:11 +00:00
nickysn
ad92f4e80a + implemented thlcgcpu.a_op_const_reg with far pointer support for i8086, so
that second_class_to_intf can be converted to the high level code generator

git-svn-id: trunk@32301 -
2015-11-12 22:01:44 +00:00
nickysn
41203a9152 * support far classrefdef targets on i8086 in thlcgcpu.a_loadaddr_ref_reg. This
fixes code generation for loadvmtaddr nodes in i8086 far data memory models
  after r31064.

git-svn-id: trunk@31326 -
2015-08-15 17:24:49 +00:00
nickysn
6b0a19c0ab * fixed getting the address of a far proc on i8086 after the hlcgllvm branch merge
git-svn-id: trunk@30354 -
2015-03-28 17:31:52 +00:00
nickysn
0162b199f7 * fixed the i8086 g_intf_wrapper after the hlcgllvm branch merge
git-svn-id: trunk@30353 -
2015-03-28 14:33:22 +00:00
nickysn
003b283e55 * fixed thlcgcpu.g_exception_reason_save_const always generating a 286+ push
instruction on i8086, regardless of current cpu level

git-svn-id: trunk@30352 -
2015-03-28 13:59:10 +00:00
Jonas Maebe
b745dcc64c * moved g_external_wrapper() to the hlcg, and also g_intf_wrapper() because
for some platforms it depends on that routine

git-svn-id: branches/hlcgllvm@28492 -
2014-08-19 20:22:54 +00:00
Jonas Maebe
a637fbe596 * moved all g_exception_*() methods to hlcgobj and cleaned them up (no more
hardcoded registers for the most part)
  + added extra g_exception_discard_reason() that can be called when we only
    want to get rid of the currently pushed exception reason, and don't have
    to load it (so it can do nothing on platforms that don't use push/pop)

git-svn-id: branches/hlcgllvm@28481 -
2014-08-19 20:22:24 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +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
nickysn
24fcac9f87 + added support for nested procvars in the i8086 far data memory models
git-svn-id: trunk@27812 -
2014-05-22 23:44:09 +00:00
nickysn
feb840b47f * support reg=NR_NO in thlcgcpu.reference_reset_base on i8086. This fixes test
webtbs/tw26162.pp in the i8086 far data memory models.

git-svn-id: trunk@27807 -
2014-05-21 13:26:02 +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
7da8719036 + support near pointers, bound to a segment register in hlcg.reference_reset_base
on i8086

git-svn-id: trunk@27688 -
2014-04-29 23:15:20 +00:00
nickysn
313240b9e8 * use a better way (suggested by Jonas) to determine whether a procedure is from
the same unit

git-svn-id: trunk@27629 -
2014-04-21 23:14:16 +00:00
nickysn
70a7ecd0fa + use 'push cs + call near' (which is both shorter and faster), instead of far
call, when calling a far proc in the same segment

git-svn-id: trunk@27621 -
2014-04-21 00:44:45 +00:00
nickysn
d8d3706462 + override hlcg.a_call_name for i8086 and dispatch to the appropriate type of
call (near or far), according to whether the procdef is near or far, instead
  of relying on the default for the memory model

git-svn-id: trunk@27562 -
2014-04-13 15:17:43 +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
2e7aab0155 * refactored i8086's thlcgcpu.location_force_mem:
o The checks for types that need special handling moved to separate methods,
    because they'll probably be used by the other hlcg.a_load*loc* methods as
    well.
  o Use voidcodepointertype and voidpointertype to avoid the ifs for checking
    the memory model.

git-svn-id: trunk@27554 -
2014-04-12 21:59:32 +00:00
nickysn
4e60d2316f * support implicit pointer types (classes, dynarrays, ansistrings, etc.) in
i8086's thlcgcpu.getaddressregister and thlcgcpu.reference_reset_base

git-svn-id: trunk@27333 -
2014-03-29 14:00:24 +00:00
nickysn
ce59c4616f * assume SS for the segment of references that have BP as base in
thlcgcpu.a_loadaddr_ref_reg

git-svn-id: trunk@27332 -
2014-03-29 13:25:11 +00:00
nickysn
ead05754b4 + implemented hlcg.a_loadaddr_ref_reg for i8086, which uses tosize to determine whether the destination is a far pointer, instead of using the presence of ref.segment
git-svn-id: trunk@27321 -
2014-03-28 14:49:43 +00:00
nickysn
26b53607f8 + added method reference_reset_base with support for different pointer types to
the high level code generator. All hlcg code, except for the jvm code
  generator, updated to use the new method. I didn't update jvm (it still uses
  the method from cgutils), because I'm not familiar with that platform, so I
  might get the types wrong.

git-svn-id: trunk@27309 -
2014-03-28 00:01:18 +00:00
nickysn
3cd9cef182 + added a far pointer aware implementation of hlcg.getaddressregister for i8086.
This should allow writing memory model independent code in the FPC code
  generator.

git-svn-id: trunk@27274 -
2014-03-25 00:18:32 +00:00
nickysn
039979fdcc * handle 4-byte records in registers as well in location_force_mem on i8086
git-svn-id: trunk@26002 -
2013-11-09 21:57:29 +00:00
nickysn
7e7ab2fd4d * also handle nested proc ptrs in thlcgcpu.location_force_mem on i8086
git-svn-id: trunk@25824 -
2013-10-18 20:09:01 +00:00
nickysn
a5284881f5 + support 6-byte records in registers in thlcgcpu.location_force_mem on the i8086; this fixes the handling of methodpointers typecasted to record (TMethod) in medium and compact memory models
git-svn-id: trunk@25500 -
2013-09-16 16:24:00 +00:00
nickysn
2e97de9522 + added an i8086 specific override of thlcgcpu.location_force_mem, which handles 6-byte (medium/compact memory model) method pointers
git-svn-id: trunk@25151 -
2013-07-20 19:40:27 +00:00
nickysn
eff0894a66 all the extra i8086 units added
git-svn-id: branches/i8086@23718 -
2013-03-08 00:04:45 +00:00