c-compiler/src/codegen.h
2026-04-13 21:08:57 +03:00

32 lines
622 B
C++

#ifndef CODEGEN_H
#define CODEGEN_H
#include <memory>
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/IRBuilder.h>
#include <map>
#include "builder.h"
#include "types.h"
#include "binops.h"
#include "casting.h"
#include "tokens.h"
namespace codegen {
struct StackValue {
llvm::Value* value = nullptr;
std::shared_ptr<types::Type> ty = nullptr;
};
struct Scope {
std::vector<types::BinopDefinition>& binops;
std::vector<types::CastDefinition>& casts;
std::map<std::string, StackValue> values;
bool is_lvalue;
Scope with_lvalue();
};
}
#endif