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
$(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

View file

@ -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 = []

View file

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

View file

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

View file

@ -1,5 +1,5 @@
from binding import *
from namespace import llvm
from ..namespace import llvm
from StringRef import StringRef
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 namespace import llvm
from ..namespace import llvm
@llvm.Class()
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 Instruction import Instruction, TerminatorInst
from LLVMContext import LLVMContext
from StringRef import StringRef
from ADT.StringRef import StringRef
@BasicBlock
class BasicBlock:

View file

@ -1,5 +1,5 @@
from binding import *
from namespace import llvm
from ..namespace import llvm
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 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

View file

@ -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)

View file

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

View file

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

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 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

View file

@ -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:

View file

@ -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

View file

@ -1,5 +1,5 @@
from binding import *
from namespace import llvm
from ..namespace import llvm
@llvm.Class()
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 namespace import llvm
from StringRef import StringRef
from ..namespace import llvm
from ..ADT.StringRef import StringRef
Target = llvm.Class()
@Target

View file

@ -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')

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 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:

View file

@ -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)

View file

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

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 namespace import llvm
llvm.includes.add('llvm/TargetTransformInfo.h')
ScalarTargetTransformInfo = llvm.Class()
VectorTargetTransformInfo = llvm.Class()

View file

@ -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')

View file

@ -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:

View file

@ -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)

View file

@ -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

View file

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