Commit Graph

750 Commits

Author SHA1 Message Date
nickysn
5b503f42c7 + implemented Mem/MemW/MemL[] for i8086
git-svn-id: trunk@24665 -
2013-05-31 13:31:45 +00:00
svenbarth
956b26bc97 Completely reworked implementation of generic constraints, by moving the generic constraint data from the symbols to the definitions (I originally thought that this would simplyfy things, but the more correct approach is to add it to the defs).
symsym.pas:
    - remove "tgenericconstraintdata" and any using/loading/writing of it in "ttypesym"
    - remove "tgenericconstraintflag"
symdef.pas:
    + add "tgenericconstraintdata"
    + load and write "genconstraintdata" in "tstoreddef"
symconst.pas:
    + add "tgenericconstraintflag" so it can be used in "ppudump" as well
defcmp.pas, compare_defs_ext:
    * as we allow global operator overloads we can't really determine whether two defs are compatible, because a valid operator for the specialization types might just happen to be in scope of the generic; so for now constraints are only strictly checked when declaring a specialization
pgenutil.pas:
    * adjust "parse_generic_parameters" and "check_generic_constraints" to the new location of the constraint data
ppudump.pp:
    * corrrectly parse defs which contain generic constraints

git-svn-id: trunk@24628 -
2013-05-29 08:19:02 +00:00
svenbarth
cc5a108cca Allocate the list for generic parameters in tstoreddef only on demand as most defs won't contain generic parameters anyway (avoids a little bit of runtime and memory overhead per def).
symdef.pas, tstoreddef:
  + comment that the list is allocated on demand (and thus should be checked for Nil)
  + fillgenericparas: create the list when adding at least one generic parameter symbol
  - create & ppuload: don't create list instance anymore
  + is_generic & is_specialization: check whether the list is assigned
defcmp.pas, compare_defs_ext:
  + check whether "genericparas" list is assigned
pgenutil.pas:
  + check_generic_constraints: check whether "genericparas" is assigned
  + insert_generic_parameter_types: create list before adding generic parameters

git-svn-id: trunk@24627 -
2013-05-29 07:50:49 +00:00
nickysn
e810cabf50 * set tpointerdef.savesize correctly for far and huge pointers
git-svn-id: trunk@24551 -
2013-05-22 11:54:42 +00:00
nickysn
f571aebdd0 * tx86pointertyp moved from unit symdef to symconst, so it can be used by ppudump
git-svn-id: trunk@24547 -
2013-05-21 14:18:48 +00:00
nickysn
d95c995894 - rm the commented out code of tpointerdef.createfar
git-svn-id: trunk@24546 -
2013-05-21 13:59:36 +00:00
nickysn
ae74cd17d2 * tarraydef.ppuload/ppuwrite: use ppufile.getasizeint/putasizeint for reading/writing lowrange and highrange as they're asizeint type, not aint
git-svn-id: trunk@24491 -
2013-05-13 12:37:11 +00:00
nickysn
b0f7786782 + added support for special versions of near data pointers associated with a x86 segment register. They are supported on all x86 platforms: i8086, i386 and x86_64
git-svn-id: trunk@24453 -
2013-05-05 17:22:37 +00:00
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
nickysn
5caadbbc40 + added method tabstractprocdef.is_pushleftright that exists on all platforms and returns whether parameters must be loaded left to right
git-svn-id: branches/i8086@24281 -
2013-04-21 09:49:34 +00:00
florian
e1233e0111 * asizeint => longint, it is unlikely that an variant record well ever have more than 2^31 branches
git-svn-id: trunk@24260 -
2013-04-16 16:49:42 +00:00
florian
2fdd3e2d0a + introduce tvariantrecbranch to be able to store
all needed information for iso compatible variant records
* new for variant records as required by iso pascal
+ tests

git-svn-id: trunk@24241 -
2013-04-14 15:50:42 +00:00
florian
7ba197a221 * fix stack parameter handling for arm thumb
* fix entry/exit code generation for arm thumb

