summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2017-12-28 17:56:03 -0600
committerTim Rowley <[email protected]>2018-01-10 09:44:07 -0600
commitf5f1bbcb5c66c55a45e47c71685ca6709b714390 (patch)
treeb2af3056c1da16bdb3074e229a79fd8ad9588d2a /src/gallium/drivers/swr
parent04d0bfde3962ee76ee7310b3dee5e0f72d2b4c17 (diff)
swr/rast: autogenerate named structs instead of literal structs
Results in far smaller and useful IR output. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r--src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
index 18ea7817137..574ee5aaa79 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
@@ -40,15 +40,22 @@ namespace SwrJit
INLINE static StructType *Gen_${type['name']}(JitManager* pJitMgr)
{
LLVMContext& ctx = pJitMgr->mContext;
- std::vector<Type*> members;
- <%
- (max_type_len, max_name_len) = calc_max_len(type['members'])
- %>
- %for member in type['members']:
- /* ${member['name']} ${pad(len(member['name']), max_name_len)}*/ members.push_back( ${member['type']} );
- %endfor
- return StructType::get(ctx, members, false);
+ StructType* pRetType = pJitMgr->mpCurrentModule->getTypeByName("${type['name']}");
+ if (pRetType == nullptr)
+ {
+ std::vector<Type*> members;
+ <%
+ (max_type_len, max_name_len) = calc_max_len(type['members'])
+ %>
+ %for member in type['members']:
+ /* ${member['name']} ${pad(len(member['name']), max_name_len)}*/ members.push_back(${ member['type'] });
+ %endfor
+
+ pRetType = StructType::create(members, "${type['name']}", false);
+ }
+
+ return pRetType;
}
%for member in type['members']: