glsl: fix the type of ir_constant_data::u16
[mesa.git] / src / compiler / glsl / lower_int64.cpp
index 0a19ce429e41b46023791a1bd9bca57652fa0bea..43774d6ab334d9ba8d8f0546ea3852402c5402fd 100644 (file)
@@ -69,11 +69,11 @@ namespace {
 class lower_64bit_visitor : public ir_rvalue_visitor {
 public:
    lower_64bit_visitor(void *mem_ctx, exec_list *instructions, unsigned lower)
-      : progress(false), lower(lower), instructions(instructions),
+      : progress(false), lower(lower),
         function_list(), added_functions(&function_list, mem_ctx)
    {
       functions = _mesa_hash_table_create(mem_ctx,
-                                          _mesa_key_hash_string,
+                                          _mesa_hash_string,
                                           _mesa_key_string_equal);
 
       foreach_in_list(ir_instruction, node, instructions) {
@@ -111,8 +111,6 @@ public:
 private:
    unsigned lower; /** Bitfield of which operations to lower */
 
-   exec_list *instructions;
-
    /** Hashtable containing all of the known functions in the IR */
    struct hash_table *functions;
 
@@ -128,12 +126,6 @@ private:
 
 } /* anonymous namespace */
 
-static bool
-is_integer_64(const glsl_type *t)
-{
-   return t->base_type == GLSL_TYPE_UINT64 || t->base_type == GLSL_TYPE_INT64;
-}
-
 /**
  * Determine if a particular type of lowering should occur
  */
@@ -208,8 +200,7 @@ lower_64bit::expand_source(ir_factory &body,
                            ir_rvalue *val,
                            ir_variable **expanded_src)
 {
-   assert(val->type->base_type == GLSL_TYPE_UINT64 ||
-          val->type->base_type == GLSL_TYPE_INT64);
+   assert(val->type->is_integer_64());
 
    ir_variable *const temp = body.make_temp(val->type, "tmp");
 
@@ -265,7 +256,7 @@ lower_64bit::lower_op_to_function_call(ir_instruction *base_ir,
                                        ir_expression *ir,
                                        ir_function_signature *callee)
 {
-   const unsigned num_operands = ir->get_num_operands();
+   const unsigned num_operands = ir->num_operands;
    ir_variable *src[4][4];
    ir_variable *dst[4];
    void *const mem_ctx = ralloc_parent(ir);
@@ -326,8 +317,8 @@ lower_64bit_visitor::handle_op(ir_expression *ir,
                                const char *function_name,
                                function_generator generator)
 {
-   for (unsigned i = 0; i < ir->get_num_operands(); i++)
-      if (!is_integer_64(ir->operands[i]->type))
+   for (unsigned i = 0; i < ir->num_operands; i++)
+      if (!ir->operands[i]->type->is_integer_64())
          return ir;
 
    /* Get a handle to the correct ir_function_signature for the core
@@ -348,6 +339,7 @@ lower_64bit_visitor::handle_op(ir_expression *ir,
       add_function(f);
    }
 
+   this->progress = true;
    return lower_op_to_function_call(this->base_ir, ir, callee);
 }
 
@@ -364,7 +356,6 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
    case ir_unop_sign:
       if (lowering(SIGN64)) {
          *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
-         this->progress = true;
       }
       break;
 
@@ -375,7 +366,6 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
          } else {
             *rvalue = handle_op(ir, "__builtin_idiv64", generate_ir::idiv64);
          }
-         this->progress = true;
       }
       break;
 
@@ -386,14 +376,12 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
          } else {
             *rvalue = handle_op(ir, "__builtin_imod64", generate_ir::imod64);
          }
-         this->progress = true;
       }
       break;
 
    case ir_binop_mul:
       if (lowering(MUL64)) {
          *rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
-         this->progress = true;
       }
       break;