mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 05:49:12 +02:00
* write the volatile flag for LLVM load/store operations if set
git-svn-id: trunk@35004 -
This commit is contained in:
parent
4d951780d1
commit
26f9dabf56
@ -28,7 +28,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
globtype,globals,systems,
|
globtype,globals,systems,
|
||||||
aasmbase,aasmtai,aasmdata,
|
aasmbase,aasmtai,aasmdata,
|
||||||
assemble;
|
assemble,
|
||||||
|
aasmllvm;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLLVMInstrWriter = class;
|
TLLVMInstrWriter = class;
|
||||||
@ -85,6 +86,7 @@ interface
|
|||||||
owner: TLLVMAssember;
|
owner: TLLVMAssember;
|
||||||
fstr: TSymStr;
|
fstr: TSymStr;
|
||||||
|
|
||||||
|
function getopcodestr(hp: taillvm): TSymStr;
|
||||||
function getopstr(const o:toper; refwithalign: boolean) : TSymStr;
|
function getopstr(const o:toper; refwithalign: boolean) : TSymStr;
|
||||||
procedure WriteAsmRegisterAllocationClobbers(list: tasmlist);
|
procedure WriteAsmRegisterAllocationClobbers(list: tasmlist);
|
||||||
end;
|
end;
|
||||||
@ -98,7 +100,7 @@ implementation
|
|||||||
fmodule,verbose,
|
fmodule,verbose,
|
||||||
objcasm,
|
objcasm,
|
||||||
aasmcnst,symconst,symdef,symtable,
|
aasmcnst,symconst,symdef,symtable,
|
||||||
llvmbase,aasmllvm,itllvm,llvmdef,
|
llvmbase,itllvm,llvmdef,
|
||||||
cgbase,cgutils,cpubase,llvminfo;
|
cgbase,cgutils,cpubase,llvminfo;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -537,7 +539,7 @@ implementation
|
|||||||
opstart:=1;
|
opstart:=1;
|
||||||
if llvmflag_load_getelptr_type in llvmversion_properties[current_settings.llvmversion] then
|
if llvmflag_load_getelptr_type in llvmversion_properties[current_settings.llvmversion] then
|
||||||
begin
|
begin
|
||||||
owner.writer.AsmWrite(llvm_op2str[op]);
|
owner.writer.AsmWrite(getopcodestr(taillvm(hp)));
|
||||||
opdone:=true;
|
opdone:=true;
|
||||||
if nested then
|
if nested then
|
||||||
owner.writer.AsmWrite(' (')
|
owner.writer.AsmWrite(' (')
|
||||||
@ -578,7 +580,7 @@ implementation
|
|||||||
opstart:=2;
|
opstart:=2;
|
||||||
if llvmflag_call_no_ptr in llvmversion_properties[current_settings.llvmversion] then
|
if llvmflag_call_no_ptr in llvmversion_properties[current_settings.llvmversion] then
|
||||||
begin
|
begin
|
||||||
owner.writer.AsmWrite(llvm_op2str[op]);
|
owner.writer.AsmWrite(getopcodestr(taillvm(hp)));
|
||||||
opdone:=true;
|
opdone:=true;
|
||||||
tmpstr:=llvmencodetypename(taillvm(hp).oper[2]^.def);
|
tmpstr:=llvmencodetypename(taillvm(hp).oper[2]^.def);
|
||||||
if tmpstr[length(tmpstr)]<>'*' then
|
if tmpstr[length(tmpstr)]<>'*' then
|
||||||
@ -627,7 +629,7 @@ implementation
|
|||||||
owner.writer.AsmWrite(getopstr(taillvm(hp).oper[0]^,false)+' = ')
|
owner.writer.AsmWrite(getopstr(taillvm(hp).oper[0]^,false)+' = ')
|
||||||
else
|
else
|
||||||
nested:=true;
|
nested:=true;
|
||||||
owner.writer.AsmWrite(llvm_op2str[op]);
|
owner.writer.AsmWrite(getopcodestr(taillvm(hp)));
|
||||||
if not nested then
|
if not nested then
|
||||||
owner.writer.AsmWrite(' ')
|
owner.writer.AsmWrite(' ')
|
||||||
else
|
else
|
||||||
@ -665,7 +667,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if not opdone then
|
if not opdone then
|
||||||
begin
|
begin
|
||||||
owner.writer.AsmWrite(llvm_op2str[op]);
|
owner.writer.AsmWrite(getopcodestr(taillvm(hp)));
|
||||||
if nested then
|
if nested then
|
||||||
owner.writer.AsmWrite(' (');
|
owner.writer.AsmWrite(' (');
|
||||||
end;
|
end;
|
||||||
@ -692,6 +694,24 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TLLVMInstrWriter.getopcodestr(hp: taillvm): TSymStr;
|
||||||
|
begin
|
||||||
|
result:=llvm_op2str[hp.llvmopcode];
|
||||||
|
case hp.llvmopcode of
|
||||||
|
la_load:
|
||||||
|
begin
|
||||||
|
if vol_read in hp.oper[2]^.ref^.volatility then
|
||||||
|
result:=result+' volatile';
|
||||||
|
end;
|
||||||
|
la_store:
|
||||||
|
begin
|
||||||
|
if vol_write in hp.oper[3]^.ref^.volatility then
|
||||||
|
result:=result+' volatile';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
{ LLVM Assembler writer }
|
{ LLVM Assembler writer }
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
|
Loading…
Reference in New Issue
Block a user