* improved symbol alias handling (pass in old sym instead of name, add

pointer add end of aliased procdef)

git-svn-id: branches/hlcgllvm@27008 -
This commit is contained in:
Jonas Maebe 2014-03-06 21:41:56 +00:00
parent abee66b611
commit dad45d63b1
3 changed files with 14 additions and 10 deletions

View File

@ -128,7 +128,7 @@ interface
linkage: tllvmlinkage;
oldsym, newsym: TAsmSymbol;
def: tdef;
constructor Create(const oldname, newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage);
constructor create(_oldsym: tasmsymbol; const newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage);
end;
{ start of a procedure }
@ -160,10 +160,11 @@ uses
{ taillvmalias }
constructor taillvmalias.Create(const oldname, newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage);
constructor taillvmalias.create(_oldsym: tasmsymbol; const newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage);
begin
inherited Create;
oldsym:=current_asmdata.RefAsmSymbol(oldname,AT_FUNCTION);
typ:=ait_llvmalias;
oldsym:=_oldsym;
newsym:=current_asmdata.DefineAsmSymbol(newname,AB_GLOBAL,AT_FUNCTION);
def:=_def;
vis:=_vis;

View File

@ -617,14 +617,16 @@ implementation
end;
ait_llvmalias:
begin
asmwrite(taillvmalias(hp).newsym.name);
asmwrite(' = ');
asmwrite('@'+taillvmalias(hp).newsym.name);
asmwrite(' = alias ');
if taillvmalias(hp).linkage<>lll_default then
begin
str(taillvmalias(hp).linkage,s);
asmwrite(copy(s,length('lll_'),255));
asmwrite(' ');
end;
end
else
asmwrite('external ');
if taillvmalias(hp).vis<>llv_default then
begin
str(taillvmalias(hp).vis,s);
@ -632,7 +634,7 @@ implementation
asmwrite(' ');
end;
asmwrite(llvmencodetype(taillvmalias(hp).def));
asmwrite(' ');
asmwrite('* ');
asmwriteln(taillvmalias(hp).oldsym.name);
end;
{$ifdef arm}

View File

@ -690,6 +690,7 @@ implementation
var
item: TCmdStrListItem;
mangledname: TSymStr;
asmsym: tasmsymbol;
begin
item:=TCmdStrListItem(current_procinfo.procdef.aliasnames.first);
mangledname:=current_procinfo.procdef.mangledname;
@ -697,13 +698,13 @@ implementation
refer to the symbol and get the binding correct }
if (cs_profile in current_settings.moduleswitches) or
(po_global in current_procinfo.procdef.procoptions) then
current_asmdata.DefineAsmSymbol(mangledname,AB_GLOBAL,AT_FUNCTION)
asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_GLOBAL,AT_FUNCTION)
else
current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION);
asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION);
while assigned(item) do
begin
if mangledname<>item.Str then
list.concat(taillvmalias.Create(mangledname,item.str,current_procinfo.procdef,llv_default,lll_default));
list.concat(taillvmalias.create(asmsym,item.str,current_procinfo.procdef,llv_default,lll_default));
item:=TCmdStrListItem(item.next);
end;
list.concat(taillvmprocdef.create(current_procinfo.procdef));