Remove inline asm boost hack: not needed for MCJIT.

This commit is contained in:
Axel Naumann 2015-01-08 09:12:50 +01:00 committed by sftnight
parent baf51f6b04
commit 2ee6383c36

View File

@ -24,35 +24,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/DynamicLibrary.h"
namespace {
// From boost/detail/sp_counted_base.hpp.
// JIT cannot handle inline asm, thus compile these symbols and
// inject them when needed.
static int boost__detail__atomic_exchange_and_add( int * pw, int dv )
{
// int r = *pw;
// *pw += dv;
// return r;
#if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
int r;
__asm__ __volatile__
(
"lock\n\t"
"xadd %1, %0":
"=m"( *pw ), "=r"( r ): // outputs (%0, %1)
"m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1)
"memory", "cc" // clobbers
);
#else
int r = *pw;
*pw += dv;
#endif
return r;
}
}
using namespace llvm;
namespace cling {
@ -76,19 +47,6 @@ std::vector<IncrementalExecutor::LazyFunctionCreatorFunc_t>
m_SymbolsToRemap["__cxa_atexit"]
= std::make_pair((void*)0, std::string("cling_cxa_atexit"));
// Helper to cast a function pointer to a void*:
typedef int (*p2tfunc_t)();
union {
p2tfunc_t m_func;
void* m_ptr;
} p2f;
// Provide a symbol to common boost functions using inline asm such that the
// JIT does not need to compile it (and fail doing it due to inline asm).
p2f.m_func = (p2tfunc_t) &boost__detail__atomic_exchange_and_add;
m_SymbolsToRemap["_ZN5boost6detail23atomic_exchange_and_addEPii"]
= std::make_pair((void*)p2f.m_ptr, std::string());
//
// Create an execution engine to use.
//