mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 07:29:25 +01:00
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/branches/wpo
........
r11878 | jonas | 2008-10-11 02:25:18 +0200 (Sat, 11 Oct 2008) | 19 lines
+ initial implementation of whole-program optimisation framework
+ implementation of whole-program devirtualisation
o use:
a) generate whole-program optimisation information (no need
to completely compile the program and all of its units
with -OW/-FW, only the main program is sufficient)
fpc -OWdevirtcalls -FWmyprog.wpo myprog
b) use it to optimise the program
fpc -B -Owdevirtcalls -Fwmyprog.wpo myprog
(the -B is not required, but only sources recompiled during
the second pass will actually be optimised -- if you want,
you can even rebuild the rtl devirtualised for a particular
program; and these options can obviously also be used
together with regular optimisation switches)
o warning:
- there are no checks yet to ensure that you do not use
units optimised for a particular program with another
program (or with a changed version of the same program)
........
r11881 | jonas | 2008-10-11 19:35:52 +0200 (Sat, 11 Oct 2008) | 13 lines
* extracted code to detect constructed class/object types from
tcallnode.gen_vmt_tree into its own method to avoid clutter
* detect x.classtype.create constructs (with classtype = the
system.tobject.classtype method), and treat them as if a
"class of x" has been instantiated rather than a
"class of tobject". this required storing the instantiated
classrefs in their own array though, because at such a
point we don't have a "class of x" tdef available (so
now "x", and all other defs instantiated via a classref,
are now stored as tobjectdefs in a separate array)
+ support for devirtualising class methods (including
constructors)
........
r11882 | jonas | 2008-10-11 20:44:02 +0200 (Sat, 11 Oct 2008) | 7 lines
+ -Owoptvmts whole program optimisation which replaces vmt entries
with method names of child classes in case the current class'
method can never be called (e.g., because this class is never
instantiated). As a result, such methods can then be removed
by dead code removal/smart linking (not much effect for either
the compiler, lazarus or a trivial lazarus app though).
........
r11889 | jonas | 2008-10-12 14:29:54 +0200 (Sun, 12 Oct 2008) | 2 lines
* some comment fixes
........
r11891 | jonas | 2008-10-12 18:49:13 +0200 (Sun, 12 Oct 2008) | 4 lines
* fixed twpofilereader.getnextnoncommentline() when reusing a previously
read line
* fixed skipping of unnecessary wpo feedback file sections
........
r11892 | jonas | 2008-10-12 23:42:43 +0200 (Sun, 12 Oct 2008) | 31 lines
+ symbol liveness wpo information extracted from smartlinked programs
(-OW/-Owsymbolliveness)
+ use symbol liveness information to improve devirtualisation (don't
consider classes created in code that has been dead code stripped).
This requires at least two passes of using wpo (first uses dead code
info to locate classes that are constructed only in dead code,
second pass uses this info to potentially further devirtualise).
I.e.:
1) generate initial liveness and devirtualisation feedback
fpc -FWtt.wpo -OWall tt.pp -Xs- -CX -XX
2) use previously generated feedback, and regenerate new feedback
based on this (i.e., disregard classes created in dead code)
fpc -FWtt-1.wpo -OWall -Fwtt.wo -Owall tt.pp -Xs- -CX -XX
3) use the newly generated feedback (in theory, it is possible
that even more opportunities pop up afterwards; you can
continue until the program does not get smaller anymore)
fpc -Fwtt-1.wpo -Owall tt.pp -CX -XX
* changed all message() to cgmessage() calls so the set codegenerror
* changed static fsectionhandlers field to a regular field called
fwpocomponents
* changed registration of wpocomponents: no longer happens in the
initialization section of their unit, but in the InitWpo routine
(which has been moved from the woinfo to the wpo unit). This way
you can register different classes based on the target/parameters.
+ added static method to twpocomponentbase for checking whether
the command line parameters don't conflict with the requested
optimisations (e.g. generating liveness info requires that
smartlinking is turned on)
+ added static method to twpocomponentbase to request the
section name
........
r11893 | jonas | 2008-10-12 23:53:57 +0200 (Sun, 12 Oct 2008) | 3 lines
* fixed comment error (twpodeadcodeinfo keeps a list of live,
not dead symbols)
........
r11895 | jonas | 2008-10-13 00:13:59 +0200 (Mon, 13 Oct 2008) | 2 lines
+ documented -OW<x>, -Ow<x>, -FW<x> and -Fw<x> wpo parameters
........
r11899 | jonas | 2008-10-14 22:14:56 +0200 (Tue, 14 Oct 2008) | 2 lines
* replaced hardcoded string with objdumpsearchstr constant
........
r11900 | jonas | 2008-10-14 22:15:25 +0200 (Tue, 14 Oct 2008) | 2 lines
* reset wpofeedbackinput and wpofeedbackoutput in wpodone
........
r11901 | jonas | 2008-10-14 22:16:07 +0200 (Tue, 14 Oct 2008) | 2 lines
* various additional comments and comment fixes
........
r11902 | jonas | 2008-10-15 18:09:42 +0200 (Wed, 15 Oct 2008) | 5 lines
* store vmt procdefs in the ppu files so we don't have to use a hack to
regenerate them for whole-program optimisation
* fixed crash when performing devirtualisation optimisation on programs
that do not construct any classes/objects with optimisable vmts
........
r11935 | jonas | 2008-10-19 12:24:26 +0200 (Sun, 19 Oct 2008) | 4 lines
* set the vmt entries of non-class virtual methods of not instantiated
objects/classes to FPC_ABSTRACTERROR so the code they refer to can
be thrown away if it is not referred to in any other way either
........
r11938 | jonas | 2008-10-19 20:55:02 +0200 (Sun, 19 Oct 2008) | 7 lines
* record all classrefdefs/objdefs for which a loadvmtaddrnode is generated,
and instead of marking all classes that derive from instantiated
classrefdefs as instantiated, only mark those classes from the above
collection that derive from instantiated classrefdefs as
instantiated (since to instantiate a class, you have to load its vmt
somehow -- this may be broken by using assembler code though)
........
r12212 | jonas | 2008-11-23 12:26:34 +0100 (Sun, 23 Nov 2008) | 3 lines
* fixed to work with the new vmtentries that are always available and
removed previously added code to save/load vmtentries to ppu files
........
r12304 | jonas | 2008-12-05 22:23:30 +0100 (Fri, 05 Dec 2008) | 4 lines
* check whether the correct wpo feedback file is used in the current
compilation when using units that were compiled using wpo information
during a previous compilation run
........
r12308 | jonas | 2008-12-06 18:03:39 +0100 (Sat, 06 Dec 2008) | 2 lines
* abort compilation if an error occurred during wpo initialisation
........
r12309 | jonas | 2008-12-06 18:04:28 +0100 (Sat, 06 Dec 2008) | 3 lines
* give an error message instead of crashing with an io exception if the
compiler is unable to create the wpo feedback file specified using -FW
........
r12310 | jonas | 2008-12-06 18:12:43 +0100 (Sat, 06 Dec 2008) | 3 lines
* don't let the used wpo feedback file influence the interface crc (there's
a separate check for such changes)
........
r12316 | jonas | 2008-12-08 19:08:25 +0100 (Mon, 08 Dec 2008) | 3 lines
* document the format of the sections of the wpo feedback file inside the
feedback file itself
........
r12330 | jonas | 2008-12-10 22:26:47 +0100 (Wed, 10 Dec 2008) | 2 lines
* use sysutils instead of dos to avoid command line length limits
........
r12331 | jonas | 2008-12-10 22:31:11 +0100 (Wed, 10 Dec 2008) | 3 lines
+ support for testing whole program optimisation tests (multiple
compilations using successively generated feedback files)
........
r12332 | jonas | 2008-12-10 22:31:40 +0100 (Wed, 10 Dec 2008) | 2 lines
+ whole program optimisation tests
........
r12334 | jonas | 2008-12-10 22:38:07 +0100 (Wed, 10 Dec 2008) | 2 lines
- removed unused local variable
........
r12339 | jonas | 2008-12-11 18:06:36 +0100 (Thu, 11 Dec 2008) | 2 lines
+ comments for newly added fields to tobjectdef for devirtualisation
........
r12340 | jonas | 2008-12-11 18:10:01 +0100 (Thu, 11 Dec 2008) | 2 lines
* increase ppu version (was no longer different from trunk due to merging)
........
git-svn-id: trunk@12341 -
|
||
|---|---|---|
| .. | ||
| alpha | ||
| arm | ||
| avr | ||
| html | ||
| i386 | ||
| ia64 | ||
| m68k | ||
| mips | ||
| msg | ||
| powerpc | ||
| powerpc64 | ||
| ppcgen | ||
| sparc | ||
| systems | ||
| utils | ||
| vis | ||
| x86 | ||
| x86_64 | ||
| aasmbase.pas | ||
| aasmdata.pas | ||
| aasmsym.pas | ||
| aasmtai.pas | ||
| aggas.pas | ||
| aopt.pas | ||
| aoptbase.pas | ||
| aoptcs.pas | ||
| aoptda.pas | ||
| aoptobj.pas | ||
| assemble.pas | ||
| browcol.pas | ||
| bsdcompile | ||
| catch.pas | ||
| ccharset.pas | ||
| cclasses.pas | ||
| cfidwarf.pas | ||
| cfileutl.pas | ||
| cg64f32.pas | ||
| cgbase.pas | ||
| cgobj.pas | ||
| cgutils.pas | ||
| cmsgs.pas | ||
| comphook.pas | ||
| compiler.pas | ||
| compinnr.inc | ||
| comprsrc.pas | ||
| constexp.pas | ||
| COPYING | ||
| cp437.pas | ||
| cp850.pas | ||
| cp866.pas | ||
| cp1251.pas | ||
| cp8859_1.pas | ||
| cp8859_5.pas | ||
| crefs.pas | ||
| cresstr.pas | ||
| cstreams.pas | ||
| cutils.pas | ||
| dbgbase.pas | ||
| dbgdwarf.pas | ||
| dbgstabs.pas | ||
| defcmp.pas | ||
| defutil.pas | ||
| export.pas | ||
| expunix.pas | ||
| finput.pas | ||
| fmodule.pas | ||
| fpccrc.pas | ||
| fpcdefs.inc | ||
| fppu.pas | ||
| gendef.pas | ||
| globals.pas | ||
| globtype.pas | ||
| htypechk.pas | ||
| impdef.pas | ||
| import.pas | ||
| link.pas | ||
| Makefile | ||
| Makefile.fpc | ||
| MPWMake | ||
| msgidx.inc | ||
| msgtxt.inc | ||
| nadd.pas | ||
| nbas.pas | ||
| ncal.pas | ||
| ncgadd.pas | ||
| ncgbas.pas | ||
| ncgcal.pas | ||
| ncgcnv.pas | ||
| ncgcon.pas | ||
| ncgflw.pas | ||
| ncginl.pas | ||
| ncgld.pas | ||
| ncgmat.pas | ||
| ncgmem.pas | ||
| ncgopt.pas | ||
| ncgrtti.pas | ||
| ncgset.pas | ||
| ncgutil.pas | ||
| ncnv.pas | ||
| ncon.pas | ||
| nflw.pas | ||
| ninl.pas | ||
| nld.pas | ||
| nmat.pas | ||
| nmem.pas | ||
| nobj.pas | ||
| node.pas | ||
| nopt.pas | ||
| nset.pas | ||
| nstate.pas | ||
| nutils.pas | ||
| ogbase.pas | ||
| ogcoff.pas | ||
| ogelf.pas | ||
| oglx.pas | ||
| ogmap.pas | ||
| optbase.pas | ||
| optcse.pas | ||
| optdead.pas | ||
| optdfa.pas | ||
| options.pas | ||
| optloop.pas | ||
| opttail.pas | ||
| optutils.pas | ||
| optvirt.pas | ||
| owar.pas | ||
| owbase.pas | ||
| parabase.pas | ||
| paramgr.pas | ||
| parser.pas | ||
| pass_1.pas | ||
| pass_2.pas | ||
| pbase.pas | ||
| pdecl.pas | ||
| pdecobj.pas | ||
| pdecsub.pas | ||
| pdecvar.pas | ||
| pexports.pas | ||
| pexpr.pas | ||
| pinline.pas | ||
| pmodules.pas | ||
| pp.lpi | ||
| pp.pas | ||
| ppc68k.lpi | ||
| ppc.cfg | ||
| ppc.conf | ||
| ppc.dof | ||
| ppcarm.lpi | ||
| ppcavr.lpi | ||
| ppcppc.lpi | ||
| ppcsparc.lpi | ||
| ppheap.pas | ||
| ppu.pas | ||
| ppx86_64.lpi | ||
| procinfo.pas | ||
| pstatmnt.pas | ||
| psub.pas | ||
| psystem.pas | ||
| ptconst.pas | ||
| ptype.pas | ||
| raatt.pas | ||
| rabase.pas | ||
| rasm.pas | ||
| rautils.pas | ||
| README | ||
| regvars.pas | ||
| rescmn.pas | ||
| rgbase.pas | ||
| rgobj.pas | ||
| scandir.pas | ||
| scanner.pas | ||
| script.pas | ||
| switches.pas | ||
| symbase.pas | ||
| symconst.pas | ||
| symdef.pas | ||
| symnot.pas | ||
| symsym.pas | ||
| symtable.pas | ||
| symtype.pas | ||
| symutil.pas | ||
| systems.pas | ||
| tgobj.pas | ||
| tokens.pas | ||
| verbose.pas | ||
| version.pas | ||
| widestr.pas | ||
| wpo.pas | ||
| wpobase.pas | ||
| wpoinfo.pas | ||
This directory contains the sources of the Free Pascal Compiler
If you want to compile/modify the compiler, please read first the
programmers manual.
To recompile the compiler, you can use the batch files :
+ mppc386.bat if you want to build a cross compiler from i386 to m68k
+ mppcsparc if you want to build a cross compiler from i386 to SPARC
or
Use the make utility as following
make OS_TARGET="compiler OS target" \
CPU_TARGET="compiler CPU target" \
FPCCPUOPT="Optimization level" \
PP="compiler used to compile FPC" \
COMPILER_OPTIONS="Options passed to compiler" \
If an option is omitted, then target CPU/OS will be same as current CPU/OS
Possibles targets are : linux go32v2 win32 os2 freebsd beos netbsd amiga haiku
atari sunos qnx netware openbsd wdosx palmos macos macosx emx
Possible compiler switches (* marks a currently required switch):
-----------------------------------------------------------------
GDB* support of the GNU Debugger
I386 generate a compiler for the Intel i386+
x86_64 generate a compiler for the AMD x86-64 architecture
M68K generate a compiler for the M68000
SPARC generate a compiler for SPARC
POWERPC generate a compiler for the PowerPC
VIS generate a compile for the VIS
DEBUG version with debug code is generated
EXTDEBUG some extra debug code is executed
SUPPORT_MMX only i386: releases the compiler switch
MMX which allows the compiler to generate
MMX instructions
EXTERN_MSG Don't compile the msgfiles in the compiler, always
use external messagefiles, default for TP
NOAG386INT no Intel Assembler output
NOAG386NSM no NASM output
NOAG386BIN leaves out the binary writer, default for TP
NORA386DIR No direct i386 assembler reader
TEST_GENERIC Test Generic version of code generator
(uses generic RTL calls)
-----------------------------------------------------------------
cpuflags The target processor has status flags (on by default)
cpufpemu The target compiler will also support emitting software
floating point operations
cpu64bitaddr The targets use a 64-bit address space (pointers and
the default integer type are 64 bit)
cpu64bitalu The target cpu has 64-bit registers available (unless
cpu64bitaddr is also defined, pointers and default
integer type remain 32 bit, but the cpu can perform
64 bit calculations directly without needing helpers)
-----------------------------------------------------------------
Required switches for a i386 compiler be compiled by Free Pascal Compiler:
GDB;I386
to build a compiler to SPARC target using a Win32/i386 you just use :
make CPU_TARGET=SPARC