Commit Graph

15341 Commits

Author SHA1 Message Date
sergei
fe322f35d5 * MIPS: fixed passing CPU type specified with -CpXXX switch to assembler
- 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 -
2013-05-30 15:02:40 +00:00
Jonas Maebe
a1bc04bbb3 * don't omit stack frame generation when generating gprof information, as
mcount expects the frame pointer to be valid

git-svn-id: trunk@24642 -
2013-05-30 13:43:51 +00:00
nickysn
35939ff0a9 + method pointer support for targets with a 16-bit address space in tcgloadnode.pass_generate_code
git-svn-id: trunk@24641 -
2013-05-30 13:22:59 +00:00
svenbarth
6eaefeed7f Addendum to 24628: forgot to increase PPU version
git-svn-id: trunk@24639 -
2013-05-30 12:21:03 +00:00
Jonas Maebe
d6180b1e70 * properly propagate PIC-related suffixes from the x86 assembler reader in
case the operand was parsed as a symbol

git-svn-id: trunk@24638 -
2013-05-30 12:20:48 +00:00
Jeppe Johansen
0bb8d24e24 Add some immediate forms of shift instructions to tcgthumb.a_op_const_reg
git-svn-id: trunk@24637 -
2013-05-30 12:07:32 +00:00
Jeppe Johansen
e5066a5f43 Update jumptabel generation for ARM Thumb
git-svn-id: trunk@24636 -
2013-05-30 12:06:30 +00:00
Jeppe Johansen
c4263ced51 Disable one peephole optimization for Thumb
git-svn-id: trunk@24635 -
2013-05-30 12:05:27 +00:00
nickysn
1797c8b803 * i8086 fixes for the handling of large sets in tx86innode.pass_generate_code; test/cg/tin.pp works now
git-svn-id: trunk@24634 -
2013-05-30 10:16:05 +00:00
sergei
0ad96d2099 * MIPS: some clean up of assembler reader:
- references cannot be in brackets
  - registers are only prefixed by dollar, never by percent
  - syntax x@LO is not supported, must be %lo(x).

git-svn-id: trunk@24633 -
2013-05-30 09:28:21 +00:00
sergei
2944fc8839 * MIPS improvements:
* reworked condition codes, changed BC1T and BC1F from separate instructions to condition jumps.
  - removed A_P_SW, A_P_LW and A_SPARC8UNIMP
  + support '.set at' and '.set noat' directives
  + prepare to support bgtz,bgez,bltz,blez instructions.

