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;
|
||||
}
|
||||
|
||||
bool BitcodeEmitter::emit(Function const& node) {
|
||||
d->scope.enter();
|
||||
|
||||
bool BitcodeEmitter::emitFunctionPrototype(Function const& node, llvm::Function **proto) {
|
||||
std::vector<llvm::Type*> argTypes;
|
||||
|
||||
for (FunArg const* arg: node.getArgs()) {
|
||||
|
@ -492,6 +490,17 @@ bool BitcodeEmitter::emit(Function const& node) {
|
|||
++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(
|
||||
getGlobalContext(), "entry", func
|
||||
);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
namespace llvm {
|
||||
class Module;
|
||||
class Function;
|
||||
}
|
||||
|
||||
namespace monicelli {
|
||||
|
@ -65,6 +66,7 @@ public:
|
|||
|
||||
private:
|
||||
bool emitSemiExpression(Id const& left, SemiExpression const& right);
|
||||
bool emitFunctionPrototype(Function const& node, llvm::Function **proto);
|
||||
|
||||
std::unique_ptr<llvm::Module> module;
|
||||
Private *d;
|
||||
|
|
Reference in New Issue
Block a user