Updating to python 3 with 2to3. Check llvm/py3k_update.diff and llvm/py3k_update.out for the output from this.

This commit is contained in:
AndrewBC 2011-06-11 20:39:16 -05:00
commit 6d50a337ad
29 changed files with 3455 additions and 143 deletions

View file

@ -28,9 +28,9 @@ class strstream(object):
def __init__(self): pass
def read(self): return test_module
m = Module.from_assembly(strstream())
print "-"*60
print m
print "-"*60
print("-"*60)
print(m)
print("-"*60)
test_func = m.get_function_named("test_func")
prod = m.get_function_named("prod")
@ -38,16 +38,16 @@ prod = m.get_function_named("prod")
#===----------------------------------------------------------------------===
# test operands
print
print()
i1 = test_func.basic_blocks[0].instructions[0]
i2 = test_func.basic_blocks[0].instructions[1]
print "Testing User.operand_count ..",
print("Testing User.operand_count ..", end=' ')
if i1.operand_count == 3 and i2.operand_count == 2:
print "OK"
print("OK")
else:
print "FAIL"
print("FAIL")
print "Testing User.operands ..",
print("Testing User.operands ..", end=' ')
c1 = i1.operands[0] is prod
c2 = i1.operands[1] is test_func.args[0]
c3 = i1.operands[2] is test_func.args[1]
@ -56,22 +56,22 @@ c5 = i2.operands[1] is test_func.args[2]
c6 = len(i1.operands) == 3
c7 = len(i2.operands) == 2
if c1 and c2 and c3 and c5 and c6 and c7:
print "OK"
print("OK")
else:
print "FAIL"
print
print("FAIL")
print()
#===----------------------------------------------------------------------===
# show test_function
print "Examining test_function `test_test_func':"
print("Examining test_function `test_test_func':")
idx = 1
for inst in test_func.basic_blocks[0].instructions:
print "Instruction #%d:" % (idx,)
print " operand_count =", inst.operand_count
print " operands:"
print("Instruction #%d:" % (idx,))
print(" operand_count =", inst.operand_count)
print(" operands:")
oidx = 1
for op in inst.operands:
print " %d: %s" % (oidx, repr(op))
print(" %d: %s" % (oidx, repr(op)))
oidx += 1
idx += 1