1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
  
     | 
    
      set(LLVM_NO_RTTI 1)
set(ISL_CODEGEN_FILES
    CodeGen/IslAst.cpp
    CodeGen/IslExprBuilder.cpp
    CodeGen/IslNodeBuilder.cpp
    CodeGen/CodeGeneration.cpp)
if (GPU_CODEGEN)
  set (GPGPU_CODEGEN_FILES
       CodeGen/PPCGCodeGeneration.cpp
       CodeGen/ManagedMemoryRewrite.cpp
       )
endif (GPU_CODEGEN)
# Compile ISL into a separate library.
add_subdirectory(External)
set(POLLY_HEADER_FILES)
if (MSVC_IDE OR XCODE)
  file(GLOB_RECURSE POLLY_HEADER_FILES "${POLLY_SOURCE_DIR}/include/polly/*.h")
endif ()
# Use an object-library to add the same files to multiple libs without requiring
# the sources them to be recompiled for each of them.
add_library(PollyCore OBJECT
  Analysis/DependenceInfo.cpp
  Analysis/PolyhedralInfo.cpp
  Analysis/ScopDetection.cpp
  Analysis/ScopDetectionDiagnostic.cpp
  Analysis/ScopInfo.cpp
  Analysis/ScopBuilder.cpp
  Analysis/ScopGraphPrinter.cpp
  Analysis/ScopPass.cpp
  Analysis/PruneUnprofitable.cpp
  CodeGen/BlockGenerators.cpp
  ${ISL_CODEGEN_FILES}
  CodeGen/LoopGenerators.cpp
  CodeGen/IRBuilder.cpp
  CodeGen/Utils.cpp
  CodeGen/RuntimeDebugBuilder.cpp
  CodeGen/CodegenCleanup.cpp
  CodeGen/PerfMonitor.cpp
  ${GPGPU_CODEGEN_FILES}
  Exchange/JSONExporter.cpp
  Support/GICHelper.cpp
  Support/SCEVAffinator.cpp
  Support/SCEVValidator.cpp
  Support/RegisterPasses.cpp
  Support/ScopHelper.cpp
  Support/ScopLocation.cpp
  Support/ISLTools.cpp
  Support/DumpModulePass.cpp
  Support/VirtualInstruction.cpp
  ${POLLY_JSON_FILES}
  Transform/Canonicalization.cpp
  Transform/CodePreparation.cpp
  Transform/DeadCodeElimination.cpp
  Transform/ScheduleOptimizer.cpp
  Transform/FlattenSchedule.cpp
  Transform/FlattenAlgo.cpp
  Transform/ForwardOpTree.cpp
  Transform/DeLICM.cpp
  Transform/ZoneAlgo.cpp
  Transform/Simplify.cpp
  Transform/MaximalStaticExpansion.cpp
  Transform/RewriteByReferenceParameters.cpp
  Transform/ScopInliner.cpp
  ${POLLY_HEADER_FILES}
  )
set_target_properties(PollyCore PROPERTIES FOLDER "Polly")
# Create the library that can be linked into LLVM's tools and Polly's unittests.
# It depends on all library it needs, such that with
# LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as
# well.
add_polly_library(Polly $<TARGET_OBJECTS:PollyCore>)
target_link_libraries(Polly
  ${ISL_TARGET}
  ${JSONCPP_LIBRARIES}
)
# Additional dependencies for Polly-ACC.
if (GPU_CODEGEN)
  target_link_libraries(Polly PollyPPCG)
endif ()
# Polly-ACC requires the NVPTX backend to work. Ask LLVM about its libraries.
set(nvptx_libs)
if (GPU_CODEGEN)
  # This call emits an error if they NVPTX backend is not enable.
  llvm_map_components_to_libnames(nvptx_libs NVPTX)
endif ()
if (LLVM_LINK_LLVM_DYLIB)
  # The shlib/dylib contains all the LLVM components
  # (including NVPTX is enabled) already. Adding them to target_link_libraries
  # would cause them being twice in the address space
  # (their LLVM*.a/so and their copies in libLLVM.so)
  # which results in errors when the two instances try to register the same
  # command-line switches.
  target_link_libraries(Polly LLVM)
else ()
  target_link_libraries(Polly
    LLVMSupport
    LLVMCore
    LLVMScalarOpts
    LLVMInstCombine
    LLVMTransformUtils
    LLVMAnalysis
    LLVMipo
    LLVMMC
    LLVMPasses
    LLVMLinker
    LLVMIRReader
    ${nvptx_libs}
    # The libraries below are required for darwin: http://PR26392
    LLVMBitReader
    LLVMMCParser
    LLVMObject
    LLVMProfileData
    LLVMTarget
    LLVMVectorize
    )
endif ()
# Create a loadable module Polly.so that can be loaded using
# LLVM's/clang's "-load" option.
if (MSVC)
  # Add dummy target, because loadable modules are not supported on Windows
  add_custom_target(LLVMPolly)
  set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
else ()
  add_polly_loadable_module(LLVMPolly
    Polly.cpp
    $<TARGET_OBJECTS:PollyCore>
  )
  # Only add the dependencies that are not part of LLVM. The latter are assumed
  # to be already available in the address space the module is loaded into.
  # Adding them once more would have the effect that both copies try to register
  # the same command line options, to which LLVM reacts with an error.
  # If Polly-ACC is enabled, the NVPTX target is also expected to reside in the
  # hosts. This is not the case for bugpoint. Use LLVM_POLLY_LINK_INTO_TOOLS=ON
  # instead which will automatically resolve the additional dependencies by
  # Polly.
  target_link_libraries(LLVMPolly ${ISL_TARGET} ${JSONCPP_LIBRARIES})
  if (GPU_CODEGEN)
    target_link_libraries(LLVMPolly PollyPPCG)
  endif ()
  set_target_properties(LLVMPolly
    PROPERTIES
    LINKER_LANGUAGE CXX
    PREFIX "")
endif ()
if (TARGET intrinsics_gen)
  # Check if we are building as part of an LLVM build
  add_dependencies(PollyCore intrinsics_gen)
endif()
 
     |