changes to make llvmpy compatible with development branch of llvm
mostly just removing stuff and changing function prototypes. with these changes, llvmpy compiles and llvm.test() passes.
This commit is contained in:
parent
0610a27535
commit
aa0ee9b6a6
8 changed files with 45 additions and 28 deletions
|
|
@ -211,8 +211,10 @@ class CCEnum(Enum):
|
|||
CC_X86_THISCALL = ID.X86_ThisCall
|
||||
CC_PTX_KERNEL = ID.PTX_Kernel
|
||||
CC_PTX_DEVICE = ID.PTX_Device
|
||||
CC_MBLAZE_INTR = ID.MBLAZE_INTR
|
||||
CC_MBLAZE_SVOL = ID.MBLAZE_SVOL
|
||||
|
||||
if llvm.version <= (3, 3):
|
||||
CC_MBLAZE_INTR = ID.MBLAZE_INTR
|
||||
CC_MBLAZE_SVOL = ID.MBLAZE_SVOL
|
||||
|
||||
CCEnum.declare()
|
||||
|
||||
|
|
|
|||
|
|
@ -120,13 +120,14 @@ class PassManagerBuilder(llvm.Wrapper):
|
|||
def disable_unroll_loops(self, disable):
|
||||
self._ptr.DisableUnrollLoops = disable
|
||||
|
||||
@property
|
||||
def disable_simplify_lib_calls(self):
|
||||
return self._ptr.DisableSimplifyLibCalls
|
||||
if llvm.version <= (3, 3):
|
||||
@property
|
||||
def disable_simplify_lib_calls(self):
|
||||
return self._ptr.DisableSimplifyLibCalls
|
||||
|
||||
@disable_simplify_lib_calls.setter
|
||||
def disable_simplify_lib_calls(self, disable):
|
||||
self._ptr.DisableSimplifyLibCalls = disable
|
||||
@disable_simplify_lib_calls.setter
|
||||
def disable_simplify_lib_calls(self, disable):
|
||||
self._ptr.DisableSimplifyLibCalls = disable
|
||||
|
||||
def use_inliner_with_threshold(self, threshold):
|
||||
self._ptr.Inliner = api.llvm.createFunctionInliningPass(threshold)
|
||||
|
|
|
|||
|
|
@ -393,7 +393,8 @@ entry:
|
|||
# make sure the default is False
|
||||
self.assertFalse(pmb.disable_unit_at_a_time)
|
||||
self.assertFalse(pmb.disable_unroll_loops)
|
||||
self.assertFalse(pmb.disable_simplify_lib_calls)
|
||||
if llvm.version <= (3, 3):
|
||||
self.assertFalse(pmb.disable_simplify_lib_calls)
|
||||
|
||||
pmb.disable_unit_at_a_time = True
|
||||
self.assertTrue(pmb.disable_unit_at_a_time)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
from binding import *
|
||||
from .namespace import llvm
|
||||
|
||||
ccs = '''
|
||||
C, Fast, Cold, GHC, FirstTargetCC, X86_StdCall, X86_FastCall,
|
||||
ARM_APCS, ARM_AAPCS, ARM_AAPCS_VFP, MSP430_INTR, X86_ThisCall,
|
||||
PTX_Kernel, PTX_Device,
|
||||
'''
|
||||
|
||||
if LLVM_VERSION <= (3, 3):
|
||||
ccs += "MBLAZE_INTR, MBLAZE_SVOL,"
|
||||
|
||||
ccs += 'SPIR_FUNC, SPIR_KERNEL, Intel_OCL_BI'
|
||||
|
||||
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,
|
||||
SPIR_KERNEL, Intel_OCL_BI
|
||||
''') # HiPE
|
||||
ID = CallingConv.Enum('ID', ccs) # HiPE
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ DIBuilder = llvm.Class()
|
|||
from .Module import Module
|
||||
from .Value import Value, MDNode, Function, BasicBlock
|
||||
from .Instruction import Instruction
|
||||
from .DebugInfo import DIFile, DIEnumerator, DIType, DIBasicType, DIDerivedType
|
||||
from .DebugInfo import DIFile, DIEnumerator, DIType, DIBasicType, DIDerivedType, DICompositeType
|
||||
from .DebugInfo import DIDescriptor, DIArray, DISubrange, DIGlobalVariable
|
||||
from .DebugInfo import DIVariable, DISubprogram, DINameSpace, DILexicalBlockFile
|
||||
from .DebugInfo import DILexicalBlock
|
||||
|
|
@ -25,7 +25,8 @@ class DIBuilder:
|
|||
new = Constructor(ref(Module))
|
||||
delete = Destructor()
|
||||
|
||||
getCU = Method(const(ptr(MDNode)))
|
||||
if LLVM_VERSION <= (3, 3):
|
||||
getCU = Method(const(ptr(MDNode)))
|
||||
finalize = Method()
|
||||
|
||||
createCompileUnit = Method(Void,
|
||||
|
|
@ -46,12 +47,16 @@ class DIBuilder:
|
|||
|
||||
createEnumerator = Method(DIEnumerator,
|
||||
stringref_arg, # Name
|
||||
uint64_arg, # Val
|
||||
uint64_arg if LLVM_VERSION <= (3, 3) else int64_arg, # Val
|
||||
)
|
||||
|
||||
createNullPtrType = Method(DIType,
|
||||
stringref_arg, # Name
|
||||
)
|
||||
if LLVM_VERSION <= (3, 3):
|
||||
createNullPtrType = Method(DIType,
|
||||
stringref_arg, # Name
|
||||
)
|
||||
else:
|
||||
createNullPtrType = Method(DIBasicType)
|
||||
|
||||
|
||||
createBasicType = Method(DIType,
|
||||
stringref_arg, # Name
|
||||
|
|
@ -85,7 +90,7 @@ class DIBuilder:
|
|||
ref(DIDescriptor), # Context
|
||||
)
|
||||
|
||||
createFriend = Method(DIType,
|
||||
createFriend = Method(DIType if LLVM_VERSION <= (3, 3) else DIDerivedType,
|
||||
ref(DIType), # Ty
|
||||
ref(DIType), # FriendTy
|
||||
)
|
||||
|
|
@ -169,7 +174,7 @@ class DIBuilder:
|
|||
ref(DIArray), # Subscripts
|
||||
)
|
||||
|
||||
createVectorType = Method(DIType,
|
||||
createVectorType = Method(DIType if LLVM_VERSION <= (3, 3) else DICompositeType,
|
||||
uint64_arg, # Size
|
||||
uint64_arg, # AlignInBits
|
||||
ref(DIType), # Ty
|
||||
|
|
@ -275,7 +280,7 @@ class DIBuilder:
|
|||
stringref_arg, # LinkageName
|
||||
ref(DIFile), # File
|
||||
unsigned_arg, # LineNo
|
||||
ref(DIType), # Ty
|
||||
ref(DIType if LLVM_VERSION <= (3, 3) else DICompositeType), # Ty
|
||||
bool_arg, # isLocalToUnit
|
||||
bool_arg, # isDefinition
|
||||
unsigned_arg, # ScopeLine
|
||||
|
|
@ -293,7 +298,7 @@ class DIBuilder:
|
|||
stringref_arg, # LinkageName
|
||||
ref(DIFile), # File
|
||||
unsigned_arg, # LineNo
|
||||
ref(DIType), # Ty
|
||||
ref(DIType if LLVM_VERSION <= (3, 3) else DICompositeType), # Ty
|
||||
bool_arg, # isLocalToUnit
|
||||
bool_arg, # isDefinition
|
||||
unsigned_arg, # Virtuality=0
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class DIFile:
|
|||
@DIEnumerator
|
||||
class DIEnumerator:
|
||||
getName = Method(return_stringref)
|
||||
getEnumValue = Method(cast(Uint64, int))
|
||||
getEnumValue = Method(cast(Uint64 if LLVM_VERSION <= (3, 3) else Int64, int))
|
||||
Verify = Method(return_bool)
|
||||
|
||||
@DIType
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ class PassManagerBuilder:
|
|||
return Attr(getter=cast(Bool, bool),
|
||||
setter=cast(bool, Bool))
|
||||
|
||||
DisableSimplifyLibCalls = _attr_bool()
|
||||
if LLVM_VERSION <= (3, 3):
|
||||
DisableSimplifyLibCalls = _attr_bool()
|
||||
|
||||
DisableUnitAtATime = _attr_bool()
|
||||
DisableUnrollLoops = _attr_bool()
|
||||
if LLVM_VERSION >= (3, 3):
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -63,7 +63,7 @@ def auto_intrinsic_gen(incdir):
|
|||
print("Generate intrinsic IDs")
|
||||
from tools import intrgen
|
||||
|
||||
if llvm_version.startswith('3.3'):
|
||||
if llvm_version.startswith('3.3') or llvm_version.startswith('3.4'):
|
||||
path = "%s/llvm/IR/Intrinsics.gen" % incdir
|
||||
else:
|
||||
path = "%s/llvm/Intrinsics.gen" % incdir
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue