diff --git a/BitcodeEmitter.cpp b/BitcodeEmitter.cpp index 2cee78b..b78887a 100644 --- a/BitcodeEmitter.cpp +++ b/BitcodeEmitter.cpp @@ -192,6 +192,15 @@ llvm::Value* coerce(BitcodeEmitter::Private *d, llvm::Value *val, llvm::Type *to 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() { module = std::unique_ptr( new llvm::Module("monicelli", getGlobalContext()) @@ -244,15 +253,6 @@ bool BitcodeEmitter::emit(Loop const& node) { 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) { llvm::Function *father = d->builder.GetInsertBlock()->getParent(); llvm::Type *varType = LLVMType(node.getType());