4 #ifndef CHI_NODE_TYPE_HPP 5 #define CHI_NODE_TYPE_HPP 10 #include <unordered_map> 14 #include "chi/Support/json.hpp" 48 size_t execInputID,
const llvm::DebugLoc& nodeLocation,
49 const std::vector<llvm::Value*>& io,
50 const std::vector<llvm::BasicBlock*>& outputBlocks) = 0;
54 virtual nlohmann::json
toJSON()
const {
return {}; }
57 virtual std::unique_ptr<NodeType>
clone()
const = 0;
61 std::string
name()
const {
return mName; }
73 const std::vector<NamedDataType>&
dataInputs()
const {
return mDataInputs; }
76 const std::vector<NamedDataType>&
dataOutputs()
const {
return mDataOutputs; }
79 const std::vector<std::string>&
execInputs()
const {
return mExecInputs; }
82 const std::vector<std::string>&
execOutputs()
const {
return mExecOutputs; }
86 bool pure() {
return mPure; }
107 void setName(std::string newName);
134 std::string mName, mDescription;
138 std::vector<NamedDataType> mDataInputs;
139 std::vector<NamedDataType> mDataOutputs;
141 std::vector<std::string> mExecInputs;
142 std::vector<std::string> mExecOutputs;
145 bool mConverter =
false;
149 #endif // CHI_NODE_TYPE_HPP const std::vector< std::string > & execInputs() const
Get the execution inputs for the node.
ChiModule & module() const
Get the ChiModule this NodeType belongs to.
Forward declares all the chigraph data types.
Context & context() const
Get the Context this NodeType belongs to.
const std::vector< NamedDataType > & dataOutputs() const
Get the data outputs for the node.
void makeConverter()
Make this a converter node.
void setDescription(std::string newDesc)
Set the description of the node.
bool converter()
Get if this node is a converter.
std::string name() const
Get the name of the NodeType in the ChiModule.
virtual nlohmann::json toJSON() const
Create the JSON necessary to store the object.
const std::vector< std::string > & execOutputs() const
Get the execution outputs for the node.
void makePure()
Make this node pure For more info on what this means, see https://en.wikipedia.org/wiki/Pure_function...
std::string description() const
Get the description of the NodeType.
NodeInstance * nodeInstance() const
Get the node instance.
The class that handles the loading, creation, storing, and compilation of modules It also stores a LL...
NodeType(ChiModule &mod, std::string name={}, std::string description={})
Constructor.
An abstract class that represents a module of code in Chigraph Can be compiled to a llvm::Module...
void setExecOutputs(std::vector< std::string > newOutputs)
Set the exec outputs for the NodeType.
void setDataOutputs(std::vector< NamedDataType > newOutputs)
Set the data outputs for the NodeType.
void setExecInputs(std::vector< std::string > newInputs)
Set the exec inputs for the NodeType.
bool pure()
Get if this node is pure.
void setName(std::string newName)
Set the name of the type.
virtual ~NodeType()
Destructor.
const std::vector< NamedDataType > & dataInputs() const
Get the data inputs for the node.
The namespace where chigraph lives.
std::string qualifiedName() const
Get the qualified name of the node type, like module.name():name()
virtual std::unique_ptr< NodeType > clone() const =0
Clones the type.
The result object, used for identifiying errors with good diagnostics.
virtual Result codegen(NodeCompiler &compiler, llvm::BasicBlock &codegenInto, size_t execInputID, const llvm::DebugLoc &nodeLocation, const std::vector< llvm::Value *> &io, const std::vector< llvm::BasicBlock *> &outputBlocks)=0
A virtual function that is called when this node needs to be called.
void setDataInputs(std::vector< NamedDataType > newInputs)
Set the data inputs for the NodeType.