remove excess whitespace
This commit is contained in:
parent
ba759b59d0
commit
f8deae06dd
22 changed files with 69 additions and 70 deletions
34
llvm/core.py
34
llvm/core.py
|
|
@ -388,7 +388,7 @@ class Module(llvm.Wrapper):
|
||||||
return str(self) == str(rhs)
|
return str(self) == str(rhs)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __ne__(self, rhs):
|
def __ne__(self, rhs):
|
||||||
return not (self == rhs)
|
return not (self == rhs)
|
||||||
|
|
||||||
|
|
@ -429,7 +429,7 @@ class Module(llvm.Wrapper):
|
||||||
|
|
||||||
The `other' module is no longer valid after this method is
|
The `other' module is no longer valid after this method is
|
||||||
invoked, all refs to it should be dropped.
|
invoked, all refs to it should be dropped.
|
||||||
|
|
||||||
In the future, this API might be replaced with a full-fledged
|
In the future, this API might be replaced with a full-fledged
|
||||||
Linker class.
|
Linker class.
|
||||||
"""
|
"""
|
||||||
|
|
@ -560,7 +560,7 @@ class Module(llvm.Wrapper):
|
||||||
pm = PassManager.new()._ptr
|
pm = PassManager.new()._ptr
|
||||||
formatted
|
formatted
|
||||||
failed = tm.addPassesToEmitFile(pm, fileobj, cgft, False)
|
failed = tm.addPassesToEmitFile(pm, fileobj, cgft, False)
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
raise llvm.LLVMException("Failed to write native object file")
|
raise llvm.LLVMException("Failed to write native object file")
|
||||||
if ret:
|
if ret:
|
||||||
|
|
@ -664,7 +664,7 @@ class Type(llvm.Wrapper):
|
||||||
context = api.llvm.getGlobalContext()
|
context = api.llvm.getGlobalContext()
|
||||||
ptr = api.llvm.Type.getFP128Ty(context)
|
ptr = api.llvm.Type.getFP128Ty(context)
|
||||||
return Type(ptr)
|
return Type(ptr)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ppc_fp128():
|
def ppc_fp128():
|
||||||
"""Create a 128-bit floating point type (two 64-bits)."""
|
"""Create a 128-bit floating point type (two 64-bits)."""
|
||||||
|
|
@ -920,7 +920,7 @@ class PointerType(Type):
|
||||||
|
|
||||||
class VectorType(Type):
|
class VectorType(Type):
|
||||||
_type_ = api.llvm.VectorType
|
_type_ = api.llvm.VectorType
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def element(self):
|
def element(self):
|
||||||
return Type(self._ptr.getVectorElementType())
|
return Type(self._ptr.getVectorElementType())
|
||||||
|
|
@ -989,7 +989,7 @@ class Value(llvm.Wrapper):
|
||||||
@property
|
@property
|
||||||
def use_count(self):
|
def use_count(self):
|
||||||
return self._ptr.getNumUses()
|
return self._ptr.getNumUses()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def uses(self):
|
def uses(self):
|
||||||
return list(map(_make_value, self._ptr.list_use()))
|
return list(map(_make_value, self._ptr.list_use()))
|
||||||
|
|
@ -1263,7 +1263,7 @@ class GlobalValue(Constant):
|
||||||
|
|
||||||
def _set_linkage(self, value):
|
def _set_linkage(self, value):
|
||||||
self._ptr.setLinkage(value)
|
self._ptr.setLinkage(value)
|
||||||
|
|
||||||
linkage = property(_get_linkage, _set_linkage)
|
linkage = property(_get_linkage, _set_linkage)
|
||||||
|
|
||||||
def _get_section(self):
|
def _get_section(self):
|
||||||
|
|
@ -1287,7 +1287,7 @@ class GlobalValue(Constant):
|
||||||
|
|
||||||
def _set_alignment(self, value):
|
def _set_alignment(self, value):
|
||||||
return self._ptr.setAlignment(value)
|
return self._ptr.setAlignment(value)
|
||||||
|
|
||||||
alignment = property(_get_alignment, _set_alignment)
|
alignment = property(_get_alignment, _set_alignment)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -1490,7 +1490,7 @@ class Function(GlobalValue):
|
||||||
@property
|
@property
|
||||||
def basic_blocks(self):
|
def basic_blocks(self):
|
||||||
return list(map(_make_value, self._ptr.getBasicBlockList()))
|
return list(map(_make_value, self._ptr.getBasicBlockList()))
|
||||||
|
|
||||||
def viewCFG(self):
|
def viewCFG(self):
|
||||||
return self._ptr.viewCFG()
|
return self._ptr.viewCFG()
|
||||||
|
|
||||||
|
|
@ -1510,7 +1510,7 @@ class Function(GlobalValue):
|
||||||
def verify(self):
|
def verify(self):
|
||||||
# Although we're just asking LLVM to return the success or
|
# Although we're just asking LLVM to return the success or
|
||||||
# failure, it appears to print result to stderr and abort.
|
# failure, it appears to print result to stderr and abort.
|
||||||
|
|
||||||
# Note: LLVM has a bug in preverifier that will always abort
|
# Note: LLVM has a bug in preverifier that will always abort
|
||||||
# the process upon failure.
|
# the process upon failure.
|
||||||
actions = api.llvm.VerifierFailureAction
|
actions = api.llvm.VerifierFailureAction
|
||||||
|
|
@ -1528,7 +1528,7 @@ class Function(GlobalValue):
|
||||||
|
|
||||||
class InlineAsm(Value):
|
class InlineAsm(Value):
|
||||||
_type_ = api.llvm.InlineAsm
|
_type_ = api.llvm.InlineAsm
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get(functype, asm, constrains, side_effect=False,
|
def get(functype, asm, constrains, side_effect=False,
|
||||||
align_stack=False, dialect=api.llvm.InlineAsm.AsmDialect.AD_ATT):
|
align_stack=False, dialect=api.llvm.InlineAsm.AsmDialect.AD_ATT):
|
||||||
|
|
@ -1609,7 +1609,7 @@ class NamedMetaData(llvm.Wrapper):
|
||||||
def delete(self):
|
def delete(self):
|
||||||
_ValueFactory.delete(self._ptr)
|
_ValueFactory.delete(self._ptr)
|
||||||
self._ptr.eraseFromParent()
|
self._ptr.eraseFromParent()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return self._ptr.getName()
|
return self._ptr.getName()
|
||||||
|
|
@ -1639,7 +1639,7 @@ class Instruction(User):
|
||||||
@property
|
@property
|
||||||
def is_binary_op(self):
|
def is_binary_op(self):
|
||||||
return self._ptr.isBinaryOp()
|
return self._ptr.isBinaryOp()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_shift(self):
|
def is_shift(self):
|
||||||
return self._ptr.isShift()
|
return self._ptr.isShift()
|
||||||
|
|
@ -1663,7 +1663,7 @@ class Instruction(User):
|
||||||
@property
|
@property
|
||||||
def is_commutative(self):
|
def is_commutative(self):
|
||||||
return self._ptr.isCommutative()
|
return self._ptr.isCommutative()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_volatile(self):
|
def is_volatile(self):
|
||||||
"""True if this is a volatile load or store."""
|
"""True if this is a volatile load or store."""
|
||||||
|
|
@ -1925,7 +1925,7 @@ class Builder(llvm.Wrapper):
|
||||||
def ret_void(self):
|
def ret_void(self):
|
||||||
self._guard_terminators()
|
self._guard_terminators()
|
||||||
return _make_value(self._ptr.CreateRetVoid())
|
return _make_value(self._ptr.CreateRetVoid())
|
||||||
|
|
||||||
def ret(self, value):
|
def ret(self, value):
|
||||||
self._guard_terminators()
|
self._guard_terminators()
|
||||||
return _make_value(self._ptr.CreateRet(value._ptr))
|
return _make_value(self._ptr.CreateRet(value._ptr))
|
||||||
|
|
@ -2039,7 +2039,7 @@ class Builder(llvm.Wrapper):
|
||||||
"")
|
"")
|
||||||
inst = self._ptr.Insert(malloc, name)
|
inst = self._ptr.Insert(malloc, name)
|
||||||
return _make_value(inst)
|
return _make_value(inst)
|
||||||
|
|
||||||
def malloc_array(self, ty, size, name=""):
|
def malloc_array(self, ty, size, name=""):
|
||||||
context = api.llvm.getGlobalContext()
|
context = api.llvm.getGlobalContext()
|
||||||
allocsz = api.llvm.ConstantExpr.getSizeOf(ty._ptr)
|
allocsz = api.llvm.ConstantExpr.getSizeOf(ty._ptr)
|
||||||
|
|
@ -2242,7 +2242,7 @@ class Builder(llvm.Wrapper):
|
||||||
|
|
||||||
def atomic_umin(self, *args, **kwargs):
|
def atomic_umin(self, *args, **kwargs):
|
||||||
return self.atomic_rmw('umin', *args, **kwargs)
|
return self.atomic_rmw('umin', *args, **kwargs)
|
||||||
|
|
||||||
def atomic_load(self, ptr, ordering, align=1, crossthread=True,
|
def atomic_load(self, ptr, ordering, align=1, crossthread=True,
|
||||||
volatile=False, name=""):
|
volatile=False, name=""):
|
||||||
inst = self.load(ptr, align=align, volatile=volatile, name=name)
|
inst = self.load(ptr, align=align, volatile=volatile, name=name)
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class EngineBuilder(llvm.Wrapper):
|
||||||
|
|
||||||
def select_target(self, *args):
|
def select_target(self, *args):
|
||||||
'''get the corresponding target machine
|
'''get the corresponding target machine
|
||||||
|
|
||||||
Accept no arguments or (triple, march, mcpu, mattrs)
|
Accept no arguments or (triple, march, mcpu, mattrs)
|
||||||
'''
|
'''
|
||||||
if args:
|
if args:
|
||||||
|
|
@ -338,7 +338,7 @@ class TargetMachine(llvm.Wrapper):
|
||||||
@property
|
@property
|
||||||
def cpu(self):
|
def cpu(self):
|
||||||
return self._ptr.getTargetCPU()
|
return self._ptr.getTargetCPU()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def feature_string(self):
|
def feature_string(self):
|
||||||
return self._ptr.getTargetFeatureString()
|
return self._ptr.getTargetFeatureString()
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class PassManagerBuilder(llvm.Wrapper):
|
||||||
@vectorize.setter
|
@vectorize.setter
|
||||||
def vectorize(self, enable):
|
def vectorize(self, enable):
|
||||||
self._ptr.Vectorize = enable
|
self._ptr.Vectorize = enable
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def loop_vectorize(self):
|
def loop_vectorize(self):
|
||||||
|
|
@ -200,7 +200,7 @@ class Pass(llvm.Wrapper):
|
||||||
try:
|
try:
|
||||||
return self.__name
|
return self.__name
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return
|
return
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def description(self):
|
def description(self):
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class Capsule(object):
|
||||||
"Wraps PyCapsule so that we can build weakref of it."
|
"Wraps PyCapsule so that we can build weakref of it."
|
||||||
|
|
||||||
from ._capsule import check, getClassName, getName, getPointer
|
from ._capsule import check, getClassName, getName, getPointer
|
||||||
|
|
||||||
def __init__(self, capsule):
|
def __init__(self, capsule):
|
||||||
assert Capsule.valid(capsule)
|
assert Capsule.valid(capsule)
|
||||||
self.capsule = capsule
|
self.capsule = capsule
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ class Class(SubModule, _Type):
|
||||||
|
|
||||||
class Enum(object):
|
class Enum(object):
|
||||||
format = 'O'
|
format = 'O'
|
||||||
|
|
||||||
def __init__(self, *value_names):
|
def __init__(self, *value_names):
|
||||||
self.parent = None
|
self.parent = None
|
||||||
if len(value_names) == 1:
|
if len(value_names) == 1:
|
||||||
|
|
@ -507,7 +507,7 @@ class Method(object):
|
||||||
def is_return_ownedptr(self):
|
def is_return_ownedptr(self):
|
||||||
retty = self.signatures[0][0]
|
retty = self.signatures[0][0]
|
||||||
return isinstance(retty, ownedptr)
|
return isinstance(retty, ownedptr)
|
||||||
|
|
||||||
def process_ownedptr_args(self, writer, unwrapped):
|
def process_ownedptr_args(self, writer, unwrapped):
|
||||||
argtys = self.signatures[0][1:]
|
argtys = self.signatures[0][1:]
|
||||||
for i, ty in enumerate(argtys):
|
for i, ty in enumerate(argtys):
|
||||||
|
|
@ -525,7 +525,7 @@ class CustomMethod(Method):
|
||||||
ret = writer.call(self.methodname, retty.fullname, *args)
|
ret = writer.call(self.methodname, retty.fullname, *args)
|
||||||
writer.return_value(retty.wrap(writer, ret))
|
writer.return_value(retty.wrap(writer, ret))
|
||||||
|
|
||||||
|
|
||||||
class StaticMethod(Method):
|
class StaticMethod(Method):
|
||||||
|
|
||||||
def compile_cpp_body(self, writer, retty, argtys):
|
def compile_cpp_body(self, writer, retty, argtys):
|
||||||
|
|
@ -544,7 +544,7 @@ class StaticMethod(Method):
|
||||||
with decl as varargs:
|
with decl as varargs:
|
||||||
unwrapped = writer.unwrap_many(varargs)
|
unwrapped = writer.unwrap_many(varargs)
|
||||||
self.process_ownedptr_args(writer, unwrapped)
|
self.process_ownedptr_args(writer, unwrapped)
|
||||||
|
|
||||||
func = '.'.join([self.parent.py_name, self.name])
|
func = '.'.join([self.parent.py_name, self.name])
|
||||||
ret = writer.call('_api.%s' % func, varargs=unwrapped)
|
ret = writer.call('_api.%s' % func, varargs=unwrapped)
|
||||||
wrapped = writer.wrap(ret, self.is_return_ownedptr())
|
wrapped = writer.wrap(ret, self.is_return_ownedptr())
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ static
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
println(fmt % locals())
|
println(fmt % locals())
|
||||||
|
|
||||||
fn.generate_cpp(println)
|
fn.generate_cpp(println)
|
||||||
|
|
||||||
println('static')
|
println('static')
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,4 @@ class Argument:
|
||||||
addAttr = Method(Void, ref(Attributes))
|
addAttr = Method(Void, ref(Attributes))
|
||||||
removeAttr = Method(Void, ref(Attributes))
|
removeAttr = Method(Void, ref(Attributes))
|
||||||
getParamAlignment = Method(cast(Unsigned, int))
|
getParamAlignment = Method(cast(Unsigned, int))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class BasicBlock:
|
||||||
|
|
||||||
getParent = Method(ptr(Function))
|
getParent = Method(ptr(Function))
|
||||||
getTerminator = Method(ptr(TerminatorInst))
|
getTerminator = Method(ptr(TerminatorInst))
|
||||||
|
|
||||||
empty = Method(cast(Bool, bool))
|
empty = Method(cast(Bool, bool))
|
||||||
dropAllReferences = Method()
|
dropAllReferences = Method()
|
||||||
isLandingPad = Method(cast(Bool, bool))
|
isLandingPad = Method(cast(Bool, bool))
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class UndefValue:
|
||||||
@ConstantInt
|
@ConstantInt
|
||||||
class ConstantInt:
|
class ConstantInt:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
get = StaticMethod(ptr(ConstantInt),
|
get = StaticMethod(ptr(ConstantInt),
|
||||||
ptr(IntegerType),
|
ptr(IntegerType),
|
||||||
cast(int, Uint64),
|
cast(int, Uint64),
|
||||||
|
|
@ -89,7 +89,7 @@ class ConstantInt:
|
||||||
@ConstantFP
|
@ConstantFP
|
||||||
class ConstantFP:
|
class ConstantFP:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
get = StaticMethod(ptr(Constant), ptr(Type), cast(float, Double))
|
get = StaticMethod(ptr(Constant), ptr(Type), cast(float, Double))
|
||||||
getNegativeZero = StaticMethod(ptr(ConstantFP), ptr(Type))
|
getNegativeZero = StaticMethod(ptr(ConstantFP), ptr(Type))
|
||||||
getInfinity = StaticMethod(ptr(ConstantFP), ptr(Type), cast(bool, Bool))
|
getInfinity = StaticMethod(ptr(ConstantFP), ptr(Type), cast(bool, Bool))
|
||||||
|
|
@ -103,7 +103,7 @@ class ConstantFP:
|
||||||
@ConstantArray
|
@ConstantArray
|
||||||
class ConstantArray:
|
class ConstantArray:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
get = CustomStaticMethod('ConstantArray_get',
|
get = CustomStaticMethod('ConstantArray_get',
|
||||||
PyObjectPtr, # ptr(Constant),
|
PyObjectPtr, # ptr(Constant),
|
||||||
ptr(ArrayType),
|
ptr(ArrayType),
|
||||||
|
|
@ -114,7 +114,7 @@ class ConstantArray:
|
||||||
@ConstantStruct
|
@ConstantStruct
|
||||||
class ConstantStruct:
|
class ConstantStruct:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
get = CustomStaticMethod('ConstantStruct_get',
|
get = CustomStaticMethod('ConstantStruct_get',
|
||||||
PyObjectPtr, # ptr(Constant)
|
PyObjectPtr, # ptr(Constant)
|
||||||
ptr(StructType),
|
ptr(StructType),
|
||||||
|
|
@ -130,7 +130,7 @@ class ConstantStruct:
|
||||||
@ConstantVector
|
@ConstantVector
|
||||||
class ConstantVector:
|
class ConstantVector:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
get = CustomStaticMethod('ConstantVector_get',
|
get = CustomStaticMethod('ConstantVector_get',
|
||||||
PyObjectPtr, # ptr(Constant)
|
PyObjectPtr, # ptr(Constant)
|
||||||
PyObjectPtr, # constants
|
PyObjectPtr, # constants
|
||||||
|
|
@ -145,7 +145,7 @@ class ConstantDataSequential:
|
||||||
@ConstantDataArray
|
@ConstantDataArray
|
||||||
class ConstantDataArray:
|
class ConstantDataArray:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
getString = StaticMethod(ptr(Constant),
|
getString = StaticMethod(ptr(Constant),
|
||||||
ref(LLVMContext),
|
ref(LLVMContext),
|
||||||
cast(str, StringRef),
|
cast(str, StringRef),
|
||||||
|
|
@ -178,7 +178,7 @@ def _factory_const_type():
|
||||||
@ConstantExpr
|
@ConstantExpr
|
||||||
class ConstantExpr:
|
class ConstantExpr:
|
||||||
_downcast_ = Constant, Value
|
_downcast_ = Constant, Value
|
||||||
|
|
||||||
getAlignOf = _factory(ptr(Type))
|
getAlignOf = _factory(ptr(Type))
|
||||||
getSizeOf = _factory(ptr(Type))
|
getSizeOf = _factory(ptr(Type))
|
||||||
getOffsetOf = _factory(ptr(Type), ptr(Constant))
|
getOffsetOf = _factory(ptr(Type), ptr(Constant))
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class ExecutionEngine:
|
||||||
'llvm/ExecutionEngine/JIT.h') # force linking of jit
|
'llvm/ExecutionEngine/JIT.h') # force linking of jit
|
||||||
|
|
||||||
delete = Destructor()
|
delete = Destructor()
|
||||||
|
|
||||||
create = CustomStaticMethod('ExecutionEngine_create',
|
create = CustomStaticMethod('ExecutionEngine_create',
|
||||||
ptr(ExecutionEngine),
|
ptr(ExecutionEngine),
|
||||||
ownedptr(Module), cast(bool, Bool),
|
ownedptr(Module), cast(bool, Bool),
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,4 @@ class GenericValue:
|
||||||
|
|
||||||
toFloat = _accessor('ToFloat', cast(Double, float), ptr(Type))
|
toFloat = _accessor('ToFloat', cast(Double, float), ptr(Type))
|
||||||
|
|
||||||
toPointer = _accessor('ToPointer', cast(VoidPtr, int))
|
toPointer = _accessor('ToPointer', cast(VoidPtr, int))
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,15 @@ class GlobalValue:
|
||||||
_include_ = 'llvm/GlobalValue.h'
|
_include_ = 'llvm/GlobalValue.h'
|
||||||
|
|
||||||
LinkageTypes = Enum('''
|
LinkageTypes = Enum('''
|
||||||
ExternalLinkage, AvailableExternallyLinkage, LinkOnceAnyLinkage,
|
ExternalLinkage, AvailableExternallyLinkage, LinkOnceAnyLinkage,
|
||||||
LinkOnceODRLinkage, LinkOnceODRAutoHideLinkage, WeakAnyLinkage,
|
LinkOnceODRLinkage, LinkOnceODRAutoHideLinkage, WeakAnyLinkage,
|
||||||
WeakODRLinkage, AppendingLinkage, InternalLinkage, PrivateLinkage,
|
WeakODRLinkage, AppendingLinkage, InternalLinkage, PrivateLinkage,
|
||||||
LinkerPrivateLinkage, LinkerPrivateWeakLinkage, DLLImportLinkage,
|
LinkerPrivateLinkage, LinkerPrivateWeakLinkage, DLLImportLinkage,
|
||||||
DLLExportLinkage, ExternalWeakLinkage, CommonLinkage
|
DLLExportLinkage, ExternalWeakLinkage, CommonLinkage
|
||||||
''')
|
''')
|
||||||
|
|
||||||
VisibilityTypes = Enum('''DefaultVisibility,
|
VisibilityTypes = Enum('''DefaultVisibility,
|
||||||
HiddenVisibility,
|
HiddenVisibility,
|
||||||
ProtectedVisibility''')
|
ProtectedVisibility''')
|
||||||
|
|
||||||
setLinkage = Method(Void, LinkageTypes)
|
setLinkage = Method(Void, LinkageTypes)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from .Value import Constant
|
||||||
|
|
||||||
@GlobalVariable
|
@GlobalVariable
|
||||||
class GlobalVariable:
|
class GlobalVariable:
|
||||||
ThreadLocalMode = Enum('''NotThreadLocal, GeneralDynamicTLSModel,
|
ThreadLocalMode = Enum('''NotThreadLocal, GeneralDynamicTLSModel,
|
||||||
LocalDynamicTLSModel, InitialExecTLSModel,
|
LocalDynamicTLSModel, InitialExecTLSModel,
|
||||||
LocalExecTLSModel
|
LocalExecTLSModel
|
||||||
''')
|
''')
|
||||||
|
|
@ -46,4 +46,3 @@ class GlobalVariable:
|
||||||
# setExternallyinitialized = Method(Void, cast(bool, Bool))
|
# setExternallyinitialized = Method(Void, cast(bool, Bool))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ class IRBuilder:
|
||||||
cast(bool, Bool)]
|
cast(bool, Bool)]
|
||||||
op = Method(*sig).require_only(2)
|
op = Method(*sig).require_only(2)
|
||||||
return op
|
return op
|
||||||
|
|
||||||
CreateUDiv = _binop_is_exact()
|
CreateUDiv = _binop_is_exact()
|
||||||
CreateSDiv = _binop_is_exact()
|
CreateSDiv = _binop_is_exact()
|
||||||
CreateLShr = _binop_is_exact()
|
CreateLShr = _binop_is_exact()
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class Instruction:
|
||||||
insertBefore = Method(Void, ptr(Instruction))
|
insertBefore = Method(Void, ptr(Instruction))
|
||||||
insertAfter = Method(Void, ptr(Instruction))
|
insertAfter = Method(Void, ptr(Instruction))
|
||||||
moveBefore = Method(Void, ptr(Instruction))
|
moveBefore = Method(Void, ptr(Instruction))
|
||||||
|
|
||||||
isTerminator = Method(cast(Bool, bool))
|
isTerminator = Method(cast(Bool, bool))
|
||||||
isBinaryOp = Method(cast(Bool, bool))
|
isBinaryOp = Method(cast(Bool, bool))
|
||||||
isShift = Method(cast(Bool, bool))
|
isShift = Method(cast(Bool, bool))
|
||||||
|
|
@ -135,7 +135,7 @@ class BinaryOperator:
|
||||||
@CallInst
|
@CallInst
|
||||||
class CallInst:
|
class CallInst:
|
||||||
_downcast_ = Value, User, Instruction
|
_downcast_ = Value, User, Instruction
|
||||||
|
|
||||||
getCallingConv = Method(CallingConv.ID)
|
getCallingConv = Method(CallingConv.ID)
|
||||||
setCallingConv = Method(Void, CallingConv.ID)
|
setCallingConv = Method(Void, CallingConv.ID)
|
||||||
getParamAlignment = Method(cast(Unsigned, int), cast(int, Unsigned))
|
getParamAlignment = Method(cast(Unsigned, int), cast(int, Unsigned))
|
||||||
|
|
@ -298,7 +298,7 @@ class ReturnInst:
|
||||||
@SwitchInst
|
@SwitchInst
|
||||||
class SwitchInst:
|
class SwitchInst:
|
||||||
_downcast_ = Value, Instruction
|
_downcast_ = Value, Instruction
|
||||||
|
|
||||||
getCondition = Method(ptr(Value))
|
getCondition = Method(ptr(Value))
|
||||||
setCondition = Method(Void, ptr(Value))
|
setCondition = Method(Void, ptr(Value))
|
||||||
getDefaultDest = Method(ptr(BasicBlock))
|
getDefaultDest = Method(ptr(BasicBlock))
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,4 @@ class NamedMDNode:
|
||||||
from llvmpy import extra
|
from llvmpy import extra
|
||||||
os = extra.make_raw_ostream_for_printing()
|
os = extra.make_raw_ostream_for_printing()
|
||||||
self.print_(os, None)
|
self.print_(os, None)
|
||||||
return os.str()
|
return os.str()
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@ class PassRegistry:
|
||||||
|
|
||||||
# This is a custom method that wraps enumerateWith
|
# This is a custom method that wraps enumerateWith
|
||||||
# Returns list of tuples of (pass-arg, pass-name)
|
# Returns list of tuples of (pass-arg, pass-name)
|
||||||
enumerate = CustomMethod('PassRegistry_enumerate', PyObjectPtr)
|
enumerate = CustomMethod('PassRegistry_enumerate', PyObjectPtr)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ LibFunc.Enum('Func', '''
|
||||||
ZdaPv, ZdlPv, Znaj, ZnajRKSt9nothrow_t,
|
ZdaPv, ZdlPv, Znaj, ZnajRKSt9nothrow_t,
|
||||||
Znam, ZnamRKSt9nothrow_t, Znwj, ZnwjRKSt9nothrow_t,
|
Znam, ZnamRKSt9nothrow_t, Znwj, ZnwjRKSt9nothrow_t,
|
||||||
Znwm, ZnwmRKSt9nothrow_t, cxa_atexit, cxa_guard_abort,
|
Znwm, ZnwmRKSt9nothrow_t, cxa_atexit, cxa_guard_abort,
|
||||||
cxa_guard_acquire, cxa_guard_release, memcpy_chk,
|
cxa_guard_acquire, cxa_guard_release, memcpy_chk,
|
||||||
acos, acosf, acosh, acoshf,
|
acos, acosf, acosh, acoshf,
|
||||||
acoshl, acosl, asin, asinf,
|
acoshl, acosl, asin, asinf,
|
||||||
asinh, asinhf, asinhl, asinl,
|
asinh, asinhf, asinhl, asinl,
|
||||||
|
|
@ -38,17 +38,17 @@ LibFunc.Enum('Func', '''
|
||||||
powl, putchar, puts,
|
powl, putchar, puts,
|
||||||
realloc, reallocf, rint, rintf,
|
realloc, reallocf, rint, rintf,
|
||||||
rintl, round, roundf, roundl,
|
rintl, round, roundf, roundl,
|
||||||
sin, sinf, sinh, sinhf,
|
sin, sinf, sinh, sinhf,
|
||||||
sinhl, sinl, siprintf,
|
sinhl, sinl, siprintf,
|
||||||
sqrt, sqrtf, sqrtl, stpcpy,
|
sqrt, sqrtf, sqrtl, stpcpy,
|
||||||
strcat, strchr, strcmp, strcpy,
|
strcat, strchr, strcmp, strcpy,
|
||||||
strcspn, strdup, strlen, strncat,
|
strcspn, strdup, strlen, strncat,
|
||||||
strncmp, strncpy, strndup, strnlen,
|
strncmp, strncpy, strndup, strnlen,
|
||||||
strpbrk, strrchr, strspn, strstr,
|
strpbrk, strrchr, strspn, strstr,
|
||||||
strtod, strtof, strtol, strtold,
|
strtod, strtof, strtol, strtold,
|
||||||
strtoll, strtoul, strtoull, tan,
|
strtoll, strtoul, strtoull, tan,
|
||||||
tanf, tanh, tanhf, tanhl,
|
tanf, tanh, tanhf, tanhl,
|
||||||
tanl, trunc, truncf,
|
tanl, trunc, truncf,
|
||||||
truncl, valloc, NumLibFuncs''')
|
truncl, valloc, NumLibFuncs''')
|
||||||
# not in llvm-3.2 abs, ffs, ffsl, ffsll, fprintf, isascii,
|
# not in llvm-3.2 abs, ffs, ffsl, ffsll, fprintf, isascii,
|
||||||
# isdigit, labs, llabs, printf, sprintf, toascii
|
# isdigit, labs, llabs, printf, sprintf, toascii
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from src.Pass import Pass
|
||||||
@PassManagerBuilder
|
@PassManagerBuilder
|
||||||
class PassManagerBuilder:
|
class PassManagerBuilder:
|
||||||
_include_ = 'llvm/Transforms/IPO/PassManagerBuilder.h'
|
_include_ = 'llvm/Transforms/IPO/PassManagerBuilder.h'
|
||||||
|
|
||||||
new = Constructor()
|
new = Constructor()
|
||||||
delete = Destructor()
|
delete = Destructor()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ class StructType:
|
||||||
).require_only(1)
|
).require_only(1)
|
||||||
getNumElements = Method(cast(Unsigned, int))
|
getNumElements = Method(cast(Unsigned, int))
|
||||||
getElementType = Method(ptr(Type), cast(int, Unsigned))
|
getElementType = Method(ptr(Type), cast(int, Unsigned))
|
||||||
|
|
||||||
create = StaticMethod(ptr(StructType),
|
create = StaticMethod(ptr(StructType),
|
||||||
ref(LLVMContext),
|
ref(LLVMContext),
|
||||||
cast(str, StringRef),
|
cast(str, StringRef),
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,10 @@ class Value:
|
||||||
ValueTy = Enum('''
|
ValueTy = Enum('''
|
||||||
ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
|
ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
|
||||||
GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
|
GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
|
||||||
ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal,
|
ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal,
|
||||||
ConstantIntVal, ConstantFPVal, ConstantArrayVal, ConstantStructVal,
|
ConstantIntVal, ConstantFPVal, ConstantArrayVal, ConstantStructVal,
|
||||||
ConstantVectorVal, ConstantPointerNullVal, MDNodeVal, MDStringVal,
|
ConstantVectorVal, ConstantPointerNullVal, MDNodeVal, MDStringVal,
|
||||||
InlineAsmVal, PseudoSourceValueVal, FixedStackPseudoSourceValueVal,
|
InlineAsmVal, PseudoSourceValueVal, FixedStackPseudoSourceValueVal,
|
||||||
InstructionVal, ConstantFirstVal, ConstantLastVal
|
InstructionVal, ConstantFirstVal, ConstantLastVal
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ def test_basic_jit_use():
|
||||||
fpm.doInitialization()
|
fpm.doInitialization()
|
||||||
fpm.run(fn)
|
fpm.run(fn)
|
||||||
fpm.doFinalization()
|
fpm.doFinalization()
|
||||||
|
|
||||||
pm.run(m)
|
pm.run(m)
|
||||||
|
|
||||||
print(m)
|
print(m)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue