names, and disabled them for ppc64 ELFv2
* disabling those also disables the function descriptors, so use the
_CALL_ELF compiler variable to check whether there is in fact a
function descriptor
git-svn-id: trunk@30196 -
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 -
models. The $F directive and the 'near' and 'far' procedure modifiers should
now work as expected in the far code memory models (they are still ignored in
the near code memory models). The compiler defaults to the {$F+} state,
because {$F-} requires adding 'far' to a lot of procedures in the rtl,
packages and tests.
git-svn-id: trunk@27590 -
for llvm, and empty for other targets:
o the '@' is required to mark a global/static symbol identifier in llvm
o the double quotes are required in case special characters are involved
o the \01 means that the name should not be mangled by llvm (e.g., by
default it still adds the C-prefix to all symbol names, and replaces
some special characters with alternatives)
* apply this prefix/suffix in all name mangling routines
git-svn-id: branches/hlcgllvm@26995 -
- removed mips_cpu variable and cpu_mips_default CPU type.
* globals.pas: default CPU type changed to MIPS2, this is what was passed to assembler before.
git-svn-id: trunk@24643 -
JVM target, since Java bytecode itself has no support for properties and
hence exposing properties to external Java code can only be done through
getters/setters. Use the new parameters to do so:
-CTautogetterprefix=XXX
-CTautosetterprefix=YYY
The getter/setter will get the same visibility as the property. If a
getter/setter with the same naming convention was already specified for a
property and this getter/setter is declared in the same class as the
property, then the visibility of this existing getter/setter is
modified and no new routine is generated.
Newly generated getters/setters are virtual methods, because that is
the only way in Java bytecode to allow redefining these getters/setters
in child classes. However, that also means that using these switches can
change the behvaviour of code, since normally the used property definition
is only determined by the declared type of its associated class instance,
and not by the actual instance type. The compiler will therefore warn when
such an automatically generated getter/setter is overridden by another
automatically generated getter/setter in a child class.
git-svn-id: trunk@22959 -
and also use this code to trash local variables in inlined routines
o fixes mantis #22088
o makes it possible to also implement it for the jvm target in the future
git-svn-id: trunk@21393 -
+ implement trashing of local variables if subroutine is inlined
* fix some errors releated to interproc. gotos and inlining
+ node_count function
* inline cannot be used with iochecking and safecall calling conventions
* track inherited usage
* don't inline if inherited is used
git-svn-id: trunk@21335 -
- prefer UnicodeString, WideString, PWideChar, PAnsiChar, AnsiString, ShortString when passing a string constant if default string is UnicodeString,
- change default string type to UnicodeString for MODE DelphiUnicode
git-svn-id: trunk@21094 -
be generated for a single object file on AIX, automatically switch to
an indirection scheme that uses much less TOC entries, but is slower to
access global variables
* manually merged infrastructure for target-specific code generation
switches from JVM branch (-CTxxx switches)
* -CTsmalltoc switch for AIX that forces the indirection scheme for TOC
entries from the start in case the automatic one does not conserve
a sufficient amount (or in case you bump up against the global TOC
entries limit during linking)
git-svn-id: trunk@20963 -
based on the actual target platform rather than always on the host
platform
* on Unix, use single rather than double quotes for quoting, so it also
properly handles $, ! and `, which keep their special meaning when
appearing in scripts inside double quotes
* since sysutils.executeprocess() can only deal with double-quoted
strings in parameters, re-quote parameters on Unix when they turn
out not to be for scripts but for direct execution (which is most
of the time, but unfortunately doing the reverse is not possible
because parameters used in scripts sometimes contain script-specific
code that must not be quoted, such as `cat link.res`)
-> always use cfileutl.RequotedExecuteProcess() rather than
sysutils.ExecuteProcess() in the compiler (added a bunch of dummy
ExecuteProcess string constants to common units to prevent accidental
usage)
git-svn-id: branches/jvmbackend@20901 -
o support for the new codepage-aware ansistrings in the jvm branch
o empty ansistrings are now always represented by a nil pointer rather than
by an empty string, because an empty string also has a code page which
can confuse code (although this will make ansistrings harder to use
in Java code)
o more string helpers code shared between the general and jvm rtl
o support for indexbyte/word in the jvm rtl (warning: first parameter
is an open array rather than an untyped parameter there, so
indexchar(pcharvar^,10,0) will be equivalent to
indexchar[pcharvar^],10,0) there, which is different from what is
intended; changing it to an untyped parameter wouldn't help though)
o default() support is not yet complete
o calling fpcres is currently broken due to limitations in
sysutils.executeprocess() regarding handling unix quoting and
the compiler using the same command lines for scripts and directly
calling external programs
o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
to the make command line
git-svn-id: branches/jvmbackend@20887 -
Mac OS X/iOS version for the compiler code
o such a parameter is not passed, extract the information from the
environment variables MACOSX_DEPLOYMENT_TARGET/IPHONEOS_DEPLOYMENT_TARGET,
like gcc
o if neither the parameter nor the environment variable is used, use preset
default values
o pass on this version setting on to the Darwin linker
o use this setting to determine which version of the startup code (crt1.o
etc) to use, if any (based on information gathered from the GCC sources)
o define a symbol called MAC_OS_X_VERSION_MIN_REQUIRED/
IPHONE_OS_VERSION_MIN_REQUIRED based on this parameter
o for usage information, see
http://wiki.freepascal.org/FPC_New_Features_Trunk#Support_for_specifying_and_querying_the_deployment_version
git-svn-id: trunk@20503 -
+ -CTcompactintarrayinit command line option to change the code generation
for typed array of some kind of integer-type initialization so that it
takes up less space in the bytecode (because the bytecode for all
routines, including the class initialization code that contains the
typed constant init code, is limited 64kb, large array or multiple
array constants could fairly easily bump into that limit)
git-svn-id: branches/jvmbackend@19638 -
- return default compiler codepage to 8859-1
- emit ansistring constants in CP_NONE by default
- add new modeswitch systemcodepage which sets default compiler codepage to system and emits ansistring constants with systemcodepage as delphi do
- add new mode DelphiUnicode with has the same switches as delphi mode + systemcodepage switch. Later it will also have string = unicodestring by default.
git-svn-id: trunk@19165 -
- emit ansistring constants with compiler codepage if no codepage is explicitly set
- set default compiler codepage to default system codepage (delphi compatible)
+ tests
git-svn-id: trunk@19145 -
+ support parsing of strings with code page specification
+ added encoding and elementsize field to ansi- and unicodestring records
+ some basic rtl support routines for encoding aware strings
+ DefaultSystemCodePage
+ DefaultUnicodeCodePage
+ ppu writing/loading of code page aware strings
git-svn-id: trunk@19080 -
* converts the embedded information into controller specific records (arm and avr)
* new cpu-specific units for several Stellaris (Fury and Tempest class) targets,
+ STM32F103RB
- old Stellaris unit has been removed
git-svn-id: trunk@18848 -
+ it_interfacejava type (not explicitly selectable via -SI nor
{$interfaces xxx}, but default for jvm target)
* disable it_interfacecom/corba for jvm target
+ init_settings for jvm that select it_interfacejava as default interface
type
+ default_class_type constant (in symconst) that is odt_javaclass for the jvm
target and odt_class for other targets (used to determine the meaning of
"type x = class" declarations)
git-svn-id: branches/jvmbackend@18286 -
switching from a mode that has it to a mode that doesn't have it (which
meant that all modes had it, since the default FPC mode has it)
* added default inline support to mode macpas to minimize breaking existing
code due to this switch (only TP and ISO modes now don't have it by
default)
git-svn-id: trunk@18265 -
change in utils/fpcm/fpcmake.ini in prevous commit.
Adapt also other files to that change:
* compiler/globals.pas: Replace $FPCTARGET by os_string if
tf_use_8_3 flag is set for target_info also.
* tests/Makefile.fpc: Modify TEST_TARGETSUFFIX in the same way
as TARGETSUFFIX was modified in previous commit.
* tests/utils/dotest.pp:
+ New variable UseOSOnly, set to true if only target OS name
should be used for subdirectories.
git-svn-id: trunk@18228 -
* globtype.pas:
tmsgstate updated (ms_on/off/error_global variants added).
ms_local_mask, ms_global_mask : new constants.
tmessagestaterecord: new record, use to list chains
of local changes to warnings by $WARN directive.
pmessagestaterecord: new pointer to tmessagestaterecord.
* globals.pas:
tsettings record:
new field: pmessage of type pmessagestaterecord;
* cmsgs.pas:
TMessage class:
New method: ResetStates; Called on unit parsing changes
New Method: SetVerbosity(nr:longint;newstate:tmsgstate):boolean;
Remember global state in
replacing ClearVerbosity method.
New boolean field: has_local_changes
set if a call to SetVerbosity makes a local change that must be
reset when changing unit.
* verbose.pas:
New functions/procedures:
function SetMessageVerbosity(v:longint;state:tmsgstate):boolean;
for changes caused by $WARN or option
procedure RestoreLocalVerbosity(pstate : pmessagestaterecord);
procedure FreeLocalVerbosity(var fstate : pmessagestaterecord);
function ChangeMessageVerbosity(s: string; var i: integer;state:tmsgstate): boolean;
* switches.pas:
Implement recordpendingmessagestate
flushpendingswitchesstate: Handle new pmessage field of
current_settings record.
* parser.pas:
Handle pmessage field of current_settings.
* scandir.pas:
Handle also integer constants in $WARN.
git-svn-id: trunk@17852 -
into systems.inc include file for direct inclusion by utils/ppudump.pp
+ new generic/cpuinfo.pas unit to allow compilation of ppudump without any
CPU specific code.
* Modified utils/ppudump rule in utils Makefile.fpc
to use generic/cpuinfo unit by use of -dGENERIC_CPU
* globals unit changed to support GENERIC_CPU.
* utils/ppudump.pp changed to remove local enumeration types.
git-svn-id: trunk@17773 -
* TCmdStr changed into an ansistring
* command line parameter handling uses now ansistrings
* message handling parameters are now ansistrings
git-svn-id: trunk@17469 -
- add mode switch extendedrecords to allow/disallow extended records syntax, add this mode switch to delphi mode by default
- disable/enable extended records parsing based on extendedreocrds mode switch
git-svn-id: branches/paul/extended_records@16561 -
+ support for nested procedural variables:
o activate using {$modeswitch nestedprocvars} (compatible with all
regular syntax modes, enabled by default for MacPas mode)
o activating this mode switch changes the way the frame pointer is
passed to nested routines into the same way that Delphi uses (always
passed via the stack, and if necessary removed from the stack by
the caller) -- Todo: possibly also allow using this parameter
passing convention without enabling nested procvars, maybe even
by default in Delphi mode, see mantis #9432
o both global and nested routines can be passed to/assigned to a
nested procvar (and called via them). Note that converting global
*procvars* to nested procvars is intentionally not supported, so
that this functionality can also be implemented via compile-time
generated trampolines if necessary (e.g. for LLVM or CIL backends
as long as they don't support the aforementioned parameter passing
convention)
o a nested procvar can both be declared using a Mac/ISO Pascal style
"inline" type declaration as a parameter type, or as a stand-alone
type (in the latter case, add "is nested" at the end in analogy to
"of object" for method pointers -- note that using variables of
such a type is dangerous, because if you call them once the enclosing
stack frame no longer exists on the stack, the results are
undefined; this is however allowed for Metaware Pascal compatibility)
git-svn-id: trunk@15694 -
* reordered fields of tsetting to avoid unaligned fields
* fixed compilation of arm after disableddircache was added
* increased ppu version
git-svn-id: trunk@13327 -
* changed type of minstacksize, maxstacksize and imagebase from aword
(= size of integer registers of the target platform) into puint
(= size of address space of target platform)
git-svn-id: trunk@13155 -
alignment for each memory reference (mantis #12137, and
test/packages/fcl-registry/tregistry1.pp on sparc). This also
enables better code generation for packed records in many cases.
o several changes were made to the compiler to minimise the chances
of accidentally forgetting to set the alignment of memory references
in the future:
- reference_reset*() now has an extra alignment parameter
- location_reset() can now only be used for non LOC_(C)REFERENCE,
use location_reset_ref() for those (split the tloc enum so the
compiler can catch errors using range checking)
git-svn-id: trunk@12719 -
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 -
shortstring temps don't get maximum alignment)
* changed some gettemptyed() calls into gettemp() calls (gettemptyped
means that this temp can only be used for temps of that type,
which is necessary for refcounted types but not for floats)
git-svn-id: trunk@12036 -
* store a node's verbosity in the node so that e.g. disabling warnings
also disables warnings for this node in pass_1
(the above together fix mantis #12076)
* save/restore verbosity with {$push}/{$pop} (mantis #12075)
* if warnings/notes/hints are turned off, also do not count encountered
ones for the totals (otherwise -Sew cannot be used properly in
combination with {$warnings off}, because disabled warnings will still
trigger a compiler error) -- this required adding -vw/-vn/-vh to all
tests using -Sew/-Sen/-Seh
- removed some superfluous state saving/restoring from firstpass()
git-svn-id: trunk@12025 -
the code using {$pascalmainname x} + storing it in the ppu file
(and give a warning if it's overridden multiple times + test)
git-svn-id: trunk@10406 -
* small cleanups of unused variables in firstpass
* node_resources_fpu() created to get an approximation of the
required fpu registers
* for the moment use node_complexity in the CG until the
node_resource_int() is created
git-svn-id: trunk@8655 -
moved to it)
+ -go[no]dwarfsets switch to [disable]/enable generation of dwarf set
information, as this breaks gdb < 6.5 (used to be disabled in the
compiler by an ifdef, still off by default)
git-svn-id: trunk@8414 -
constants. The default is currently 32 bits/single, which corresponds
to the old behaviour (constants which cannot be exactly represented
in the default/chosen precision will also still be automatically
upgraded to higher precision). Supported constructs:
* Command line switch -CF<x>
* Compiler directive {$MINFPCONSTPREC <x>}
whereby in both cases <x> can be default, 32 or 64. 80 is not supported
because there is no generic way to figure out whether the current target
actually supports 80 bit precision floating point calculations while
parsing the command line switches (pbestreal can still change in case of
win64 or -Cfsse2)
git-svn-id: trunk@8349 -
* fixed some (harmless) ptrint warnings
- removed some commented code in agppcmpw
* added one missing field in a typed constant in cp1251
git-svn-id: trunk@8081 -
+ added ppc740 (g3), ppc7400 (G4) and ppc970 (G5) as ppc32 cpu
targets
* initialise optimizecputype by default to ppc7400 for ppc32 and to
ppc970 for ppc64
* merged ppc32/ppc64 overflow checking code and use the ppc64 one
in case cputype or optimizecputype >= ppc970, because one of
the instructions used in the ppc32 version no longer exists on the
ppc970 (although it's emulated in the kernel on at least Mac OS X)
* moved some other support routines and constants to ppcgen which
were needed for the overflow checking (were identical for ppc32 and
ppc64)
git-svn-id: trunk@6323 -