Commit Graph

232 Commits

Author SHA1 Message Date
daniel
557ac8b02e * Fixed a register allocator bug
* Figured out why -dnewra generates superfluous "mov reg1,reg2"
    statements: changes in location_force. These moves are now no longer
    constrained so they are optimized away.
2003-08-03 14:09:50 +00:00
Jonas Maebe
177d57f22c * split en_exit_code into a part that may allocate a register and a part
that doesn't, so the former can be done before the register colouring
    has been performed
2003-07-23 11:04:15 +00:00
peter
32d076480b * framepointer fixes for sparc
* parent framepointer code more generic
2003-07-06 17:58:22 +00:00
daniel
268bfcf784 * Fixed register allocator. *Lots* of fixes. 2003-07-06 15:31:20 +00:00
peter
b7d99ec934 * paraloc splitted in callerparaloc,calleeparaloc
* sparc calling convention updates
2003-07-02 22:18:04 +00:00
Jonas Maebe
aa9f048e02 * fixed -dnewra compilation problems 2003-06-17 18:13:51 +00:00
peter
43746bc54a * alloc register for function result 2003-06-17 16:32:44 +00:00
peter
0dceec9a64 * current_procdef removed, use current_procinfo.procdef instead 2003-06-13 21:19:30 +00:00
peter
77d641fa2a * init/final of procedure data splitted from genentrycode
* use asmnode getposition to insert final at the correct position
    als for the implicit try...finally
2003-06-09 12:23:29 +00:00
Jonas Maebe
edb2179730 + added freeintparaloc
* ppc get/freeintparaloc now check whether the parameter regs are
    properly allocated/deallocated (and get an extra list para)
  * ppc a_call_* now internalerrors if pi_do_call is not yet set
  * fixed lot of missing pi_do_call's
2003-06-07 18:57:04 +00:00
peter
2df40538b9 * g_copyopenarrayvalue gets length reference
* don't copy open arrays for cdecl
2003-06-06 14:43:02 +00:00
peter
d91c880148 * cg.a_load_* get a from and to size specifier
* makeregsize only accepts newregister
  * i386 uses generic tcgnotnode,tcgunaryminus
2003-06-03 21:11:09 +00:00
Jonas Maebe
cbe4a3abd1 * fixed ref/loc problems 2003-06-03 15:49:49 +00:00
daniel
fc90d8ab4b * fixed conflict marks 2003-06-03 15:06:37 +00:00
daniel
41e0bc4cec * Register allocator finished 2003-06-03 13:01:59 +00:00
Jonas Maebe
6f3e16298a * function results can now also be regvars
- removed tprocinfo.return_offset, never use it again since it's invalid
    if the result is a regvar
2003-06-02 21:42:05 +00:00
peter
230a14ff68 * getregisterfpu size parameter added
* op_const_reg size parameter added
  * sparc updates
2003-06-01 21:38:06 +00:00
Jonas Maebe
dbf22a6cc9 * changed copyvalueparas so it also supports register parameters
(except for copy_value_openarray, but that one is seriously broken
     anyway, since it expects that the high parameter will always be in
     memory right after the pointer to the array, while it could just as
     will be in a register)
2003-05-31 20:28:17 +00:00
peter
1e7ecac976 * FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results 2003-05-31 15:05:28 +00:00
Jonas Maebe
2961250600 * fixed my previous commit 2003-05-31 00:48:15 +00:00
peter
414bd5fa22 * more sparc cleanup
* accumulator removed, splitted in function_return_reg (called) and
    function_result_reg (caller)
2003-05-30 23:57:08 +00:00
Jonas Maebe
e7e2cfe9a4 * a_load_loc_reg now has an extra size parameter for the destination
register (properly fixes what I worked around in revision 1.106 of
    ncgutil.pas)
2003-05-30 23:49:18 +00:00
Jonas Maebe
fefdcc6331 * fixed bug with intregvars
* locapara.loc can also be LOC_CFPUREGISTER -> also fixed
    rcgppc.a_param_ref, which previously got bogus size values
