Re-organize
This commit is contained in:
parent
c085bef46e
commit
961c5e99e1
37 changed files with 137 additions and 66 deletions
|
|
@ -5,15 +5,15 @@ all: _api.so _capsule.so
|
|||
_api.so _capsule.so: api.cpp capsule.cpp
|
||||
$(PYTHON) setup.py build_ext --inplace
|
||||
|
||||
api.cpp api.py: src/*.py include/llvm_binding/*.h gen.py binding.py
|
||||
$(PYTHON) gen.py api src
|
||||
api.cpp api.py: src/*.py include/llvm_binding/*.h gen/gen.py gen/binding.py
|
||||
$(PYTHON) gen/gen.py api src
|
||||
|
||||
clean: cleantemp
|
||||
rm -f _api.so _capsule.so
|
||||
|
||||
cleantemp:
|
||||
rm -f api.cpp api.py
|
||||
rm -f src/*.pyc src/Transforms/*.pyc
|
||||
rm -f src/*.pyc src/Transforms/*.pyc src/ADT/*.pyc src/Assembly/*.pyc src/CodeGen/*.pyc src/ExecutionEngine/*.pyc src/Target/*.pyc src/Transforms/*.pyc
|
||||
|
||||
|
||||
check: _api.so api.py
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import sys
|
||||
import sys, os
|
||||
from binding import *
|
||||
import codegen
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ def wrap_println_from_file(file):
|
|||
def main():
|
||||
outputfilename = sys.argv[1]
|
||||
entry_modname = sys.argv[2]
|
||||
|
||||
sys.path += [os.path.dirname(os.curdir)]
|
||||
entry_module = __import__(entry_modname)
|
||||
|
||||
units = []
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
|
||||
@llvm.Class()
|
||||
class SmallVector_Type:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
|
||||
@llvm.Class()
|
||||
class StringRef:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
from StringRef import StringRef
|
||||
|
||||
Triple = llvm.Class()
|
||||
10
newbinding/src/ADT/__init__.py
Normal file
10
newbinding/src/ADT/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os.path, importlib
|
||||
|
||||
def _init():
|
||||
for fname in os.listdir(os.path.dirname(__file__)):
|
||||
if ((fname.endswith('.py') or fname.endswith('.pyc')) and
|
||||
not fname.startswith('__init__')):
|
||||
modname = os.path.basename(fname).rsplit('.', 1)[0]
|
||||
importlib.import_module('.' + modname, __name__)
|
||||
|
||||
_init()
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
|
||||
@llvm.Class()
|
||||
class AssemblyAnnotationWriter:
|
||||
10
newbinding/src/Assembly/__init__.py
Normal file
10
newbinding/src/Assembly/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os.path, importlib
|
||||
|
||||
def _init():
|
||||
for fname in os.listdir(os.path.dirname(__file__)):
|
||||
if ((fname.endswith('.py') or fname.endswith('.pyc')) and
|
||||
not fname.startswith('__init__')):
|
||||
modname = os.path.basename(fname).rsplit('.', 1)[0]
|
||||
importlib.import_module('.' + modname, __name__)
|
||||
|
||||
_init()
|
||||
|
|
@ -3,7 +3,7 @@ from namespace import llvm
|
|||
from Value import Function, BasicBlock
|
||||
from Instruction import Instruction, TerminatorInst
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
from ADT.StringRef import StringRef
|
||||
|
||||
@BasicBlock
|
||||
class BasicBlock:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
|
||||
MachineCodeInfo = llvm.Class()
|
||||
|
||||
10
newbinding/src/CodeGen/__init__.py
Normal file
10
newbinding/src/CodeGen/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os.path, importlib
|
||||
|
||||
def _init():
|
||||
for fname in os.listdir(os.path.dirname(__file__)):
|
||||
if ((fname.endswith('.py') or fname.endswith('.pyc')) and
|
||||
not fname.startswith('__init__')):
|
||||
modname = os.path.basename(fname).rsplit('.', 1)[0]
|
||||
importlib.import_module('.' + modname, __name__)
|
||||
|
||||
_init()
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
from ADT.StringRef import StringRef
|
||||
from Module import Module
|
||||
from Type import Type, IntegerType, StructType
|
||||
from SmallVector import SmallVector_Value
|
||||
from ADT.SmallVector import SmallVector_Value
|
||||
from GlobalVariable import GlobalVariable
|
||||
from Pass import ImmutablePass
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from binding import *
|
|||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from Type import Type
|
||||
from SmallVector import SmallVector_Type
|
||||
from ADT.SmallVector import SmallVector_Type
|
||||
|
||||
FunctionType = llvm.Class(Type)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ from binding import *
|
|||
from namespace import llvm
|
||||
from Module import Module
|
||||
from JITMemoryManager import JITMemoryManager
|
||||
from CodeGen import CodeGenOpt, Reloc, CodeModel
|
||||
from StringRef import StringRef
|
||||
from ExecutionEngine import ExecutionEngine
|
||||
from TargetMachine import TargetMachine
|
||||
from Triple import Triple
|
||||
from Support.CodeGen import CodeGenOpt, Reloc, CodeModel
|
||||
from ADT.StringRef import StringRef
|
||||
from ExecutionEngine.ExecutionEngine import ExecutionEngine
|
||||
from Target.TargetMachine import TargetMachine
|
||||
from ADT.Triple import Triple
|
||||
|
||||
EngineBuilder = llvm.Class()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from Module import Module
|
||||
from JITMemoryManager import JITMemoryManager
|
||||
from CodeGen import CodeGenOpt, Reloc, CodeModel
|
||||
from DataLayout import DataLayout
|
||||
from Value import Function, GlobalValue, BasicBlock, Constant
|
||||
from GlobalVariable import GlobalVariable
|
||||
from MachineCodeInfo import MachineCodeInfo
|
||||
from GenericValue import GenericValue
|
||||
from Type import Type
|
||||
from ..namespace import llvm
|
||||
from ..Module import Module
|
||||
from ..JITMemoryManager import JITMemoryManager
|
||||
from ..Support.CodeGen import CodeGenOpt, Reloc, CodeModel
|
||||
from ..DataLayout import DataLayout
|
||||
from ..Value import Function, GlobalValue, BasicBlock, Constant
|
||||
from ..GlobalVariable import GlobalVariable
|
||||
from ..CodeGen.MachineCodeInfo import MachineCodeInfo
|
||||
from ..GenericValue import GenericValue
|
||||
from ..Type import Type
|
||||
|
||||
ExecutionEngine = llvm.Class()
|
||||
|
||||
10
newbinding/src/ExecutionEngine/__init__.py
Normal file
10
newbinding/src/ExecutionEngine/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os.path, importlib
|
||||
|
||||
def _init():
|
||||
for fname in os.listdir(os.path.dirname(__file__)):
|
||||
if ((fname.endswith('.py') or fname.endswith('.pyc')) and
|
||||
not fname.startswith('__init__')):
|
||||
modname = os.path.basename(fname).rsplit('.', 1)[0]
|
||||
importlib.import_module('.' + modname, __name__)
|
||||
|
||||
_init()
|
||||
|
|
@ -8,8 +8,8 @@ from Instruction import UnreachableInst, AllocaInst, LoadInst, StoreInst
|
|||
from Instruction import FenceInst, AtomicCmpXchgInst, AtomicRMWInst, CmpInst
|
||||
from Instruction import LandingPadInst, VAArgInst
|
||||
from Instruction import AtomicOrdering, SynchronizationScope
|
||||
from SmallVector import SmallVector_Value, SmallVector_Unsigned
|
||||
from StringRef import StringRef
|
||||
from ADT.SmallVector import SmallVector_Value, SmallVector_Unsigned
|
||||
from ADT.StringRef import StringRef
|
||||
from Value import Value, MDNode
|
||||
from Type import Type, IntegerType
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
from ADT.StringRef import StringRef
|
||||
from Constant import Constant
|
||||
from Function import Function
|
||||
from DerivedTypes import FunctionType
|
||||
from raw_ostream import raw_ostream
|
||||
from AssemblyAnnotationWriter import AssemblyAnnotationWriter
|
||||
from Support.raw_ostream import raw_ostream
|
||||
from Assembly.AssemblyAnnotationWriter import AssemblyAnnotationWriter
|
||||
|
||||
@llvm.Class()
|
||||
class Module:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from StringRef import StringRef
|
||||
from ADT.StringRef import StringRef
|
||||
from Module import Module
|
||||
from Function import Function
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
|
||||
@llvm.Class()
|
||||
class Reloc:
|
||||
9
newbinding/src/Support/MemoryBuffer.py
Normal file
9
newbinding/src/Support/MemoryBuffer.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from binding import *
|
||||
from ..namespace import llvm
|
||||
|
||||
MemoryBuffer = llvm.Class()
|
||||
|
||||
@MemoryBuffer
|
||||
class MemoryBuffer:
|
||||
_include_ = 'llvm/Support/MemoryBuffer.h'
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from StringRef import StringRef
|
||||
from ..namespace import llvm
|
||||
from ..ADT.StringRef import StringRef
|
||||
Target = llvm.Class()
|
||||
|
||||
@Target
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
|
||||
llvm.includes.add('llvm/Support/TargetSelect.h')
|
||||
|
||||
llvm.Function('InitializeNativeTarget')
|
||||
InitializeNativeTarget = llvm.Function('InitializeNativeTarget')
|
||||
#llvm.Function('InitializeAllTargets')
|
||||
|
||||
10
newbinding/src/Support/__init__.py
Normal file
10
newbinding/src/Support/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os.path, importlib
|
||||
|
||||
def _init():
|
||||
for fname in os.listdir(os.path.dirname(__file__)):
|
||||
if ((fname.endswith('.py') or fname.endswith('.pyc')) and
|
||||
not fname.startswith('__init__')):
|
||||
modname = os.path.basename(fname).rsplit('.', 1)[0]
|
||||
importlib.import_module('.' + modname, __name__)
|
||||
|
||||
_init()
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
from ..namespace import llvm
|
||||
from ..LLVMContext import LLVMContext
|
||||
from ..ADT.StringRef import StringRef
|
||||
|
||||
@llvm.Class()
|
||||
class raw_ostream:
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from Triple import Triple
|
||||
from Pass import ImmutablePass
|
||||
from StringRef import StringRef
|
||||
from ..namespace import llvm
|
||||
from ..ADT.Triple import Triple
|
||||
from ..Pass import ImmutablePass
|
||||
from ..ADT.StringRef import StringRef
|
||||
|
||||
TargetLibraryInfo = llvm.Class(ImmutablePass)
|
||||
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from StringRef import StringRef
|
||||
from CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc
|
||||
from GlobalValue import GlobalValue
|
||||
from Target import Target
|
||||
from DataLayout import DataLayout
|
||||
from TargetTransformInfo import (ScalarTargetTransformInfo,
|
||||
VectorTargetTransformInfo)
|
||||
from ..namespace import llvm
|
||||
from ..ADT.StringRef import StringRef
|
||||
from ..Support.CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc
|
||||
from ..GlobalValue import GlobalValue
|
||||
from ..Support.Target import Target
|
||||
from ..DataLayout import DataLayout
|
||||
from ..TargetTransformInfo import (ScalarTargetTransformInfo,
|
||||
VectorTargetTransformInfo)
|
||||
|
||||
TargetMachine = llvm.Class()
|
||||
|
||||
10
newbinding/src/Target/__init__.py
Normal file
10
newbinding/src/Target/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os.path, importlib
|
||||
|
||||
def _init():
|
||||
for fname in os.listdir(os.path.dirname(__file__)):
|
||||
if ((fname.endswith('.py') or fname.endswith('.pyc')) and
|
||||
not fname.startswith('__init__')):
|
||||
modname = os.path.basename(fname).rsplit('.', 1)[0]
|
||||
importlib.import_module('.' + modname, __name__)
|
||||
|
||||
_init()
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
|
||||
llvm.includes.add('llvm/TargetTransformInfo.h')
|
||||
|
||||
ScalarTargetTransformInfo = llvm.Class()
|
||||
VectorTargetTransformInfo = llvm.Class()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from ..namespace import llvm
|
||||
from ..Pass import Pass
|
||||
|
||||
llvm.includes.add('llvm/Transforms/IPO.h')
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from PassManager import PassManagerBase, FunctionPassManager
|
||||
from TargetLibraryInfo import TargetLibraryInfo
|
||||
from Pass import Pass
|
||||
from ..namespace import llvm
|
||||
from ..PassManager import PassManagerBase, FunctionPassManager
|
||||
from ..Target.TargetLibraryInfo import TargetLibraryInfo
|
||||
from ..Pass import Pass
|
||||
|
||||
@llvm.Class()
|
||||
class PassManagerBuilder:
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from raw_ostream import raw_ostream
|
||||
from StringRef import StringRef
|
||||
from Support.raw_ostream import raw_ostream
|
||||
from ADT.StringRef import StringRef
|
||||
|
||||
Type = llvm.Class()
|
||||
IntegerType = llvm.Class(Type)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from raw_ostream import raw_ostream
|
||||
from AssemblyAnnotationWriter import AssemblyAnnotationWriter
|
||||
from Support.raw_ostream import raw_ostream
|
||||
from Assembly.AssemblyAnnotationWriter import AssemblyAnnotationWriter
|
||||
from Type import Type
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
from ADT.StringRef import StringRef
|
||||
|
||||
Value = llvm.Class()
|
||||
# forward declarations
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ def _init():
|
|||
|
||||
_init()
|
||||
|
||||
import Transforms
|
||||
import Transforms, ADT, Support, Assembly, ExecutionEngine, CodeGen, Target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue