This commit is contained in:
Ilan Schnell 2013-01-31 17:54:20 -06:00
commit 5dd0948c65
13 changed files with 24 additions and 24 deletions

View file

@ -86,7 +86,7 @@ if __name__ == '__main__':
tag = sh2('git describe --exact-match') tag = sh2('git describe --exact-match')
except CalledProcessError: except CalledProcessError:
tag = "dev" # Fallback tag = "dev" # Fallback
startdir = os.getcwdu() startdir = os.getcwdu()
if not os.path.exists(pages_dir): if not os.path.exists(pages_dir):
# init the repo # init the repo

View file

@ -16,7 +16,7 @@ from pyaddfunc import pyaddfunc
LLVM_TO_INT_PARSE_STR_MAP = { LLVM_TO_INT_PARSE_STR_MAP = {
8 : 'b', 8 : 'b',
16 : 'h', 16 : 'h',
32 : 'i', # Note that on 32-bit systems sizeof(int) == sizeof(long) 32 : 'i', # Note that on 32-bit systems sizeof(int) == sizeof(long)
64 : 'L', # Seeing sizeof(long long) == 8 on both 32 and 64-bit platforms 64 : 'L', # Seeing sizeof(long long) == 8 on both 32 and 64-bit platforms
} }

View file

@ -63,7 +63,7 @@ Shell32
print('-lLLVMNVPTXCodeGen') print('-lLLVMNVPTXCodeGen')
print('-lLLVMNVPTXDesc') print('-lLLVMNVPTXDesc')
print('-lLLVMNVPTXInfo') print('-lLLVMNVPTXInfo')
elif sys.argv[1] == '--includedir': elif sys.argv[1] == '--includedir':
llvmbin = find_path_of('llvm-tblgen.exe') llvmbin = find_path_of('llvm-tblgen.exe')
if llvmbin is None: if llvmbin is None:
raise RuntimeError('Could not find LLVM') raise RuntimeError('Could not find LLVM')
@ -71,7 +71,7 @@ elif sys.argv[1] == '--includedir':
if not os.path.exists(os.path.join(incdir, 'llvm/BasicBlock.h')): if not os.path.exists(os.path.join(incdir, 'llvm/BasicBlock.h')):
raise RuntimeError('Could not find LLVM include dir') raise RuntimeError('Could not find LLVM include dir')
print incdir print incdir
elif sys.argv[1] == '--libdir': elif sys.argv[1] == '--libdir':
llvmbin = find_path_of('llvm-tblgen.exe') llvmbin = find_path_of('llvm-tblgen.exe')
if llvmbin is None: if llvmbin is None:
raise RuntimeError('Could not find LLVM') raise RuntimeError('Could not find LLVM')

View file

@ -156,7 +156,7 @@ class PassManager(object):
def add(self, pass_obj): def add(self, pass_obj):
'''Add a pass to the pass manager. '''Add a pass to the pass manager.
pass_obj --- Either a Pass instance, a string name of a pass pass_obj --- Either a Pass instance, a string name of a pass
''' '''
if isinstance(pass_obj, Pass): if isinstance(pass_obj, Pass):
@ -340,7 +340,7 @@ def build_pass_managers(tm, opt=2, loop_vectorize=False, vectorize=False,
inline_threshold=2000, pm=True, fpm=True, mod=None): inline_threshold=2000, pm=True, fpm=True, mod=None):
''' '''
tm --- The TargetMachine for which the passes are optimizing for. tm --- The TargetMachine for which the passes are optimizing for.
The TargetMachine must stay alive until the pass managers The TargetMachine must stay alive until the pass managers
are removed. are removed.
opt --- [0-3] Optimization level. Default to 2. opt --- [0-3] Optimization level. Default to 2.
loop_vectorize --- [boolean] Whether to use loop-vectorizer. loop_vectorize --- [boolean] Whether to use loop-vectorizer.

View file

