From cc7b9b34e99fa17357e14ac69f5fb2d1535b5512 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 3 Mar 2026 07:22:19 +0000 Subject: Added all built-in functions --- lib/CodeGen/CharHandler.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/CodeGen/CharHandler.cc (limited to 'lib/CodeGen/CharHandler.cc') diff --git a/lib/CodeGen/CharHandler.cc b/lib/CodeGen/CharHandler.cc new file mode 100644 index 0000000..5e9b502 --- /dev/null +++ b/lib/CodeGen/CharHandler.cc @@ -0,0 +1,15 @@ +#include "cps/CharHandler.h" + +using namespace llvm; +using namespace cps; + +CharHandler::CharHandler(LLVMContext &Ctx, IRBuilder<> &B, llvm::Module &M) + : Context(Ctx), Builder(B), Module(M) {} + +Value *CharHandler::emitAsc(Value *CharVal) { + return Builder.CreateZExt(CharVal, Type::getInt32Ty(Context), "asc_val"); +} + +Value *CharHandler::emitChr(Value *IntVal) { + return Builder.CreateTrunc(IntVal, Type::getInt8Ty(Context), "chr_val"); +} -- cgit v1.3.1-4-g156e