swr/rast: Add debugging type support for function types.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
George Kyriazis 2018-01-19 15:47:02 -06:00
parent e9e7f3ce0a
commit c4a42f5add
2 changed files with 21 additions and 0 deletions

View File

@ -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);

View File

@ -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)
{