git-svn-id: trunk@24197 -
2013-04-07 21:01:15 +00:00
nickysn
b178a038f5 * set the FileRec size for i8086
git-svn-id: branches/i8086@23858 -
2013-03-16 12:07:39 +00:00
nickysn
a0e683bed6 * set the proper TextRec size for i8086
git-svn-id: branches/i8086@23854 -
2013-03-16 10:45:57 +00:00
nickysn
30d661734c + enable tprocdef.fpu_used for i8086 also
git-svn-id: branches/i8086@23835 -
2013-03-14 16:33:37 +00:00
nickysn
a9809323dc some more generic i8086 defines added
git-svn-id: branches/i8086@23712 -
2013-03-07 22:46:00 +00:00
svenbarth
344571cb4e Added support for type helpers. In non Delphi modes they use "type helper" and in mode Delphi they use "record helper". They can also be used on constants.
symconst.pas:
  + extend "thelpertype" by "ht_type" which tells the code in "pdecobj.parse_extended_type" that a type helper declaration has been parsed
node.pas:
  + add a constant which identifies all constant node types
ptype.pas:
  + read_named_type: add a parameter "hadtypetoken" to tell the code whether a "type" token had been parsed before
  + read_named_type: if an identifier "helper" is parsed we need to check whether "hadtypetoken" is true and the modeswitch "m_class" is set, but the "m_delphi" one is not; in that case we have a "type helper" declaration
pgenutil.pas, generate_specialization:
  * adjust call to read_named_type
pdecl.pas, types_dec:
  * adjust call to read_named_type

pdecobj.pas:
  * parse_extended_type: extend for correct handling of primitive types (includes Delphi compatible handling as well) and reject types that are explicitly not allowed
  * method_dec: require "static" for class methods in type helpers
  * method_doc: allow constructors for type helpers as well
paramgr.pas, tparamanager:
  * set_common_funcretloc_info: handle type helper constructors like record constructors
  * handle_common_ret_in_param: the "self" value of a type helper constructor is also returned in a parameter
pexpr.pas:
  + add a function to postfixoperators which tries to find and apply a type helper for a given type
  * postfixoperators: try to apply type helpers for ordinal constants
  * postfixoperators: use the correct string type for string constants
  * postfixoperators: try to apply type helpers for enum constants
  * postfixoperators: try to apply type helpers for arrays
  * postfixoperators: try to apply type helpers for Variant
  * postfixoperators: try to apply type helpers for pointer types
  * postfixoperators: try to apply type helpers for other types
  * factor: check postfixoperators after _REALNUMBER, _CCHAR, _CWCHAR, _TRUE and _FALSE
  * factor: also check postfixoperators if a _POINT follows a _NIL

symdef.pas, tdefawaresymtablestack.addhelpers:
  * use "generate_objectpascal_helper_key" to generate the key
symtable.pas:
  + add function to generate the key value for the map of extended types using the extended def
  * adjust "search_last_objectpascal_helper" and "search_objectpascal_helper" to handle primitive types as well
  * use the new "generate_objectpascal_helper_key" function to generate the key

pparautl.pas:
  * insert_self_and_vmt_para: don't insert the $vmt symbol for record or type helpers (ToDo: check whether class helpers really need the symbol as well)
  * insert_self_and_vmt_para: pass "self" as var parameter for type helpers as well
psub.pas, generate_bodyentry_block: 
  * also allow type helpers for constructor methods
ncal.pas, tcallnode.gen_self_tree:
  * also use a temp variable for type helper constructors
ncgcal.pas, tcgcallnode.secondcallparan:
  * allow Pointers to be passed as address param if it is the Self value of a type helper extending a pointer type
  * correctly handle the location in case of type helper constructors

+ add tests

git-svn-id: trunk@23580 -
2013-02-06 09:49:35 +00:00
svenbarth
6fb958a491 symdef.pas, tstoreddef:
* adjust "is_generic" so that it will really work for true generics only
  + added an analogous method "is_specialization" for specializations

