| Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
|
| ===================================================================
|
| --- a/llvm/lib/CodeGen/IntrinsicLowering.cpp
|
| +++ b/llvm/lib/CodeGen/IntrinsicLowering.cpp
|
| @@ -17,7 +17,6 @@
|
| #include "llvm/Type.h"
|
| #include "llvm/CodeGen/IntrinsicLowering.h"
|
| #include "llvm/Support/CallSite.h"
|
| -#include "llvm/Support/CommandLine.h" // @LOCALMOD
|
| #include "llvm/Support/ErrorHandling.h"
|
| #include "llvm/Support/IRBuilder.h"
|
| #include "llvm/Support/raw_ostream.h"
|
| @@ -25,19 +24,6 @@
|
| #include "llvm/ADT/SmallVector.h"
|
| using namespace llvm;
|
|
|
| -// @LOCALMOD-BEGIN
|
| -static cl::opt<bool>
|
| - AddNaClReadTPDep("add-nacl-read-tp-dependency",
|
| - cl::desc("Add __nacl_read_tp dependency to bitcode modules"),
|
| - cl::init(false));
|
| -
|
| -// We use this when we want to link libgcc as bitcode
|
| -static cl::opt<bool>
|
| - AddLibgccDeps("add-libgcc-dependencies",
|
| - cl::desc("Add libgcc dependencies to bitcode modules"),
|
| - cl::init(false));
|
| -// @LOCALMOD-END
|
| -
|
| template <class ArgIt>
|
| static void EnsureFunctionExists(Module &M, const char *Name,
|
| ArgIt ArgBegin, ArgIt ArgEnd,
|
| @@ -107,63 +93,6 @@
|
| #endif
|
|
|
| // @LOCALMOD-BEGIN
|
| -// NOTE: we are experimenting with the idea of providing libgcc
|
| -// in a bitcode (derived) form. If this works out libgcc will not
|
| -// differ between platforms anymore, and the list of symbols below will
|
| -// be what is guaranteed to be included with libgcc.
|
| -// If for some reason a backend needs additional functions
|
| -// it would have generated them itself.
|
| -// NOTE: llvm bitcode does not preserve signedness of types so the type
|
| -// annotation below is simplified:
|
| -// s: i32
|
| -// d: i64
|
| -// f: f32
|
| -// F: f64
|
| -// The first letter denotes the return type the remaining one the
|
| -// parameter types.
|
| -static const struct { const char* name; const char* types; }
|
| - LibgccIntrinsicNames[] = {
|
| - /* RTLIB::SDIV_I32 */ {"__divsi3", "sss"},
|
| - /* RTLIB::SDIV_I64 */ {"__divdi3", "ddd"},
|
| -
|
| - /* RTLIB::UDIV_I32 */ {"__udivsi3", "sss"},
|
| - /* RTLIB::UDIV_I64 */ {"__udivdi3", "ddd"},
|
| -
|
| - /* RTLIB::SREM_I32 */ {"__modsi3", "sss"},
|
| - /* RTLIB::SREM_I64 */ {"__moddi3", "ddd"},
|
| -
|
| - /* RTLIB::UREM_I32 */ {"__umodsi3", "sss"},
|
| - /* RTLIB::UREM_I64 */ {"__umoddi3", "ddd"},
|
| -
|
| - /* RTLIB::FPTOSINT_F32_I32 */ {"__fixsfsi", "sf"},
|
| - /* RTLIB::FPTOSINT_F32_I64 */ {"__fixsfdi", "df"},
|
| -
|
| - /* RTLIB::FPTOSINT_F64_I32 */ {"__fixdfsi", "sF"},
|
| - /* RTLIB::FPTOSINT_F64_I64 */ {"__fixdfdi", "dF"},
|
| -
|
| - /* RTLIB::FPTOUINT_F32_I32 */ {"__fixunssfsi", "sf"},
|
| - /* RTLIB::FPTOUINT_F32_I64 */ {"__fixunssfdi", "dF"},
|
| -
|
| - /* RTLIB::FPTOUINT_F64_I32 */ {"__fixunsdfsi", "sF"},
|
| - /* RTLIB::FPTOUINT_F64_I64 */ {"__fixunsdfdi", "dF"},
|
| -
|
| - /* RTLIB::SINTTOFP_I32_F32 */ {"__floatsisf", "fs"},
|
| - /* RTLIB::SINTTOFP_I32_F64 */ {"__floatsidf", "Fs"},
|
| -
|
| - /* RTLIB::SINTTOFP_I64_F32 */ {"__floatdisf", "fd"},
|
| - /* RTLIB::SINTTOFP_I64_F64 */ {"__floatdidf", "Fd"},
|
| -
|
| - /* RTLIB::UINTTOFP_I32_F32 */ {"__floatunsisf", "fs"},
|
| - /* RTLIB::UINTTOFP_I32_F64 */ {"__floatunsidf", "Fs"},
|
| -
|
| - /* RTLIB::UINTTOFP_I64_F32 */ {"__floatundisf", "fd"},
|
| - /* RTLIB::UINTTOFP_I64_F64 */ {"__floatundidf", "Fd"},
|
| -
|
| - /* RTLIB::POWI_F32 */ {"__powisf2", "ffs"},
|
| - /* RTLIB::POWI_F64 */ {"__powidf2", "FFs"},
|
| - {NULL, NULL}
|
| -};
|
| -
|
| // Calls to these functions may materialize as part of a conversion
|
| // from an intrinsics, e.g. llvm.memset -> memset
|
| // So if these functions are available in bitcode form we need to:
|
| @@ -173,7 +102,7 @@
|
| // Both problems are avoided by pretending there are unknown callers.
|
| // The function: IntrinsicLowering::AddPrototypes() below does just that.
|
| // TODO(robertm): elaborate some more
|
| -static const char *MiscIntrinsicNames[] = {
|
| +static const char *IntrinsicNames[] = {
|
| "abort",
|
| "memcpy", "memset", "memmove",
|
| "sqrtf", "sqrt", "sqrtl",
|
| @@ -185,7 +114,6 @@
|
| "log10f", "log10", "log10l",
|
| "expf", "exp", "expl",
|
| "exp2f", "exp2", "exp2l",
|
| - "__nacl_read_tp",
|
| NULL
|
| };
|
|
|
| @@ -193,11 +121,8 @@
|
|
|
| const StringSet<> &IntrinsicLowering::GetFuncNames() {
|
| if (FuncNames.empty()) {
|
| - for (unsigned i=0; MiscIntrinsicNames[i]; ++i)
|
| - FuncNames.insert(MiscIntrinsicNames[i]);
|
| -
|
| - for (unsigned i=0; LibgccIntrinsicNames[i].name; ++i)
|
| - FuncNames.insert(LibgccIntrinsicNames[i].name);
|
| + for (unsigned i=0; IntrinsicNames[i]; ++i)
|
| + FuncNames.insert(IntrinsicNames[i]);
|
| }
|
| return FuncNames;
|
| }
|
| @@ -209,51 +134,6 @@
|
|
|
| void IntrinsicLowering::AddPrototypes(Module &M) {
|
| LLVMContext &Context = M.getContext();
|
| -
|
| - // @LOCALMOD-BEGIN
|
| - // Calls to __nacl_read_tp may be generated by codegen on X86-64
|
| - // in non-PIC TLS mode. Since __nacl_read_tp exists in a bitcode
|
| - // archive, it is necessary to add a dependency to it during
|
| - // bitcode linking, so that it gets included in the link.
|
| - if (AddNaClReadTPDep) {
|
| - Type *RetTy = Type::getInt8PtrTy(Context);
|
| - M.getOrInsertFunction("__nacl_read_tp", RetTy, (Type*)0);
|
| - }
|
| -
|
| - // If we link libgcc we need to add a dependency to all its functions
|
| - // during bitcode linking, so that they get included in the link.
|
| -
|
| - if (AddLibgccDeps) {
|
| - Type *CharToTypeMap[128];
|
| - for (unsigned i=0; i < 128; ++i) {
|
| - CharToTypeMap[i] = 0;
|
| - }
|
| - CharToTypeMap['f'] = Type::getFloatTy(Context);
|
| - CharToTypeMap['F'] = Type::getDoubleTy(Context);
|
| - CharToTypeMap['s'] = Type::getInt32Ty(Context);
|
| - CharToTypeMap['d'] = Type::getInt64Ty(Context);
|
| -
|
| - for (unsigned i=0; LibgccIntrinsicNames[i].name; ++i) {
|
| - Type *RetTy = 0;
|
| - std::vector<Type *> ParamTys;
|
| - const char* name = LibgccIntrinsicNames[i].name;
|
| - const char* params = LibgccIntrinsicNames[i].types;
|
| - for (unsigned j=0; params[j]; ++j) {
|
| - Type *Current = CharToTypeMap[params[j]];
|
| - assert (Current != 0);
|
| - if (j == 0) {
|
| - RetTy = Current;
|
| - } else {
|
| - ParamTys.push_back(Current);
|
| - }
|
| - }
|
| - M.getOrInsertFunction(name, FunctionType::get(RetTy,
|
| - makeArrayRef(ParamTys),
|
| - false));
|
| - }
|
| - }
|
| - // @LOCALMOD-END
|
| -
|
| for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
|
| if (I->isDeclaration() && !I->use_empty())
|
| switch (I->getIntrinsicID()) {
|
|
|