Organize code layout
This commit is contained in:
parent
5c1e8985a1
commit
d0935fe533
14 changed files with 22 additions and 11 deletions
6
newbinding/src/AssemblyAnnotationWriter.py
Normal file
6
newbinding/src/AssemblyAnnotationWriter.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
|
||||
AssemblyAnnotationWriter = llvm.Class()
|
||||
AssemblyAnnotationWriter.include.add("llvm/Assembly/AssemblyAnnotationWriter.h")
|
||||
|
||||
13
newbinding/src/DerivedTypes.py
Normal file
13
newbinding/src/DerivedTypes.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from Type import Type
|
||||
|
||||
FunctionType = Type.Subclass()
|
||||
FunctionType.include.add('llvm/DerivedTypes.h')
|
||||
|
||||
get = FunctionType.staticmethod(FunctionType.Pointer, Type.Pointer, Bool.From(bool))
|
||||
isVarArg = FunctionType.method(Bool.To(bool))
|
||||
getReturnType = FunctionType.method(Type.Pointer)
|
||||
getParamType = FunctionType.method(Type.Pointer, Unsigned.From(int))
|
||||
getNumParams = FunctionType.method(Unsigned.To(int))
|
||||
8
newbinding/src/LLVMContext.py
Normal file
8
newbinding/src/LLVMContext.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
|
||||
LLVMContext = llvm.Class()
|
||||
LLVMContext.include.add("llvm/LLVMContext.h")
|
||||
|
||||
getGlobalContext = llvm.Function(LLVMContext.Ref)
|
||||
|
||||
25
newbinding/src/Module.py
Normal file
25
newbinding/src/Module.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
from raw_ostream import raw_svector_ostream_helper
|
||||
from AssemblyAnnotationWriter import AssemblyAnnotationWriter
|
||||
|
||||
Module = llvm.Class()
|
||||
Module.include.add("llvm/Module.h")
|
||||
|
||||
new = Module.new(StringRef.From(str), LLVMContext.Ref)
|
||||
delete = Module.delete()
|
||||
getModuleIdentifier = Module.method(ConstStdString.To(str))
|
||||
setModuleIdentifier = Module.method(Void, StringRef.From(str))
|
||||
setDataLayout = Module.method(Void, StringRef.From(str))
|
||||
setTargetTriple = Module.method(Void, StringRef.From(str))
|
||||
setModuleInlineAsm = Module.method(Void, StringRef.From(str))
|
||||
appendModuleInlineAsm = Module.method(Void, StringRef.From(str))
|
||||
getContext = Module.method(LLVMContext.Ref)
|
||||
dump = Module.method(Void)
|
||||
print_ = Module.method(Void, raw_svector_ostream_helper.Ref,
|
||||
AssemblyAnnotationWriter.Pointer)
|
||||
print_.realname = 'print'
|
||||
#getOrInsertFunction = Module.method(Constant, StringRef.From(str), FunctionType.Pointer)
|
||||
|
||||
6
newbinding/src/StringRef.py
Normal file
6
newbinding/src/StringRef.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
|
||||
StringRef = llvm.Class()
|
||||
StringRef.include.add("llvm/ADT/StringRef.h")
|
||||
|
||||
96
newbinding/src/Type.py
Normal file
96
newbinding/src/Type.py
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from raw_ostream import raw_svector_ostream_helper
|
||||
|
||||
Type = llvm.Class()
|
||||
Type.include.add('llvm/Type.h')
|
||||
|
||||
IntegerType = Type.Subclass()
|
||||
CompositeType = Type.Subclass()
|
||||
SequentialType = CompositeType.Subclass()
|
||||
PointerType = SequentialType.Subclass()
|
||||
|
||||
getContext = Type.method(LLVMContext.Ref)
|
||||
dump = Type.method(Void)
|
||||
print_ = Type.method(Void, raw_svector_ostream_helper.Ref)
|
||||
print_.realname = 'print'
|
||||
|
||||
def type_checker():
|
||||
return Type.method(Bool.To(bool))
|
||||
|
||||
isVoidTy = type_checker()
|
||||
isHalfTy = type_checker()
|
||||
isFloatTy = type_checker()
|
||||
isDoubleTy = type_checker()
|
||||
isX86_FP80Ty = type_checker()
|
||||
isFP128Ty = type_checker()
|
||||
isPPC_FP128Ty = type_checker()
|
||||
isFloatingPointTy = type_checker()
|
||||
isX86_MMXTy = type_checker()
|
||||
isFPOrFPVectorTy = type_checker()
|
||||
isLabelTy = type_checker()
|
||||
isMetadataTy = type_checker()
|
||||
isIntOrIntVectorTy = type_checker()
|
||||
isFunctionTy = type_checker()
|
||||
isStructTy = type_checker()
|
||||
isArrayTy = type_checker()
|
||||
isPointerTy = type_checker()
|
||||
isPtrOrPtrVectorTy = type_checker()
|
||||
isVectorTy = type_checker()
|
||||
isEmptyTy = type_checker()
|
||||
isPrimitiveType = type_checker()
|
||||
isDerivedType = type_checker()
|
||||
isFirstClassType = type_checker()
|
||||
isSingleValueType = type_checker()
|
||||
isAggregateType = type_checker()
|
||||
isSized = type_checker()
|
||||
|
||||
isIntegerTy = Type.multimethod([Bool.To(bool)],
|
||||
[Bool.To(bool), Unsigned.From(int)])
|
||||
|
||||
|
||||
def type_factory():
|
||||
return Type.staticmethod(Type.Pointer, LLVMContext.Ref)
|
||||
|
||||
getVoidTy = type_factory()
|
||||
getLabelTy = type_factory()
|
||||
getHalfTy = type_factory()
|
||||
getFloatTy = type_factory()
|
||||
getDoubleTy = type_factory()
|
||||
getMetadataTy = type_factory()
|
||||
getX86_FP80Ty = type_factory()
|
||||
getFP128Ty = type_factory()
|
||||
getPPC_FP128Ty = type_factory()
|
||||
getX86_MMXTy = type_factory()
|
||||
|
||||
getIntNTy = Type.staticmethod(IntegerType.Pointer, LLVMContext.Ref, Unsigned.From(int))
|
||||
|
||||
def integer_factory():
|
||||
return Type.staticmethod(IntegerType.Pointer, LLVMContext.Ref)
|
||||
|
||||
getInt1Ty = integer_factory()
|
||||
getInt8Ty = integer_factory()
|
||||
getInt16Ty = integer_factory()
|
||||
getInt32Ty = integer_factory()
|
||||
getInt64Ty = integer_factory()
|
||||
|
||||
def pointer_factory():
|
||||
return Type.staticmethod(PointerType.Pointer, LLVMContext.Ref)
|
||||
|
||||
getHalfPtrTy = pointer_factory()
|
||||
getFloatPtrTy = pointer_factory()
|
||||
getDoublePtrTy = pointer_factory()
|
||||
getX86_FP80PtrTy = pointer_factory()
|
||||
getFP128PtrTy = pointer_factory()
|
||||
getPPC_FP128PtrTy = pointer_factory()
|
||||
getX86_MMXPtrTy = pointer_factory()
|
||||
getInt1PtrTy = pointer_factory()
|
||||
getInt8PtrTy = pointer_factory()
|
||||
getInt16PtrTy = pointer_factory()
|
||||
getInt32PtrTy = pointer_factory()
|
||||
getInt64PtrTy = pointer_factory()
|
||||
getIntNPtrTy = Type.staticmethod(PointerType.Pointer,
|
||||
LLVMContext.Ref, Unsigned.From(int))
|
||||
|
||||
|
||||
3
newbinding/src/_Debug.py
Normal file
3
newbinding/src/_Debug.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from binding import *
|
||||
|
||||
enable_capsule_dtor_debug = Function('', Void, Bool.From(bool))
|
||||
0
newbinding/src/__init__.py
Normal file
0
newbinding/src/__init__.py
Normal file
4
newbinding/src/namespace.py
Normal file
4
newbinding/src/namespace.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from binding import *
|
||||
|
||||
extra = Namespace('llvm_extra')
|
||||
llvm = Namespace('llvm')
|
||||
17
newbinding/src/raw_ostream.py
Normal file
17
newbinding/src/raw_ostream.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
from LLVMContext import LLVMContext
|
||||
from StringRef import StringRef
|
||||
|
||||
raw_ostream = llvm.Class()
|
||||
raw_ostream.include.add("llvm/Support/raw_ostream.h")
|
||||
|
||||
raw_svector_ostream = raw_ostream.Subclass()
|
||||
raw_svector_ostream.include.add("llvm/Support/raw_os_ostream.h")
|
||||
|
||||
# extra class to help binding
|
||||
raw_svector_ostream_helper = raw_svector_ostream.Subclass()
|
||||
create = raw_svector_ostream_helper.staticmethod(
|
||||
raw_svector_ostream_helper.Pointer)
|
||||
delete = raw_svector_ostream_helper.delete()
|
||||
str = raw_svector_ostream_helper.method(StringRef.To(str))
|
||||
Loading…
Add table
Add a link
Reference in a new issue