Mesa (master): ac/nir: drop nir_to_llvm_context from glsl_to_llvm_type()

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Mon Feb 12 10:55:01 UTC 2018


Module: Mesa
Branch: master
Commit: 759acfa18011eb64fa224389ee0eae5e94c59658
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=759acfa18011eb64fa224389ee0eae5e94c59658

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Feb  9 13:54:32 2018 +0100

ac/nir: drop nir_to_llvm_context from glsl_to_llvm_type()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/common/ac_nir_to_llvm.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 464fdc1609..09f47fe8d0 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -5641,7 +5641,7 @@ handle_shader_output_decl(struct ac_nir_context *ctx,
 }
 
 static LLVMTypeRef
-glsl_base_to_llvm_type(struct nir_to_llvm_context *ctx,
+glsl_base_to_llvm_type(struct ac_llvm_context *ac,
 		       enum glsl_base_type type)
 {
 	switch (type) {
@@ -5649,42 +5649,42 @@ glsl_base_to_llvm_type(struct nir_to_llvm_context *ctx,
 	case GLSL_TYPE_UINT:
 	case GLSL_TYPE_BOOL:
 	case GLSL_TYPE_SUBROUTINE:
-		return ctx->ac.i32;
+		return ac->i32;
 	case GLSL_TYPE_FLOAT: /* TODO handle mediump */
-		return ctx->ac.f32;
+		return ac->f32;
 	case GLSL_TYPE_INT64:
 	case GLSL_TYPE_UINT64:
-		return ctx->ac.i64;
+		return ac->i64;
 	case GLSL_TYPE_DOUBLE:
-		return ctx->ac.f64;
+		return ac->f64;
 	default:
 		unreachable("unknown GLSL type");
 	}
 }
 
 static LLVMTypeRef
-glsl_to_llvm_type(struct nir_to_llvm_context *ctx,
+glsl_to_llvm_type(struct ac_llvm_context *ac,
 		  const struct glsl_type *type)
 {
 	if (glsl_type_is_scalar(type)) {
-		return glsl_base_to_llvm_type(ctx, glsl_get_base_type(type));
+		return glsl_base_to_llvm_type(ac, glsl_get_base_type(type));
 	}
 
 	if (glsl_type_is_vector(type)) {
 		return LLVMVectorType(
-		   glsl_base_to_llvm_type(ctx, glsl_get_base_type(type)),
+		   glsl_base_to_llvm_type(ac, glsl_get_base_type(type)),
 		   glsl_get_vector_elements(type));
 	}
 
 	if (glsl_type_is_matrix(type)) {
 		return LLVMArrayType(
-		   glsl_to_llvm_type(ctx, glsl_get_column_type(type)),
+		   glsl_to_llvm_type(ac, glsl_get_column_type(type)),
 		   glsl_get_matrix_columns(type));
 	}
 
 	if (glsl_type_is_array(type)) {
 		return LLVMArrayType(
-		   glsl_to_llvm_type(ctx, glsl_get_array_element(type)),
+		   glsl_to_llvm_type(ac, glsl_get_array_element(type)),
 		   glsl_get_length(type));
 	}
 
@@ -5694,11 +5694,11 @@ glsl_to_llvm_type(struct nir_to_llvm_context *ctx,
 
 	for (unsigned i = 0; i < glsl_get_length(type); i++) {
 		member_types[i] =
-			glsl_to_llvm_type(ctx,
+			glsl_to_llvm_type(ac,
 					  glsl_get_struct_field(type, i));
 	}
 
-	return LLVMStructTypeInContext(ctx->context, member_types,
+	return LLVMStructTypeInContext(ac->context, member_types,
 				       glsl_get_length(type), false);
 }
 
@@ -5733,7 +5733,7 @@ setup_shared(struct ac_nir_context *ctx,
 	nir_foreach_variable(variable, &nir->shared) {
 		LLVMValueRef shared =
 			LLVMAddGlobalInAddressSpace(
-			   ctx->ac.module, glsl_to_llvm_type(ctx->nctx, variable->type),
+			   ctx->ac.module, glsl_to_llvm_type(&ctx->ac, variable->type),
 			   variable->name ? variable->name : "",
 			   AC_LOCAL_ADDR_SPACE);
 		_mesa_hash_table_insert(ctx->vars, variable, shared);




More information about the mesa-commit mailing list