mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 17:59:25 +02:00
* CMOV support in optimizer (in define USECMOV)
+ start of support of exceptions in constructors
This commit is contained in:
parent
fdf8713693
commit
332c7a568f
@ -3087,6 +3087,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
{ a constructor needs a help procedure }
|
||||
if (aktprocsym^.definition^.proctypeoption=potype_constructor) then
|
||||
begin
|
||||
procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;
|
||||
if procinfo^._class^.is_class then
|
||||
begin
|
||||
exprasmlist^.insert(new(paicpu,op_cond_sym(A_Jcc,C_Z,S_NO,faillabel)));
|
||||
@ -3405,6 +3406,8 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
hr : treference;
|
||||
oldexprasmlist : paasmoutput;
|
||||
ai : paicpu;
|
||||
pd : pprocdef;
|
||||
r : preference;
|
||||
|
||||
begin
|
||||
oldexprasmlist:=exprasmlist;
|
||||
@ -3470,6 +3473,34 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
exprasmlist^.concat(new(paicpu,
|
||||
op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
|
||||
emitjmp(C_E,noreraiselabel);
|
||||
if (aktprocsym^.definition^.proctypeoption=potype_constructor) then
|
||||
begin
|
||||
{
|
||||
if assigned(procinfo^._class) then
|
||||
begin
|
||||
pd:=procinfo^._class^.searchdestructor;
|
||||
if procinfo^._class^.is_class then
|
||||
begin
|
||||
emit_const(A_PUSH,S_L,1);
|
||||
emit_reg(A_PUSH,S_L,R_ESI);
|
||||
end
|
||||
else
|
||||
begin
|
||||
emit_reg(A_PUSH,S_L,R_ESI);
|
||||
emit_sym(A_PUSH,S_L,newasmsymbol(procinfo._class^.vmt_mangledname);
|
||||
end;
|
||||
if (po_virtualmethod in pd^.procoptions) then
|
||||
begin
|
||||
emit_ref_reg(A_MOV,S_L,ref,R_EDI)
|
||||
emit_ref(A_CALL,S_NO,ref);
|
||||
end
|
||||
else
|
||||
begin
|
||||
end;
|
||||
end
|
||||
}
|
||||
end
|
||||
else
|
||||
{ must be the return value finalized before reraising the exception? }
|
||||
if (procinfo^.returntype.def<>pdef(voiddef)) and
|
||||
(procinfo^.returntype.def^.needs_inittable) and
|
||||
@ -3684,7 +3715,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.72 2000-01-23 11:11:36 michael
|
||||
Revision 1.73 2000-01-23 21:29:14 florian
|
||||
* CMOV support in optimizer (in define USECMOV)
|
||||
+ start of support of exceptions in constructors
|
||||
|
||||
Revision 1.72 2000/01/23 11:11:36 michael
|
||||
+ Fixes from Jonas.
|
||||
|
||||
Revision 1.71 2000/01/22 16:02:37 jonas
|
||||
|
@ -202,7 +202,7 @@ uses
|
||||
bufptr:=@buf;
|
||||
while (fillsize>0) do
|
||||
begin
|
||||
for j:=0to 5 do
|
||||
for j:=0 to 5 do
|
||||
if (fillsize>=length(alignarray[j])) then
|
||||
break;
|
||||
move(alignarray[j][1],bufptr^,length(alignarray[j]));
|
||||
@ -1600,7 +1600,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2000-01-12 10:38:18 peter
|
||||
Revision 1.11 2000-01-23 21:29:14 florian
|
||||
* CMOV support in optimizer (in define USECMOV)
|
||||
+ start of support of exceptions in constructors
|
||||
|
||||
Revision 1.10 2000/01/12 10:38:18 peter
|
||||
* smartlinking fixes for binary writer
|
||||
* release alignreg code and moved instruction writing align to cpuasm,
|
||||
but it doesn't use the specified register yet
|
||||
@ -1692,4 +1696,4 @@ end.
|
||||
* removed R_DEFAULT_SEG
|
||||
* uniform float names
|
||||
|
||||
}
|
||||
}
|
@ -153,7 +153,8 @@ unit globals;
|
||||
initpackenum : longint;
|
||||
initpackrecords : tpackrecords;
|
||||
initoutputformat : tasm;
|
||||
initoptprocessor : tprocessors;
|
||||
initoptprocessor,
|
||||
initspecificoptprocessor : tprocessors;
|
||||
initasmmode : tasmmode;
|
||||
{ current state values }
|
||||
aktglobalswitches : tglobalswitches;
|
||||
@ -164,7 +165,8 @@ unit globals;
|
||||
aktmaxfpuregisters: longint;
|
||||
aktpackrecords : tpackrecords;
|
||||
aktoutputformat : tasm;
|
||||
aktoptprocessor : tprocessors;
|
||||
aktoptprocessor,
|
||||
aktspecificoptprocessor : tprocessors;
|
||||
aktasmmode : tasmmode;
|
||||
|
||||
{ Memory sizes }
|
||||
@ -1448,6 +1450,7 @@ implementation
|
||||
initglobalswitches:=[cs_check_unit_name,cs_link_static];
|
||||
{$ifdef i386}
|
||||
initoptprocessor:=Class386;
|
||||
initspecificoptprocessor:=Class386;
|
||||
initpackenum:=4;
|
||||
initpackrecords:=packrecord_2;
|
||||
initoutputformat:=target_asm.id;
|
||||
@ -1488,7 +1491,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.48 2000-01-23 16:36:37 peter
|
||||
Revision 1.49 2000-01-23 21:29:14 florian
|
||||
* CMOV support in optimizer (in define USECMOV)
|
||||
+ start of support of exceptions in constructors
|
||||
|
||||
Revision 1.48 2000/01/23 16:36:37 peter
|
||||
* better auto RTL dir detection
|
||||
|
||||
Revision 1.47 2000/01/20 00:23:03 pierre
|
||||
@ -1646,4 +1653,4 @@ end.
|
||||
Revision 1.8.2.1 1999/07/07 07:53:21 michael
|
||||
+ Merged patches from florian
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{$ifdef Delphi}
|
||||
const msgtxt : array[0..000108] of string[240]=(
|
||||
const msgtxt : array[0..000107] of string[240]=(
|
||||
{$else Delphi}
|
||||
const msgtxt : array[0..000108,1..240] of char=(
|
||||
const msgtxt : array[0..000107,1..240] of char=(
|
||||
{$endif Delphi}
|
||||
'T_Compiler: $1'#000+
|
||||
'D_Compiler OS: $1'#000+
|
||||
@ -546,26 +546,26 @@ const msgtxt : array[0..000108,1..240] of char=(
|
||||
'For more information read COPYING.FPC'#000+
|
||||
#000+
|
||||
'Report bugs,suggestions etc to:'#000+
|
||||
' fpc-devel','@vekoll.saturnus.vein.hu'#000+
|
||||
' bugrep@fr','eepascal.org'#000+
|
||||
'**0*_put + after a boolean switch option to enable it, - to disable it'+
|
||||
#000+
|
||||
'**1a_the compiler doesn'#039't delete the generated assembler file'#000+
|
||||
'**2al_list sourcecode lines in assembler file'#000+
|
||||
'**2ar_list register allocation/relea','se info in assembler file'#000+
|
||||
'**2ar_list register allocation/release info in a','ssembler file'#000+
|
||||
'**2at_list temp allocation/release info in assembler file'#000+
|
||||
'**1b_generate browser info'#000+
|
||||
'**2bl_generate local symbol info'#000+
|
||||
'**1B_build all modules'#000+
|
||||
'**1C<x>_code generation options:'#000+
|
||||
'3*2CD_create dynamic library'#000+
|
||||
'**2Ch<n>_<n','> bytes heap (between 1023 and 67107840)'#000+
|
||||
'**2Ch<n>_<n> bytes heap',' (between 1023 and 67107840)'#000+
|
||||
'**2Ci_IO-checking'#000+
|
||||
'**2Cn_omit linking stage'#000+
|
||||
'**2Co_check overflow of integer operations'#000+
|
||||
'**2Cr_range checking'#000+
|
||||
'**2Cs<n>_set stack size to <n>'#000+
|
||||
'**2Ct_stack checking'#000+
|
||||
'**2CD_create also dynamic library (* doe','sn'#039't work yet *)'#000+
|
||||
'**2CD_create also dynamic library (* doesn'#039't work ye','t *)'#000+
|
||||
'**2CX_create also smartlinked library'#000+
|
||||
'**1d<x>_defines the symbol <x>'#000+
|
||||
'*O1D_generate a DEF file'#000+
|
||||
@ -573,13 +573,13 @@ const msgtxt : array[0..000108,1..240] of char=(
|
||||
'*O2Dw_PM application'#000+
|
||||
'**1e<x>_set path to executable'#000+
|
||||
'**1E_same as -Cn'#000+
|
||||
'**1F<x>_set file names and p','aths:'#000+
|
||||
'**2FD<x>_sets the directory where to search for compiler utilities'#000+
|
||||
'**1F<x>_set file names and paths:'#000+
|
||||
'**2FD<','x>_sets the directory where to search for compiler utilities'#000+
|
||||
'**2Fe<x>_redirect error output to <x>'#000+
|
||||
'**2FE<x>_set exe/unit output path to <x>'#000+
|
||||
'**2Fi<x>_adds <x> to include path'#000+
|
||||
'**2Fl<x>_adds <x> to library path'#000+
|
||||
'*L2FL<x>_uses <x> as',' dynamic linker'#000+
|
||||
'*L2FL<x>_uses <x> as dynamic lin','ker'#000+
|
||||
'**2Fo<x>_adds <x> to object path'#000+
|
||||
'**2Fr<x>_load error message file <x>'#000+
|
||||
'**2Fu<x>_adds <x> to unit path'#000+
|
||||
@ -587,7 +587,7 @@ const msgtxt : array[0..000108,1..240] of char=(
|
||||
'*g1g<x>_generate debugger information:'#000+
|
||||
'*g2gg_use gsym'#000+
|
||||
'*g2gd_use dbx'#000+
|
||||
'*g2','gh_use heap trace unit'#000+
|
||||
'*g2gh_use heap ','trace unit'#000+
|
||||
'*g2gc_generate checks for pointers'#000+
|
||||
'**1i_information'#000+
|
||||
'**2iD_return compiler date'#000+
|
||||
@ -595,101 +595,101 @@ const msgtxt : array[0..000108,1..240] of char=(
|
||||
'**2iSO_return compiler OS'#000+
|
||||
'**2iSP_return compiler processor'#000+
|
||||
'**2iTO_return target OS'#000+
|
||||
'**2iTP_return target proc','essor'#000+
|
||||
'**1I<x>_adds <x> to include path'#000+
|
||||
'**2iTP_return target processor'#000+
|
||||
'**1I<x','>_adds <x> to include path'#000+
|
||||
'**1k<x>_Pass <x> to the linker'#000+
|
||||
'**1l_write logo'#000+
|
||||
'**1n_don'#039't read the default config file'#000+
|
||||
'**1o<x>_change the name of the executable produced to <x>'#000+
|
||||
'**1pg_generate profile code for gprof (defines FPC_PROFI','LE)'#000+
|
||||
'*L1P_use pipes instead of creating temporary assembler files'#000+
|
||||
'**1pg_generate profile code for gprof (defines FPC_PROFILE)'#000+
|
||||
'*L1P_use',' pipes instead of creating temporary assembler files'#000+
|
||||
'**1S<x>_syntax options:'#000+
|
||||
'**2S2_switch some Delphi 2 extensions on'#000+
|
||||
'**2Sc_supports operators like C (*=,+=,/= and -=)'#000+
|
||||
'**2Sd_tries to be Delphi compatible'#000+
|
||||
'**2Se<x>_compiler stops ','after the <x> errors (default is 1)'#000+
|
||||
'**2Se<x>_compiler stops after the <x','> errors (default is 1)'#000+
|
||||
'**2Sg_allow LABEL and GOTO'#000+
|
||||
'**2Sh_Use ansistrings'#000+
|
||||
'**2Si_support C++ styled INLINE'#000+
|
||||
'**2Sm_support macros like C (global)'#000+
|
||||
'**2So_tries to be TP/BP 7.0 compatible'#000+
|
||||
'**2Sp_tries to be gpc compatible'#000+
|
||||
'**2Ss_construc','tor name must be init (destructor must be done)'#000+
|
||||
'**2Ss_constructor name mus','t be init (destructor must be done)'#000+
|
||||
'**2St_allow static keyword in objects'#000+
|
||||
'**1s_don'#039't call assembler and linker (only with -a)'#000+
|
||||
'**1u<x>_undefines the symbol <x>'#000+
|
||||
'**1U_unit options:'#000+
|
||||
'**2Un_don'#039't check the unit name'#000+
|
||||
'**2Us_compile a sy','stem unit'#000+
|
||||
'**1v<x>_Be verbose. <x> is a combination of the following letters:'#000+
|
||||
'**2Us_compile a system unit'#000+
|
||||
'**','1v<x>_Be verbose. <x> is a combination of the following letters:'#000+
|
||||
'**2*_e : Show errors (default) d : Show debug info'#000+
|
||||
'**2*_w : Show warnings u : Show unit info'#000+
|
||||
'**2*_n : Show notes t : Show trie','d/used files'#000+
|
||||
'**2*_n : Show notes t : Show tried/used files',#000+
|
||||
'**2*_h : Show hints m : Show defined macros'#000+
|
||||
'**2*_i : Show general info p : Show compiled procedures'#000+
|
||||
'**2*_l : Show linenumbers c : Show conditionals'#000+
|
||||
'**2*_a : Show everything 0 : ','Show nothing (except errors'+
|
||||
'**2*_a : Show everything 0 : Show nothing',' (except errors'+
|
||||
')'#000+
|
||||
'**2*_b : Show all procedure r : Rhide/GCC compatibility mode'#000+
|
||||
'**2*_ declarations if an error x : Executable info (Win32 only)'#000+
|
||||
'**2*_ occurs'#000+
|
||||
'**1X_executable options:'#000+
|
||||
'*L2Xc_link with the c library'#000,
|
||||
'**2Xs_strip all symbols from executable'#000+
|
||||
'*L2Xc_link with the c library'#000+
|
||||
'**2Xs_strip ','all symbols from executable'#000+
|
||||
'**2XD_try to link dynamic (defines FPC_LINK_DYNAMIC)'#000+
|
||||
'**2XS_try to link static (default) (defines FPC_LINK_STATIC)'#000+
|
||||
'**2XX_try to link smart (defines FPC_LINK_SMART)'#000+
|
||||
'**0*_Processor sp','ecific options:'#000+
|
||||
'**0*_Processor specific optio','ns:'#000+
|
||||
'3*1A<x>_output format:'#000+
|
||||
'3*2Aas_assemble using GNU AS'#000+
|
||||
'3*2Aasaout_assemble using GNU AS for aout (Go32v1)'#000+
|
||||
'3*2Anasmcoff_coff (Go32v2) file using Nasm'#000+
|
||||
'3*2Anasmelf_elf32 (Linux) file using Nasm'#000+
|
||||
'3*2Anasmobj_obj file using Nasm'#000+
|
||||
'3*2A','masm_obj file using Masm (Microsoft)'#000+
|
||||
'3*2Amasm_obj fil','e using Masm (Microsoft)'#000+
|
||||
'3*2Atasm_obj file using Tasm (Borland)'#000+
|
||||
'3*2Acoff_coff (Go32v2) using internal writer'#000+
|
||||
'3*2Apecoff_pecoff (Win32) using internal writer'#000+
|
||||
'3*1R<x>_assembler reading style:'#000+
|
||||
'3*2Ratt_read AT&T style assembler'#000+
|
||||
'3*2R','intel_read Intel style assembler'#000+
|
||||
'3*2Rintel_read I','ntel style assembler'#000+
|
||||
'3*2Rdirect_copy assembler text directly to assembler file'#000+
|
||||
'3*1O<x>_optimizations:'#000+
|
||||
'3*2Og_generate smaller code'#000+
|
||||
'3*2OG_generate faster code (default)'#000+
|
||||
'3*2Or_keep certain variables in registers (still BUGGY!!!)'#000+
|
||||
'3*','2Ou_enable uncertain optimizations (see docs)'#000+
|
||||
'3*2Ou_enable u','ncertain optimizations (see docs)'#000+
|
||||
'3*2O1_level 1 optimizations (quick optimizations)'#000+
|
||||
'3*2O2_level 2 optimizations (-O1 + slower optimizations)'#000+
|
||||
'3*2O3_level 3 optimizations (same as -O2u)'#000+
|
||||
'3*2Op<x>_target processor:'#000+
|
||||
'3*3Op1_set target',' processor to 386/486'#000+
|
||||
'3*3Op1_set target processor t','o 386/486'#000+
|
||||
'3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#000+
|
||||
'3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#000+
|
||||
'3*1T<x>_Target operating system:'#000+
|
||||
'3*2TGO32V1_version 1 of DJ Delorie DOS extender'#000+
|
||||
'3*2TGO32V2_version 2 of DJ D','elorie DOS extender'#000+
|
||||
'3*2TGO32V2_version 2 of DJ Delorie DOS e','xtender'#000+
|
||||
'3*2TLINUX_Linux'#000+
|
||||
'3*2TOS2_OS/2 2.x'#000+
|
||||
'3*2TWin32_Windows 32 Bit'#000+
|
||||
'3*1WB<x>_ Set Image base to Hexadecimal <x> value'#000+
|
||||
'3*1WC_ Specify console type application'#000+
|
||||
'3*1WD_ Use DEFFILE to export functions of DLL or EXE'#000+
|
||||
'3*1WG_ Specify grap','hic type application'#000+
|
||||
'3*1WG_ Specify graphic type app','lication'#000+
|
||||
'3*1WN_ Do not generate relocation code (necessary for debugging)'#000+
|
||||
'3*1WR_ Generate relocation code'#000+
|
||||
'6*1A<x>_output format'#000+
|
||||
'6*2Aas_Unix o-file using GNU AS'#000+
|
||||
'6*2Agas_GNU Motorola assembler'#000+
|
||||
'6*2Amit_MIT Syntax (old GAS)'#000+
|
||||
'6*2Amot_','Standard Motorola assembler'#000+
|
||||
'6*2Amot_Standard Mot','orola assembler'#000+
|
||||
'6*1O_optimizations:'#000+
|
||||
'6*2Oa_turn on the optimizer'#000+
|
||||
'6*2Og_generate smaller code'#000+
|
||||
'6*2OG_generate faster code (default)'#000+
|
||||
'6*2Ox_optimize maximum (still BUGGY!!!)'#000+
|
||||
'6*2O2_set target processor to a MC68020+'#000+
|
||||
'6*1R<x>_assembler ','reading style:'#000+
|
||||
'6*1R<x>_assembler reading styl','e:'#000+
|
||||
'6*2RMOT_read motorola style assembler'#000+
|
||||
'6*1T<x>_Target operating system:'#000+
|
||||
'6*2TAMIGA_Commodore Amiga'#000+
|
||||
@ -698,5 +698,5 @@ const msgtxt : array[0..000108,1..240] of char=(
|
||||
'6*2TLINUX_Linux-68k'#000+
|
||||
'**1*_'#000+
|
||||
'**1?_shows this help'#000+
|
||||
'**1h_shows this help without w','aiting'#000
|
||||
'**1h_shows this help without waiting'#000
|
||||
);
|
||||
|
@ -71,7 +71,21 @@ begin
|
||||
Inc(j);
|
||||
End
|
||||
Else IllegalPara(opt)
|
||||
End;
|
||||
{$ifdef USECMOV}
|
||||
's' :
|
||||
Begin
|
||||
If j < Length(Opt) Then
|
||||
Begin
|
||||
Case opt[j+1] Of
|
||||
'3': initspecificoptprocessor:=ClassP6
|
||||
Else IllegalPara(Opt)
|
||||
End;
|
||||
Inc(j);
|
||||
End
|
||||
Else IllegalPara(opt)
|
||||
End
|
||||
{$endif USECMOV}
|
||||
else IllegalPara(opt);
|
||||
End;
|
||||
Inc(j)
|
||||
@ -97,7 +111,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.17 2000-01-07 01:14:28 peter
|
||||
Revision 1.18 2000-01-23 21:29:17 florian
|
||||
* CMOV support in optimizer (in define USECMOV)
|
||||
+ start of support of exceptions in constructors
|
||||
|
||||
Revision 1.17 2000/01/07 01:14:28 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.16 1999/08/04 13:02:47 jonas
|
||||
|
@ -267,6 +267,7 @@ unit parser;
|
||||
oldaktpackenum,oldaktmaxfpuregisters : longint;
|
||||
oldaktpackrecords : tpackrecords;
|
||||
oldaktoutputformat : tasm;
|
||||
oldaktspecificoptprocessor,
|
||||
oldaktoptprocessor : tprocessors;
|
||||
oldaktasmmode : tasmmode;
|
||||
oldaktmodeswitches : tmodeswitches;
|
||||
@ -328,6 +329,7 @@ unit parser;
|
||||
oldaktmaxfpuregisters:=aktmaxfpuregisters;
|
||||
oldaktoutputformat:=aktoutputformat;
|
||||
oldaktoptprocessor:=aktoptprocessor;
|
||||
oldaktspecificoptprocessor:=aktspecificoptprocessor;
|
||||
oldaktasmmode:=aktasmmode;
|
||||
oldaktfilepos:=aktfilepos;
|
||||
oldaktmodeswitches:=aktmodeswitches;
|
||||
@ -379,6 +381,7 @@ unit parser;
|
||||
aktpackenum:=initpackenum;
|
||||
aktoutputformat:=initoutputformat;
|
||||
aktoptprocessor:=initoptprocessor;
|
||||
aktspecificoptprocessor:=initspecificoptprocessor;
|
||||
aktasmmode:=initasmmode;
|
||||
{ we need this to make the system unit }
|
||||
if compile_system then
|
||||
@ -513,6 +516,7 @@ unit parser;
|
||||
aktmaxfpuregisters:=oldaktmaxfpuregisters;
|
||||
aktoutputformat:=oldaktoutputformat;
|
||||
aktoptprocessor:=oldaktoptprocessor;
|
||||
aktspecificoptprocessor:=oldaktspecificoptprocessor;
|
||||
aktasmmode:=oldaktasmmode;
|
||||
aktfilepos:=oldaktfilepos;
|
||||
aktmodeswitches:=oldaktmodeswitches;
|
||||
@ -587,7 +591,11 @@ unit parser;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.97 2000-01-11 09:52:06 peter
|
||||
Revision 1.98 2000-01-23 21:29:17 florian
|
||||
* CMOV support in optimizer (in define USECMOV)
|
||||
+ start of support of exceptions in constructors
|
||||
|
||||
Revision 1.97 2000/01/11 09:52:06 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
@ -691,4 +699,4 @@ end.
|
||||
Revision 1.70 1999/03/24 23:17:10 peter
|
||||
* fixed bugs 212,222,225,227,229,231,233
|
||||
|
||||
}
|
||||
}
|
@ -60,9 +60,9 @@ Procedure PeepHoleOptPass1(Asml: PAasmOutput; BlockStart, BlockEnd: Pai);
|
||||
|
||||
Var
|
||||
l : longint;
|
||||
p ,hp1, hp2 : pai;
|
||||
p,hp1,hp2 : pai;
|
||||
{$ifdef foropt}
|
||||
hp3, hp4: pai;
|
||||
hp3,hp4: pai;
|
||||
{$endif foropt}
|
||||
TmpBool1, TmpBool2: Boolean;
|
||||
|
||||
@ -287,7 +287,7 @@ Begin
|
||||
If (LabDif <> 0) Then
|
||||
GetFinalDestination(asml, paicpu(p));
|
||||
end;
|
||||
end
|
||||
end;
|
||||
end
|
||||
else
|
||||
{ All other optimizes }
|
||||
@ -1582,11 +1582,27 @@ End;
|
||||
|
||||
Procedure PeepHoleOptPass2(AsmL: PAasmOutput; BlockStart, BlockEnd: Pai);
|
||||
|
||||
function CanBeCMOV(p : pai) : boolean;
|
||||
|
||||
begin
|
||||
CanBeCMOV:=assigned(p) and (p^.typ=ait_instruction) and
|
||||
(paicpu(p)^.opcode=A_MOV) and
|
||||
(paicpu(p)^.opsize in [S_L,S_W]) and
|
||||
(paicpu(p)^.oper[0].typ in [top_reg,top_ref]) and
|
||||
(paicpu(p)^.oper[1].typ in [top_reg,top_ref]);
|
||||
end;
|
||||
|
||||
var
|
||||
p,hp1,hp2: pai;
|
||||
{$ifdef USECMOV}
|
||||
l : longint;
|
||||
condition : tasmcond;
|
||||
hp3: pai;
|
||||
{$endif USECMOV}
|
||||
{$ifdef foldArithOps}
|
||||
UsedRegs, TmpUsedRegs: TRegSet;
|
||||
{$endif foldArithOps}
|
||||
|
||||
Begin
|
||||
P := BlockStart;
|
||||
{$ifdef foldArithOps}
|
||||
@ -1614,6 +1630,79 @@ Begin
|
||||
AsmL^.Remove(hp1);
|
||||
Dispose(hp1, Done)
|
||||
End;
|
||||
|
||||
{$ifdef USECMOV}
|
||||
A_Jcc:
|
||||
if (aktspecificoptprocessor=ClassP6) then
|
||||
begin
|
||||
{ check for
|
||||
jCC xxx
|
||||
<several movs>
|
||||
xxx:
|
||||
}
|
||||
l:=0;
|
||||
GetNextInstruction(p, hp1);
|
||||
while assigned(hp1) And
|
||||
CanBeCMOV(hp1) do
|
||||
begin
|
||||
inc(l);
|
||||
hp1:=pai(hp1^.next);
|
||||
while assigned(hp1) and (hp1^.typ in skipinstr) do
|
||||
hp1:=pai(hp1^.next);
|
||||
end;
|
||||
if assigned(hp1) then
|
||||
begin
|
||||
if FindLabel(PAsmLabel(paicpu(p)^.oper[0].sym),hp1) then
|
||||
begin
|
||||
if (l<=4) and (l>0) then
|
||||
begin
|
||||
condition:=inverse_cond[paicpu(p)^.condition];
|
||||
GetNextInstruction(p,hp1);
|
||||
asml^.remove(p);
|
||||
dispose(p,done);
|
||||
p:=hp1;
|
||||
repeat
|
||||
paicpu(hp1)^.opcode:=A_CMOVcc;
|
||||
paicpu(hp1)^.condition:=condition;
|
||||
GetNextInstruction(hp1,hp1);
|
||||
until not(assigned(hp1)) or
|
||||
not(CanBeCMOV(hp1));
|
||||
asml^.remove(hp1);
|
||||
p:=hp1;
|
||||
continue;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ check further for
|
||||
jCC xxx
|
||||
<several movs>
|
||||
jmp yyy
|
||||
xxx:
|
||||
<several movs>
|
||||
yyy:
|
||||
}
|
||||
{!!!!!!!!!!!1
|
||||
hp1:=hp1^.next;
|
||||
if assigned(hp3) and
|
||||
(l<=3) and
|
||||
(hp3^.typ=ait_instruction) and
|
||||
(paicpu(hp3)^.is_jmp) and
|
||||
(paicpu(hp3)^.condition=C_None) and
|
||||
FindLabel(PAsmLabel(paicpu(p)^.oper[0].sym),hp1) then
|
||||
begin
|
||||
while GetNextInstruction(p, hp1) And
|
||||
CanBeCMOV(hp1) do
|
||||
begin
|
||||
hp2:=hp1;
|
||||
inc(l);
|
||||
end;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$endif USECMOV}
|
||||
A_MOV:
|
||||
Begin
|
||||
If (Paicpu(p)^.oper[0].typ = top_reg) And
|
||||
@ -1741,7 +1830,11 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.80 2000-01-22 16:05:15 jonas
|
||||
Revision 1.81 2000-01-23 21:29:17 florian
|
||||
* CMOV support in optimizer (in define USECMOV)
|
||||
+ start of support of exceptions in constructors
|
||||
|
||||
Revision 1.80 2000/01/22 16:05:15 jonas
|
||||
+ change "lea x(reg),reg" to "add x,reg" (-dnewoptimizations)
|
||||
* detection whether edi is used after instructions (since regalloc
|
||||
info for it is now available)
|
||||
@ -1866,4 +1959,4 @@ End.
|
||||
Revision 1.49 1999/05/02 14:26:31 peter
|
||||
* fixed dec -> sub $1 opt which didn't set ops=2
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user