Browse Source

+ support for LLVM nil assembler symbols in instructions (write as "null")
+ support for LLVM nil tai operands (will be used for terminating a daisy
chain of catch/filter clauses of landingpads): don't try to write it

git-svn-id: trunk@35160 -

Jonas Maebe 8 years ago
parent
commit
28e5636daa
2 changed files with 17 additions and 7 deletions
  1. 13 7
      compiler/llvm/agllvm.pas
  2. 4 0
      compiler/llvm/llvmtype.pas

+ 13 - 7
compiler/llvm/agllvm.pas

@@ -399,7 +399,10 @@ implementation
            if o.ref^.refaddr=addr_full then
            if o.ref^.refaddr=addr_full then
              begin
              begin
                getopstr:='';
                getopstr:='';
-               getopstr:=LlvmAsmSymName(o.ref^.symbol);
+               if assigned(o.ref^.symbol) then
+                 getopstr:=LlvmAsmSymName(o.ref^.symbol)
+               else
+                 getopstr:='null';
                if o.ref^.offset<>0 then
                if o.ref^.offset<>0 then
                  internalerror(2013060223);
                  internalerror(2013060223);
              end
              end
@@ -437,12 +440,15 @@ implementation
            end;
            end;
          top_tai:
          top_tai:
            begin
            begin
-             tmpinline:=1;
-             tmpasmblock:=false;
-             hp:=o.ai;
-             owner.writer.AsmWrite(fstr);
-             fstr:='';
-             owner.WriteTai(false,false,tmpinline,tmpasmblock,hp);
+             if assigned(o.ai) then
+               begin
+                 tmpinline:=1;
+                 tmpasmblock:=false;
+                 hp:=o.ai;
+                 owner.writer.AsmWrite(fstr);
+                 fstr:='';
+                 owner.WriteTai(false,false,tmpinline,tmpasmblock,hp);
+               end;
              result:='';
              result:='';
            end;
            end;
 {$if defined(cpuextended) and defined(FPC_HAS_TYPE_EXTENDED)}
 {$if defined(cpuextended) and defined(FPC_HAS_TYPE_EXTENDED)}

+ 4 - 0
compiler/llvm/llvmtype.pas

@@ -217,6 +217,8 @@ implementation
       var
       var
         value: tai_abstracttypedconst;
         value: tai_abstracttypedconst;
       begin
       begin
+        if not assigned(p) then
+          exit;
         case p.typ of
         case p.typ of
           ait_llvmalias:
           ait_llvmalias:
             begin
             begin
@@ -388,6 +390,8 @@ implementation
 
 
     procedure TLLVMTypeInfo.insert_tai_typeconversions(toplevellist: tasmlist; p: tai);
     procedure TLLVMTypeInfo.insert_tai_typeconversions(toplevellist: tasmlist; p: tai);
       begin
       begin
+        if not assigned(p) then
+          exit;
         case p.typ of
         case p.typ of
           ait_llvmins:
           ait_llvmins:
             insert_llvmins_typeconversions(toplevellist,taillvm(p));
             insert_llvmins_typeconversions(toplevellist,taillvm(p));