diff options
| author | _ov4 <hausemasterstream@gmail.com> | 2026-02-02 08:45:01 +0000 |
|---|---|---|
| committer | _ov4 <hausemasterstream@gmail.com> | 2026-02-02 08:45:01 +0000 |
| commit | 419420770c4545ea4010047ef2153004d4700eed (patch) | |
| tree | bd19eed681dbb68ecb501b6cfc220c42a9803ef3 /lib/CodeGen/BooleanHandler.cc | |
| parent | ecc0fc463ba54dd0cbe33bc14415f432eaa959de (diff) | |
Added REAL and BOOLEAN types, DIV and MOD operators
Diffstat (limited to 'lib/CodeGen/BooleanHandler.cc')
| -rw-r--r-- | lib/CodeGen/BooleanHandler.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/CodeGen/BooleanHandler.cc b/lib/CodeGen/BooleanHandler.cc new file mode 100644 index 0000000..558ac95 --- /dev/null +++ b/lib/CodeGen/BooleanHandler.cc @@ -0,0 +1,16 @@ +#include "cps/BooleanHandler.h" + +using namespace llvm; +using namespace cps; + +void BooleanHandler::emitDeclare(const std::string &Name) { + Function *TheFunction = Builder.GetInsertBlock()->getParent(); + IRBuilder<> TmpB(&TheFunction->getEntryBlock(), TheFunction->getEntryBlock().begin()); + AllocaInst *Alloca = TmpB.CreateAlloca(Type::getInt1Ty(Context), nullptr, Name); + Builder.CreateStore(ConstantInt::get(Context, APInt(1, 0)), Alloca); + NamedValues[Name] = Alloca; +} + +Value *BooleanHandler::createLiteral(bool Val) { + return ConstantInt::get(Context, APInt(1, Val ? 1 : 0)); +} |