Both methods are not used yet, but this will change in the future...

git-svn-id: trunk@23348 -
2013-01-09 09:34:20 +00:00
florian
889b7285b1 * disable record register variables with a size of 2*sizeof(asizeint) on big endian architectures
git-svn-id: trunk@23331 -
2013-01-06 19:46:53 +00:00
florian
4f30ac0247 * put records with 16 bytes size into two register on 64 bit targets if possible
* don't put records containing floats into integer registers
* copy&paste error in tcg128.a_load128_const_reg fixed

git-svn-id: trunk@23317 -
2013-01-05 22:58:32 +00:00
florian
c781f21a46 * records with two times the size of a register can be kept in registers
git-svn-id: trunk@23313 -
2013-01-04 21:48:41 +00:00
florian
4d6471fef6 * get rid of calls to empty procedures having parameters without side effect
git-svn-id: trunk@23274 -
2013-01-01 15:58:05 +00:00
Jonas Maebe
c4a55f5481 * store the "synthetic kind" information about procdefs in ppu files,
required by future patch

git-svn-id: trunk@22956 -
2012-11-08 20:17:53 +00:00
florian
b2706861f6 + define bestrealtype for aarch64
git-svn-id: trunk@22902 -
2012-11-01 17:19:46 +00:00
sergei
12ad6704f6 - Removed a number of unused variables, reduces noise at compilation.
git-svn-id: trunk@22880 -
2012-10-30 11:55:59 +00:00
florian
04543b179f o merge of the branch laksen/arm-embedded of Jeppe Johansen:
fixes a couple of arm-embedded stuff, 
  adds some controllers, start of fpv4_s16 support, for a complete list of
  changes see below:
------------------------------------------------------------------------
r22787 | laksen | 2012-10-20 22:00:36 +0200 (Sa, 20 Okt 2012) | 1 line

Properly do NR_DEFAULTFLAGS detection/allocation/deallocation
------------------------------------------------------------------------
r22782 | laksen | 2012-10-20 07:44:55 +0200 (Sa, 20 Okt 2012) | 1 line

Fixed flags detections code for wide->short optimization code for Thumb-2
------------------------------------------------------------------------
r22778 | laksen | 2012-10-19 20:23:14 +0200 (Fr, 19 Okt 2012) | 1 line

Added coprocessor registers, and support for 6 operands(MCR/MRC instructions, etc)
------------------------------------------------------------------------
r22647 | laksen | 2012-10-14 21:28:08 +0200 (So, 14 Okt 2012) | 1 line

Added register specifications to lpc1768.pp. From Joan Duran
------------------------------------------------------------------------
r22646 | laksen | 2012-10-14 21:10:20 +0200 (So, 14 Okt 2012) | 4 lines

Fixed some minor formating issues
Implemented a small heap mananger
Implemented console IO
Changed default LineEnding to CrLf(to ease console IO parsing)
------------------------------------------------------------------------
r22599 | laksen | 2012-10-09 08:58:58 +0200 (Di, 09 Okt 2012) | 1 line

Added all STM32F1 configurations
------------------------------------------------------------------------
r22597 | laksen | 2012-10-08 22:10:45 +0200 (Mo, 08 Okt 2012) | 1 line

Added initial support for the Cortex-M4F FPv4_S16 FPU
------------------------------------------------------------------------
r22596 | laksen | 2012-10-08 22:04:14 +0200 (Mo, 08 Okt 2012) | 1 line

Added FPv4_d16 FPU instructions, and a few extra registers
------------------------------------------------------------------------
r22592 | laksen | 2012-10-08 16:07:40 +0200 (Mo, 08 Okt 2012) | 2 lines

Added support for IT block merging
Added a peephole pattern check for UXTB->UXTH chains
------------------------------------------------------------------------
r22590 | laksen | 2012-10-08 14:30:00 +0200 (Mo, 08 Okt 2012) | 3 lines

Add CBNZ/CBZ instructions
Create preliminary Thumb-2 PeepHoleOptPass2 code, hacked together from the ARM mode code
Added a number of simple size optimizations for common Thumb-2 instructions
------------------------------------------------------------------------
r22582 | laksen | 2012-10-08 06:49:39 +0200 (Mo, 08 Okt 2012) | 3 lines

Fix optimizations of Thumb-2 code
Fix problem with loading of condition operand for IT instructions
Properly split IT blocks when register allocator tries to spill inside a block.
------------------------------------------------------------------------
r22581 | laksen | 2012-10-08 05:15:40 +0200 (Mo, 08 Okt 2012) | 4 lines

Fixed assembler calling command line for cpus>ARMv5TE. EDSP instructions will generate errors while assembling, due to RTL assembler routines
Updated boot code for all Cortex-M3 controllers, and sc32442b to use weak linking for exception tables.
Cortex-M3 devices now also share initialization routine to simplify maintenance
STM32F10x classes now have specific units which fit the interrupt source names and counts
------------------------------------------------------------------------
r22580 | laksen | 2012-10-08 05:10:44 +0200 (Mo, 08 Okt 2012) | 2 lines

Added support for .section, .set, .weak, and .thumb_set directive for GAS assembler reader
IFDEF'ed JVM specific assembler directives, to prevent ait_* set to exceed 32 elements
------------------------------------------------------------------------
r22579 | laksen | 2012-10-08 02:10:52 +0200 (Mo, 08 Okt 2012) | 3 lines

