aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CharHandler.cc
diff options
context:
space:
mode:
author_ov4 <hausemasterstream@gmail.com>2026-03-03 07:22:19 +0000
committer_ov4 <hausemasterstream@gmail.com>2026-03-03 07:22:19 +0000
commitcc7b9b34e99fa17357e14ac69f5fb2d1535b5512 (patch)
tree40f093ef98c062a14a3b839ad2337646437645e9 /lib/CodeGen/CharHandler.cc
parent1b524f75401a6318fbaf3fee0bfcbe59348f2e51 (diff)
Added all built-in functions
Diffstat (limited to 'lib/CodeGen/CharHandler.cc')
-rw-r--r--lib/CodeGen/CharHandler.cc15
1 files changed, 15 insertions, 0 deletions
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");
+}