tipc
A TIP to LLVM compiler
ASTRefExpr.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ASTExpr.h"
4 
7 class ASTRefExpr : public ASTExpr {
8  std::shared_ptr<ASTExpr> VAR;
9 
10 public:
11  std::vector<std::shared_ptr<ASTNode>> getChildren() override;
12  ASTRefExpr(std::shared_ptr<ASTExpr> VAR) : VAR(VAR) {}
13  ASTExpr *getVar() const { return VAR.get(); }
14  void accept(ASTVisitor *visitor) override;
15  llvm::Value *codegen() override;
16 
17 protected:
18  std::ostream &print(std::ostream &out) const override;
19 };
Abstract class for all expression subtypes.
Definition: ASTExpr.h:7
Class for referencing the address of an expression.
Definition: ASTRefExpr.h:7
std::vector< std::shared_ptr< ASTNode > > getChildren() override
Return all of the children for the node.
Definition: ASTRefExpr.cpp:16
ASTRefExpr(std::shared_ptr< ASTExpr > VAR)
Definition: ASTRefExpr.h:12
std::ostream & print(std::ostream &out) const override
Definition: ASTRefExpr.cpp:11
void accept(ASTVisitor *visitor) override
Visit the children of this node and apply the visitor.
Definition: ASTRefExpr.cpp:4
llvm::Value * codegen() override
Perform code generation and return an LLVM value the code.
Definition: CodeGenFunctions.cpp:603
ASTExpr * getVar() const
Definition: ASTRefExpr.h:13
Base class for AST visitors.
Definition: ASTVisitor.h:23