summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorMathieu Bridon <[email protected]>2018-07-05 15:17:32 +0200
committerDylan Baker <[email protected]>2018-07-06 10:04:22 -0700
commit0f7b18fa0d353aab0a44082b1aca8d8c00df71a7 (patch)
treee511fe8f70b48ad5203e3a0e52d0dc1b086bfd91 /src/compiler
parentb3a42fa0667caeeebabd9e6aeb46a9534810c2f3 (diff)
python: Use the print function
In Python 2, `print` was a statement, but it became a function in Python 3. Using print functions everywhere makes the script compatible with Python versions >= 2.6, including Python 3. Signed-off-by: Mathieu Bridon <[email protected]> Acked-by: Eric Engestrom <[email protected]> Acked-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_builder_opcodes_h.py3
-rw-r--r--src/compiler/nir/nir_constant_expressions.py5
-rw-r--r--src/compiler/nir/nir_opcodes_c.py4
-rw-r--r--src/compiler/nir/nir_opcodes_h.py3
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py12
5 files changed, 17 insertions, 10 deletions
diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py
index 4a41e6079ed..72cf5b4549d 100644
--- a/src/compiler/nir/nir_builder_opcodes_h.py
+++ b/src/compiler/nir/nir_builder_opcodes_h.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
template = """\
/* Copyright (C) 2015 Broadcom
@@ -68,4 +69,4 @@ from nir_opcodes import opcodes
from nir_intrinsics import INTR_OPCODES
from mako.template import Template
-print Template(template).render(opcodes=opcodes, INTR_OPCODES=INTR_OPCODES)
+print(Template(template).render(opcodes=opcodes, INTR_OPCODES=INTR_OPCODES))
diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py
index db5bde2b82d..35dffe70ce7 100644
--- a/src/compiler/nir/nir_constant_expressions.py
+++ b/src/compiler/nir/nir_constant_expressions.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import re
@@ -431,8 +432,8 @@ nir_eval_const_opcode(nir_op op, unsigned num_components,
from nir_opcodes import opcodes
from mako.template import Template
-print Template(template).render(opcodes=opcodes, type_sizes=type_sizes,
+print(Template(template).render(opcodes=opcodes, type_sizes=type_sizes,
type_has_size=type_has_size,
type_add_size=type_add_size,
op_bit_sizes=op_bit_sizes,
- get_const_field=get_const_field)
+ get_const_field=get_const_field))
diff --git a/src/compiler/nir/nir_opcodes_c.py b/src/compiler/nir/nir_opcodes_c.py
index 8afccca9504..108e144b5f4 100644
--- a/src/compiler/nir/nir_opcodes_c.py
+++ b/src/compiler/nir/nir_opcodes_c.py
@@ -23,6 +23,8 @@
# Authors:
# Connor Abbott ([email protected])
+from __future__ import print_function
+
from nir_opcodes import opcodes
from mako.template import Template
@@ -135,4 +137,4 @@ const nir_op_info nir_op_infos[nir_num_opcodes] = {
};
""")
-print template.render(opcodes=opcodes)
+print(template.render(opcodes=opcodes))
diff --git a/src/compiler/nir/nir_opcodes_h.py b/src/compiler/nir/nir_opcodes_h.py
index c9538e4e957..8ad17c84d49 100644
--- a/src/compiler/nir/nir_opcodes_h.py
+++ b/src/compiler/nir/nir_opcodes_h.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
template = """\
/* Copyright (C) 2014 Connor Abbott
@@ -43,4 +44,4 @@ typedef enum {
from nir_opcodes import opcodes
from mako.template import Template
-print Template(template).render(opcodes=opcodes)
+print(Template(template).render(opcodes=opcodes))
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 2f1cba398f0..5e07d662b07 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -23,6 +23,8 @@
# Authors:
# Jason Ekstrand ([email protected])
+from __future__ import print_function
+
from collections import OrderedDict
import nir_algebraic
import itertools
@@ -791,8 +793,8 @@ late_optimizations = [
(('b2f@32', a), ('iand', a, 1.0), 'options->lower_b2f'),
]
-print nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render()
-print nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma",
- before_ffma_optimizations).render()
-print nir_algebraic.AlgebraicPass("nir_opt_algebraic_late",
- late_optimizations).render()
+print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())
+print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_before_ffma",
+ before_ffma_optimizations).render())
+print(nir_algebraic.AlgebraicPass("nir_opt_algebraic_late",
+ late_optimizations).render())