2003-05-30 18:52:10 +00:00
Jonas Maebe
eb441421cc * fixed ppc cycle 2003-05-27 21:19:08 +00:00
Jonas Maebe
2fafd75860 * patch from Peter for nested procedures 2003-05-27 14:28:14 +00:00
peter
047a066711 * procinlinenode removed
* aktexit2label removed, fast exit removed
  + tcallnode.inlined_pass_2 added
2003-05-26 21:17:17 +00:00
Jonas Maebe
54cacc63a5 * fixed integer typeconversion problems 2003-05-24 11:59:42 +00:00
peter
8ff5792776 * remove some unit dependencies
* current_procinfo changes to store more info
2003-05-23 14:27:35 +00:00
peter
92ee1804b6 * removed selfpointer_offset, vmtpointer_offset
* tvarsym.adjusted_address
  * address in localsymtable is now in the real direction
  * removed some obsolete globals
2003-05-15 18:58:53 +00:00
Jonas Maebe
3a35aefdfd * patch from Peter for int64 function results 2003-05-14 19:36:54 +00:00
peter
05c05f2555 * failn removed
* inherited result code check moven to pexpr
2003-05-13 19:14:41 +00:00
peter
c577c78366 * removed ret_in_acc, it's the reverse of ret_in_param
* fixed ret_in_param for win32 cdecl array
2003-05-13 15:16:13 +00:00
Jonas Maebe
f8cb290a84 * fixed several initialization and finalization related bugs (missing
tg.direction's, wrong paralocation for decreasing refcount of
    everything but ansistrings)
2003-05-12 08:08:27 +00:00
peter
26d78ff5c9 * moved implicit exception frame from ncgutil to psub
* constructor/destructor helpers moved from cobj/ncgutil to psub
2003-05-11 21:37:03 +00:00
peter
15b0132f6f * tloadnode does not support objectsymtable,withsymtable anymore
* withnode cleanup
  * direct with rewritten to use temprefnode
2003-05-11 14:45:12 +00:00
Jonas Maebe
17906f62d2 * moved storing of register parameters to memory even earlier in the
entry code to fix problems with constructors
2003-05-10 13:20:23 +00:00
peter
1a2eedd767 * self moved to hidden parameter
* removed hdisposen,hnewn,selfn
2003-05-09 17:47:02 +00:00
michael
cf68b27bb9 + Patch from peter to fix wrong pushing of ansistring function results in open array 2003-04-29 07:28:52 +00:00
peter
6d57995944 * do not finalize function results 2003-04-28 21:17:38 +00:00
Jonas Maebe
d03841dc16 * store register para's to memory before copying the valuepara's, because
that one requires them to be there already (and it calls subroutines ->
    could overwrite those registers)
2003-04-27 16:30:34 +00:00
peter
60978ba89c * aktprocdef renamed to current_procdef
* procinfo renamed to current_procinfo
  * procinfo will now be stored in current_module so it can be
    cleaned up properly
  * gen_main_procsym changed to create_main_proc and release_main_proc
    to also generate a tprocinfo structure
  * fixed unit implicit initfinal
2003-04-27 11:21:32 +00:00
peter
7f14891d66 * aktprocdef cleanup, aktprocdef is now always nil when parsing
a new procdef declaration
  * aktprocsym removed
  * lexlevel removed, use symtable.symtablelevel instead
  * implicit init/final code uses the normal genentry/genexit
  * funcret state checking updated for new funcret handling
2003-04-27 07:29:50 +00:00
florian
b5d749d24d * fixed passing of fpu values by fpu register 2003-04-26 17:21:08 +00:00
peter
f4b818fc1d * removed funcretn,funcretsym, function result is now in varsym
and aliases for result and function name are added using absolutesym
  * vs_hidden parameter for funcret passed in parameter
  * vs_hidden fixes
  * writenode changed to printnode and released from extdebug
  * -vp option added to generate a tree.log with the nodetree
  * nicer printnode for statements, callnode
