5 #ifndef CHI_NODE_COMPILER_HPP 6 #define CHI_NODE_COMPILER_HPP 11 #include <unordered_set> 14 #include <boost/dynamic_bitset.hpp> 73 bool compiled(
size_t inputExecID)
const;
82 llvm::BasicBlock&
firstBlock(
size_t inputExecID)
const;
89 llvm::BasicBlock&
codeBlock(
size_t inputExecID)
const;
105 std::vector<llvm::Value*>
returnValues()
const {
return mReturnValues; }
111 assert(
pure() &&
"Cannot get jump back inst for a nonpure node");
112 return *mJumpBackInst;
119 std::vector<std::vector<llvm::BasicBlock*>> mPureBlocks;
120 std::vector<llvm::BasicBlock*> mCodeBlocks;
122 std::vector<llvm::Value*> mReturnValues;
124 boost::dynamic_bitset<> mCompiledInputs;
126 llvm::IndirectBrInst* mJumpBackInst =
nullptr;
142 #endif // CHI_NODE_COMPILER_HPP Result compile_stage2(std::vector< llvm::BasicBlock *> trailingBlocks, size_t inputExecID)
Fill the codegen block If compile_stage1 hasn't been called for this inputExecID, then it will be cal...
llvm::BasicBlock & codeBlock(size_t inputExecID) const
Get the code block for a given inputExecID Requires that compile_stage1 has been called for this ID...
llvm::Module & llvmModule() const
Get the module being generated.
bool pure() const
node().type().pure()
Forward declares all the chigraph data types.
FunctionCompiler & funcCompiler() const
Get the function compiler.
std::vector< NodeInstance * > dependentPuresRecursive(const NodeInstance &inst)
Get the pures a NodeInstance relies on These are all the dependent pures (it's fetched recursively) T...
size_t inputExecs() const
The number of input execs that we can compile If it's pure or an entry node, this is 1...
The class that handles the loading, creation, storing, and compilation of modules It also stores a LL...
NodeInstance & node() const
The node we're compiling.
void compile_stage1(size_t inputExecID)
Add the basic blocks and fill the pure blocks, but don't fill the code block nop if its already been ...
Class for compiling GraphFunctions into llvm::Functions.
std::vector< llvm::Value * > returnValues() const
Get return values.
Context & context() const
Just node().context()
bool compiled(size_t inputExecID) const
Get if compile_stage2 has been called for a given inputExecID.
NodeCompiler(FunctionCompiler &functionCompiler, NodeInstance &inst)
Constructor.
The namespace where chigraph lives.
The result object, used for identifiying errors with good diagnostics.
llvm::BasicBlock & firstBlock(size_t inputExecID) const
Get the first block to jump to for the node If there are dependent pures, it's the first pure block O...
llvm::IndirectBrInst & jumpBackInst() const
Get the IndirectBrInst* for the pure.