summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-01-19 15:47:02 -0600
committerGeorge Kyriazis <[email protected]>2018-01-19 16:52:38 -0600
commitc4a42f5add66f43747f2f86aa06f7b80b6ba1edc (patch)
treee0bc192c286da07c844717508a8acdf779f307d6 /src/gallium
parente9e7f3ce0a757184ff224a94f61a72c71e78d7f9 (diff)
swr/rast: Add debugging type support for function types.
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp20
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/JitManager.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index a3bda616f95..b0f9d2f6456 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -254,11 +254,31 @@ DIType* JitManager::GetDebugType(Type* pTy)
case Type::ArrayTyID: return GetDebugArrayType(pTy); break;
case Type::PointerTyID: return builder.createPointerType(GetDebugType(pTy->getPointerElementType()), 64, 64); break;
case Type::VectorTyID: return GetDebugVectorType(pTy); break;
+ case Type::FunctionTyID: return GetDebugFunctionType(pTy); break;
default: SWR_ASSERT(false, "Unimplemented llvm type");
}
return nullptr;
}
+// Create a DISubroutineType from an llvm FunctionType
+DIType* JitManager::GetDebugFunctionType(Type* pTy)
+{
+ SmallVector<Metadata*, 8> ElemTypes;
+ FunctionType* pFuncTy = cast<FunctionType>(pTy);
+ DIBuilder builder(*mpCurrentModule);
+
+ // Add result type
+ ElemTypes.push_back(GetDebugType(pFuncTy->getReturnType()));
+
+ // Add arguments
+ for (auto& param : pFuncTy->params())
+ {
+ ElemTypes.push_back(GetDebugType(param));
+ }
+
+ return builder.createSubroutineType(builder.getOrCreateTypeArray(ElemTypes));
+}
+
DIType* JitManager::GetDebugIntegerType(Type* pTy)
{
DIBuilder builder(*mpCurrentModule);
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
index fb20a36625d..50b9d829047 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
@@ -175,6 +175,7 @@ struct JitManager
llvm::DIType* GetDebugIntegerType(llvm::Type* pTy);
llvm::DIType* GetDebugArrayType(llvm::Type* pTy);
llvm::DIType* GetDebugVectorType(llvm::Type* pTy);
+ llvm::DIType* GetDebugFunctionType(llvm::Type* pTy);
llvm::DIType* GetDebugStructType(llvm::Type* pType)
{