* write also asmblocklabel for a connected labelsym

git-svn-id: trunk@8159 -
This commit is contained in:
peter 2007-07-23 21:01:32 +00:00
parent 0fc65c5eec
commit 1dd62b8686
8 changed files with 35 additions and 6 deletions

1
.gitattributes vendored
View File

@ -8193,6 +8193,7 @@ tests/webtbs/tw6203.pp svneol=native#text/plain
tests/webtbs/tw6435.pp svneol=native#text/plain
tests/webtbs/tw6491.pp svneol=native#text/plain
tests/webtbs/tw6493.pp svneol=native#text/plain
tests/webtbs/tw6525.pp -text
tests/webtbs/tw6543.pp svneol=native#text/plain
tests/webtbs/tw6624.pp svneol=native#text/plain
tests/webtbs/tw6641.pp svneol=native#text/plain

View File

@ -864,6 +864,13 @@ implementation
load_all_regvars(current_asmdata.CurrAsmList);
{$endif OLDREGVARS}
cg.a_label(current_asmdata.CurrAsmList,getasmlabel);
{ Write also extra label if this label was referenced from
assembler block }
if assigned(labsym) and
assigned(labsym.asmblocklabel) then
cg.a_label(current_asmdata.CurrAsmList,labsym.asmblocklabel);
secondpass(left);
end;

View File

@ -153,7 +153,9 @@ interface
copiedto : tlabelnode;
{ contains all goto nodesrefering to this label }
referinggotonodes : TFPObjectList;
constructor create(l:tnode);virtual;
{ original labelsym, used for writing label referenced from assembler block }
labsym : tlabelsym;
constructor create(l:tnode;alabsym:tlabelsym);virtual;
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
procedure buildderefimpl;override;
@ -1151,10 +1153,11 @@ implementation
TLABELNODE
*****************************************************************************}
constructor tlabelnode.create(l:tnode);
constructor tlabelnode.create(l:tnode;alabsym:tlabelsym);
begin
inherited create(labeln,l);
exceptionblock:=aktexceptblock;
labsym:=alabsym;
end;

View File

@ -194,7 +194,7 @@ unit opttail;
vardef.needs_inittable) then
exit;
labelnode:=clabelnode.create(cnothingnode.create);
labelnode:=clabelnode.create(cnothingnode.create,nil);
if find_and_replace_tailcalls(n) then
begin
oldnodes:=n;

View File

@ -112,7 +112,7 @@ unit optunrol;
if (counts mod unrolls<>0) and
((counts mod unrolls)=unrolls-i) then
begin
tfornode(node).entrylabel:=clabelnode.create(cnothingnode.create);
tfornode(node).entrylabel:=clabelnode.create(cnothingnode.create,nil);
addstatement(unrollstatement,tfornode(node).entrylabel);
end;

View File

@ -1702,7 +1702,7 @@ implementation
if tlabelsym(srsym).defined then
Message(sym_e_label_already_defined);
tlabelsym(srsym).defined:=true;
p1:=clabelnode.create(nil);
p1:=clabelnode.create(nil,tlabelsym(srsym));
tlabelsym(srsym).code:=p1;
end;
end;

View File

@ -1039,7 +1039,7 @@ implementation
if tlabelsym(srsym).defined then
Message(sym_e_label_already_defined);
tlabelsym(srsym).defined:=true;
p:=clabelnode.create(nil);
p:=clabelnode.create(nil,tlabelsym(srsym));
tlabelsym(srsym).code:=p;
end
else

18
tests/webtbs/tw6525.pp Normal file
View File

@ -0,0 +1,18 @@
{ %cpu=i386,x86_64 }
label l1;
var
err : boolean;
begin
asm
jmp l1
end;
writeln('oops');
err:=true;
l1:
writeln('hello');
if err then
halt(1);
end.