summaryrefslogtreecommitdiff
path: root/ir_print_visitor.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-04-07 17:18:29 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-28 15:42:07 -0700
commit3b96996b7eb6e3603a5f138177867c3e856e0dfa (patch)
tree0dad0ce7c51cad062115e44fa31b7c798a34052c /ir_print_visitor.cpp
parentbff6013d469b3d4e54cdc5731801c56994a523ec (diff)
Move array of operator strings out of ir_print_visitor.cpp.
Also implement a reverse-lookup function for use in the IR reader.
Diffstat (limited to 'ir_print_visitor.cpp')
-rw-r--r--ir_print_visitor.cpp52
1 files changed, 1 insertions, 51 deletions
diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp
index 56048fe..778a5c1 100644
--- a/ir_print_visitor.cpp
+++ b/ir_print_visitor.cpp
@@ -101,61 +101,11 @@ void ir_print_visitor::visit(ir_function *ir)
void ir_print_visitor::visit(ir_expression *ir)
{
- static const char *const operators[] = {
- "~",
- "!",
- "-",
- "abs",
- "rcp",
- "rsq",
- "sqrt",
- "exp",
- "log",
- "exp2",
- "log2",
- "f2i",
- "i2f",
- "f2b",
- "b2f",
- "i2b",
- "b2i",
- "u2f",
- "trunc",
- "ceil",
- "floor",
- "+",
- "-",
- "*",
- "/",
- "%",
- "<",
- ">",
- "<=",
- ">=",
- "==",
- "!=",
- "<<",
- ">>",
- "&",
- "^",
- "|",
- "&&",
- "^^",
- "||",
- "dot",
- "min",
- "max",
- "pow",
- };
-
printf("(expression ");
print_type(ir->type);
- assert((unsigned int)ir->operation <
- sizeof(operators) / sizeof(operators[0]));
-
- printf(" %s ", operators[ir->operation]);
+ printf(" %s ", ir->operator_string());
if (ir->operands[0])
ir->operands[0]->accept(this);