2003-04-25 20:59:33 +00:00
florian
0284016ee9 * fixed several issues with powerpc
+ applied a patch from Jonas for nested function calls (PowerPC only)
  * ...
2003-04-23 12:35:34 +00:00
peter
9ed2ce8c12 * removed some notes/hints 2003-04-22 14:33:38 +00:00
peter
e248c0ece4 * fixed C style array of const
* fixed C array passing
  * fixed left to right with high parameters
2003-04-22 13:47:08 +00:00
daniel
25059e21b6 + Implemented the actual register allocator
+ Scratch registers unavailable when new register allocator used
  + maybe_save/maybe_restore unavailable when new register allocator used
2003-04-22 10:09:34 +00:00
Jonas Maebe
56132c1a9c * assembler procedures now again get a stackframe if they have local
variables. No space is reserved for a function result however.
    Also, the register parameters aren't automatically saved on the stack
    anymore in assembler procedures.
2003-04-16 09:26:55 +00:00
olle
a069aadad0 * changed newasmsymbol to newasmsymboldata for data symbols 2003-04-06 21:11:23 +00:00
peter
4a0b87ac59 * fix classmethod from classmethod call
* move BeforeDestruction/AfterConstruction calls to
    genentrycode/genexitcode instead of generating them on the fly
    after a call to a constructor
2003-03-30 20:59:07 +00:00
peter
c4ddcc78a8 * generic constructor working for i386
* remove fixed self register
  * esi added as address register for i386
2003-03-28 19:16:56 +00:00
peter
ec2a9a6ef8 * fix range error 2003-03-17 15:52:20 +00:00
Jonas Maebe
d168ae15df * lots of new regallocator fixes, both in generic and ppc-specific code
(ppc compiler still can't compile the linux system unit though)
2003-03-11 21:46:24 +00:00
daniel
18ab545cb7 * Fixed the optimizer 2003-02-26 21:15:43 +00:00
daniel
86bcea6ef5 * Code generator converted to new register notation
- Horribily outdated todo.txt removed
2003-02-19 22:00:14 +00:00
carl
2c19def917 * bugfix of FPU emulation code 2003-02-15 22:17:38 +00:00
florian
2102ce7031 * fixed some PowerPC issues 2003-01-09 22:00:53 +00:00
florian
34a91d9171 * fixed broken PowerPC compiler 2003-01-09 20:41:10 +00:00
daniel
55a161bbbf * Tregister changed into a record 2003-01-08 18:43:56 +00:00
florian
cd4c8de820 * web bug #2214 fixed: ie 10 in const array constructors 2002-12-29 23:51:43 +00:00
peter
af98b48c22 * stackpointer_alloc added for adjusting ESP. Win32 needs
this for the pageprotection
2002-12-24 15:56:50 +00:00
florian
fbbaf36800 * added missing then, Carl did you really a make fullcycle :) ? 2002-12-05 14:39:21 +00:00
carl
6e46f3424c * bugfix of problems with profile code which clobbers some registers 2002-12-03 22:13:39 +00:00
carl
2f89d59534 * warning of portabilitiy problems with parasize / localsize 2002-12-01 22:06:59 +00:00
carl
65113dcece + profiling support for Win32 2002-11-30 18:44:57 +00:00
carl
c79bdd9179 * try to fix profiling for win32 2002-11-30 14:39:15 +00:00
florian
593e30b839 * push_value_para didn't release floatdef locations, fixes tw2045 2002-11-28 23:28:14 +00:00
peter
8c82be898d * copy_value_on_stack method added for cdecl record passing 2002-11-27 02:33:19 +00:00
peter
f3fc72095f * splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
  * made operator search faster by walking the list only once
2002-11-25 17:43:16 +00:00
peter
a496dbe1ff * pass proccalloption to ret_in_xxx and push_xxx functions 2002-11-18 17:31:54 +00:00
mazen
41153e2b1a + return_result_reg and function_result_reg are now used, in all plateforms, to pass functions result between called function and its caller. See the explanation of each one 2002-11-17 17:49:08 +00:00
carl
64655be168 * memory optimization (3-4%) : cleanup of tai fields,
cleanup of tdef and tsym fields.
  * make it work for m68k
