From 419420770c4545ea4010047ef2153004d4700eed Mon Sep 17 00:00:00 2001 From: _ov4 Date: Mon, 2 Feb 2026 08:45:01 +0000 Subject: Added REAL and BOOLEAN types, DIV and MOD operators --- lib/CodeGen/IntegerHandler.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/CodeGen/IntegerHandler.cc (limited to 'lib/CodeGen/IntegerHandler.cc') diff --git a/lib/CodeGen/IntegerHandler.cc b/lib/CodeGen/IntegerHandler.cc new file mode 100644 index 0000000..8161593 --- /dev/null +++ b/lib/CodeGen/IntegerHandler.cc @@ -0,0 +1,16 @@ +#include "cps/IntegerHandler.h" + +using namespace llvm; +using namespace cps; + +void IntegerHandler::emitDeclare(const std::string &Name) { + Function *TheFunction = Builder.GetInsertBlock()->getParent(); + IRBuilder<> TmpB(&TheFunction->getEntryBlock(), TheFunction->getEntryBlock().begin()); + AllocaInst *Alloca = TmpB.CreateAlloca(Type::getInt64Ty(Context), nullptr, Name); + Builder.CreateStore(ConstantInt::get(Context, APInt(64, 0)), Alloca); + NamedValues[Name] = Alloca; +} + +Value *IntegerHandler::createLiteral(int64_t Val) { + return ConstantInt::get(Context, APInt(64, Val, true)); +} -- cgit v1.3.1-4-g156e