@ -2,11 +2,11 @@ from llvm.core import *
class TBAABuilder(object): class TBAABuilder(object):
'''Simplify creation of TBAA metadata. '''Simplify creation of TBAA metadata.
Each TBAABuidler object operates on a module. Each TBAABuidler object operates on a module.
User can create multiple TBAABuilder on a module User can create multiple TBAABuilder on a module
''' '''
def __init__(self, module, rootid): def __init__(self, module, rootid):
''' '''
module --- the module to use. module --- the module to use.
@ -23,7 +23,7 @@ class TBAABuilder(object):
def get_node(self, name, parent=None, const=False): def get_node(self, name, parent=None, const=False):
'''Returns a MetaData object representing a TBAA node. '''Returns a MetaData object representing a TBAA node.
Use loadstore_instruction.set_metadata('tbaa', node) to Use loadstore_instruction.set_metadata('tbaa', node) to
bind a type to a memory. bind a type to a memory.
''' '''
parent = parent or self.root parent = parent or self.root

View file

@ -454,7 +454,7 @@ class TestEngineBuilder(TestCase):
with self.assertRaises(llvm.LLVMException): with self.assertRaises(llvm.LLVMException):
# Ensure the targetmachine is owned. # Ensure the targetmachine is owned.
llvm._util.check_is_unowned(tm) llvm._util.check_is_unowned(tm)
with self.assertRaises(llvm.LLVMException): with self.assertRaises(llvm.LLVMException):
# Ensure the module is owned. # Ensure the module is owned.
@ -932,7 +932,7 @@ class TestCPUSupport(TestCase):
arg = le.GenericValue.real(Type.double(), 1.234) arg = le.GenericValue.real(Type.double(), 1.234)
retval = ee.run_function(func, [arg]) retval = ee.run_function(func, [arg])
golden = math.sin(1.234) golden = math.sin(1.234)
answer = retval.as_real(Type.double()) answer = retval.as_real(Type.double())
self.assertTrue(abs(answer-golden)/golden < 1e-5) self.assertTrue(abs(answer-golden)/golden < 1e-5)

View file

@ -18,7 +18,7 @@ def run_llvm_config(args):
if run_llvm_config(['--version']) == '': if run_llvm_config(['--version']) == '':
sys.exit("Cannot invoke llvm-config.\n" sys.exit("Cannot invoke llvm-config.\n"
"Try setting LLVM_CONFIG_PATH=/path/to/llvm-config") "Try setting LLVM_CONFIG_PATH=/path/to/llvm-config")
def get_libs_and_objs(components): def get_libs_and_objs(components):
parts = run_llvm_config(['--libs'] + components).split() parts = run_llvm_config(['--libs'] + components).split()

View file

