From 3dcb25364fc3b8570dfe240e5b1e6fa278bf0911 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 12 May 2010 10:04:48 -0600 Subject: gallivm: added lp_typekind_name() util function --- src/gallium/auxiliary/gallivm/lp_bld_type.c | 45 +++++++++++++++++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_type.h | 4 +++ 2 files changed, 49 insertions(+) (limited to 'src/gallium/auxiliary/gallivm') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.c b/src/gallium/auxiliary/gallivm/lp_bld_type.c index 796af88caad..a86ef03e41c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_type.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_type.c @@ -238,6 +238,51 @@ lp_wider_type(struct lp_type type) } +/** + * Return string name for a LLVMTypeKind. Useful for debugging. + */ +const char * +lp_typekind_name(LLVMTypeKind t) +{ + switch (t) { + case LLVMVoidTypeKind: + return "LLVMVoidTypeKind"; + case LLVMFloatTypeKind: + return "LLVMFloatTypeKind"; + case LLVMDoubleTypeKind: + return "LLVMDoubleTypeKind"; + case LLVMX86_FP80TypeKind: + return "LLVMX86_FP80TypeKind"; + case LLVMFP128TypeKind: + return "LLVMFP128TypeKind"; + case LLVMPPC_FP128TypeKind: + return "LLVMPPC_FP128TypeKind"; + case LLVMLabelTypeKind: + return "LLVMLabelTypeKind"; + case LLVMIntegerTypeKind: + return "LLVMIntegerTypeKind"; + case LLVMFunctionTypeKind: + return "LLVMFunctionTypeKind"; + case LLVMStructTypeKind: + return "LLVMStructTypeKind"; + case LLVMArrayTypeKind: + return "LLVMArrayTypeKind"; + case LLVMPointerTypeKind: + return "LLVMPointerTypeKind"; + case LLVMOpaqueTypeKind: + return "LLVMOpaqueTypeKind"; + case LLVMVectorTypeKind: + return "LLVMVectorTypeKind"; + case LLVMMetadataTypeKind: + return "LLVMMetadataTypeKind"; + case LLVMUnionTypeKind: + return "LLVMUnionTypeKind"; + default: + return "unknown LLVMTypeKind"; + } +} + + void lp_build_context_init(struct lp_build_context *bld, LLVMBuilderRef builder, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h index cd59d2faa66..f1922ef9acb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_type.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h @@ -316,6 +316,10 @@ struct lp_type lp_wider_type(struct lp_type type); +const char * +lp_typekind_name(LLVMTypeKind t); + + void lp_build_context_init(struct lp_build_context *bld, LLVMBuilderRef builder, -- cgit v1.2.3