From 831896f844453ba09c9e6cbfe7d29f6d44282632 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 7 Aug 2017 16:06:58 -0700 Subject: Starting to add intermediate representation (IR) Right now none of this is hooked up, but I want to get things checked in incrementally rather than have along long-lived branches. - Added placeholder declarations for IR representation of instructions, basic blocks, etc. - Start adding a `lower-to-ir` pass to translate from AST representation to IR Again: none of this is functional, so it shouldn't mess with existing users of the compiler. --- source/slang/visitor.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/slang/visitor.h') diff --git a/source/slang/visitor.h b/source/slang/visitor.h index 59c5772f2..8a0301782 100644 --- a/source/slang/visitor.h +++ b/source/slang/visitor.h @@ -34,6 +34,13 @@ struct TypeVisitor : Base return result; } + Result dispatchType(Type* type) + { + Result result; + type->accept(this, &result); + return result; + } + #define ABSTRACT_SYNTAX_CLASS(NAME,BASE) /* empty */ #define SYNTAX_CLASS(NAME, BASE) \ virtual void dispatch_##NAME(NAME* obj, void* extra) override \ @@ -61,6 +68,11 @@ struct TypeVisitor : Base type->accept(this, 0); } + void dispatchType(Type* type) + { + type->accept(this, 0); + } + #define ABSTRACT_SYNTAX_CLASS(NAME,BASE) /* empty */ #define SYNTAX_CLASS(NAME, BASE) \ virtual void dispatch_##NAME(NAME* obj, void*) override \ -- cgit v1.2.3