2002-11-17 16:31:55 +00:00
peter
bfd72ad5d5 * merged changes from 1.0.7 up to 04-11
- -V option for generating bug report tracing
    - more tracing for option parsing
    - errors for cdecl and high()
    - win32 import stabs
    - win32 records<=8 are returned in eax:edx (turned off by default)
    - heaptrc update
    - more info for temp management in .s file with EXTDEBUG
2002-11-15 01:58:45 +00:00
mazen
f97aa452bd * SPARC calling mechanism almost OK (as in GCC./mppcsparc ) 2002-11-10 19:07:45 +00:00
mazen
f170b21371 * parameter handling updated 2002-11-03 20:22:40 +00:00
peter
83dae76625 + $IMPLICITEXCEPTIONS switch to turn on/off generation of the
implicit exception frames for procedures with initialized variables
    and for constructors. The default is on for compatibility
2002-10-16 19:01:43 +00:00
peter
798289b1f3 * only use init tables for threadvars 2002-10-14 19:42:33 +00:00
peter
6d4fcce014 * Add finalization of typed consts
* Finalization of globals in the main program
2002-10-06 19:41:30 +00:00
carl
d170f6625f * fix heap leaks 2002-10-05 15:18:42 +00:00
florian
d5f0cbbf2b * fixes to common code to get the alpha compiler compiled applied 2002-09-30 07:00:44 +00:00
carl
8733061c78 * stack checking cannot be called before system unit is initialized
* MC68020 define
2002-09-22 14:02:34 +00:00
Jonas Maebe
a15d8cfe39 * a_load_reg_reg() now has two size parameters: source and dest. This
allows some optimizations on architectures that don't encode the
    register size in the register name.
2002-09-17 18:54:01 +00:00
florian
55c7896d06 * improved handling of procedures with register calling conventions 2002-09-10 21:48:30 +00:00
peter
dcd9e0107c * old logs removed and tabs fixed 2002-09-07 15:25:00 +00:00
peter
c850b953c0 * fixed (not) pushing of empty parameters
* fixed implicit initialization/finalization generation
  * fixed/optimized local copy of value arguments init/final
2002-09-02 18:44:48 +00:00
peter
f77536fece * use index register when available for generating a reference with
only a signle register. Using the base register could possibly
    destroy the framepointer
2002-09-01 19:27:34 +00:00
peter
5a06f334b7 * fixed maybe_save that did not support a reference with only
a index register. It now also updates the location with the new
    base register only
2002-09-01 18:50:20 +00:00
peter
a4e309d6ae * removevaluepara added to fix the stackpointer so restoring of
saved registers works
2002-09-01 14:42:41 +00:00
peter
a28f75ed03 * sym.insert_in_data removed
* symtable.insertvardata/insertconstdata added
  * removed insert_in_data call from symtable.insert, it needs to be
    called separatly. This allows to deref the address calculation
  * procedures now calculate the parast addresses after the procedure
    directives are parsed. This fixes the cdecl parast problem
  * push_addr_param has an extra argument that specifies if cdecl is used
    or not
2002-08-25 19:25:18 +00:00
peter
46731a77ab * really use tt_noreuse for exception frame buffers 2002-08-24 18:38:26 +00:00
peter
4b81e16fe2 * tempgen cleanup
* tt_noreuse temp type added that will be used in genentrycode
2002-08-23 16:14:48 +00:00
florian
a375ad9565 * remaining assembler writer bugs fixed, the errors in the
system unit are inline assembler problems
2002-08-18 10:42:37 +00:00
florian
e313bab4ff * first part of procinfo rewrite 2002-08-17 09:23:33 +00:00
carl
745efb2c47 * issameref() to test if two references are the same (then emit no opcodes)
+ ret_in_reg to replace ret_in_acc
    (fix some register allocation bugs at the same time)
  + save_std_register now has an extra parameter which is the
    usedinproc registers
