Ver código fonte

* fixed external wrapper generation on llvm

git-svn-id: trunk@32472 -
Jonas Maebe 9 anos atrás
pai
commit
7b89072d88
4 arquivos alterados com 73 adições e 3 exclusões
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/llvm/llvmnode.pas
  3. 69 0
      compiler/llvm/nllvmvmt.pas
  4. 2 2
      compiler/ncgvmt.pas

+ 1 - 0
.gitattributes

@@ -348,6 +348,7 @@ compiler/llvm/nllvmmat.pas svneol=native#text/plain
 compiler/llvm/nllvmmem.pas svneol=native#text/plain
 compiler/llvm/nllvmtcon.pas svneol=native#text/plain
 compiler/llvm/nllvmutil.pas svneol=native#text/plain
+compiler/llvm/nllvmvmt.pas svneol=native#text/plain
 compiler/llvm/rgllvm.pas svneol=native#text/plain
 compiler/llvm/symllvm.pas svneol=native#text/plain
 compiler/llvm/tgllvm.pas svneol=native#text/plain

+ 1 - 1
compiler/llvm/llvmnode.pas

@@ -38,7 +38,7 @@ implementation
     ncgadd,ncgcal,ncgmat,ncginl,
     tgllvm,hlcgllvm,
     nllvmadd,nllvmbas,nllvmcal,nllvmcnv,nllvmcon,nllvminl,nllvmld,nllvmmat,
-    nllvmmem,nllvmtcon,nllvmutil,
+    nllvmmem,nllvmtcon,nllvmutil,nllvmvmt,
     llvmpara,
     symllvm;
 

+ 69 - 0
compiler/llvm/nllvmvmt.pas

@@ -0,0 +1,69 @@
+{
+    Copyright (c) 2015 by Jonas Maebe
+
+    Generate LLVM IR for VMT generation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit nllvmvmt;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+      aasmdata,
+      ncgvmt,
+      symdef;
+
+    type
+      tllvmvmtwriter = class(TVMTWriter)
+      protected
+        procedure generate_abstract_stub(list:TAsmList;pd:tprocdef); override;
+      end;
+
+
+implementation
+
+  uses
+    globtype,globals,
+    aasmbase,
+    symconst,
+    hlcgobj;
+
+
+{*****************************************************************************
+                             TLLVMVMTWRITER
+*****************************************************************************}
+
+
+  procedure tllvmvmtwriter.generate_abstract_stub(list: TAsmList; pd: tprocdef);
+    var
+      sym: TAsmSymbol;
+    begin
+      if (po_global in pd.procoptions) and
+         (pd.owner.defowner<>self._class) then
+        exit;
+      sym:=current_asmdata.GetAsmSymbol(pd.mangledname);
+      if assigned(sym) and (sym.bind<>AB_EXTERNAL) then
+        exit;
+      hlcg.g_external_wrapper(list,pd,'FPC_ABSTRACTERROR');
+    end;
+
+begin
+  CVMTWriter:=tllvmvmtwriter;
+end.

+ 2 - 2
compiler/ncgvmt.pas

@@ -38,7 +38,7 @@ interface
       end;
 
       TVMTWriter=class
-      private
+      protected
         _Class : tobjectdef;
         { message tables }
         root : pprocdeftree;
@@ -83,7 +83,7 @@ interface
         procedure genintmsgtab(tcb: ttai_typedconstbuilder; out lab: tasmlabel; out msginttabledef: trecorddef);
         procedure genpublishedmethodstable(tcb: ttai_typedconstbuilder; out lab: tasmlabel; out pubmethodsdef: trecorddef);
         procedure generate_field_table(tcb: ttai_typedconstbuilder; out lab: tasmlabel; out fieldtabledef: trecorddef);
-        procedure generate_abstract_stub(list:TAsmList;pd:tprocdef);
+        procedure generate_abstract_stub(list:TAsmList;pd:tprocdef); virtual;
 {$ifdef WITHDMT}
         { generates a DMT for _class }
         function  gendmt : tasmlabel;