[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 15 18:07:15 PDT 2004



Changes in directory llvm/lib/ExecutionEngine/JIT:

JIT.cpp updated: 1.42 -> 1.43
---
Log message:

Add a special case for argc,argv


---
Diffs of the changes:  (+13 -2)

Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.42 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.43
--- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.42	Sun Aug 15 19:14:18 2004
+++ llvm/lib/ExecutionEngine/JIT/JIT.cpp	Sun Aug 15 20:07:04 2004
@@ -77,8 +77,7 @@
   if (RetTy == Type::IntTy || RetTy == Type::UIntTy || RetTy == Type::VoidTy) {
     switch (ArgValues.size()) {
     case 3:
-      if (FTy->getNumParams() == 3 && 
-          (FTy->getParamType(0) == Type::IntTy || 
+      if ((FTy->getParamType(0) == Type::IntTy || 
            FTy->getParamType(0) == Type::UIntTy) &&
           isa<PointerType>(FTy->getParamType(1)) &&
           isa<PointerType>(FTy->getParamType(2))) {
@@ -92,6 +91,18 @@
         return rv;
       }
       break;
+    case 2:
+      if ((FTy->getParamType(0) == Type::IntTy || 
+           FTy->getParamType(0) == Type::UIntTy) &&
+          isa<PointerType>(FTy->getParamType(1))) {
+        int (*PF)(int, char **) = (int(*)(int, char **))FPtr;
+        
+        // Call the function.
+        GenericValue rv;
+        rv.IntVal = PF(ArgValues[0].IntVal, (char **)GVTOP(ArgValues[1]));
+        return rv;
+      }
+      break;
     case 1:
       if (FTy->getNumParams() == 1 &&
           (FTy->getParamType(0) == Type::IntTy || 






More information about the llvm-commits mailing list