2002-08-16 14:24:57 +00:00
carl
588abc6631 * jmpbuf size allocation for exceptions is now cpu specific (as it should)
* more generic nodes for maths
  * several fixes for better m68k support
2002-08-15 15:15:55 +00:00
carl
b117e6ad01 * fix Florian's last commit for m68k compilation 2002-08-14 19:25:09 +00:00
florian
af4302bc67 * more fixes for ppc calling conventions 2002-08-13 21:40:55 +00:00
carl
9da171faf2 + stab register indexes for powerpc (moved from gdb to cpubase)
+ tprocessor enumeration moved to cpuinfo
  + linker in target_info is now a class
  * many many updates for m68k (will soon start to compile)
  - removed some ifdef or correct them for correct cpu
2002-08-12 15:08:39 +00:00
peter
425bb45ddc * renamed current_library to objectlibrary 2002-08-11 14:32:25 +00:00
peter
ac71268ce6 * saving of asmsymbols in ppu supported
* asmsymbollist global is removed and moved into a new class
    tasmlibrarydata that will hold the info of a .a file which
    corresponds with a single module. Added librarydata to tmodule
    to keep the library info stored for the module. In the future the
    objectfiles will also be stored to the tasmlibrarydata class
  * all getlabel/newasmsymbol and friends are moved to the new class
2002-08-11 13:24:10 +00:00
carl
947142291c * stack allocation is now done separately (at the end) of genentrycode
so temps. can be allocated before.
  * fix generic exception handling
2002-08-09 19:16:57 +00:00
florian
b136cecacd * first part of ppc calling conventions fix 2002-08-06 20:55:20 +00:00
carl
32f3f65a26 + added generic exception support (still does not work!)
+ more documentation
2002-08-04 19:06:41 +00:00
florian
e7a6cd18dd * more fixes for the ppc
+ wrappers for the tcnvnode.first_* stuff introduced
2002-07-29 21:23:42 +00:00
Jonas Maebe
75d8e42d85 * fixed bug in location_force_reg32() when converting smaller values to
64 bit locations
  * use cg.op_const_reg_reg() instead of a move and then cg.op_const_reg()
    in location_force_reg32()
2002-07-28 15:59:57 +00:00
Jonas Maebe
6b83738e7d + generic implementation of tcg.g_flags2ref()
* tcg.flags2xxx() now also needs a size parameter
2002-07-27 19:53:51 +00:00
florian
eb2ca8d10f * rewrote the system handling 2002-07-26 21:15:37 +00:00
carl
448d40de1a + FPURESULTREG -> FPU_RESULT_REG 2002-07-25 17:56:29 +00:00
florian
59abf2555b * types.pas renamed to defbase.pas because D6 contains a types
unit so this would conflicts if D6 programms are compiled
  + Willamette/SSE2 instructions to assembler added
2002-07-20 11:57:52 +00:00
florian
336808f6c3 * start of the new generic parameter handling 2002-07-11 14:41:27 +00:00
Jonas Maebe
fea6dd2fd4 * big-endian fixes for location_force_reg*() 2002-07-11 07:33:25 +00:00
florian
07783d2a0d * powerpc target fixed, very simple units can be compiled
* some basic stuff for better callparanode handling, far from being finished
2002-07-07 09:52:32 +00:00
peter
4285e99853 * internal linker
* reorganized aasm layer
2002-07-01 18:46:20 +00:00
peter
68ce5a00e5 * cg64 patch
* basics for currency
  * asnode updates for class and interface (not finished)
