tipc
A TIP to LLVM compiler
Static Public Member Functions | List of all members
CodeGenerator Class Reference

Routines to optimize generated code. More...

#include <CodeGenerator.h>

Static Public Member Functions

static std::shared_ptr< llvm::Module > generate (ASTProgram *program, SemanticAnalysis *analysisResults, std::string fileName)
 Generate LLVM IR for ast. More...
 
static void emit (llvm::Module *m, std::string filename="")
 Emit LLVM IR to a file. More...
 
static void emitHumanReadableAssembly (llvm::Module *m, std::string filename="")
 Emit LLVM human-readable assembly to a file. More...
 

Detailed Description

Routines to optimize generated code.

A collection of routines for generating LLVM IR from a program AST and its semantic analysis results and for emitting the resulting LLVM IR to a file.

Member Function Documentation

◆ emit()

CodeGenerator::emit ( llvm::Module *  m,
std::string  filename = "" 
)
static

Emit LLVM IR to a file.

Parameters
mthe LLVM module holding the generated program

◆ emitHumanReadableAssembly()

CodeGenerator::emitHumanReadableAssembly ( llvm::Module *  m,
std::string  filename = "" 
)
static

Emit LLVM human-readable assembly to a file.

Parameters
mthe LLVM module holding the generated program

◆ generate()

CodeGenerator::generate ( ASTProgram program,
SemanticAnalysis analysisResults,
std::string  fileName 
)
static

Generate LLVM IR for ast.

Apply a series of basic optimization passes to the given LLVM module.

Parameters
programthe root of an AST encoding the program
analysisResultsthe results from semantic analysis of the program
fileNamethe name of the source file holding the program
Returns
the LLVM module holding the generated program

The documentation for this class was generated from the following files: