Просмотр исходного кода

* write also asmblocklabel for a connected labelsym

git-svn-id: trunk@8159 -
peter 18 лет назад
Родитель
Сommit
1dd62b8686
8 измененных файлов с 35 добавлено и 6 удалено
  1. 1 0
      .gitattributes
  2. 7 0
      compiler/ncgflw.pas
  3. 5 2
      compiler/nflw.pas
  4. 1 1
      compiler/opttail.pas
  5. 1 1
      compiler/optunrol.pas
  6. 1 1
      compiler/pexpr.pas
  7. 1 1
      compiler/pstatmnt.pas
  8. 18 0
      tests/webtbs/tw6525.pp

+ 1 - 0
.gitattributes

@@ -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

+ 7 - 0
compiler/ncgflw.pas

@@ -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;
 

+ 5 - 2
compiler/nflw.pas

@@ -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;
 
 

+ 1 - 1
compiler/opttail.pas

@@ -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;

+ 1 - 1
compiler/optunrol.pas

@@ -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;
 

+ 1 - 1
compiler/pexpr.pas

@@ -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;

+ 1 - 1
compiler/pstatmnt.pas

@@ -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 - 0
tests/webtbs/tw6525.pp

@@ -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.
+
+