assert early instead of late for unimplemented feature
authorChris Lattner <sabre@nondot.org>
Thu, 8 May 2003 21:08:43 +0000 (21:08 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 8 May 2003 21:08:43 +0000 (21:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6050 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/VM.cpp

index c107438f0f2fd9f45f9f09efbe0190f42eb9d018..836e00e4fa8e40619d78a2e8a0998130cb0bbdd4 100644 (file)
@@ -81,10 +81,17 @@ void *VM::getPointerToFunction(const Function *F) {
   if (F->isExternal())
     return Addr = getPointerToNamedFunction(F->getName());
 
-  // JIT all of the functions in the module.  Eventually this will JIT functions
-  // on demand.  This has the effect of populating all of the non-external
-  // functions into the GlobalAddress table.
+  static bool isAlreadyCodeGenerating = false;
+  if (isAlreadyCodeGenerating) {
+    assert(0 && "Recursive function stubs not handled yet!");
+  }
+
+  // FIXME: JIT all of the functions in the module.  Eventually this will JIT
+  // functions on demand.  This has the effect of populating all of the
+  // non-external functions into the GlobalAddress table.
+  isAlreadyCodeGenerating = true;
   PM.run(getModule());
+  isAlreadyCodeGenerating = false;
 
   assert(Addr && "Code generation didn't add function to GlobalAddress table!");
   return Addr;