12 std::shared_ptr<ASTDeclNode> DECL;
13 std::vector<std::shared_ptr<ASTDeclNode>> FORMALS;
14 std::vector<std::shared_ptr<ASTDeclStmt>> DECLS;
15 std::vector<std::shared_ptr<ASTStmt>> BODY;
19 std::vector<std::shared_ptr<ASTNode>>
getChildren()
override;
21 std::vector<std::shared_ptr<ASTDeclNode>> FORMALS,
22 const std::vector<std::shared_ptr<ASTDeclStmt>> &DECLS,
23 std::vector<std::shared_ptr<ASTStmt>> BODY,
bool ISPOLY)
24 : DECL(DECL), FORMALS(FORMALS), DECLS(DECLS), BODY(BODY), ISPOLY(ISPOLY) {
28 std::string
getName()
const {
return DECL->getName(); };
29 bool isPoly()
const {
return ISPOLY; };
32 std::vector<ASTStmt *>
getStmts()
const;
34 llvm::Value *
codegen()
override;
37 std::ostream &
print(std::ostream &out)
const override;
Class for declaring a name, e.g., function, parameter, variable.
Definition: ASTDeclNode.h:7
Class for defining the signature, local declarations, and a body of a function.
Definition: ASTFunction.h:11
std::vector< std::shared_ptr< ASTNode > > getChildren() override
Return all of the children for the node.
Definition: ASTFunction.cpp:47
ASTDeclNode * getDecl() const
Definition: ASTFunction.h:27
void accept(ASTVisitor *visitor) override
Visit the children of this node and apply the visitor.
Definition: ASTFunction.cpp:15
bool isPoly() const
Definition: ASTFunction.h:29
std::vector< ASTDeclStmt * > getDeclarations() const
Definition: ASTFunction.cpp:9
std::ostream & print(std::ostream &out) const override
Print an abbreviated shared string for the function.
Definition: ASTFunction.cpp:32
ASTFunction(std::shared_ptr< ASTDeclNode > DECL, std::vector< std::shared_ptr< ASTDeclNode >> FORMALS, const std::vector< std::shared_ptr< ASTDeclStmt >> &DECLS, std::vector< std::shared_ptr< ASTStmt >> BODY, bool ISPOLY)
Definition: ASTFunction.h:20
llvm::Value * codegen() override
Perform code generation and return an LLVM value the code.
Definition: CodeGenFunctions.cpp:336
std::vector< ASTStmt * > getStmts() const
Definition: ASTFunction.cpp:13
std::string getName() const
Definition: ASTFunction.h:28
std::vector< ASTDeclNode * > getFormals() const
Definition: ASTFunction.cpp:5
Abstract base class for all AST nodes.
Definition: ASTNode.h:34
Base class for AST visitors.
Definition: ASTVisitor.h:23