git-svn-id: trunk@24631 -
2013-05-29 17:35:56 +00:00
sergei
e1f6cf79e9 * MIPS: an empty reference (no symbol, base or index and zero offset) must not be output as empty string.
git-svn-id: trunk@24630 -
2013-05-29 15:59:40 +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
de345ac191 * added missing setbase fixup in tx86innode.pass_generate_code for the case of LOC_CONSTANT in LOC_REFERENCE for large sets
git-svn-id: trunk@24619 -
2013-05-26 10:53:42 +00:00
nickysn
533bd30094 * some more i8086 bug fixes in tx86innode.pass_generate_code
git-svn-id: trunk@24618 -
2013-05-26 09:08:28 +00:00
nickysn
967e10ea95 * i8086 fixes in tx86innode.pass_generate_code
git-svn-id: trunk@24617 -
2013-05-25 22:46:50 +00:00
nickysn
f3ad9ce9ce * i8086 fixes in tx86typeconvnode.second_int_to_bool; this fixes tcnvint2.pp
git-svn-id: trunk@24615 -
2013-05-25 21:19:55 +00:00
nickysn
b43c4c4aca * i8086 fixes in tx86typeconvnode.second_int_to_real
git-svn-id: trunk@24606 -
2013-05-25 16:37:41 +00:00
nickysn
2b583bb265 * do not use fsin and fcos on 286-, since they're 387+
git-svn-id: trunk@24596 -
2013-05-25 15:24:53 +00:00
nickysn
09249b31b8 * use the generic implementation of second_IncludeExclude in case the cpu is earlier than 386, since then it does not support BTR and BTS
git-svn-id: trunk@24593 -
2013-05-25 14:18:55 +00:00
nickysn
06838be452 * fixed bug when passing a 'single' floating point type parameter via tcg8086.a_load_ref_cgpara
git-svn-id: trunk@24592 -
2013-05-25 13:37:24 +00:00
nickysn
27adafeecb + support moving from a shorter unsigned (sign extension not yet implemented) to a longer type in tcg8086.a_load_reg_ref
git-svn-id: trunk@24589 -
2013-05-25 12:05:02 +00:00
nickysn
c41d93214f * fixed passing a longint to an array of const parameter on i8086 (and other 8/16-bit cpus)
git-svn-id: trunk@24588 -
2013-05-25 10:14:39 +00:00
nickysn
3aeea835f9 + int register in treference.segment support in tcg8086.op_*ref*
git-svn-id: trunk@24586 -
2013-05-24 19:57:02 +00:00
florian
2ec15deaba * more readable register allocation comments
git-svn-id: trunk@24585 -
2013-05-24 19:03:50 +00:00
florian
23c84fd27c * more fixes for segment register usage
git-svn-id: trunk@24584 -
2013-05-24 19:02:09 +00:00
nickysn
5dfdb616be * fixed a regression, introduced in r24571
git-svn-id: trunk@24583 -
2013-05-24 18:25:11 +00:00
florian
c1a1325a72 * reduce register pressure by allocating/deallocating registers as late/early as possible
git-svn-id: trunk@24581 -
2013-05-24 18:09:15 +00:00
florian
b734c17c4f * formatting
git-svn-id: trunk@24580 -
2013-05-24 18:08:05 +00:00
florian
b85addb451 + color segment register
git-svn-id: trunk@24579 -
2013-05-24 17:57:28 +00:00
nickysn
a308994423 * i8086 specific code from tcgpointerconstnode.pass_generate_code moved to an i8086 specific overriden method
git-svn-id: trunk@24577 -
2013-05-24 17:16:55 +00:00
svenbarth
2c792659ce Fix for Mantis #24071.
pdecl.pas, types_dec:
  * extract the determination of the nested generic def to a new local function "determine_generic_def"
  * use "determine_generic_def" to determine the generic def in case of a forward def and pass this and the generic type list to "object_dec"

+ added test

git-svn-id: trunk@24572 -
2013-05-24 15:27:27 +00:00
nickysn
d300116419 * fixed a bug, which caused ptr(nonconst, const) to be incorrectly inlined as a const
git-svn-id: trunk@24571 -
2013-05-24 15:26:43 +00:00
nickysn
8b1e621665 * segment in int register support added also to tcg8086.a_load_reg_ref and .a_load_ref_reg
git-svn-id: trunk@24570 -
2013-05-24 14:46:40 +00:00
nickysn
9171c19601 * support int register in treference.segment in tcg8086.a_load_const_ref; this fixes farptr^:=const
git-svn-id: trunk@24569 -
2013-05-24 13:36:22 +00:00
nickysn
0baa004571 * i8086 far pointer fix in tcgpointerconstnode.pass_generate_code; this finally fixes ptr(constseg,constofs)
git-svn-id: trunk@24568 -
2013-05-24 13:08:31 +00:00
nickysn
a86cb5c600 + far pointer fixes in the internal compiler handling of ptr(const,const)
git-svn-id: trunk@24567 -
2013-05-24 12:42:43 +00:00
nickysn
ed29f7a92d + far pointer support in tpointerconstnode
git-svn-id: trunk@24566 -
2013-05-24 12:41:53 +00:00
sergei
c31321c2fe * TCGMIPS.handle_reg_const_reg(): fixed to generate 'real' CPU instructions, so macro processing by assembler is no longer needed.
git-svn-id: trunk@24564 -
2013-05-24 03:56:51 +00:00
sergei
23cb216435 * RTTI fix for alignment-sensitive targets:
* typinfo.pp: the newly introduced records were added into {$PACKRECORDS 1} area of effect, which  effectively made all records packed, entirely defeating FPC_REQUIRES_PROPER_ALIGNMENT purpose. 
  * added alignment between TProcedureParam records, adjusted TProcedureSignature.GetParam() appropriately.
   * ncgrtti.pas: added two missing alignments and removed a redundant one.
   * tests/test/trtti9.pp: modified to use TProcedureSignature.GetParam() and endian-independent check for parameter flags.

