506
441
result:=generic_regname(r);
445
function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
447
inverse: array[TAsmCond] of TAsmCond=(C_None,
448
C_NA,C_NAE,C_NB,C_NBE,C_NC,C_NE,C_NG,C_NGE,C_NL,C_NLE,C_A,C_AE,
449
C_B,C_BE,C_C,C_E,C_G,C_GE,C_L,C_LE,C_O,C_P,
450
C_S,C_Z,C_NO,C_NP,C_NP,C_P,C_NS,C_NZ
453
result := inverse[c];
457
function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
511
466
$Log: cpubase.pas,v $
512
Revision 1.42 2004/02/27 10:21:06 florian
514
+ refaddr to treference added
515
+ refsymbol to treference added
516
* top_local stuff moved to an extra record to save memory
518
* tppufile.get/putint64/aint implemented
520
Revision 1.41 2004/02/22 18:27:21 florian
521
* fixed exception reason size for 64 bit systems
523
Revision 1.40 2004/02/05 18:28:37 peter
524
* x86_64 fixes for opsize
526
Revision 1.39 2004/02/04 22:01:13 peter
527
* first try to get cpupara working for x86_64
529
Revision 1.38 2004/01/30 13:42:03 florian
530
* fixed more alignment issues
532
Revision 1.37 2004/01/15 14:01:32 florian
533
+ x86 instruction tables for x86-64 extended
535
Revision 1.36 2004/01/14 23:39:05 florian
536
* another bunch of x86-64 fixes mainly calling convention and
537
assembler reader related
539
Revision 1.35 2004/01/12 16:37:59 peter
540
* moved spilling code from taicpu to rg
542
Revision 1.34 2003/12/26 13:19:16 florian
543
* rtl and compiler compile with -Cfsse2
545
Revision 1.33 2003/12/25 01:07:09 florian
546
+ $fputype directive support
547
+ single data type operations with sse unit
548
* fixed more x86-64 stuff
550
Revision 1.32 2003/12/19 22:08:44 daniel
551
* Some work to restore the MMX capabilities
553
Revision 1.31 2003/12/15 21:25:49 peter
554
* reg allocations for imaginary register are now inserted just
555
before reg allocation
556
* tregister changed to enum to allow compile time check
557
* fixed several tregister-tsuperregister errors
559
Revision 1.30 2003/10/31 09:22:55 mazen
560
* using findreg_by_<name|number>_table directly to decrease heap overheading
562
Revision 1.29 2003/10/30 17:13:18 peter
563
* fixed findreg_by_number
564
* renamed rghelper to rgbase
566
Revision 1.28 2003/10/30 15:03:18 mazen
567
* now uses standard routines in rgHelper unit to search registers by number and by name
569
Revision 1.27 2003/10/17 15:08:34 peter
570
* commented out more obsolete constants
572
Revision 1.26 2003/10/17 14:38:32 peter
573
* 64k registers supported
574
* fixed some memory leaks
576
Revision 1.25 2003/10/11 16:06:42 florian
577
* fixed some MMX<->SSE
578
* started to fix ppc, needs an overhaul
579
+ stabs info improve for spilling, not sure if it works correctly/completly
580
- MMX_SUPPORT removed from Makefile.fpc
582
Revision 1.24 2003/10/09 21:31:37 daniel
583
* Register allocator splitted, ans abstract now
585
Revision 1.23 2003/10/03 22:00:33 peter
586
* parameter alignment fixes
588
Revision 1.22 2003/10/01 20:34:51 peter
589
* procinfo unit contains tprocinfo
590
* cginfo renamed to cgbase
591
* moved cgmessage to verbose
592
* fixed ppc and sparc compiles
594
Revision 1.21 2003/09/28 21:49:39 peter
597
Revision 1.20 2003/09/25 21:29:23 peter
600
Revision 1.19 2003/09/24 17:12:36 florian
603
Revision 1.18 2003/09/23 17:56:06 peter
604
* locals and paras are allocated in the code generation
605
* tvarsym.localloc contains the location of para/local when
606
generating code for the current procedure
608
Revision 1.17 2003/09/07 22:09:35 peter
609
* preparations for different default calling conventions
612
Revision 1.16 2003/09/04 21:07:03 florian
613
* ARM compiler compiles again
615
Revision 1.15 2003/09/03 15:55:02 peter
616
* NEWRA branch merged
618
Revision 1.14 2003/09/03 11:18:37 florian
619
* fixed arm concatcopy
620
+ arm support in the common compiler sources added
621
* moved some generic cg code around
625
Revision 1.13.2.8 2003/08/31 19:31:51 daniel
626
* FIxed superregister constants
628
Revision 1.13.2.7 2003/08/31 16:18:05 peter
631
Revision 1.13.2.6 2003/08/31 15:46:26 peter
632
* more updates for tregister
634
Revision 1.13.2.5 2003/08/31 13:50:16 daniel
635
* Remove sorting and use pregenerated indexes
636
* Some work on making things compile
638
Revision 1.13.2.4 2003/08/29 17:29:00 peter
639
* next batch of updates
641
Revision 1.13.2.3 2003/08/28 18:35:08 peter
642
* tregister changed to cardinal
644
Revision 1.13.2.2 2003/08/27 21:06:34 peter
647
Revision 1.13.2.1 2003/08/27 19:55:54 peter
648
* first tregister patch
650
Revision 1.13 2003/08/20 07:48:04 daniel
651
* Made internal assembler use new register coding
653
Revision 1.12 2003/08/17 16:59:20 jonas
654
* fixed regvars so they work with newra (at least for ppc)
655
* fixed some volatile register bugs
656
+ -dnotranslation option for -dnewra, which causes the registers not to
657
be translated from virtual to normal registers. Requires support in
658
the assembler writer as well, which is only implemented in aggas/
661
Revision 1.11 2003/07/06 21:50:33 jonas
662
* fixed ppc compilation problems and changed VOLATILE_REGISTERS for x86
663
so that it doesn't include ebp and esp anymore
665
Revision 1.10 2003/06/17 16:34:45 jonas
666
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
667
* renamed all_intregisters to volatile_intregisters and made it
670
Revision 1.9 2003/06/13 21:19:33 peter
671
* current_procdef removed, use current_procinfo.procdef instead
673
Revision 1.8 2003/06/12 19:11:34 jonas
674
- removed ALL_INTREGISTERS (only the one in rgobj is valid)
676
Revision 1.7 2003/06/03 21:11:09 peter
677
* cg.a_load_* get a from and to size specifier
678
* makeregsize only accepts newregister
679
* i386 uses generic tcgnotnode,tcgunaryminus
681
Revision 1.6 2003/06/03 13:01:59 daniel
682
* Register allocator finished
684
Revision 1.5 2003/05/30 23:57:08 peter
686
* accumulator removed, splitted in function_return_reg (called) and
687
function_result_reg (caller)
689
Revision 1.4 2003/04/30 20:53:32 florian
690
* error when address of an abstract method is taken
691
* fixed some x86-64 problems
692
* merged some more x86-64 and i386 code
694
Revision 1.3 2002/04/25 20:15:40 florian
695
* block nodes within expressions shouldn't release the used registers,
696
fixed using a flag till the new rg is ready
698
Revision 1.2 2002/04/25 16:12:09 florian
699
* fixed more problems with cpubase and x86-64
701
Revision 1.1 2003/04/25 11:12:09 florian
702
* merged i386/cpubase and x86_64/cpubase to x86/cpubase;
703
different stuff went to cpubase.inc
705
Revision 1.50 2003/04/25 08:25:26 daniel
706
* Ifdefs around a lot of calls to cleartempgen
707
* Fixed registers that are allocated but not freed in several nodes
708
* Tweak to register allocator to cause less spills
709
* 8-bit registers now interfere with esi,edi and ebp
710
Compiler can now compile rtl successfully when using new register
713
Revision 1.49 2003/04/22 23:50:23 peter
714
* firstpass uses expectloc
715
* checks if there are differences between the expectloc and
716
location.loc from secondpass in EXTDEBUG
718
Revision 1.48 2003/04/22 14:33:38 peter
719
* removed some notes/hints
721
Revision 1.47 2003/04/22 10:09:35 daniel
722
+ Implemented the actual register allocator
723
+ Scratch registers unavailable when new register allocator used
724
+ maybe_save/maybe_restore unavailable when new register allocator used
726
Revision 1.46 2003/04/21 19:16:50 peter
727
* count address regs separate
729
Revision 1.45 2003/03/28 19:16:57 peter
730
* generic constructor working for i386
731
* remove fixed self register
732
* esi added as address register for i386
734
Revision 1.44 2003/03/18 18:15:53 peter
735
* changed reg2opsize to function
737
Revision 1.43 2003/03/08 08:59:07 daniel
738
+ $define newra will enable new register allocator
739
+ getregisterint will return imaginary registers with $newra
740
+ -sr switch added, will skip register allocation so you can see
741
the direct output of the code generator before register allocation
743
Revision 1.42 2003/02/19 22:00:15 daniel
744
* Code generator converted to new register notation
745
- Horribily outdated todo.txt removed
747
Revision 1.41 2003/02/02 19:25:54 carl
748
* Several bugfixes for m68k target (register alloc., opcode emission)
750
+ Generic add more complete (still not verified)
752
Revision 1.40 2003/01/13 18:37:44 daniel
753
* Work on register conversion
755
Revision 1.39 2003/01/09 20:41:00 daniel
756
* Converted some code in cgx86.pas to new register numbering
758
Revision 1.38 2003/01/09 15:49:56 daniel
759
* Added register conversion
761
Revision 1.37 2003/01/08 22:32:36 daniel
762
* Added register convesrion procedure
764
Revision 1.36 2003/01/08 18:43:57 daniel
765
* Tregister changed into a record
767
Revision 1.35 2003/01/05 13:36:53 florian
769
+ very basic support for float128 type (x86-64 only)
771
Revision 1.34 2002/11/17 18:26:16 mazen
772
* fixed a compilation bug accmulator-->FUNCTION_RETURN_REG, in definition of return_result_reg
774
Revision 1.33 2002/11/17 17:49:08 mazen
775
+ 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
777
Revision 1.32 2002/10/05 12:43:29 carl
778
* fixes for Delphi 6 compilation
779
(warning : Some features do not work under Delphi)
781
Revision 1.31 2002/08/14 18:41:48 jonas
782
- remove valuelow/valuehigh fields from tlocation, because they depend
783
on the endianess of the host operating system -> difficult to get
784
right. Use lo/hi(location.valueqword) instead (remember to use
785
valueqword and not value!!)
787
Revision 1.30 2002/08/13 21:40:58 florian
788
* more fixes for ppc calling conventions
790
Revision 1.29 2002/08/12 15:08:41 carl
791
+ stab register indexes for powerpc (moved from gdb to cpubase)
792
+ tprocessor enumeration moved to cpuinfo
793
+ linker in target_info is now a class
794
* many many updates for m68k (will soon start to compile)
795
- removed some ifdef or correct them for correct cpu
797
Revision 1.28 2002/08/06 20:55:23 florian
798
* first part of ppc calling conventions fix
800
Revision 1.27 2002/07/25 18:01:29 carl
801
+ FPURESULTREG -> FPU_RESULT_REG
803
Revision 1.26 2002/07/07 09:52:33 florian
804
* powerpc target fixed, very simple units can be compiled
805
* some basic stuff for better callparanode handling, far from being finished
807
Revision 1.25 2002/07/01 18:46:30 peter
809
* reorganized aasm layer
811
Revision 1.24 2002/07/01 16:23:55 peter
813
* basics for currency
814
* asnode updates for class and interface (not finished)
816
Revision 1.23 2002/05/18 13:34:22 peter
817
* readded missing revisions
819
Revision 1.22 2002/05/16 19:46:50 carl
820
+ defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
821
+ try to fix temp allocation (still in ifdef)
822
+ generic constructor calls
823
+ start of tassembler / tmodulebase class cleanup
825
Revision 1.19 2002/05/12 16:53:16 peter
826
* moved entry and exitcode to ncgutil and cgobj
827
* foreach gets extra argument for passing local data to the
829
* -CR checks also class typecasts at runtime by changing them
831
* fixed compiler to cycle with the -CR option
832
* fixed stabs with elf writer, finally the global variables can
834
* removed a lot of routines from cga unit and replaced them by
836
* u32bit-s32bit updates for and,or,xor nodes. When one element is
837
u32bit then the other is typecasted also to u32bit without giving
838
a rangecheck warning/error.
839
* fixed pascal calling method with reversing also the high tree in
840
the parast, detected by tcalcst3 test
842
Revision 1.18 2002/04/21 15:31:40 carl
843
- removed some other stuff to their units
845
Revision 1.17 2002/04/20 21:37:07 carl
846
+ generic FPC_CHECKPOINTER
847
+ first parameter offset in stack now portable
848
* rename some constants
849
+ move some cpu stuff to other units
850
- remove unused constents
851
* fix stacksize for some targets
852
* fix generic size problems which depend now on EXTEND_SIZE constant
853
* removing frame pointer in routines is only available for : i386,m68k and vis targets
855
Revision 1.16 2002/04/15 19:53:54 peter
856
* fixed conflicts between the last 2 commits
858
Revision 1.15 2002/04/15 19:44:20 peter
859
* fixed stackcheck that would be called recursively when a stack
861
* generic changeregsize(reg,size) for i386 register resizing
862
* removed some more routines from cga unit
863
* fixed returnvalue handling
864
* fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
866
Revision 1.14 2002/04/15 19:12:09 carl
867
+ target_info.size_of_pointer -> pointer_size
868
+ some cleanup of unused types/variables
869
* move several constants from cpubase to their specific units
870
(where they are used)
871
+ att_Reg2str -> gas_reg2str
872
+ int_reg2str -> std_reg2str
874
Revision 1.13 2002/04/14 16:59:41 carl
875
+ att_reg2str -> gas_reg2str
877
Revision 1.12 2002/04/02 17:11:34 peter
878
* tlocation,treference update
879
* LOC_CONSTANT added for better constant handling
880
* secondadd splitted in multiple routines
881
* location_force_reg added for loading a location to a register
883
* secondassignment parses now first the right and then the left node
884
(this is compatible with Kylix). This saves a lot of push/pop especially
885
with string operations
886
* adapted some routines to use the new cg methods
888
Revision 1.11 2002/03/31 20:26:37 jonas
889
+ a_loadfpu_* and a_loadmm_* methods in tcg
890
* register allocation is now handled by a class and is mostly processor
891
independent (+rgobj.pas and i386/rgcpu.pas)
892
* temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
893
* some small improvements and fixes to the optimizer
894
* some register allocation fixes
895
* some fpuvaroffset fixes in the unary minus node
896
* push/popusedregisters is now called rg.save/restoreusedregisters and
897
(for i386) uses temps instead of push/pop's when using -Op3 (that code is
898
also better optimizable)
899
* fixed and optimized register saving/restoring for new/dispose nodes
900
* LOC_FPU locations now also require their "register" field to be set to
901
R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
902
- list field removed of the tnode class because it's not used currently
903
and can cause hard-to-find bugs
905
Revision 1.10 2002/03/04 19:10:12 peter
906
* removed compiler warnings
467
Revision 1.51 2005/02/26 01:27:00 jonas
468
* fixed generic jumps optimizer and enabled it for ppc (the label table
469
was not being initialised -> getfinaldestination always failed, which
470
caused wrong optimizations in some cases)
471
* changed the inverse_cond into a function, because tasmcond is a record
473
+ added a compare_conditions() function for the same reason
475
Revision 1.50 2005/02/14 17:13:10 peter