2009-12-04 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / mini-llvm-cpp.cpp
index f379b20c666ebc941d17288a7778be674561db2d..4564a0540753c6afe9c0f7c9320d11ceb4dca3a7 100644 (file)
@@ -67,16 +67,18 @@ public:
     unsigned char *getGOTBase() const {
                return mm->getGOTBase ();
     }
-    
+
+#if LLVM_MAJOR_VERSION == 2 && LLVM_MINOR_VERSION < 7
     void *getDlsymTable() const {
                return mm->getDlsymTable ();
     }
 
+       void SetDlsymTable(void *ptr);
+#endif
+
        void setPoisonMemory(bool) {
        }
-      
-       void SetDlsymTable(void *ptr);
-  
+
        unsigned char *startFunctionBody(const Function *F, 
                                                                         uintptr_t &ActualSize);
   
@@ -98,6 +100,14 @@ public:
        void endExceptionTable(const Function *F, unsigned char *TableStart,
                                                   unsigned char *TableEnd, 
                                                   unsigned char* FrameRegister);
+
+#if LLVM_MAJOR_VERSION == 2 && LLVM_MINOR_VERSION >= 7
+       virtual void deallocateFunctionBody(void*) {
+       }
+
+       virtual void deallocateExceptionTable(void*) {
+       }
+#endif
 };
 
 MonoJITMemoryManager::MonoJITMemoryManager ()
@@ -125,13 +135,15 @@ MonoJITMemoryManager::AllocateGOT()
 {
        mm->AllocateGOT ();
 }
-  
+
+#if LLVM_MAJOR_VERSION == 2 && LLVM_MINOR_VERSION < 7  
 void
 MonoJITMemoryManager::SetDlsymTable(void *ptr)
 {
        mm->SetDlsymTable (ptr);
 }
-  
+#endif
+
 unsigned char *
 MonoJITMemoryManager::startFunctionBody(const Function *F, 
                                        uintptr_t &ActualSize)
@@ -220,6 +232,13 @@ mono_llvm_build_volatile_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
        return wrap(unwrap(builder)->CreateLoad(unwrap(PointerVal), true, Name));
 }
 
+void
+mono_llvm_replace_uses_of (LLVMValueRef var, LLVMValueRef v)
+{
+       Value *V = ConstantExpr::getTruncOrBitCast (unwrap<Constant> (v), unwrap (var)->getType ());
+       unwrap (var)->replaceAllUsesWith (V);
+}
+
 static cl::list<const PassInfo*, bool, PassNameParser>
 PassList(cl::desc("Optimizations available:"));