Browse Source

+ new chlcgobj class reference variable that can be used to call thlcg*
virtual methods even when hlcg doesn't contain a valid instance

git-svn-id: branches/hlcgllvm@28143 -

Jonas Maebe 11 years ago
parent
commit
1516661249

+ 2 - 0
compiler/arm/hlcgcpu.pas

@@ -42,4 +42,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcg2ll;
 end.

+ 2 - 0
compiler/avr/hlcgcpu.pas

@@ -42,4 +42,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcg2ll;
 end.

+ 5 - 0
compiler/hlcgobj.pas

@@ -580,10 +580,15 @@ unit hlcgobj;
             produces a simple jump to destination label. }
           procedure g_local_unwind(list: TAsmList; l: TAsmLabel);virtual;abstract;
        end;
+     thlcgobjclass = class of thlcgobj;
 
     var
        {# Main high level code generator class }
        hlcg : thlcgobj;
+       { class type of high level code generator class (also valid when hlcg is
+         nil, in order to be able to call its virtual class methods) }
+       chlcgobj: thlcgobjclass;
+
 
     procedure destroy_hlcodegen;
 

+ 2 - 0
compiler/i386/hlcgcpu.pas

@@ -200,4 +200,6 @@ implementation
 
 
 
+begin
+  chlcgobj:=thlcgcpu;
 end.

+ 2 - 1
compiler/i8086/hlcgcpu.pas

@@ -427,5 +427,6 @@ implementation
     end;
 
 
-
+begin
+  chlcgobj:=thlcgcpu;
 end.

+ 2 - 0
compiler/jvm/hlcgcpu.pas

@@ -2557,4 +2557,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcgjvm;
 end.

+ 2 - 0
compiler/llvm/hlcgllvm.pas

@@ -1483,4 +1483,6 @@ implementation
       cgllvm.create_codegen
     end;
 
+begin
+  chlcgobj:=thlcgllvm;
 end.

+ 2 - 0
compiler/m68k/hlcgcpu.pas

@@ -42,4 +42,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcg2ll;
 end.

+ 2 - 0
compiler/mips/hlcgcpu.pas

@@ -152,4 +152,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcgmips;
 end.

+ 2 - 0
compiler/powerpc/hlcgcpu.pas

@@ -118,5 +118,7 @@ implementation
     end;
 
 
+begin
+  chlcgobj:=thlcgcpu;
 end.
 

+ 2 - 0
compiler/powerpc64/hlcgcpu.pas

@@ -124,4 +124,6 @@ implementation
 
 
 
+begin
+  chlcgobj:=thlcgcpu;
 end.

+ 2 - 0
compiler/sparc/hlcgcpu.pas

@@ -42,4 +42,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcg2ll;
 end.

+ 2 - 0
compiler/x86_64/hlcgcpu.pas

@@ -42,4 +42,6 @@ implementation
       create_codegen;
     end;
 
+begin
+  chlcgobj:=thlcgx86;
 end.