Add support for function stubs, which allow calling functions which need to
have an address available, but have not yet been code generated.
llvm-svn: 6059
diff --git a/llvm/lib/ExecutionEngine/JIT/VM.cpp b/llvm/lib/ExecutionEngine/JIT/VM.cpp
index 836e00e..6fd366e 100644
--- a/llvm/lib/ExecutionEngine/JIT/VM.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/VM.cpp
@@ -83,7 +83,10 @@
static bool isAlreadyCodeGenerating = false;
if (isAlreadyCodeGenerating) {
- assert(0 && "Recursive function stubs not handled yet!");
+ // Generate a function stub instead of reentering...
+ void *SAddr = emitStubForFunction(*F);
+ assert(SAddr && "Target machine doesn't support function stub generation!");
+ return SAddr;
}
// FIXME: JIT all of the functions in the module. Eventually this will JIT