aboutsummaryrefslogtreecommitdiff
path: root/include/cps/CodeGen.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cps/CodeGen.h')
-rw-r--r--include/cps/CodeGen.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h
index 9d71df7..9a0b2ef 100644
--- a/include/cps/CodeGen.h
+++ b/include/cps/CodeGen.h
@@ -46,6 +46,20 @@ class CodeGen {
bool emitConstruct(const std::string &TypeName, llvm::Value *Addr,
const std::vector<std::unique_ptr<ExprAST>> &Args, int Line);
bool emitDefaultConstruct(const std::string &TypeName, llvm::Value *Addr, int Line);
+ struct StackObject {
+ llvm::Value *Addr;
+ std::string TypeName;
+ llvm::AllocaInst *Alive;
+ llvm::AllocaInst *Count; // Non-null for an array; Addr then holds its buffer pointer.
+ int Line;
+ bool IsCopy;
+ };
+ std::vector<StackObject> StackObjects;
+ size_t registerStackObject(llvm::Value *Addr, const std::string &TypeName, int Line,
+ bool IsArray = false, bool IsCopy = false);
+ void activateStackObject(size_t Index, llvm::Value *Count = nullptr);
+ void emitStackObjectCleanup(const StackObject &Object);
+ void finishStackObjects(llvm::Function *F);
struct ConstantScope {
unsigned ID;
IdentifierMap<std::optional<SymbolInfo>> Saved;