mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 09:59:08 +02:00
+ volatile() expression that marks an expression as volatile
* disable matching volatile references in the assembler optimisers, so they can't be removed (more conservative than needed, but better than removing too many) o the CSE optimiser will ignore them by default, because they're an unknown inline node for it * also removed no longer used fpc_in_move_x and fpc_in_fillchar_x inline node identifiers from rtl/inc/innr.inc, and placed fpc_in_unaligned_x at the right place git-svn-id: trunk@40465 -
This commit is contained in:
parent
b7da7cd654
commit
122d0d36d6
@ -1059,7 +1059,10 @@ Unit AoptObj;
|
|||||||
Top_Reg :
|
Top_Reg :
|
||||||
OpsEqual:=o1.reg=o2.reg;
|
OpsEqual:=o1.reg=o2.reg;
|
||||||
Top_Ref :
|
Top_Ref :
|
||||||
OpsEqual := references_equal(o1.ref^, o2.ref^);
|
OpsEqual:=
|
||||||
|
references_equal(o1.ref^, o2.ref^) and
|
||||||
|
(o1.ref^.volatility=[]) and
|
||||||
|
(o2.ref^.volatility=[]);
|
||||||
Top_Const :
|
Top_Const :
|
||||||
OpsEqual:=o1.val=o2.val;
|
OpsEqual:=o1.val=o2.val;
|
||||||
Top_None :
|
Top_None :
|
||||||
|
@ -117,7 +117,9 @@ Implementation
|
|||||||
(r1.signindex = r2.signindex) and
|
(r1.signindex = r2.signindex) and
|
||||||
(r1.shiftimm = r2.shiftimm) and
|
(r1.shiftimm = r2.shiftimm) and
|
||||||
(r1.addressmode = r2.addressmode) and
|
(r1.addressmode = r2.addressmode) and
|
||||||
(r1.shiftmode = r2.shiftmode);
|
(r1.shiftmode = r2.shiftmode) and
|
||||||
|
(r1.volatility=[]) and
|
||||||
|
(r2.volatility=[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MatchInstruction(const instr: tai; const op: TCommonAsmOps; const cond: TAsmConds; const postfix: TOpPostfixes): boolean;
|
function MatchInstruction(const instr: tai; const op: TCommonAsmOps; const cond: TAsmConds; const postfix: TOpPostfixes): boolean;
|
||||||
|
@ -75,7 +75,9 @@ Implementation
|
|||||||
(r1.index = r2.index) and (r1.scalefactor = r2.scalefactor) and
|
(r1.index = r2.index) and (r1.scalefactor = r2.scalefactor) and
|
||||||
(r1.symbol=r2.symbol) and (r1.refaddr = r2.refaddr) and
|
(r1.symbol=r2.symbol) and (r1.refaddr = r2.refaddr) and
|
||||||
(r1.relsymbol = r2.relsymbol) and
|
(r1.relsymbol = r2.relsymbol) and
|
||||||
(r1.addressmode = r2.addressmode);
|
(r1.addressmode = r2.addressmode) and
|
||||||
|
(r1.volatility=[]) and
|
||||||
|
(r2.volatility=[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ type
|
|||||||
in_not_assign_x = 95,
|
in_not_assign_x = 95,
|
||||||
in_gettypekind_x = 96,
|
in_gettypekind_x = 96,
|
||||||
in_faraddr_x = 97,
|
in_faraddr_x = 97,
|
||||||
|
in_volatile_x = 98,
|
||||||
|
|
||||||
{ Internal constant functions }
|
{ Internal constant functions }
|
||||||
in_const_sqr = 100,
|
in_const_sqr = 100,
|
||||||
|
@ -65,7 +65,9 @@ unit aoptcpu;
|
|||||||
(r1.base = r2.base) and
|
(r1.base = r2.base) and
|
||||||
(r1.index = r2.index) and (r1.scalefactor = r2.scalefactor) and
|
(r1.index = r2.index) and (r1.scalefactor = r2.scalefactor) and
|
||||||
(r1.symbol=r2.symbol) and (r1.refaddr = r2.refaddr) and
|
(r1.symbol=r2.symbol) and (r1.refaddr = r2.refaddr) and
|
||||||
(r1.relsymbol = r2.relsymbol);
|
(r1.relsymbol = r2.relsymbol) and
|
||||||
|
(r1.volatility=[]) and
|
||||||
|
(r2.volatility=[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MatchOperand(const oper1: TOper; const oper2: TOper): boolean;
|
function MatchOperand(const oper1: TOper; const oper2: TOper): boolean;
|
||||||
|
@ -164,6 +164,13 @@ implementation
|
|||||||
if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
|
if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
|
||||||
location.reference.alignment:=resultdef.alignment;
|
location.reference.alignment:=resultdef.alignment;
|
||||||
end;
|
end;
|
||||||
|
in_volatile_x:
|
||||||
|
begin
|
||||||
|
secondpass(tcallparanode(left).left);
|
||||||
|
location:=tcallparanode(left).left.location;
|
||||||
|
if location.loc in [LOC_CREFERENCE,LOC_REFERENCE,LOC_SUBSETREF,LOC_CSUBSETREF] then
|
||||||
|
location.reference.volatility:=[vol_read,vol_write];
|
||||||
|
end;
|
||||||
{$ifdef SUPPORT_MMX}
|
{$ifdef SUPPORT_MMX}
|
||||||
in_mmx_pcmpeqb..in_mmx_pcmpgtw:
|
in_mmx_pcmpeqb..in_mmx_pcmpgtw:
|
||||||
begin
|
begin
|
||||||
|
@ -3548,6 +3548,12 @@ implementation
|
|||||||
begin
|
begin
|
||||||
resultdef:=left.resultdef;
|
resultdef:=left.resultdef;
|
||||||
end;
|
end;
|
||||||
|
in_volatile_x:
|
||||||
|
begin
|
||||||
|
resultdef:=left.resultdef;
|
||||||
|
{ volatile only makes sense if the value is in memory }
|
||||||
|
make_not_regable(left,[ra_addr_regable]);
|
||||||
|
end;
|
||||||
in_assert_x_y :
|
in_assert_x_y :
|
||||||
begin
|
begin
|
||||||
resultdef:=voidtype;
|
resultdef:=voidtype;
|
||||||
@ -4037,7 +4043,8 @@ implementation
|
|||||||
expectloc:=LOC_VOID;
|
expectloc:=LOC_VOID;
|
||||||
end;
|
end;
|
||||||
in_aligned_x,
|
in_aligned_x,
|
||||||
in_unaligned_x:
|
in_unaligned_x,
|
||||||
|
in_volatile_x:
|
||||||
begin
|
begin
|
||||||
expectloc:=tcallparanode(left).left.expectloc;
|
expectloc:=tcallparanode(left).left.expectloc;
|
||||||
end;
|
end;
|
||||||
|
@ -891,6 +891,7 @@ implementation
|
|||||||
in_abs_real,
|
in_abs_real,
|
||||||
in_aligned_x,
|
in_aligned_x,
|
||||||
in_unaligned_x,
|
in_unaligned_x,
|
||||||
|
in_volatile_x,
|
||||||
in_prefetch_var:
|
in_prefetch_var:
|
||||||
begin
|
begin
|
||||||
inc(result);
|
inc(result);
|
||||||
|
@ -515,7 +515,8 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
in_aligned_x,
|
in_aligned_x,
|
||||||
in_unaligned_x :
|
in_unaligned_x,
|
||||||
|
in_volatile_x:
|
||||||
begin
|
begin
|
||||||
err:=false;
|
err:=false;
|
||||||
consume(_LKLAMMER);
|
consume(_LKLAMMER);
|
||||||
|
@ -103,6 +103,7 @@ implementation
|
|||||||
{$endif SUPPORT_GET_FRAME}
|
{$endif SUPPORT_GET_FRAME}
|
||||||
systemunit.insert(csyssym.create('Unaligned',in_unaligned_x));
|
systemunit.insert(csyssym.create('Unaligned',in_unaligned_x));
|
||||||
systemunit.insert(csyssym.create('Aligned',in_aligned_x));
|
systemunit.insert(csyssym.create('Aligned',in_aligned_x));
|
||||||
|
systemunit.insert(csyssym.create('Volatile',in_volatile_x));
|
||||||
systemunit.insert(csyssym.create('ObjCSelector',in_objc_selector_x)); { objc only }
|
systemunit.insert(csyssym.create('ObjCSelector',in_objc_selector_x)); { objc only }
|
||||||
systemunit.insert(csyssym.create('ObjCEncode',in_objc_encode_x)); { objc only }
|
systemunit.insert(csyssym.create('ObjCEncode',in_objc_encode_x)); { objc only }
|
||||||
systemunit.insert(csyssym.create('Default',in_default_x));
|
systemunit.insert(csyssym.create('Default',in_default_x));
|
||||||
|
@ -218,7 +218,9 @@ unit aoptx86;
|
|||||||
(r1.segment = r2.segment) and (r1.base = r2.base) and
|
(r1.segment = r2.segment) and (r1.base = r2.base) and
|
||||||
(r1.index = r2.index) and (r1.scalefactor = r2.scalefactor) and
|
(r1.index = r2.index) and (r1.scalefactor = r2.scalefactor) and
|
||||||
(r1.symbol=r2.symbol) and (r1.refaddr = r2.refaddr) and
|
(r1.symbol=r2.symbol) and (r1.refaddr = r2.refaddr) and
|
||||||
(r1.relsymbol = r2.relsymbol);
|
(r1.relsymbol = r2.relsymbol) and
|
||||||
|
(r1.volatility=[]) and
|
||||||
|
(r2.volatility=[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -232,7 +234,8 @@ unit aoptx86;
|
|||||||
((base=NR_INVALID) or
|
((base=NR_INVALID) or
|
||||||
(ref.base=base)) and
|
(ref.base=base)) and
|
||||||
((index=NR_INVALID) or
|
((index=NR_INVALID) or
|
||||||
(ref.index=index));
|
(ref.index=index)) and
|
||||||
|
(ref.volatility=[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -245,7 +248,8 @@ unit aoptx86;
|
|||||||
((base=NR_INVALID) or
|
((base=NR_INVALID) or
|
||||||
(ref.base=base)) and
|
(ref.base=base)) and
|
||||||
((index=NR_INVALID) or
|
((index=NR_INVALID) or
|
||||||
(ref.index=index));
|
(ref.index=index)) and
|
||||||
|
(ref.volatility=[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,8 +62,7 @@ const
|
|||||||
fpc_in_leave = 51; {macpas}
|
fpc_in_leave = 51; {macpas}
|
||||||
fpc_in_cycle = 52; {macpas}
|
fpc_in_cycle = 52; {macpas}
|
||||||
fpc_in_slice = 53;
|
fpc_in_slice = 53;
|
||||||
fpc_in_move_x = 54;
|
fpc_in_unaligned_x = 54;
|
||||||
fpc_in_fillchar_x = 55;
|
|
||||||
fpc_in_get_frame = 56;
|
fpc_in_get_frame = 56;
|
||||||
fpc_in_get_caller_addr = 57;
|
fpc_in_get_caller_addr = 57;
|
||||||
fpc_in_get_caller_frame = 58;
|
fpc_in_get_caller_frame = 58;
|
||||||
@ -105,6 +104,7 @@ const
|
|||||||
fpc_in_neg_assign_x = 94;
|
fpc_in_neg_assign_x = 94;
|
||||||
fpc_in_not_assign_x = 95;
|
fpc_in_not_assign_x = 95;
|
||||||
fpc_in_faraddr_x = 97;
|
fpc_in_faraddr_x = 97;
|
||||||
|
fpc_in_volatile_x = 98;
|
||||||
|
|
||||||
{ Internal constant functions }
|
{ Internal constant functions }
|
||||||
fpc_in_const_sqr = 100;
|
fpc_in_const_sqr = 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user