Skip to content

Commit a820458

Browse files
committed
LLVMCompilerContext: Add addDefinedProcedure() method
1 parent 0887e59 commit a820458

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/engine/internal/llvm/llvmcompilercontext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ const std::unordered_map<function_id_t, LLVMExecutableCode *> &LLVMCompilerConte
6565
return m_codeMap;
6666
}
6767

68+
void LLVMCompilerContext::addDefinedProcedure(BlockPrototype *prototype)
69+
{
70+
m_definedProcedures.insert(prototype);
71+
}
72+
6873
void LLVMCompilerContext::addUsedProcedure(BlockPrototype *prototype, const std::string &functionName, llvm::FunctionType *functionType)
6974
{
7075
m_usedProcedures[prototype] = { functionName, functionType };

src/engine/internal/llvm/llvmcompilercontext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <scratchcpp/compilercontext.h>
1010

11+
#include <unordered_set>
1112
#include <unordered_map>
1213

1314
namespace libscratchcpp
@@ -35,6 +36,7 @@ class LLVMCompilerContext : public CompilerContext
3536
void addCode(LLVMExecutableCode *code);
3637
const std::unordered_map<function_id_t, LLVMExecutableCode *> &codeMap() const;
3738

39+
void addDefinedProcedure(BlockPrototype *prototype);
3840
void addUsedProcedure(BlockPrototype *prototype, const std::string &functionName, llvm::FunctionType *functionType);
3941

4042
function_id_t getNextFunctionId();
@@ -95,6 +97,7 @@ class LLVMCompilerContext : public CompilerContext
9597
llvm::StructType *m_stringPtrType = nullptr;
9698
llvm::Type *m_functionIdType = nullptr;
9799

100+
std::unordered_set<BlockPrototype *> m_definedProcedures;
98101
std::unordered_map<BlockPrototype *, std::pair<std::string, llvm::FunctionType *>> m_usedProcedures; // function name, function type
99102
};
100103

0 commit comments

Comments
 (0)