/** Forms links between nested blocks in the syntax tree. */
class BlockHierarchyResolver: private TraversingVisitor
{
+private:
+ bool r_any_resolved;
+
public:
- void apply(Stage &s) { s.content.visit(*this); }
+ BlockHierarchyResolver(): r_any_resolved(false) { }
+
+ bool apply(Stage &s) { r_any_resolved = false; s.content.visit(*this); return r_any_resolved; }
private:
virtual void enter(Block &);
std::map<TypeDeclaration *, TypeDeclaration *> alias_map;
std::map<TypeDeclaration *, TypeDeclaration *> array_types;
NodeList<Statement>::iterator type_insert_point;
+ InterfaceBlock *iface_block;
+ bool r_any_resolved;
public:
TypeResolver();
- void apply(Stage &);
+ bool apply(Stage &);
private:
- TypeDeclaration *resolve_type(const std::string &);
+ TypeDeclaration *get_or_create_array_type(TypeDeclaration &);
+ void resolve_type(TypeDeclaration *&, const std::string &, bool);
virtual void visit(Block &);
virtual void visit(BasicTypeDeclaration &);
virtual void visit(ImageTypeDeclaration &);
virtual void visit(StructDeclaration &);
virtual void visit(VariableDeclaration &);
+ virtual void visit(InterfaceBlock &);
virtual void visit(FunctionDeclaration &);
};
private:
Stage *stage;
RefPtr<Expression> r_replacement_expr;
- std::string block_interface;
bool r_any_resolved;
bool record_target;
bool r_self_referencing;
- VariableDeclaration *r_assignment_target;
+ Assignment::Target r_assignment_target;
public:
VariableResolver();
private:
virtual void enter(Block &);
- void visit_and_replace(RefPtr<Expression> &);
+ virtual void visit(RefPtr<Expression> &);
+ void check_assignment_target(Statement *);
virtual void visit(VariableReference &);
virtual void visit(InterfaceBlockReference &);
+ void add_to_chain(Assignment::Target::ChainType, unsigned);
virtual void visit(MemberAccess &);
- virtual void visit(UnaryExpression &);
+ virtual void visit(Swizzle &);
virtual void visit(BinaryExpression &);
virtual void visit(Assignment &);
- virtual void visit(FunctionCall &);
virtual void visit(VariableDeclaration &);
virtual void visit(InterfaceBlock &);
};
virtual void visit(VariableReference &);
virtual void visit(InterfaceBlockReference &);
virtual void visit(MemberAccess &);
+ virtual void visit(Swizzle &);
virtual void visit(UnaryExpression &);
+ void visit(BinaryExpression &, bool);
virtual void visit(BinaryExpression &);
virtual void visit(Assignment &);
virtual void visit(FunctionCall &);
private:
Stage *stage;
std::map<std::string, std::vector<FunctionDeclaration *> > declarations;
+ bool r_any_resolved;
public:
- void apply(Stage &);
+ bool apply(Stage &);
private:
virtual void visit(FunctionCall &);
std::string in_prefix;
std::string out_prefix;
bool function_scope;
- InterfaceBlock *iface_block;
bool copy_block;
+ std::vector<VariableDeclaration *> declared_inputs;
Block *iface_target_block;
NodeList<Statement>::iterator iface_insert_point;
NodeList<Statement>::iterator assignment_insert_point;