Commit 4f536b8e authored by George Stelle's avatar George Stelle
Browse files

Re-added LD_LIBRARY_PATH opencilk functionality

parent fcb8a7a9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21,8 +21,10 @@
#include "llvm/Transforms/Tapir/CudaABI.h"
#include "llvm/Transforms/Tapir/OpenCilkABI.h"
#include "llvm/Transforms/Tapir/OpenMPABI.h"
#include "llvm/Transforms/Tapir/OpenCLABI.h"
#include "llvm/Transforms/Tapir/Outline.h"
#include "llvm/Transforms/Tapir/QthreadsABI.h"
#include "llvm/Transforms/Tapir/RealmABI.h"
#include "llvm/Transforms/Tapir/SerialABI.h"
#include "llvm/Transforms/Tapir/TapirLoopInfo.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -51,8 +53,12 @@ TapirTarget *llvm::getTapirTargetFromID(Module &M, TapirTargetID ID) {
    return new OpenCilkABI(M);
  case TapirTargetID::OpenMP:
    return new OpenMPABI(M);
  case TapirTargetID::OpenCL:
    return new OpenCLABI(M);
  case TapirTargetID::Qthreads:
    return new QthreadsABI(M);
  case TapirTargetID::Realm:
    return new RealmABI(M);
  default:
    llvm_unreachable("Invalid TapirTargetID");
  }
+10 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "llvm/Transforms/Utils/EscapeEnumerator.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/TapirUtils.h"
#include "llvm/Support/Process.h"

using namespace llvm;

@@ -86,8 +87,14 @@ void OpenCilkABI::prepareModule() {
  Type *Int32Ty = Type::getInt32Ty(C);

  if (UseOpenCilkRuntimeBC) {
    assert("" != OpenCilkRuntimeBCPath &&
           "Missing path to OpenCilk runtime bitcode file.");
    Optional<std::string> path; 
    if("" == OpenCilkRuntimeBCPath){
      path = sys::Process::FindInEnvPath("LD_LIBRARY_PATH", "libopencilk-abi.bc");
      assert(path.hasValue() &&
             "Couldn't find OpenCilk runtime bitcode file in LD_LIBRARY_PATH.");
    } else {
      path = OpenCilkRuntimeBCPath.getValue();
    }
    LLVM_DEBUG(dbgs() << "Using external bitcode file for OpenCilk ABI: "
                      << OpenCilkRuntimeBCPath << "\n");
    SMDiagnostic SMD;
@@ -95,7 +102,7 @@ void OpenCilkABI::prepareModule() {
    // Parse the bitcode file.  This call imports structure definitions, but not
    // function definitions.
    std::unique_ptr<Module> ExternalModule =
        parseIRFile(OpenCilkRuntimeBCPath.getValue(), SMD, C);
        parseIRFile(*path, SMD, C);

    // Strip any debug info from the external module.  For convenience, this
    // Tapir target synthesizes some helper functions, like