fix spaces redundant trailing spaces and missing line break at EOF
This commit is contained in:
parent
72192c7e6a
commit
6e55bfc406
19 changed files with 594 additions and 594 deletions
|
|
@ -211,7 +211,7 @@ class CCEnum(Enum):
|
|||
CC_X86_THISCALL = ID.X86_ThisCall
|
||||
CC_PTX_KERNEL = ID.PTX_Kernel
|
||||
CC_PTX_DEVICE = ID.PTX_Device
|
||||
|
||||
|
||||
if llvm.version <= (3, 3):
|
||||
CC_MBLAZE_INTR = ID.MBLAZE_INTR
|
||||
CC_MBLAZE_SVOL = ID.MBLAZE_SVOL
|
||||
|
|
@ -221,7 +221,7 @@ CCEnum.declare()
|
|||
# int predicates
|
||||
class ICMPEnum(Enum):
|
||||
prefix = 'ICMP_'
|
||||
|
||||
|
||||
Predicate = api.llvm.CmpInst.Predicate
|
||||
|
||||
ICMP_EQ = Predicate.ICMP_EQ
|
||||
|
|
@ -953,7 +953,7 @@ class StructType(Type):
|
|||
def _get_name(self):
|
||||
if self._ptr.isLiteral():
|
||||
return ""
|
||||
else:
|
||||
else:
|
||||
return self._ptr.getName()
|
||||
|
||||
name = property(_get_name, _set_name)
|
||||
|
|
@ -1454,7 +1454,7 @@ class Argument(Value):
|
|||
attrbldr.addAttribute(attr)
|
||||
attrs = api.llvm.AttributeSet.get(context, 0, attrbldr)
|
||||
self._ptr.addAttr(attrs)
|
||||
|
||||
|
||||
if attr not in self:
|
||||
raise ValueError("Attribute %r is not valid for arg %s" %
|
||||
(attr, self))
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ def _replace_with(builder, inst, func):
|
|||
|
||||
def load(arch):
|
||||
'''Load the LLRT module corresponding to the given architecture
|
||||
Creates a new module and optimizes it using the information from
|
||||
Creates a new module and optimizes it using the information from
|
||||
the host machine.
|
||||
'''
|
||||
if arch != 'x86_64':
|
||||
|
|
|
|||
|
|
@ -191,12 +191,12 @@ class Disassembler(object):
|
|||
where the instruction bytes are from (not an offset into
|
||||
@bs). yields instructions in the form of (addr, data, inst) where
|
||||
addr is an integer, data is a tuple of integers and inst is an instance of
|
||||
llvm.mc.Instr. @align specifies the byte alignment of instructions and
|
||||
llvm.mc.Instr. @align specifies the byte alignment of instructions and
|
||||
is only used if an un-decodable instruction is encountered, in which
|
||||
case the disassembler will skip the following bytes until the next
|
||||
aligned address. if @align is unspecified, the default alignment
|
||||
for the architecture will be used, however this may not be ideal
|
||||
for disassembly. for example, the default alignment for ARM is 1, but you
|
||||
for disassembly. for example, the default alignment for ARM is 1, but you
|
||||
probably want it to be 4 for the purposes of disassembling ARM
|
||||
instructions.
|
||||
'''
|
||||
|
|
@ -223,7 +223,7 @@ class Disassembler(object):
|
|||
if amt_left >= size:
|
||||
data = code.readBytes(addr, size)
|
||||
elif amt_left < 1:
|
||||
break
|
||||
break
|
||||
else:
|
||||
data = code.readBytes(addr, amt_left)
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class TargetMachine(llvm.Wrapper):
|
|||
@property
|
||||
def feature_string(self):
|
||||
return self._ptr.getTargetFeatureString()
|
||||
|
||||
|
||||
@property
|
||||
def target(self):
|
||||
return self._ptr.getTarget()
|
||||
|
|
|
|||
|
|
@ -1469,7 +1469,7 @@ class TestArith(TestCase):
|
|||
cty = maptypes[ty]
|
||||
prototype = CFUNCTYPE(*[cty] * 3)
|
||||
callee = prototype(ptr)
|
||||
callee(12, 23)
|
||||
callee(12, 23)
|
||||
|
||||
def template(self, iop, fop):
|
||||
inttys = [Type.int(32), Type.int(64)]
|
||||
|
|
@ -1487,7 +1487,7 @@ class TestArith(TestCase):
|
|||
|
||||
def test_sub(self):
|
||||
self.template('sub', 'fsub')
|
||||
|
||||
|
||||
def test_mul(self):
|
||||
self.template('mul', 'fmul')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# This should be moved to llvmpy
|
||||
#
|
||||
#
|
||||
# There are different array kinds parameterized by eltype and nd
|
||||
#
|
||||
# Contiguous or Fortran
|
||||
#
|
||||
# Contiguous or Fortran
|
||||
# struct {
|
||||
# eltype *data;
|
||||
# intp shape[nd];
|
||||
# intp shape[nd];
|
||||
# } contiguous_array(eltype, nd)
|
||||
#
|
||||
# struct {
|
||||
# eltype *data;
|
||||
# diminfo shape[nd];
|
||||
# } strided_array(eltype, nd)
|
||||
#
|
||||
#
|
||||
# struct {
|
||||
# eltype *data;
|
||||
# intp shape[nd];
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
# int32 nd;
|
||||
# diminfo shape[nd];
|
||||
# } strided_array_nd(eltype)
|
||||
#
|
||||
#
|
||||
#
|
||||
# Backward compatible but deprecated:
|
||||
# struct {
|
||||
|
|
@ -50,25 +50,25 @@
|
|||
# intp stride[nd];
|
||||
# } strided_soa_array_nd(eltype)
|
||||
#
|
||||
#
|
||||
#
|
||||
# The most general (where the kind of array is stored as well as number
|
||||
# of dimensions)
|
||||
# Rarely needed.
|
||||
#
|
||||
#
|
||||
# struct {
|
||||
# eltype *data;
|
||||
# int16 nd;
|
||||
# int16 dimkind;
|
||||
# ???
|
||||
# } array_nd(eltype)
|
||||
#
|
||||
#
|
||||
# where ??? is run-time interpreted based on the dimkind to either:
|
||||
# intp shape[nd]; for dimkind = C_CONTIGUOUS or F_CONTIGUOUS
|
||||
#
|
||||
# diminfo shape[nd]; for dimkind = STRIDED
|
||||
#
|
||||
# intp shape[ind];
|
||||
# intp strides[ind]; dimkind = STRIDED_SOA
|
||||
# intp strides[ind]; dimkind = STRIDED_SOA
|
||||
#
|
||||
|
||||
import llvm.core as lc
|
||||
|
|
@ -95,7 +95,7 @@ STRIDED_DK = STRIDED + HAS_DIMKIND
|
|||
STRIDED_SOA_DK = STRIDED_SOA + HAS_DIMKIND
|
||||
|
||||
array_kinds = (C_CONTIGUOUS, F_CONTIGUOUS, STRIDED, STRIDED_SOA,
|
||||
C_CONTIGUOUS_ND, F_CONTIGUOUS_ND, STRIDED_ND, STRIDED_SOA_DK,
|
||||
C_CONTIGUOUS_ND, F_CONTIGUOUS_ND, STRIDED_ND, STRIDED_SOA_DK,
|
||||
C_CONTIGUOUS_DK, F_CONTIGUOUS_DK, STRIDED_DK, STRIDED_SOA_DK)
|
||||
|
||||
_invmap = {}
|
||||
|
|
@ -105,7 +105,7 @@ def kind_to_str(kind):
|
|||
if not _invmap:
|
||||
for key, value in globals().items():
|
||||
if isinstance(value, int) and value in array_kinds:
|
||||
_invmap[value] = key
|
||||
_invmap[value] = key
|
||||
return _invmap[kind]
|
||||
|
||||
def str_to_kind(str):
|
||||
|
|
@ -157,7 +157,7 @@ def array_type(nd, kind, el_type=char_type):
|
|||
terms.append(Type.array(intp_type, nd)) # shape
|
||||
elif base == STRIDED:
|
||||
terms.append(Type.array(diminfo_type, nd)) # diminfo
|
||||
elif base == STRIDED_SOA:
|
||||
elif base == STRIDED_SOA:
|
||||
terms.extend([Type.array(intp_type, nd), # shape
|
||||
Type.array(intp_type, nd)]) # strides
|
||||
|
||||
|
|
@ -184,8 +184,8 @@ def _raw_check_array(arrtyp):
|
|||
a0 = arrtyp.elements[0]
|
||||
a1 = arrtyp.elements[1]
|
||||
if not isinstance(a0, lc.PointerType) or \
|
||||
not (isinstance(a1, lc.ArrayType) or
|
||||
(a1 == int32_type) or (a1 == int16_type)):
|
||||
not (isinstance(a1, lc.ArrayType) or
|
||||
(a1 == int32_type) or (a1 == int16_type)):
|
||||
return None
|
||||
|
||||
data_type = a0.pointee
|
||||
|
|
@ -214,7 +214,7 @@ def _raw_check_array(arrtyp):
|
|||
c_contiguous = C_CONTIGUOUS_DK
|
||||
f_contiguous = F_CONTIGUOUS_DK
|
||||
else:
|
||||
num = 1
|
||||
num = 1
|
||||
strided = STRIDED
|
||||
strided_soa = STRIDED_SOA
|
||||
c_contiguous = C_CONTIGUOUS
|
||||
|
|
@ -254,4 +254,4 @@ def test():
|
|||
assert check_array(arr) == (STRIDED_SOA, 3, char_type)
|
||||
|
||||
if __name__ == '__main__':
|
||||
test()
|
||||
test()
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ if LLVM_VERSION >= (3, 3):
|
|||
@Attribute
|
||||
class Attribute:
|
||||
AttrKind = Enum('''None, Alignment, AlwaysInline,
|
||||
ByVal, InlineHint, InReg,
|
||||
MinSize, Naked, Nest, NoAlias,
|
||||
NoBuiltin, NoCapture, NoDuplicate, NoImplicitFloat,
|
||||
NoInline, NonLazyBind, NoRedZone, NoReturn,
|
||||
NoUnwind, OptimizeForSize, ReadNone, ReadOnly,
|
||||
Returned, ReturnsTwice, SExt, StackAlignment,
|
||||
StackProtect, StackProtectReq, StackProtectStrong, StructRet,
|
||||
SanitizeAddress, SanitizeThread, SanitizeMemory, UWTable,
|
||||
ByVal, InlineHint, InReg,
|
||||
MinSize, Naked, Nest, NoAlias,
|
||||
NoBuiltin, NoCapture, NoDuplicate, NoImplicitFloat,
|
||||
NoInline, NonLazyBind, NoRedZone, NoReturn,
|
||||
NoUnwind, OptimizeForSize, ReadNone, ReadOnly,
|
||||
Returned, ReturnsTwice, SExt, StackAlignment,
|
||||
StackProtect, StackProtectReq, StackProtectStrong, StructRet,
|
||||
SanitizeAddress, SanitizeThread, SanitizeMemory, UWTable,
|
||||
ZExt, EndAttrKinds''')
|
||||
|
||||
delete = Destructor()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ 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,
|
||||
PTX_Kernel, PTX_Device,
|
||||
'''
|
||||
|
||||
if LLVM_VERSION <= (3, 3):
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class DIBuilder:
|
|||
)
|
||||
else:
|
||||
createNullPtrType = Method(DIBasicType)
|
||||
|
||||
|
||||
|
||||
createBasicType = Method(DIType,
|
||||
stringref_arg, # Name
|
||||
|
|
@ -204,7 +204,7 @@ class DIBuilder:
|
|||
createObjectPointerType = Method(DIType,
|
||||
ref(DIType), # Ty
|
||||
)
|
||||
|
||||
|
||||
#createTemporaryType = Method(DIType, ref(DIFile)).require_only(0)
|
||||
|
||||
createForwardDecl = Method(DIType,
|
||||
|
|
@ -250,7 +250,7 @@ class DIBuilder:
|
|||
bool_arg, # isLocalToUnit
|
||||
ptr(Value), # Val
|
||||
)
|
||||
|
||||
|
||||
createLocalVariable = Method(DIVariable,
|
||||
unsigned_arg, # Tag,
|
||||
ref(DIDescriptor), # Scope,
|
||||
|
|
@ -273,7 +273,7 @@ class DIBuilder:
|
|||
ref(SmallVector_Value), # Addr,
|
||||
unsigned_arg, # ArgNo=0,
|
||||
).require_only(7)
|
||||
|
||||
|
||||
createFunction = Method(DISubprogram,
|
||||
ref(DIDescriptor), # Scope
|
||||
stringref_arg, # Name
|
||||
|
|
@ -318,7 +318,7 @@ class DIBuilder:
|
|||
unsigned_arg, # LineNo
|
||||
)
|
||||
|
||||
createLexicalBlockFile = Method(DILexicalBlockFile,
|
||||
createLexicalBlockFile = Method(DILexicalBlockFile,
|
||||
ref(DIDescriptor), # Scope,
|
||||
ref(DIFile), # File
|
||||
)
|
||||
|
|
@ -329,7 +329,7 @@ class DIBuilder:
|
|||
unsigned_arg, # Line,
|
||||
unsigned_arg, # Col
|
||||
)
|
||||
|
||||
|
||||
_insertDeclare_1 = Method(ptr(Instruction),
|
||||
ptr(Value), # Storage,
|
||||
ref(DIVariable), # VarInfo
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Function:
|
|||
_include_ = 'llvm/IR/Function.h'
|
||||
else:
|
||||
_include_ = 'llvm/Function.h'
|
||||
|
||||
|
||||
_downcast_ = GlobalValue, Constant, Value
|
||||
|
||||
getReturnType = Method(ptr(Type))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#this file is not processed unless the llvm library is
|
||||
#this file is not processed unless the llvm library is
|
||||
#version 3.4 or higher. see llvmpy/__init__.py for details.
|
||||
from binding import *
|
||||
from ..namespace import llvm
|
||||
|
|
@ -73,7 +73,7 @@ class MCOperand:
|
|||
getImm = Method(cast(Int64, int))
|
||||
getFPImm = Method(cast(Double, float))
|
||||
getExpr = Method(const(ownedptr(MCExpr)))
|
||||
|
||||
|
||||
@MCInst
|
||||
class MCInst:
|
||||
_include_ = "llvm/MC/MCInst.h"
|
||||
|
|
@ -148,7 +148,7 @@ class MCDisassembler:
|
|||
|
||||
DecodeStatus = Enum('Fail', 'SoftFail', 'Success')
|
||||
|
||||
getInstruction = CustomMethod('MCDisassembler_getInstruction',
|
||||
getInstruction = CustomMethod('MCDisassembler_getInstruction',
|
||||
PyObjectPtr,
|
||||
ref(MCInst),
|
||||
ref(MemoryObject),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -17,7 +17,7 @@ if LLVM_VERSION >= (3, 3):
|
|||
cast(Bool, bool))
|
||||
|
||||
else:
|
||||
|
||||
|
||||
isLittleEndianHost = sys.Function('isLittleEndianHost',
|
||||
cast(Bool, bool))
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ if LLVM_VERSION >= (3, 4):
|
|||
readBytes = CustomMethod('MemoryObject_readBytes',
|
||||
PyObjectPtr,
|
||||
cast(int, Uint64), #address
|
||||
cast(int, Uint64) #size
|
||||
cast(int, Uint64) #size
|
||||
)
|
||||
@CustomPythonMethod
|
||||
def readAll(self):
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Target:
|
|||
cast(str, StringRef), #cpu
|
||||
cast(str, StringRef) #features
|
||||
)
|
||||
|
||||
|
||||
createMCDisassembler = Method(ptr(MCDisassembler), ref(MCSubtargetInfo))
|
||||
|
||||
createMCRegInfo = Method(ptr(MCRegisterInfo),
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ SplitBlockAndInsertIfThen = llvm.Function('SplitBlockAndInsertIfThen',
|
|||
ReplaceInstWithInst = llvm.Function('ReplaceInstWithInst',
|
||||
Void,
|
||||
ptr(Instruction), # from
|
||||
ptr(Instruction)) # to
|
||||
ptr(Instruction)) # to
|
||||
|
|
|
|||
|
|
@ -35,4 +35,4 @@ def main():
|
|||
|
||||
return 0
|
||||
|
||||
exit(main())
|
||||
exit(main())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from llvmpy.api import llvm;
|
||||
from llvmpy.api import llvm;
|
||||
llvm.InitializeAllTargets()
|
||||
llvm.InitializeAllTargetInfos()
|
||||
llvm.InitializeAllTargetMCs()
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ def do_function():
|
|||
f.add_attribute(ATTR_NO_RETURN)
|
||||
f.add_attribute(ATTR_ALWAYS_INLINE)
|
||||
#for some reason removeFnAttr is just gone in 3.3
|
||||
if version <= (3, 2):
|
||||
if version <= (3, 2):
|
||||
f.remove_attribute(ATTR_NO_RETURN)
|
||||
|
||||
# LLVM misbehaves:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue