Refactor to allow sub-namespace declaration
This commit is contained in:
parent
fe383ca326
commit
7c39bd1f5b
13 changed files with 264 additions and 197 deletions
|
|
@ -1,9 +1,8 @@
|
|||
from binding import *
|
||||
from namespace import llvm
|
||||
|
||||
@llvm.Class() # actually a namespace
|
||||
class CallingConv:
|
||||
ID = Enum('''
|
||||
CallingConv = llvm.Namespace('CallingConv')
|
||||
ID = CallingConv.Enum('ID', '''
|
||||
C, Fast, Cold, GHC, FirstTargetCC, X86_StdCall, X86_FastCall,
|
||||
ARM_APCS, ARM_AAPCS, ARM_AAPCS_VFP, MSP430_INTR, X86_ThisCall,
|
||||
PTX_Kernel, PTX_Device, MBLAZE_INTR, MBLAZE_SVOL, SPIR_FUNC,
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@ from ADT.Triple import Triple
|
|||
|
||||
EngineBuilder = llvm.Class()
|
||||
|
||||
@llvm.Class() # a fake class (actually a namespace)
|
||||
class EngineKind:
|
||||
Kind = Enum('JIT', 'Interpreter')
|
||||
EngineKind = llvm.Namespace('EngineKind')
|
||||
Kind = EngineKind.Enum('Kind', 'JIT', 'Interpreter')
|
||||
|
||||
@EngineBuilder
|
||||
class EngineBuilder:
|
||||
|
|
@ -22,7 +21,7 @@ class EngineBuilder:
|
|||
def _setter(*args):
|
||||
return Method(ref(EngineBuilder), *args)
|
||||
|
||||
setEngineKind = _setter(EngineKind.Kind)
|
||||
setEngineKind = _setter(Kind)
|
||||
setJITMemoryManager = _setter(ptr(JITMemoryManager))
|
||||
|
||||
setErrorStr = CustomMethod('EngineBuilder_setErrorStr',
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@ from Module import Module
|
|||
from Function import Function
|
||||
|
||||
|
||||
Intrinsic = llvm.Class() # fake class (actually a namespace)
|
||||
Intrinsic = llvm.Namespace('Intrinsic')
|
||||
|
||||
@Intrinsic
|
||||
class Intrinsic:
|
||||
getDeclaration = CustomStaticMethod('Intrinsic_getDeclaration',
|
||||
PyObjectPtr, # Function*
|
||||
ptr(Module),
|
||||
cast(int, Unsigned), # intrinsic id
|
||||
PyObjectPtr, # list of Type
|
||||
).require_only(2)
|
||||
getDeclaration = Intrinsic.CustomFunction('getDeclaration',
|
||||
'Intrinsic_getDeclaration',
|
||||
PyObjectPtr, # Function*
|
||||
ptr(Module),
|
||||
cast(int, Unsigned), # intrinsic id
|
||||
PyObjectPtr, # list of Type
|
||||
).require_only(2)
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
from binding import *
|
||||
from ..namespace import llvm
|
||||
|
||||
@llvm.Class()
|
||||
class Reloc:
|
||||
Model = Enum('Default', 'Static', 'PIC_', 'DynamicNoPIC')
|
||||
|
||||
@llvm.Class()
|
||||
class CodeModel:
|
||||
Model = Enum('Default', 'JITDefault', 'Small', 'Kernel', 'Medium', 'Large')
|
||||
Reloc = llvm.Namespace('Reloc')
|
||||
Reloc.Enum('Model',
|
||||
'Default', 'Static', 'PIC_', 'DynamicNoPIC')
|
||||
|
||||
@llvm.Class()
|
||||
class TLSModel:
|
||||
Model = Enum('GeneralDynamic', 'LocalDynamic', 'InitialExec', 'LocalExec')
|
||||
CodeModel = llvm.Namespace('CodeModel')
|
||||
CodeModel.Enum('Model',
|
||||
'Default', 'JITDefault', 'Small', 'Kernel', 'Medium', 'Large')
|
||||
|
||||
@llvm.Class()
|
||||
class CodeGenOpt:
|
||||
'Actually a namespace'
|
||||
Level = Enum('None', 'Less', 'Default', 'Aggressive')
|
||||
TLSModel = llvm.Namespace('TLSModel')
|
||||
TLSModel.Enum('Model',
|
||||
'GeneralDynamic', 'LocalDynamic', 'InitialExec', 'LocalExec')
|
||||
|
||||
CodeGenOpt = llvm.Namespace('CodeGenOpt')
|
||||
CodeGenOpt.Enum('Level',
|
||||
'None', 'Less', 'Default', 'Aggressive')
|
||||
|
||||
|
|
|
|||
6
newbinding/src/Support/DynamicLibrary.py
Normal file
6
newbinding/src/Support/DynamicLibrary.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from binding import *
|
||||
from ..namespace import sys
|
||||
|
||||
DynamicLibrary = sys.Namespace('DynamicLibrary')
|
||||
#LoadLibraryPermanently
|
||||
|
||||
|
|
@ -6,9 +6,8 @@ from ..ADT.StringRef import StringRef
|
|||
|
||||
TargetLibraryInfo = llvm.Class(ImmutablePass)
|
||||
|
||||
@llvm.Class()
|
||||
class LibFunc:
|
||||
Func = Enum('''
|
||||
LibFunc = llvm.Namespace('LibFunc')
|
||||
LibFunc.Enum('Func', '''
|
||||
ZdaPv, ZdlPv, Znaj, ZnajRKSt9nothrow_t,
|
||||
Znam, ZnamRKSt9nothrow_t, Znwj, ZnwjRKSt9nothrow_t,
|
||||
Znwm, ZnwmRKSt9nothrow_t, cxa_atexit, cxa_guard_abort,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
from binding import *
|
||||
|
||||
llvm = Namespace('llvm')
|
||||
default = Namespace('')
|
||||
|
||||
llvm = Namespace('llvm')
|
||||
sys = llvm.Namespace('sys')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue