summaryrefslogtreecommitdiff
path: root/source/slang/ir-insts.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-09 10:50:44 -0800
committerTim Foley <tfoleyNV@users.noreply.github.com>2018-01-09 10:50:44 -0800
commit8daafcc2e4bf7b2dfb66d7a3b7ac60c86b2d926c (patch)
treeb7fac301e3c4d1b006af70584feeb45af191aab6 /source/slang/ir-insts.h
parent3d435f7321c3f9241d33a0f7521573f21b548186 (diff)
bruteforce implementation of witness table resolution for associated (#358)
Diffstat (limited to 'source/slang/ir-insts.h')
-rw-r--r--source/slang/ir-insts.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/slang/ir-insts.h b/source/slang/ir-insts.h
index a8c8383e2..55ff26185 100644
--- a/source/slang/ir-insts.h
+++ b/source/slang/ir-insts.h
@@ -84,6 +84,12 @@ struct IRLookupWitnessMethod : IRInst
IRUse requirementDeclRef;
};
+struct IRLookupWitnessTable : IRInst
+{
+ IRUse sourceType;
+ IRUse interfaceType;
+};
+
//
struct IRCall : IRInst
@@ -309,6 +315,14 @@ struct IRWitnessTable : IRGlobalValue
IRValueList<IRWitnessTableEntry> entries;
};
+// An abstract witness table is a global value that
+// represents an inheritance relationship that can't
+// be resolved to a witness table at IR-generation time.
+struct IRAbstractWitness : IRGlobalValue
+{
+ RefPtr<SubtypeWitness> witness;
+ DeclRef<Decl> subTypeDeclRef, supTypeDeclRef;
+};
// Description of an instruction to be used for global value numbering
@@ -402,6 +416,15 @@ struct IRBuilder
DeclRef<Decl> witnessTableDeclRef,
DeclRef<Decl> interfaceMethodDeclRef);
+ IRValue* emitLookupInterfaceMethodInst(
+ IRType* type,
+ IRValue* witnessTableVal,
+ DeclRef<Decl> interfaceMethodDeclRef);
+
+ IRValue* emitFindWitnessTable(
+ DeclRef<Decl> baseTypeDeclRef,
+ IRType* interfaceType);
+
IRInst* emitCallInst(
IRType* type,
IRValue* func,
@@ -424,7 +447,6 @@ struct IRBuilder
IRFunc* createFunc();
IRGlobalVar* createGlobalVar(
IRType* valueType);
- IRWitnessTable* createWitnessTable(Dictionary<DeclRef<Decl>, Decl*> & witnesses);
IRWitnessTable* createWitnessTable();
IRWitnessTableEntry* createWitnessTableEntry(
IRWitnessTable* witnessTable,