Purple  0.1
Standard Language Specification
Functions
translate.h File Reference

Function headers and definitions for translation of an AST into LLVM-IR. More...

#include "parse.h"
#include "translate/llvm.h"
#include "tree.h"
Include dependency graph for translate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

LLVMStackEntryNodedetermine_binary_expression_stack_allocation (ASTNode *root)
 Perform a DFS on an AST to determine the stack allocation needed for a binary expression. More...
 
LLVMValue ast_to_llvm (ASTNode *n, LLVMValue llvm_value, TokenType parent_operation)
 Generates LLVM-IR from a given AST. More...
 
void generate_llvm (void)
 Wrapper function for generating LLVM. More...
 

Detailed Description

Function headers and definitions for translation of an AST into LLVM-IR.

Author
Charles Averill
Date
10-Sep-2022

Function Documentation

◆ ast_to_llvm()

LLVMValue ast_to_llvm ( ASTNode root,
LLVMValue  llvm_value,
TokenType  parent_operation 
)

Generates LLVM-IR from a given AST.

Parameters
nThe AST Node from which LLVM will be generated
llvm_valueLLVMValue storing register or label information
parent_operationTokenType of parent of n
Returns
LLVMValue LLVMValue struct containing information about what code this AST Node generated

◆ determine_binary_expression_stack_allocation()

LLVMStackEntryNode * determine_binary_expression_stack_allocation ( ASTNode root)

Perform a DFS on an AST to determine the stack allocation needed for a binary expression.

Parameters
rootRoot of AST to find stack allocation for
Returns
LLVMStackEntryNode* Pointer to front of the stack allocation linked list

◆ generate_llvm()

void generate_llvm ( void  )

Wrapper function for generating LLVM.