Cleanup some code that's no longer needed with logical IO.
authorSteve K <srk@LunarG.com>
Wed, 15 Oct 2014 19:26:21 +0000 (13:26 -0600)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Fri, 31 Oct 2014 21:29:16 +0000 (15:29 -0600)
icd/intel/compiler/shader/glsl_glass_backend_translator.cpp
icd/intel/compiler/shader/glsl_glass_backend_translator.h

index 98dc6a6860da227d64e3a755d8523d61f271f237..19d625fa541f4be225cb2e7a032026ea0f48f2f8 100644 (file)
@@ -2390,148 +2390,6 @@ inline void MesaGlassTranslator::trackMaxArrayElement(ir_rvalue* rvalue, int ind
 }
 
 
-/**
- * -----------------------------------------------------------------------------
- * Deference IO intrinsic down to a single slot
- * Borrorwed & modified from LunarGlass GLSL Bottom translator DereferenceName
- * -----------------------------------------------------------------------------
- */
-ir_rvalue*
-MesaGlassTranslator::dereferenceIO(ir_rvalue* aggregate,
-                                   const llvm::Type* type,
-                                   const llvm::MDNode* mdAggregate,
-                                   int slotOffset,
-                                   EMdTypeLayout& mdTypeLayout,
-                                   int irMode)
-{
-   if (type->getTypeID() == llvm::Type::PointerTyID) {
-      type = type->getContainedType(0);
-
-      aggregate = dereferenceIO(aggregate, type, mdAggregate, slotOffset, mdTypeLayout, irMode);
-   } else if (type->getTypeID() == llvm::Type::StructTyID) {
-      int field = 0;
-      int operand;
-      const llvm::StructType* structType = llvm::dyn_cast<const llvm::StructType>(type);
-      const llvm::Type* fieldType;
-      do {
-         operand = GetAggregateMdSubAggregateOp(field);
-         if (operand >= int(mdAggregate->getNumOperands())) {
-            assert(operand < int(mdAggregate->getNumOperands()));
-            return aggregate;
-         }
-         fieldType = structType->getContainedType(field);
-         const int fieldSize = CountSlots(fieldType);
-         if (fieldSize > slotOffset)
-            break;
-         slotOffset -= fieldSize;
-         ++field;
-      } while (true);
-
-      const char *field_name = ralloc_strdup(shader,
-                                             mdAggregate->getOperand(GetAggregateMdNameOp(field))->getName().str().c_str());
-
-      const llvm::MDNode* subMdAggregate = llvm::dyn_cast<const llvm::MDNode>(mdAggregate->getOperand(operand));
-
-      // interface block members are hoisted to global scope in HIR
-      if (anonBlocks.find(aggregate->type->name) != anonBlocks.end()) {
-         aggregate = newIRVariableDeref(llvmTypeToHirType(fieldType), field_name, irMode);
-      } else {
-         aggregate = new(shader) ir_dereference_record(aggregate, field_name);
-      }
-
-      aggregate = dereferenceIO(aggregate, fieldType, subMdAggregate, slotOffset, mdTypeLayout, irMode);
-
-   } else if (type->getTypeID() == llvm::Type::ArrayTyID) {
-      const llvm::ArrayType* arrayType = llvm::dyn_cast<const llvm::ArrayType>(type);
-      const int elementSize = CountSlots(arrayType->getContainedType(0));
-      const int element = slotOffset / elementSize;
-      slotOffset = slotOffset % elementSize;
-
-      ir_rvalue* indexVal = new(shader) ir_constant(element);
-
-      aggregate = new(shader) ir_dereference_array(aggregate, indexVal);
-      aggregate = dereferenceIO(aggregate, arrayType->getContainedType(0), mdAggregate, slotOffset,
-                                mdTypeLayout, irMode);
-
-      trackMaxArrayElement(aggregate, element);
-  } else if (mdAggregate)
-      mdTypeLayout = GetMdTypeLayout(mdAggregate);
-
-   return aggregate;
-}
-
-
-/**
- * -----------------------------------------------------------------------------
- * Translate read & write data intrinsics
- * -----------------------------------------------------------------------------
- */
-inline void
-MesaGlassTranslator::emitIRIOIntrinsic(const llvm::IntrinsicInst* llvmInst, bool input)
-{
-   std::string         name;
-   llvm::Type*         mdType;
-   EMdInputOutput      mdQual;
-   EMdPrecision        mdPrecision;
-   EMdTypeLayout       mdLayout;
-   int                 layoutLocation;
-   const llvm::MDNode* mdAggregate;
-   const llvm::MDNode* dummySampler;
-   int                 interpMode;
-
-   const llvm::MDNode* mdNode = llvmInst->getMetadata(input ? gla::InputMdName : gla::OutputMdName);
-   assert(mdNode);
-
-   // Glean information from metadata for intrinsic
-   gla::CrackIOMd(mdNode, name, mdQual, mdType, mdLayout, mdPrecision, layoutLocation, dummySampler, mdAggregate, interpMode);
-
-   // Create the name for anonymous block members
-   if (name.empty()) {
-      name = mdNode->getOperand(2)->getName();
-      StripSuffix(name, "_typeProxy");
-      StripSuffix(name, "_shadow");
-   }
-   
-   const glsl_type* irType  = llvmTypeToHirType(mdType->getContainedType(0), mdNode, llvmInst);
-
-   const int slotOffset  = GetConstantInt(llvmInst->getOperand(0)) - layoutLocation;
-   const ir_variable_mode irMode = input ? ir_var_shader_in : ir_var_shader_out;
-
-   ir_rvalue* ioVarDeref = newIRVariableDeref(irType, name, irMode);
-   
-   ir_variable* ioVar    = ioVarDeref->as_dereference_variable()->variable_referenced();
-
-   // ioVar->data.how_declared  = ...
-   ioVar->data.used          = true;
-
-   if (layoutLocation >= 0 && layoutLocation < gla::MaxUserLayoutLocation) {
-      ioVar->data.explicit_location = true;
-      ioVar->data.location          = layoutLocation;
-   }
-
-   ioVar->data.index         = slotOffset;
-   //   ioVar->data.explicit_index = ???
-   //   ioVar->data.explicit_binding
-   //   ioVar->data.has_initializer
-   //   ioVar->data.binding
-   //   ioVar->data.invariant
-
-   // ioVar->data.interpolation        = InterpolationQualifierToIR(gla::EInterpolationMethod(interpMode));
-   ioVar->data.origin_upper_left    = state->fs_origin_upper_left;
-   ioVar->data.pixel_center_integer = state->fs_pixel_center_integer;
-
-   ioVarDeref = dereferenceIO(ioVarDeref, mdType, mdAggregate, slotOffset, mdLayout, irMode);
-
-   // TODO: handle write mask, add to ir_variable's mask
-   if (input) {
-      addIRInstruction(llvmInst, ioVarDeref);
-   } else {
-      ir_assignment* assign = new(shader) ir_assignment(ioVarDeref, getIRValue(llvmInst->getOperand(2)));
-      addIRInstruction(llvmInst, assign);
-   }
-}
-
-
 /**
  * -----------------------------------------------------------------------------
  * Translate swizzle intrinsics
index d9c161b83f082e64cd6849165f7ace9ff108bfcf..c8a157432efaeb65a4afb33d95561a0b86aeab0d 100644 (file)
@@ -227,10 +227,6 @@ namespace gla {
         // Track maximum array value used
         inline void trackMaxArrayElement(ir_rvalue* deref, int index) const;
 
-        // Dereference IO intrinsics down to a single slot
-        ir_rvalue* dereferenceIO(ir_rvalue*, const llvm::Type*, const llvm::MDNode*, int slotOffset,
-                                 EMdTypeLayout&, int irMode);
-
         // IR texture intrinsics
         inline void emitIRTexture(const llvm::IntrinsicInst*, bool gather);
 
@@ -305,8 +301,6 @@ namespace gla {
         // raw add instruction: don't add map entry, just append to inst list
         inline void addIRInstruction(ir_instruction*, bool global = false);
 
-        inline void emitIRIOIntrinsic(const llvm::IntrinsicInst* llvmInst, bool input);
-
         // Return ref count of an rvalue
         inline unsigned getRefCount(const llvm::Value*) const;