Re-organize

This commit is contained in:
Siu Kwan Lam 2013-02-03 15:09:07 -06:00
commit 961c5e99e1
37 changed files with 137 additions and 66 deletions

View file

@ -5,15 +5,15 @@ all: _api.so _capsule.so
_api.so _capsule.so: api.cpp capsule.cpp _api.so _capsule.so: api.cpp capsule.cpp
$(PYTHON) setup.py build_ext --inplace $(PYTHON) setup.py build_ext --inplace
api.cpp api.py: src/*.py include/llvm_binding/*.h gen.py binding.py api.cpp api.py: src/*.py include/llvm_binding/*.h gen/gen.py gen/binding.py
$(PYTHON) gen.py api src $(PYTHON) gen/gen.py api src
clean: cleantemp clean: cleantemp
rm -f _api.so _capsule.so rm -f _api.so _capsule.so
cleantemp: cleantemp:
rm -f api.cpp api.py 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 check: _api.so api.py

View file

@ -1,4 +1,4 @@
import sys import sys, os
from binding import * from binding import *
import codegen import codegen
@ -59,7 +59,7 @@ def wrap_println_from_file(file):
def main(): def main():
outputfilename = sys.argv[1] outputfilename = sys.argv[1]
entry_modname = sys.argv[2] entry_modname = sys.argv[2]
sys.path += [os.path.dirname(os.curdir)]
entry_module = __import__(entry_modname) entry_module = __import__(entry_modname)
units = [] units = []

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
@llvm.Class() @llvm.Class()
class SmallVector_Type: class SmallVector_Type:

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
@llvm.Class() @llvm.Class()
class StringRef: class StringRef:

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from StringRef import StringRef from StringRef import StringRef
Triple = llvm.Class() Triple = llvm.Class()

View 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()

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
@llvm.Class() @llvm.Class()
class AssemblyAnnotationWriter: class AssemblyAnnotationWriter:

View 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()

View file

@ -3,7 +3,7 @@ from namespace import llvm
from Value import Function, BasicBlock from Value import Function, BasicBlock
from Instruction import Instruction, TerminatorInst from Instruction import Instruction, TerminatorInst
from LLVMContext import LLVMContext from LLVMContext import LLVMContext
from StringRef import StringRef from ADT.StringRef import StringRef
@BasicBlock @BasicBlock
class BasicBlock: class BasicBlock:

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
MachineCodeInfo = llvm.Class() MachineCodeInfo = llvm.Class()

View 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()

View file

@ -1,10 +1,10 @@
from binding import * from binding import *
from namespace import llvm from namespace import llvm
from LLVMContext import LLVMContext from LLVMContext import LLVMContext
from StringRef import StringRef from ADT.StringRef import StringRef
from Module import Module from Module import Module
from Type import Type, IntegerType, StructType from Type import Type, IntegerType, StructType
from SmallVector import SmallVector_Value from ADT.SmallVector import SmallVector_Value
from GlobalVariable import GlobalVariable from GlobalVariable import GlobalVariable
from Pass import ImmutablePass from Pass import ImmutablePass

View file

@ -2,7 +2,7 @@ from binding import *
from namespace import llvm from namespace import llvm
from LLVMContext import LLVMContext from LLVMContext import LLVMContext
from Type import Type from Type import Type
from SmallVector import SmallVector_Type from ADT.SmallVector import SmallVector_Type
FunctionType = llvm.Class(Type) FunctionType = llvm.Class(Type)

View file

@ -2,11 +2,11 @@ from binding import *
from namespace import llvm from namespace import llvm
from Module import Module from Module import Module
from JITMemoryManager import JITMemoryManager from JITMemoryManager import JITMemoryManager
from CodeGen import CodeGenOpt, Reloc, CodeModel from Support.CodeGen import CodeGenOpt, Reloc, CodeModel
from StringRef import StringRef from ADT.StringRef import StringRef
from ExecutionEngine import ExecutionEngine from ExecutionEngine.ExecutionEngine import ExecutionEngine
from TargetMachine import TargetMachine from Target.TargetMachine import TargetMachine
from Triple import Triple from ADT.Triple import Triple
EngineBuilder = llvm.Class() EngineBuilder = llvm.Class()

View file

@ -1,14 +1,14 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from Module import Module from ..Module import Module
from JITMemoryManager import JITMemoryManager from ..JITMemoryManager import JITMemoryManager
from CodeGen import CodeGenOpt, Reloc, CodeModel from ..Support.CodeGen import CodeGenOpt, Reloc, CodeModel
from DataLayout import DataLayout from ..DataLayout import DataLayout
from Value import Function, GlobalValue, BasicBlock, Constant from ..Value import Function, GlobalValue, BasicBlock, Constant
from GlobalVariable import GlobalVariable from ..GlobalVariable import GlobalVariable
from MachineCodeInfo import MachineCodeInfo from ..CodeGen.MachineCodeInfo import MachineCodeInfo
from GenericValue import GenericValue from ..GenericValue import GenericValue
from Type import Type from ..Type import Type
ExecutionEngine = llvm.Class() ExecutionEngine = llvm.Class()

View 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()

View file

@ -8,8 +8,8 @@ from Instruction import UnreachableInst, AllocaInst, LoadInst, StoreInst
from Instruction import FenceInst, AtomicCmpXchgInst, AtomicRMWInst, CmpInst from Instruction import FenceInst, AtomicCmpXchgInst, AtomicRMWInst, CmpInst
from Instruction import LandingPadInst, VAArgInst from Instruction import LandingPadInst, VAArgInst
from Instruction import AtomicOrdering, SynchronizationScope from Instruction import AtomicOrdering, SynchronizationScope
from SmallVector import SmallVector_Value, SmallVector_Unsigned from ADT.SmallVector import SmallVector_Value, SmallVector_Unsigned
from StringRef import StringRef from ADT.StringRef import StringRef
from Value import Value, MDNode from Value import Value, MDNode
from Type import Type, IntegerType from Type import Type, IntegerType

View file

@ -1,12 +1,12 @@
from binding import * from binding import *
from namespace import llvm from namespace import llvm
from LLVMContext import LLVMContext from LLVMContext import LLVMContext
from StringRef import StringRef from ADT.StringRef import StringRef
from Constant import Constant from Constant import Constant
from Function import Function from Function import Function
from DerivedTypes import FunctionType from DerivedTypes import FunctionType
from raw_ostream import raw_ostream from Support.raw_ostream import raw_ostream
from AssemblyAnnotationWriter import AssemblyAnnotationWriter from Assembly.AssemblyAnnotationWriter import AssemblyAnnotationWriter
@llvm.Class() @llvm.Class()
class Module: class Module:

View file

@ -1,6 +1,6 @@
from binding import * from binding import *
from namespace import llvm from namespace import llvm
from StringRef import StringRef from ADT.StringRef import StringRef
from Module import Module from Module import Module
from Function import Function from Function import Function

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
@llvm.Class() @llvm.Class()
class Reloc: class Reloc:

View file

@ -0,0 +1,9 @@
from binding import *
from ..namespace import llvm
MemoryBuffer = llvm.Class()
@MemoryBuffer
class MemoryBuffer:
_include_ = 'llvm/Support/MemoryBuffer.h'

View file

@ -1,6 +1,6 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from StringRef import StringRef from ..ADT.StringRef import StringRef
Target = llvm.Class() Target = llvm.Class()
@Target @Target

View file

@ -1,8 +1,8 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
llvm.includes.add('llvm/Support/TargetSelect.h') llvm.includes.add('llvm/Support/TargetSelect.h')
llvm.Function('InitializeNativeTarget') InitializeNativeTarget = llvm.Function('InitializeNativeTarget')
#llvm.Function('InitializeAllTargets') #llvm.Function('InitializeAllTargets')

View 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()

View file

@ -1,7 +1,7 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from LLVMContext import LLVMContext from ..LLVMContext import LLVMContext
from StringRef import StringRef from ..ADT.StringRef import StringRef
@llvm.Class() @llvm.Class()
class raw_ostream: class raw_ostream:

View file

@ -1,8 +1,8 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from Triple import Triple from ..ADT.Triple import Triple
from Pass import ImmutablePass from ..Pass import ImmutablePass
from StringRef import StringRef from ..ADT.StringRef import StringRef
TargetLibraryInfo = llvm.Class(ImmutablePass) TargetLibraryInfo = llvm.Class(ImmutablePass)

View file

@ -1,12 +1,12 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from StringRef import StringRef from ..ADT.StringRef import StringRef
from CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc from ..Support.CodeGen import CodeModel, TLSModel, CodeGenOpt, Reloc
from GlobalValue import GlobalValue from ..GlobalValue import GlobalValue
from Target import Target from ..Support.Target import Target
from DataLayout import DataLayout from ..DataLayout import DataLayout
from TargetTransformInfo import (ScalarTargetTransformInfo, from ..TargetTransformInfo import (ScalarTargetTransformInfo,
VectorTargetTransformInfo) VectorTargetTransformInfo)
TargetMachine = llvm.Class() TargetMachine = llvm.Class()

View 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()

View file

@ -1,6 +1,8 @@
from binding import * from binding import *
from namespace import llvm from namespace import llvm
llvm.includes.add('llvm/TargetTransformInfo.h')
ScalarTargetTransformInfo = llvm.Class() ScalarTargetTransformInfo = llvm.Class()
VectorTargetTransformInfo = llvm.Class() VectorTargetTransformInfo = llvm.Class()

View file

@ -1,5 +1,5 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from ..Pass import Pass from ..Pass import Pass
llvm.includes.add('llvm/Transforms/IPO.h') llvm.includes.add('llvm/Transforms/IPO.h')

View file

@ -1,8 +1,8 @@
from binding import * from binding import *
from namespace import llvm from ..namespace import llvm
from PassManager import PassManagerBase, FunctionPassManager from ..PassManager import PassManagerBase, FunctionPassManager
from TargetLibraryInfo import TargetLibraryInfo from ..Target.TargetLibraryInfo import TargetLibraryInfo
from Pass import Pass from ..Pass import Pass
@llvm.Class() @llvm.Class()
class PassManagerBuilder: class PassManagerBuilder:

View file

@ -1,8 +1,8 @@
from binding import * from binding import *
from namespace import llvm from namespace import llvm
from LLVMContext import LLVMContext from LLVMContext import LLVMContext
from raw_ostream import raw_ostream from Support.raw_ostream import raw_ostream
from StringRef import StringRef from ADT.StringRef import StringRef
Type = llvm.Class() Type = llvm.Class()
IntegerType = llvm.Class(Type) IntegerType = llvm.Class(Type)

View file

@ -1,10 +1,10 @@
from binding import * from binding import *
from namespace import llvm from namespace import llvm
from raw_ostream import raw_ostream from Support.raw_ostream import raw_ostream
from AssemblyAnnotationWriter import AssemblyAnnotationWriter from Assembly.AssemblyAnnotationWriter import AssemblyAnnotationWriter
from Type import Type from Type import Type
from LLVMContext import LLVMContext from LLVMContext import LLVMContext
from StringRef import StringRef from ADT.StringRef import StringRef
Value = llvm.Class() Value = llvm.Class()
# forward declarations # forward declarations

View file

@ -9,4 +9,4 @@ def _init():
_init() _init()
import Transforms import Transforms, ADT, Support, Assembly, ExecutionEngine, CodeGen, Target