git-svn-id: trunk@24562 -
2013-05-23 16:03:42 +00:00
nickysn
abeb2a3aaa * fixed the far pointer size not being updated after reading the near/far type modifier, which caused far pointers to be allocated only 2 bytes
git-svn-id: trunk@24554 -
2013-05-22 16:44:05 +00:00
nickysn
fd429612f8 + initial (and not yet fully complete) implementation of far pointers on the i8086
git-svn-id: trunk@24553 -
2013-05-22 16:26:33 +00:00
nickysn
42b2228dc7 + far pointer support in defutil.def_cgsize
git-svn-id: trunk@24552 -
2013-05-22 12:30:34 +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
10ef91a7f6 * updated ppudump after the x86 pointer type changes introduced in r24453
git-svn-id: trunk@24548 -
2013-05-21 14:46:52 +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
sergei
d367148f75 - Removed obsolete comments (copypasted from other CPU code, most likely).
- Removed topsize, MIPS target does not use it.

git-svn-id: trunk@24535 -
2013-05-20 10:39:05 +00:00
nickysn
47fe8e03b1 * refactored ncgutil.gen_load_cgpara_loc to use cgpara.locations_count
git-svn-id: trunk@24532 -
2013-05-19 18:49:21 +00:00
nickysn
49bd829ffc * refactored cg64f32.splitparaloc64 to use cgpara.locations_count
git-svn-id: trunk@24531 -
2013-05-19 18:44:54 +00:00
nickysn
3e22ec43b5 + added method TCGPara.locations_count
git-svn-id: trunk@24530 -
2013-05-19 18:37:55 +00:00
nickysn
b9084a22ca * in the nasm writer only declare labels as global if they have labsym.bind=AB_GLOBAL; this fixes compilation of i8086-msdos programs that use multiple units
git-svn-id: trunk@24529 -
2013-05-19 17:51:29 +00:00
nickysn
ecb5a4866d * refactored the int64 result passing in ax:bx:cx:dx to use 4 paralocs, instead of the GetNextReg hack
git-svn-id: trunk@24527 -
2013-05-19 12:50:15 +00:00
svenbarth
f1f89c77c3 Finally refactor "b_needs_init_final" flag to be a symtable flag which is written to/loaded from the PPU (as discussed in the thread "Status report for "class helpers"" in fpc-devel on 29th January 2011).
symconst.pas:
    + add "sto_needs_init_final" value to "tsymtableoptions"
symtable.pas:
    - TStoredSymtable: remove "b_needs_init_final"
    + TStoredSymtable: add "init_final_check_done" (which is False by default)
    * TStoredSymtable.ppuload: set "init_final_check_done" to True if PPU is loaded (because the flag will then already be restored)
    * TStoredSymtable.needs_init_final: check the symbols only if "init_final_check_done" is not set yet
    * TStoredSymtable._needs_init_final: only check the symbol if "sto_needs_init_final" is not set yet and set the flag accordingly if needed
utils/ppuutils/ppudump.pp:
    * respect the new flag

git-svn-id: trunk@24523 -
2013-05-17 12:15:13 +00:00
paul
b333ef582b compiler: don't treat array[..] of dynamic array as a 2 dimension array
git-svn-id: trunk@24522 -
2013-05-17 01:08:27 +00:00
yury
10c1b11d15 * ppudump: Output "RetType" attribute for procedures and destructors.
git-svn-id: trunk@24511 -
2013-05-15 14:18:38 +00:00
sergei
300289dd89 * MIPS: reworked 64-bit code generation, implemented overflow checking and optimized operations with constants.
git-svn-id: trunk@24508 -
2013-05-15 10:02:08 +00:00
sergei
bfd7401541 * MIPS: overflow checking added in r24445 works only when source and destination of operation are different registers. Fixed cases of operations on same register.
git-svn-id: trunk@24507 -
2013-05-15 09:55:47 +00:00
yury
2ec85e9705 * ppudump: Output "Size" attribute for objects and records.
git-svn-id: trunk@24506 -
2013-05-15 09:13:12 +00:00
nickysn
512ca83f33 - don't allocate/deallocate the fpu registers in tcg.[de]allocallcpuregisters on the i8086
git-svn-id: trunk@24505 -
2013-05-15 08:24:07 +00:00
yury
ec6ff22588 * ppudump: Output "MethodPtr" attribute for procedural types.
git-svn-id: trunk@24504 -
2013-05-15 08:15:23 +00:00
nickysn
9f0c23bd4c * fixed round() on i8086 after r24502
git-svn-id: trunk@24503 -
2013-05-15 00:45:08 +00:00
nickysn
3665ed4b03 + enabled returning int64 in ax:bx:cx:dx for the i8086
git-svn-id: trunk@24502 -
2013-05-14 22:45:57 +00:00
nickysn
d433408a7d -rm BX from i8086's saved_stadard_registers array, as it interferes with returning int64 in ax:bx:cx:dx and it shouldn't be saved anyway
git-svn-id: trunk@24501 -
2013-05-14 22:32:02 +00:00
nickysn
8fea00d8f5 - rm NR_PIC_OFFSET_REG from i8086/cpubase.inc, because it isn't used (and shouldn't be used) on the i8086
git-svn-id: trunk@24500 -
2013-05-14 22:22:24 +00:00
nickysn
2557382815 - rm tcg8086.g_maybe_got_init as it's of no use for the i8086
git-svn-id: trunk@24499 -
2013-05-14 22:20:04 +00:00
nickysn
6b2f59c3e0 + preparations for returning int64 in ax:bx:cx:dx on i8086
git-svn-id: trunk@24498 -
2013-05-14 22:19:17 +00:00
nickysn
0b09c50138 * updated ppudump because of the ppu changes in r24491
git-svn-id: trunk@24497 -
2013-05-14 19:22:54 +00:00
nickysn
80e76534a5 * incremented CurrentPPUVersion after r24491, because it changes the ppu structure on at least one platform (ppcjvm)
git-svn-id: trunk@24496 -
2013-05-14 14:42:01 +00:00
Jonas Maebe
11d5d4f79d * check range of enums and booleans in typed constant expressions when
using the asmlist generator (mantis #24428)

git-svn-id: trunk@24495 -
2013-05-14 12:05:00 +00:00
nickysn
e2cd2813ce + stop with an internal error if GetNextReg is called with a non-imaginary register
git-svn-id: trunk@24493 -
2013-05-13 22:34:13 +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
0d58fd6cd0 * fixed tppufile.getaint for 8/16-bit CPUs
git-svn-id: trunk@24484 -
2013-05-11 22:04:56 +00:00
nickysn
92afd7cccd + R_SUBH support added in x86/aasmcpu.spilling_create_load and spilling_create_store
git-svn-id: trunk@24477 -
2013-05-09 14:10:45 +00:00
nickysn
2a9d38d878 + proper spilling support for R_SUBH (i.e. AH,BH,CH,DH) x86 registers in trgx86.do_spill_replace
git-svn-id: trunk@24476 -
2013-05-09 11:57:00 +00:00
Jonas Maebe
1358618c36 * only display and allow ABIs that are actually supported by the current
compiler binary

git-svn-id: trunk@24475 -
2013-05-08 14:30:38 +00:00
nickysn
c4dd85a0eb + implemented tcg8086.a_op_reg_ref
git-svn-id: trunk@24474 -
2013-05-08 11:49:39 +00:00
nickysn
85b98671bd + implemented tcg8086.a_op_const_ref for op_add/and/or/sub/xor/move/none; this fixes inc(longint) among other things
git-svn-id: trunk@24473 -
2013-05-08 08:23:46 +00:00
paul
980bc634b4 compiler:
- add write_rtti_reference method, 
  - minor refactoring, 
  - always write nil as RTTI reference for objc types and void types

git-svn-id: trunk@24471 -
2013-05-08 05:47:48 +00:00
paul
fceb6c3cc5 compiler: skip objc types in ProcVar rtti arguments and result type
git-svn-id: trunk@24470 -
2013-05-08 03:40:01 +00:00
paul
bc973e538d compiler: write extended RTTI for tkProcVar (tkProcedure in Delphi)
rtl: add appropriate types for tkProcVar RTTI (based on Delphi help)
+ test

git-svn-id: trunk@24468 -
2013-05-08 02:52:13 +00:00
nickysn
2d67a3169d * i8086 fixes in tcg8086.g_copyvaluepara_openarray
git-svn-id: trunk@24467 -
2013-05-07 22:34:26 +00:00
nickysn
502c2ffb94 * fixed tcg8086.a_load_reg_reg when doing an unsigned extension in the same superregister; this fixes the taddbool test
git-svn-id: trunk@24466 -
2013-05-07 21:20:40 +00:00
Jonas Maebe
b16677a75b * only pass --gc-sections to the linker if smart linking is enabled
(mantis #24396)

git-svn-id: trunk@24465 -
2013-05-07 20:28:54 +00:00
nickysn
5a4a3cbbc3 + implemented tcg8086.a_op_ref_reg; supports op_add/sub/xor/or/and
git-svn-id: trunk@24464 -
2013-05-07 19:19:55 +00:00
nickysn
0a8e008a0d + the ES register made volatile on i8086 as per the 16-bit x86 calling conventions
git-svn-id: trunk@24462 -
2013-05-07 14:27:21 +00:00
paul
fe04dedbab compiler: change RTTI size of record field offset from fixed 32bit to platform dependent integer (sizeint) since it is stored this way in the compiler. This is also Delphi compatible, rtl: adopt rtl appropriately
git-svn-id: trunk@24460 -
2013-05-07 11:25:41 +00:00
paul
5f709430d4 compiler: fix indentation
git-svn-id: trunk@24459 -
2013-05-07 10:39:47 +00:00
paul
dce960c97b compiler: write Delphi compatible tkArray RTTI:
- TotalSize of all array dimensions instead of first dimension size
  - Element type of last array dimension
  - dimension information
rtl:
  - adopt array initialization/finalization/copy for the new tkArray RTTI
  - add Delphi compatible TArrayTypeData member for typinfo.TTypeData structure
tests:
  - add a test which checks RTTI information for 2 dimension array

git-svn-id: trunk@24458 -
2013-05-07 09:12:18 +00:00
paul
d38bd1b9bd compiler: remove dummy ado_none from tarraydefoption. It is probably a leftover from time when tarraydefoptions was not present, comment options
ppudump: simplify readarraydefoptions

git-svn-id: trunk@24456 -
2013-05-07 06:51:32 +00:00
paul
39cee28f01 compiler: don't write reference to objc classes/protocols when writing tkClassRef rtti
git-svn-id: trunk@24454 -
2013-05-06 13:12:09 +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
sergei
7cfc737866 * MIPS: rewrote 32-bit code generation methods, reducing code duplication.
+ Implemented overflow checking for unsigned 32-bit addition and subtraction.
* Use optimize_op_const instead of custom optimizations.
* Change AND/OR/XOR into ANDI/ORI/XORI if they use immediate operands, and use correct range for these immediate operands, must be 0..65535 unlike -32768..32767 for arithmetic operations.
* Don't treat AND/OR/XOR as macros, no longer necessary.
* Don't treat BEQ/BNE as macros either.

git-svn-id: trunk@24445 -
2013-05-05 05:55:03 +00:00
paul
da35b3c601 compiler, rtl: write CodePage for AnsiString RTTI (Delphi compatible), change TTypeData appropriately + test
git-svn-id: trunk@24444 -
2013-05-05 05:05:08 +00:00
paul
714511a4d9 compiler: typo
git-svn-id: trunk@24441 -
2013-05-05 03:46:42 +00:00
paul
5cd3f9d8fb compiler: don't write rtti for objc classes/protocols (a trial to fix build on mac)
git-svn-id: trunk@24440 -
2013-05-05 03:18:59 +00:00
florian
e6489ed7d2 * arm thumb: do not generate illegal ror instructions
git-svn-id: trunk@24439 -
2013-05-04 22:00:17 +00:00
marco
09e742f243 * add a -dfpc define to the resource compiler commandlines, which allows to make FPC specific exceptions in resource scripts. Mantis #24044
git-svn-id: trunk@24438 -
2013-05-04 21:25:36 +00:00
florian
ccdd4437d6 * arm thumb: do not cause bxx getting too long ranges when inserting constant blocks
git-svn-id: trunk@24437 -
2013-05-04 20:36:08 +00:00