2002-07-01 16:23:52 +00:00
carl
d75603c2ed * bugfix of hdisponen (base must be set, not index)
* more portability fixes
2002-05-20 13:30:40 +00:00
peter
06ebac4e27 * readded missing revisions 2002-05-18 13:34:04 +00:00
carl
21b3a10f02 + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
+ try to fix temp allocation (still in ifdef)
+ generic constructor calls
+ start of tassembler / tmodulebase class cleanup
2002-05-16 19:46:34 +00:00
peter
2992e1819c * removed old logs and updated copyright year 2002-05-14 19:34:38 +00:00
peter
4a176c81bc * removed n386ld and n386util units
* maybe_save/maybe_restore added instead of the old maybe_push
2002-05-13 19:54:36 +00:00
carl
11a60a8a1e * some small portability fixes 2002-05-12 19:58:36 +00:00
peter
4dcd96747e * moved entry and exitcode to ncgutil and cgobj
* foreach gets extra argument for passing local data to the
    iterator function
  * -CR checks also class typecasts at runtime by changing them
    into as
  * fixed compiler to cycle with the -CR option
  * fixed stabs with elf writer, finally the global variables can
    be watched
  * removed a lot of routines from cga unit and replaced them by
    calls to cgobj
  * u32bit-s32bit updates for and,or,xor nodes. When one element is
    u32bit then the other is typecasted also to u32bit without giving
    a rangecheck warning/error.
  * fixed pascal calling method with reversing also the high tree in
    the parast, detected by tcalcst3 test
2002-05-12 16:53:04 +00:00
peter
6320530bdd * removed newn and disposen nodes, the code is now directly
inlined from pexpr
  * -an option that will write the secondpass nodes to the .s file, this
    requires EXTDEBUG define to actually write the info
  * fixed various internal errors and crashes due recent code changes
2002-04-21 19:02:03 +00:00
carl
59f8a16c39 + a_jmp_cond -> a_jmp_always (a_jmp_cond is NOT portable)
+ changeregsize -> rg.makeregsize
2002-04-21 15:24:38 +00:00
peter
8d0751ff97 * removed some more routines from cga
* moved location_force_reg/mem to ncgutil
  * moved arrayconstructnode secondpass to ncgld
2002-04-19 15:39:34 +00:00
carl
5befcda7e5 + target_info.size_of_pointer -> pointer_Size 2002-04-15 18:57:22 +00:00
Jonas Maebe
71a52a4aeb * several powerpc-related additions and fixes 2002-04-06 18:10:42 +00:00
peter
5e7a1e3729 * removed unused units
* use tlocation.size in cg.a_*loc*() routines
2002-04-04 19:05:54 +00:00
peter
5b242f7741 * tlocation,treference update
* LOC_CONSTANT added for better constant handling
  * secondadd splitted in multiple routines
  * location_force_reg added for loading a location to a register
    of a specified size
  * secondassignment parses now first the right and then the left node
    (this is compatible with Kylix). This saves a lot of push/pop especially
    with string operations
  * adapted some routines to use the new cg methods
2002-04-02 17:11:27 +00:00
Jonas Maebe
7fb55bf4e4 + a_loadfpu_* and a_loadmm_* methods in tcg
* register allocation is now handled by a class and is mostly processor
    independent (+rgobj.pas and i386/rgcpu.pas)
  * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  * some small improvements and fixes to the optimizer
  * some register allocation fixes
  * some fpuvaroffset fixes in the unary minus node
  * push/popusedregisters is now called rg.save/restoreusedregisters and
    (for i386) uses temps instead of push/pop's when using -Op3 (that code is
    also better optimizable)
  * fixed and optimized register saving/restoring for new/dispose nodes
  * LOC_FPU locations now also require their "register" field to be set to
    R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  - list field removed of the tnode class because it's not used currently
    and can cause hard-to-find bugs
2002-03-31 20:26:33 +00:00
peter
b4cc4b7b01 * removed compiler warnings 2002-03-04 19:10:11 +00:00
Jonas Maebe
f15dbd7bf0 * range checking is now processor independent (part in cgobj, part in cg64f32) and should work correctly again (it needed some changes after the changes of the low and high of tordef's to int64) * maketojumpbool() is now processor independent (in ncgutil) * getregister32 is now called getregisterint 2001-12-30 17:24:45 +00:00