llvm metadata: counter per unit rather than globally

Results in less high numbers, and reproducible results when partially
rebuilding
This commit is contained in:
Jonas Maebe 2022-05-01 20:37:09 +02:00
parent 9b280db2b1
commit 816ab7ffcc
2 changed files with 12 additions and 6 deletions

View File

@ -27,7 +27,7 @@ interface
uses
globtype,verbose,cclasses,
aasmbase,aasmtai,aasmdata,aasmsym,aasmcnst,
aasmbase,aasmtai,aasmdata,aasmdef,aasmsym,aasmcnst,
cpubase,cgbase,cgutils,
symtype,symdef,symsym,
llvmbase;
@ -227,6 +227,10 @@ interface
end;
TLLVMAsmData = class(TAsmDataDef)
fnextmetaid: cardinal;
end;
implementation
uses
@ -1258,4 +1262,6 @@ uses
loadparas(1,paras);
end;
begin
casmdata:=TLLVMAsmData;
end.

View File

@ -76,8 +76,7 @@ interface
(* !0 = !{ type1 value1, ... } *)
tai_llvmunnamedmetadatanode = class(tai_llvmbasemetadatanode)
strict private class var
snextid: cardinal;
strict private
class function getnextid: cardinal;
strict protected
fnameval: cardinal;
@ -194,7 +193,8 @@ implementation
verbose,globals,cutils,
fmodule,
symdef,
dbgdwarfconst;
dbgdwarfconst,
aasmdata,aasmllvm;
function llvm_getmetadatareftypedconst(metadata: tai_llvmbasemetadatanode): tai_simpletypedconst;
begin
@ -232,8 +232,8 @@ implementation
class function tai_llvmunnamedmetadatanode.getnextid: cardinal;
begin
result:=snextid;
inc(snextid);
result:=tllvmasmdata(current_asmdata).fnextmetaid;
inc(tllvmasmdata(current_asmdata).fnextmetaid);
end;