Moving convertAndStore to preamble of BitcodeEmitter.cpp
This commit is contained in:
parent
9d2413857d
commit
b1aff41ce9
|
@ -192,6 +192,15 @@ llvm::Value* coerce(BitcodeEmitter::Private *d, llvm::Value *val, llvm::Type *to
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
bool convertAndStore(BitcodeEmitter::Private *d, llvm::AllocaInst *dest, llvm::Value *expression) {
|
||||||
|
llvm::Type *varType = dest->getAllocatedType();
|
||||||
|
expression = coerce(d, expression, varType);
|
||||||
|
if (expression == nullptr) return false;
|
||||||
|
d->builder.CreateStore(expression, dest);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
BitcodeEmitter::BitcodeEmitter() {
|
BitcodeEmitter::BitcodeEmitter() {
|
||||||
module = std::unique_ptr<llvm::Module>(
|
module = std::unique_ptr<llvm::Module>(
|
||||||
new llvm::Module("monicelli", getGlobalContext())
|
new llvm::Module("monicelli", getGlobalContext())
|
||||||
|
@ -244,15 +253,6 @@ bool BitcodeEmitter::emit(Loop const& node) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
bool convertAndStore(BitcodeEmitter::Private *d, llvm::AllocaInst *dest, llvm::Value *expression) {
|
|
||||||
llvm::Type *varType = dest->getAllocatedType();
|
|
||||||
expression = coerce(d, expression, varType);
|
|
||||||
if (expression == nullptr) return false;
|
|
||||||
d->builder.CreateStore(expression, dest);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BitcodeEmitter::emit(VarDeclaration const& node) {
|
bool BitcodeEmitter::emit(VarDeclaration const& node) {
|
||||||
llvm::Function *father = d->builder.GetInsertBlock()->getParent();
|
llvm::Function *father = d->builder.GetInsertBlock()->getParent();
|
||||||
llvm::Type *varType = LLVMType(node.getType());
|
llvm::Type *varType = LLVMType(node.getType());
|
||||||
|
|
Reference in New Issue
Block a user