Prechádzať zdrojové kódy

* converted taillvmdecl properties to a set

git-svn-id: trunk@31653 -
Jonas Maebe 10 rokov pred
rodič
commit
7a08319d2e
2 zmenil súbory, kde vykonal 13 pridanie a 7 odobranie
  1. 11 5
      compiler/llvm/aasmllvm.pas
  2. 2 2
      compiler/llvm/agllvm.pas

+ 11 - 5
compiler/llvm/aasmllvm.pas

@@ -147,6 +147,13 @@ interface
       constructor create(_oldsym: tasmsymbol; const newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage);
       constructor create(_oldsym: tasmsymbol; const newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage);
     end;
     end;
 
 
+    taillvmdeclflag =
+    (
+      ldf_definition,   { definition as opposed to (an external) declaration }
+      ldf_tls           { tls definition }
+    );
+    taillvmdeclflags = set of taillvmdeclflag;
+
     { declarations/definitions of symbols (procedures, variables), both defined
     { declarations/definitions of symbols (procedures, variables), both defined
       here and external }
       here and external }
     taillvmdecl = class(tai)
     taillvmdecl = class(tai)
@@ -156,8 +163,7 @@ interface
       def: tdef;
       def: tdef;
       sec: TAsmSectiontype;
       sec: TAsmSectiontype;
       alignment: shortint;
       alignment: shortint;
-      definition: boolean;
-      tls: boolean;
+      flags: taillvmdeclflags;
       constructor createdecl(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
       constructor createdecl(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
       constructor createdef(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
       constructor createdef(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
       constructor createtls(_namesym: tasmsymbol; _def: tdef; _alignment: shortint);
       constructor createtls(_namesym: tasmsymbol; _def: tdef; _alignment: shortint);
@@ -196,21 +202,21 @@ uses
         sec:=_sec;
         sec:=_sec;
         alignment:=_alignment;
         alignment:=_alignment;
         _namesym.declared:=true;
         _namesym.declared:=true;
-        definition:=false;
+        flags:=[];
       end;
       end;
 
 
 
 
     constructor taillvmdecl.createdef(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
     constructor taillvmdecl.createdef(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
       begin
       begin
         createdecl(_namesym,_def,_initdata,_sec,_alignment);
         createdecl(_namesym,_def,_initdata,_sec,_alignment);
-        definition:=true;
+        include(flags,ldf_definition);
       end;
       end;
 
 
 
 
     constructor taillvmdecl.createtls(_namesym: tasmsymbol; _def: tdef; _alignment: shortint);
     constructor taillvmdecl.createtls(_namesym: tasmsymbol; _def: tdef; _alignment: shortint);
       begin
       begin
         createdef(_namesym,_def,nil,sec_data,_alignment);
         createdef(_namesym,_def,nil,sec_data,_alignment);
-        tls:=true;
+        include(flags,ldf_tls);
       end;
       end;
 
 
 
 

+ 2 - 2
compiler/llvm/agllvm.pas

@@ -915,7 +915,7 @@ implementation
             begin
             begin
               if taillvmdecl(hp).def.typ=procdef then
               if taillvmdecl(hp).def.typ=procdef then
                 begin
                 begin
-                  if not taillvmdecl(hp).definition then
+                  if not(ldf_definition in taillvmdecl(hp).flags) then
                     begin
                     begin
                       writer.AsmWrite('declare');
                       writer.AsmWrite('declare');
                       writer.AsmWriteln(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), taillvmdecl(hp).namesym.name, lpd_decl));
                       writer.AsmWriteln(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), taillvmdecl(hp).namesym.name, lpd_decl));
@@ -946,7 +946,7 @@ implementation
                     else
                     else
                       internalerror(2014020104);
                       internalerror(2014020104);
                   end;
                   end;
-                  if taillvmdecl(hp).tls then
+                  if (ldf_tls in taillvmdecl(hp).flags) then
                     writer.AsmWrite('thread_local ');
                     writer.AsmWrite('thread_local ');
                   { todo: handle more different section types (mainly
                   { todo: handle more different section types (mainly
                       Objective-C }
                       Objective-C }