aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CharHandler.cc
blob: 5e9b5021664e81f1a0955ec6d754c693f7d72df9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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");
}