Index: lib/CMakeLists.txt =================================================================== --- lib/CMakeLists.txt +++ lib/CMakeLists.txt @@ -68,6 +68,14 @@ if (GPU_CODEGEN) target_link_libraries(Polly PollyPPCG) + if (NOT LLVM_LINK_LLVM_DYLIB) + target_link_libraries(Polly + LLVMNVPTXCodeGen + LLVMNVPTXInfo + LLVMNVPTXDesc + LLVMNVPTXAsmPrinter + ) + endif (NOT LLVM_LINK_LLVM_DYLIB) endif (GPU_CODEGEN) target_link_libraries(Polly ${ISL_TARGET}) Index: lib/Support/RegisterPasses.cpp =================================================================== --- lib/Support/RegisterPasses.cpp +++ lib/Support/RegisterPasses.cpp @@ -35,6 +35,7 @@ #include "polly/Support/DumpModulePass.h" #include "llvm/Analysis/CFGPrinter.h" #include "llvm/IR/LegacyPassManager.h" +#include "llvm/Support/TargetSelect.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/Scalar.h" @@ -204,7 +205,13 @@ initializeCodeGenerationPass(Registry); #ifdef GPU_CODEGEN - initializePPCGCodeGenerationPass(Registry); + if (Target == TARGET_GPU) { + initializePPCGCodeGenerationPass(Registry); + LLVMInitializeNVPTXTarget(); + LLVMInitializeNVPTXTargetInfo(); + LLVMInitializeNVPTXTargetMC(); + LLVMInitializeNVPTXAsmPrinter(); + } #endif initializeCodePreparationPass(Registry); initializeDeadCodeElimPass(Registry);