Extracting method BitcodeEmitter::emitFunctionPrototype()
This commit is contained in:
parent
c0bfd4757f
commit
287d543b34
|
@ -438,9 +438,7 @@ bool BitcodeEmitter::emit(Branch const& node) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BitcodeEmitter::emit(Function const& node) {
|
bool BitcodeEmitter::emitFunctionPrototype(Function const& node, llvm::Function **proto) {
|
||||||
d->scope.enter();
|
|
||||||
|
|
||||||
std::vector<llvm::Type*> argTypes;
|
std::vector<llvm::Type*> argTypes;
|
||||||
|
|
||||||
for (FunArg const* arg: node.getArgs()) {
|
for (FunArg const* arg: node.getArgs()) {
|
||||||
|
@ -492,6 +490,17 @@ bool BitcodeEmitter::emit(Function const& node) {
|
||||||
++argToEmit;
|
++argToEmit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*proto = func;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BitcodeEmitter::emit(Function const& node) {
|
||||||
|
llvm::Function *func = nullptr;
|
||||||
|
GUARDED(emitFunctionPrototype(node, &func));
|
||||||
|
|
||||||
|
d->scope.enter();
|
||||||
|
|
||||||
llvm::BasicBlock *bb = llvm::BasicBlock::Create(
|
llvm::BasicBlock *bb = llvm::BasicBlock::Create(
|
||||||
getGlobalContext(), "entry", func
|
getGlobalContext(), "entry", func
|
||||||
);
|
);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class Module;
|
class Module;
|
||||||
|
class Function;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace monicelli {
|
namespace monicelli {
|
||||||
|
@ -65,6 +66,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool emitSemiExpression(Id const& left, SemiExpression const& right);
|
bool emitSemiExpression(Id const& left, SemiExpression const& right);
|
||||||
|
bool emitFunctionPrototype(Function const& node, llvm::Function **proto);
|
||||||
|
|
||||||
std::unique_ptr<llvm::Module> module;
|
std::unique_ptr<llvm::Module> module;
|
||||||
Private *d;
|
Private *d;
|
||||||
|
|
Reference in New Issue
Block a user