Remove all traces of the interrupt vector table generation mechanism
Clean up cpuinfo tables
Fixed ARMv7M bug(BLX <label> doesn't exist on that version)

git-svn-id: trunk@22792 -
2012-10-21 08:39:52 +00:00
Jonas Maebe
b1d661d774 * look in the iPhoneAll unit for NSFastEnumeration* types on iOS/iphonesim,
instead of in the CocoaAll unit

git-svn-id: trunk@22611 -
2012-10-11 08:04:20 +00:00
Jeppe Johansen
8b17a358e4 Remove all traces of the interrupt vector table generation mechanism
Clean up cpuinfo tables
Fixed ARMv7M bug(BLX <label> doesn't exist on that version)

git-svn-id: branches/laksen/arm-embedded@22579 -
2012-10-08 00:10:52 +00:00
Jonas Maebe
032d96b415 * re-added aasmdata because it's required when compiling a compiler for the
jvm target

git-svn-id: trunk@22469 -
2012-09-27 08:59:09 +00:00
Jonas Maebe
e3b97d99c6 * fixed memory leaks in case a TP-style object inherits from another object
type that contains managed types, but this child doesn't contain any
    managed type itself (since r16632, the parent should be considered as a
    field of the child in terms of needing initialization/finalization)

git-svn-id: trunk@22461 -
2012-09-26 14:26:00 +00:00
florian
ca5fabda6d * cleanup some unused units from uses clauses
git-svn-id: trunk@22433 -
2012-09-21 18:53:46 +00:00
svenbarth
29c71d39ac Preparations for upcoming work on generics:
+ symconst.pas: add a new flag to symtables to mark them as containing at least one generic (will be used to decide whether an expression like "Foo<Bar" should even remotely be considered a specialization)
* utils/ppudump.pp: respect the new flag
* pdecl.pas, types_dec: add the flag for every generic we have parsed
* pgenutil.pas, generate_specialization: add the flag to the specialize symtable if a nested generic set it for the temporary symtable (does not happen currently, but will in the future when nested generics are supported)
+ keep references to all generic para symbols in the def; this way the symtable containing the type parameters does not need to be walked every time we need to do something with the parameters

git-svn-id: trunk@22379 -
2012-09-13 11:35:35 +00:00
florian
7901662eb3 + mark method pointers as regable
git-svn-id: trunk@22337 -
2012-09-06 15:11:42 +00:00
Jonas Maebe
ad054831bb * save/restore itype and implementsgetter fields of timplementedinterface
to/from ppu, because it can be required while resolving type casts
    (mantis #22741)

git-svn-id: trunk@22266 -
2012-08-29 16:07:55 +00:00
florian
04034b6771 * avr uses a reduced buffer and file name length in textrecs and filerecs
* fixed file and text sizes for avr

git-svn-id: trunk@22147 -
2012-08-20 20:11:13 +00:00
florian
49246b6263 * make textrec/filerec unpacked, this improves the code significantly on arm etc.
git-svn-id: trunk@22057 -
2012-08-10 21:17:50 +00:00
Jonas Maebe
be2c757aad * don't crash in getarraydef/getpointerdef if localsymtable is still nil
git-svn-id: trunk@22019 -
2012-08-06 20:13:11 +00:00
florian
c2eb030632 * for proper alignment in arrays of text, text should be a multiple of 4 in size on 32 bit platforms
git-svn-id: trunk@21956 -
2012-07-23 19:12:27 +00:00
Jonas Maebe
3798b79fd7 + optimization that (re)orders instance fields of Delphi-style classes in
order to minimise memory losses due to alignment padding. Not yet enabled
    by default at any optimization level, but can be (de)activated separately
    via -Oo(no)orderfields
   o added separate tdef.structalignment method that returns the alignment
     of a type when it appears in a record/object/class (factors out
     AIX-specific double alignment in structs)
   o changed the handling of the offset of a delegate interface
     implemented via a field, by taking the field offset on demand
     rather than at declaration time (because the ordering optimization
     causes the offsets of fields to be unknown until the entire
     declaration has been parsed)

git-svn-id: trunk@21947 -
2012-07-22 16:47:19 +00:00
Jonas Maebe
07ebc51b6c * always store generics token streams in little endian, so we don't have to
keep a separate field for each tstoreddef that records whether the
    endianness needs to be swapped

git-svn-id: trunk@21914 -
2012-07-15 16:09:14 +00:00
pierre
ae7dd3a930 tprocdef.total_local_size field added for MIPS cpu
git-svn-id: trunk@21586 -
2012-06-12 22:54:42 +00:00
Jonas Maebe
d6f85c35b5 - removed stray symtablestack.push() after r21282
git-svn-id: trunk@21301 -
2012-05-15 13:04:51 +00:00
Jonas Maebe
f95925dd91 * don't push/pop current_module.localsymtable when adding explicitly created
pointer/arraydefs, because these operations can have side-effects in case
    of helpers (will add/remove helpers, so popping after the insertion
    removed all helpers in the static symtable of the current unit)

git-svn-id: trunk@21282 -
2012-05-12 22:24:27 +00:00
Jonas Maebe
85a3fd3357 + ossinttype/osuinttype defs that correspond to OS_SINT/OS_INT for use in
the high level code generator

git-svn-id: trunk@21279 -
2012-05-12 16:03:15 +00:00
Jonas Maebe
ab914a8ae3 * the code page of unicodestring/widestring on big endian targets is
UTF-16BE, not UTF-16LE

git-svn-id: trunk@21255 -
2012-05-08 13:38:16 +00:00
sergei
a54e342060 + Reduce the amount of RTTI by not generating 'init' information if it will end up being the same as the 'full' one (which is the case of most simple types). The new behavior can be customized for every tdef by overriding needs_separate_initrtti method.
git-svn-id: trunk@21077 -
2012-04-27 10:17:59 +00:00
Jonas Maebe
564445da8c * re-enabled enum -> dispinterface typecasts after r21069, bug noticed by
Paul

git-svn-id: trunk@21076 -
2012-04-27 09:30:25 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
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 -
2012-04-15 15:54:10 +00:00
florian
dd70debe80 * records containing managed types are not "regable", resolves #21674
git-svn-id: trunk@20753 -
2012-04-07 20:19:48 +00:00