blob: 816159355b01185ab3516886cf55391d725d3b7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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));
}
|