@ -41,4 +41,4 @@ void ex7(int *A, int *B, int n, int k) {
void ex8(int *A, char *B, int n, int k) { void ex8(int *A, char *B, int n, int k) {
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
A[i] += 4 * B[i]; A[i] += 4 * B[i];
} }

View file

@ -40,4 +40,4 @@ class TestLoopVectorizer(TestCase):
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View file

@ -130,4 +130,4 @@ if __name__ == '__main__':
# TestDebugInfo("test_debug_info_compile_unit").debug() # TestDebugInfo("test_debug_info_compile_unit").debug()
# tester = TestDebugInfo("test_debug_info_compile_unit") # tester = TestDebugInfo("test_debug_info_compile_unit")
# debug_in_gdb(tester.test_debug_info_compile_unit()) # debug_in_gdb(tester.test_debug_info_compile_unit())
unittest.main() unittest.main()

View file

@ -139,7 +139,7 @@ def get_opts():
usage = "usage: %prog [options] srcdir destdir" usage = "usage: %prog [options] srcdir destdir"
p = OptionParser(usage=usage) p = OptionParser(usage=usage)
p.add_option("-f", "--force", action="store_true", dest="force", default=False, p.add_option("-f", "--force", action="store_true", dest="force", default=False,
help="ignore timestamps and force build of all files") help="ignore timestamps and force build of all files")
p.add_option("-v", "--verbose", action="count", dest="verbose", default=0, p.add_option("-v", "--verbose", action="count", dest="verbose", default=0,
help="be chatty (use more v's to be more friendly)") help="be chatty (use more v's to be more friendly)")

View file

@ -1,12 +1,12 @@
License License
======= =======
llvm-py is distributed under the llvm-py is distributed under the
http://www.opensource.org/licenses/bsd-license.php[new BSD license]. http://www.opensource.org/licenses/bsd-license.php[new BSD license].
This is similar to LLVM's license. You should be able to use llvm-py This is similar to LLVM's license. You should be able to use llvm-py
where-ever and how-ever you're able to use LLVM itself. where-ever and how-ever you're able to use LLVM itself.
The license text is present in the The license text is present in the
http://code.google.com/p/llvm-py/source/browse/trunk/LICENSE[LICENSE] http://code.google.com/p/llvm-py/source/browse/trunk/LICENSE[LICENSE]
file in the distribution, and is reproduced here: file in the distribution, and is reproduced here:

View file

@ -35,7 +35,7 @@ information is available link:license.html[here].
.Platforms .Platforms
llvm-py has been built/tested/reported to work on various GNU/Linux llvm-py has been built/tested/reported to work on various GNU/Linux
flavours, *BSD, Mac OS X; on i386 and amd64 architectures. Windows is not flavours, *BSD, Mac OS X; on i386 and amd64 architectures. Windows is not
supported, for a variety of reasons. supported, for a variety of reasons.
.Versions .Versions
llvm-py 0.6 requires verion 2.7 of LLVM. It will not work with previous llvm-py 0.6 requires verion 2.7 of LLVM. It will not work with previous
@ -433,7 +433,7 @@ Here is a quick overview of the contents of each package:
sizes and alignment of primitive types, endinanness etc) sizes and alignment of primitive types, endinanness etc)
.llvm.passes .llvm.passes
- PassManager -- represents an LLVM pass manager - PassManager -- represents an LLVM pass manager
- FunctionPassManager -- represents an LLVM function pass manager - FunctionPassManager -- represents an LLVM function pass manager
- constants +PASS_*+ that represent various passes - constants +PASS_*+ that represent various passes
@ -1007,7 +1007,7 @@ The `Function` object represents an instance of a function type.
Such objects contain `Argument` objects, which represent the actual, Such objects contain `Argument` objects, which represent the actual,
local-variable-like arguments of the function (not to be confused with local-variable-like arguments of the function (not to be confused with
the arguments returned by a function _type_ object -- these represent the arguments returned by a function _type_ object -- these represent
the _type_ of the arguments). the _type_ of the arguments).
The various `Instruction`-s are created by the `Builder` class. Most The various `Instruction`-s are created by the `Builder` class. Most
instructions are represented by `Instruction` itself, but there are instructions are represented by `Instruction` itself, but there are
@ -1260,7 +1260,7 @@ Global Value (llvm.core)
The class `llvm.core.GlobalValue` represents module-scope aliases, variables The class `llvm.core.GlobalValue` represents module-scope aliases, variables
and functions. Global variables are represented by the sub-class and functions. Global variables are represented by the sub-class
`llvm.core.GlobalVariable` and functions by `llvm.core.Function`. `llvm.core.GlobalVariable` and functions by `llvm.core.Function`.
Global values have the read-write properties `linkage`, `section`, Global values have the read-write properties `linkage`, `section`,
`visibility` and `alignment`. Use one of the following constants (from `visibility` and `alignment`. Use one of the following constants (from
@ -1841,7 +1841,7 @@ The `llvm.core.PHINode` is a subclass of
created (using `Builder.phi`) the phi node contains no incoming created (using `Builder.phi`) the phi node contains no incoming
blocks (nor their corresponding values). To add an incoming arc to blocks (nor their corresponding values). To add an incoming arc to
the phi node, use the `add_incoming` method, which takes a source the phi node, use the `add_incoming` method, which takes a source
block (`llvm.core.BasicBlock` object) and a value (object of block (`llvm.core.BasicBlock` object) and a value (object of
`llvm.core.Value` or of a class derived from it) that the phi node `llvm.core.Value` or of a class derived from it) that the phi node
will take on if control branches in from that block. will take on if control branches in from that block.