--- .../drivers/swr/rasterizer/jitter/JitManager.cpp | 20 ++++++++++++++++++++ .../drivers/swr/rasterizer/jitter/JitManager.h | 1 + 2 files changed, 21 insertions(+)
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index a3bda61..b0f9d2f 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 fb20a36..50b9d82 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) { -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev