Add i32/i8 helpers for DXIL

This commit is contained in:
baldurk
2021-09-20 17:57:33 +01:00
parent d15f264c81
commit 42f508df85
2 changed files with 46 additions and 0 deletions
@@ -2383,6 +2383,48 @@ const DXIL::Type *Program::GetBoolType()
return m_BoolType;
}
const Type *Program::GetInt32Type()
{
if(m_Int32Type)
return m_Int32Type;
for(size_t i = 0; i < m_Types.size(); i++)
{
if(m_Types[i].type == Type::Scalar && m_Types[i].scalarType == Type::Int &&
m_Types[i].bitWidth == 32)
{
m_Int32Type = &m_Types[i];
break;
}
}
if(!m_Int32Type)
RDCERR("Couldn't find void type");
return m_Int32Type;
}
const Type *Program::GetInt8Type()
{
if(m_Int8Type)
return m_Int8Type;
for(size_t i = 0; i < m_Types.size(); i++)
{
if(m_Types[i].type == Type::Scalar && m_Types[i].scalarType == Type::Int &&
m_Types[i].bitWidth == 8)
{
m_Int8Type = &m_Types[i];
break;
}
}
if(!m_Int8Type)
RDCERR("Couldn't find void type");
return m_Int8Type;
}
const Type *Program::GetPointerType(const Type *type, Type::PointerAddrSpace addrSpace) const
{
for(const Type &t : m_Types)
@@ -679,6 +679,8 @@ protected:
uint32_t GetOrAssignMetaID(DebugLocation &l);
const Type *GetVoidType();
const Type *GetBoolType();
const Type *GetInt32Type();
const Type *GetInt8Type();
const Type *GetPointerType(const Type *type, Type::PointerAddrSpace addrSpace) const;
bytebuf m_Bytes;
@@ -704,6 +706,8 @@ protected:
rdcarray<Type> m_Types;
const Type *m_VoidType = NULL;
const Type *m_BoolType = NULL;
const Type *m_Int32Type = NULL;
const Type *m_Int8Type = NULL;
rdcarray<AttributeGroup> m_AttributeGroups;
rdcarray<AttributeSet> m_AttributeSets;