From 2055d540c5dd420448a6924d784d5aed0efcd93d Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 11 Sep 2017 09:33:46 -0700 Subject: Support IR-based codegen for a few more examples. The main interesting change here is around support for lowering of calls to "subscript" operations (what a C++ programmer would think of as `operator[]`). An important infrastructure change here was to add an explicit AST-node representation for a "static member expression" which we use whenever a member is looked up in a type as opposed to a value. The implementation of this probably isn't robust yet, but it turns out to be important to be able to tell such cases apart. --- source/slang/ir.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/slang/ir.h') diff --git a/source/slang/ir.h b/source/slang/ir.h index 51755f89f..1561d15a7 100644 --- a/source/slang/ir.h +++ b/source/slang/ir.h @@ -307,6 +307,13 @@ struct IRTextureType : IRType IRType* getElementType() { return (IRType*) elementType.usedValue; } }; +struct IRBufferType : IRType +{ + IRUse elementType; + IRType* getElementType() { return (IRType*) elementType.usedValue; } +}; + + struct IRUniformBufferType : IRType { IRUse elementType; @@ -326,6 +333,12 @@ struct IRLoad : IRInst IRUse ptr; }; +struct IRStore : IRInst +{ + IRUse ptr; + IRUse val; +}; + struct IRStructField; struct IRFieldExtract : IRInst { @@ -541,6 +554,10 @@ struct IRBuilder IRInst* emitLoad( IRValue* ptr); + IRInst* emitStore( + IRValue* dstPtr, + IRValue* srcVal); + IRInst* emitFieldExtract( IRType* type, IRValue* base, -- cgit v1.2.3