Changeset 5731 for icGREP


Ignore:
Timestamp:
Nov 11, 2017, 2:56:39 PM (17 months ago)
Author:
cameron
Message:

LLVM_VERSION_INTEGER allows ordered comparisons, initial preparation for LLVM 3.9.0

Location:
icGREP/icgrep-devel/icgrep
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r5725 r5731  
    199199
    200200# detect LLVM version and add compiler flags.
     201MATH(EXPR LLVM_VERSION_INTEGER "${LLVM_VERSION_MAJOR} * 10000 + ${LLVM_VERSION_MINOR} * 100 + ${LLVM_VERSION_PATCH}")
     202SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLLVM_VERSION_INTEGER=${LLVM_VERSION_INTEGER}")
    201203SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLLVM_VERSION_major=${LLVM_VERSION_MAJOR} -DLLVM_VERSION_MINOR=${LLVM_VERSION_MINOR}")
    202 IF (${LLVM_VERSION_MAJOR} EQUAL 3)
    203   IF (${LLVM_VERSION_MINOR} EQUAL 6)
    204     message(STATUS "Found LLVM ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
    205     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LLVM_3_6")
    206   ELSEIF (${LLVM_VERSION_MINOR} EQUAL 7)
    207     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LLVM_3_7")
    208   ENDIF()
    209 ENDIF()
    210204
    211205SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPARABIX_VERSION='\"${Parabix_REVISION}\"'")
  • icGREP/icgrep-devel/icgrep/lz4d.cpp

    r5706 r5731  
    1313#include <llvm/Support/Signals.h>
    1414#include <llvm/Support/ManagedStatic.h>
     15#include <toolchain/toolchain.h>
     16
    1517#include <IR_Gen/idisa_target.h>
    1618#include <boost/filesystem.hpp>
     
    1921#include <lz4FrameDecoder.h>
    2022#include <cc/cc_compiler.h>
    21 #include <toolchain/toolchain.h>
    2223#include <kernels/cc_kernel.h>
    2324#include <kernels/streamset.h>
     
    3031#include <kernels/kernel_builder.h>
    3132#include <toolchain/cpudriver.h>
    32 
     33#include <llvm/Support/raw_ostream.h>
    3334#include <string>
    3435#include <iostream>
  • icGREP/icgrep-devel/icgrep/toolchain/NVPTXDriver.cpp

    r5646 r5731  
    2222#include <llvm/Support/ToolOutputFile.h>
    2323#include <llvm/Target/TargetMachine.h>
     24#if LLVM_VERSION_INTEGER >= LLVM_3_9_0
     25#include <llvm/Transforms/Scalar/GVN.h>
     26#endif
    2427
    2528using namespace llvm;
     
    4043    initializeLoopStrengthReducePass(*Registry);
    4144    initializeLowerIntrinsicsPass(*Registry);
     45#if LLVM_VERSION_INTEGER < LLVM_3_9_0
    4246    initializeUnreachableBlockElimPass(*Registry);
    43 
     47#else
     48    initializeUnreachableBlockElimLegacyPassPass(*Registry);
     49#endif
     50   
    4451    mMainModule->setDataLayout("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
    4552    mMainModule->setTargetTriple("nvptx64-nvidia-cuda");
     
    136143        AnalysisID StopAfterID = nullptr;
    137144        const PassRegistry *PR = PassRegistry::getPassRegistry();
    138         if (!codegen::RunPass.empty()) {
    139             if (!codegen::StartAfter.empty() || !codegen::StopAfter.empty()) {
    140                 errs() << "start-after and/or stop-after passes are redundant when run-pass is specified.\n";
    141                 return 1;
    142             }
    143             const PassInfo *PI = PR->getPassInfo(codegen::RunPass);
    144             if (!PI) {
    145                 errs() << "run-pass pass is not registered.\n";
    146                 return 1;
    147             }
    148             StopAfterID = StartBeforeID = PI->getTypeInfo();
    149         } else {
    150             if (!codegen::StartAfter.empty()) {
    151                 const PassInfo *PI = PR->getPassInfo(codegen::StartAfter);
    152                 if (!PI) {
    153                     errs() << "start-after pass is not registered.\n";
    154                     return 1;
    155                 }
    156                 StartAfterID = PI->getTypeInfo();
    157             }
    158             if (!codegen::StopAfter.empty()) {
    159                 const PassInfo *PI = PR->getPassInfo(codegen::StopAfter);
    160                 if (!PI) {
    161                     errs() << "stop-after pass is not registered.\n";
    162                     return 1;
    163                 }
    164                 StopAfterID = PI->getTypeInfo();
    165             }
    166         }
    167 
    168145        // Ask the target to add backend passes as necessary.
    169146        if (Target->addPassesToEmitFile(PM, *OS, codegen::FileType, false, StartBeforeID,
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp

    r5706 r5731  
    22
    33#include <IR_Gen/idisa_target.h>
     4#include <toolchain/toolchain.h>
    45#include <llvm/ExecutionEngine/ExecutionEngine.h>  // for EngineBuilder
    56#include <llvm/IR/LegacyPassManager.h>             // for PassManager
     
    1314#include <llvm/Target/TargetOptions.h>             // for TargetOptions
    1415#include <llvm/Transforms/Scalar.h>
     16#if LLVM_VERSION_INTEGER >= LLVM_3_9_0
     17#include <llvm/Transforms/Scalar/GVN.h>
     18#endif
    1519#include <llvm/Transforms/Utils/Local.h>
    1620#include <toolchain/object_cache.h>
    17 #include <toolchain/toolchain.h>
    1821#include <toolchain/pipeline.h>
    1922#include <kernels/kernel_builder.h>
     
    178181    }
    179182
    180     #ifndef USE_LLVM_3_6
     183#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    181184    if (LLVM_UNLIKELY(codegen::DebugOptionIsSet(codegen::ShowASM))) {
    182185        if (codegen::ASMOutputFilename) {
     
    190193        }
    191194    }
    192     #endif
     195#endif
    193196
    194197    Module * module = nullptr;
  • icGREP/icgrep-devel/icgrep/toolchain/object_cache.cpp

    r5646 r5731  
    184184        sys::path::replace_extension(objectName, ".kernel");
    185185        raw_fd_ostream kernelFile(objectName.str(), EC, sys::fs::F_None);
    186         WriteBitcodeToFile(header.get(), kernelFile, false, false);
     186        WriteBitcodeToFile(header.get(), kernelFile);
    187187        kernelFile.close();
    188188    }
     
    236236    // $HOME/.cache/parabix/
    237237    Path cachePath;
    238     #ifndef USE_LLVM_3_6
    239     sys::path::user_cache_directory(cachePath, "parabix");
    240     #else
     238#if LLVM_VERSION_INTEGER < LLVM_3_7_0
     239    sys::path::user_cache_directory(cachePath, "parabix", PARABIX_VERSION);
     240#else
    241241    sys::path::home_directory(cachePath);
    242     sys::path::append(cachePath, ".cache", "parabix");
    243     #endif
     242    sys::path::append(cachePath, ".cache", "parabix", PARABIX_VERSION);
     243#endif
    244244    return cachePath;
    245245}
  • icGREP/icgrep-devel/icgrep/toolchain/toolchain.cpp

    r5721 r5731  
    2727                        clEnumVal(ShowIR, "Print optimized LLVM IR."),
    2828                        clEnumVal(VerifyIR, "Run the IR verification pass."),
    29 #ifndef USE_LLVM_3_6
     29#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    3030                        clEnumVal(ShowASM, "Print assembly code."),
    3131#endif
     
    4040                                                       cl::desc("output IR filename"), cl::cat(CodeGenOptions));
    4141
    42 #ifndef USE_LLVM_3_6
     42#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    4343static cl::opt<std::string> ASMOutputFilenameOption("asm-output", cl::init(""),
    4444                                                    cl::desc("output ASM filename"), cl::cat(CodeGenOptions));
     
    125125const std::string MArch = ::MArch;
    126126
    127 const std::string RunPass = ::RunPass;
    128 
    129127const llvm::TargetMachine::CodeGenFileType FileType = ::FileType;
    130 
    131 const std::string StopAfter = ::StopAfter;
    132 
    133 const std::string StartAfter = ::StartAfter;
    134128
    135129TargetOptions Options;
     
    161155    AddParabixVersionPrinter();
    162156    codegen::ProgramName = argv[0];
    163     #ifndef USE_LLVM_3_6
     157#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    164158    if (hiding.size() != 0) {
    165159        cl::HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *>(hiding));
    166160    }
    167     #endif
     161#endif
    168162    cl::ParseCommandLineOptions(argc, argv);
    169163    if (DebugOptions.getBits()) {
     
    174168    ASMOutputFilename = ASMOutputFilenameOption.empty() ? nullptr : ASMOutputFilenameOption.data();
    175169    Options = InitTargetOptionsFromCodeGenFlags();
    176     #ifndef USE_LLVM_3_6
     170#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    177171    Options.MCOptions.AsmVerbose = AsmVerbose;
    178     #endif
     172#endif
    179173    switch (OptLevelOption) {
    180174        case '0': OptLevel = CodeGenOpt::None; break;
  • icGREP/icgrep-devel/icgrep/toolchain/toolchain.h

    r5721 r5731  
    1212#include <llvm/Target/TargetOptions.h>
    1313#include <llvm/Target/TargetMachine.h>
     14
     15// #defines for comparison with LLVM_VERSION_INTEGER
     16#define LLVM_3_6_0 30600
     17#define LLVM_3_7_0 30700
     18#define LLVM_3_8_0 30800
     19#define LLVM_3_9_0 30900
     20#define LLVM_4_0_0 40000
     21#define LLVM_5_0_0 50000
     22
    1423
    1524// FIXME: llvm/CodeGen/CommandFlags.h can only be included once or the various cl::opt causes multiple definition
     
    2837    ShowIR,
    2938    VerifyIR,
    30 #ifndef USE_LLVM_3_6
     39#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    3140    ShowASM,
    3241#endif
     
    4352extern bool PipelineParallel;
    4453extern bool SegmentPipelineParallel;
    45 #ifndef USE_LLVM_3_6
     54#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    4655extern const char * ASMOutputFilename;
    4756#endif
Note: See TracChangeset for help on using the changeset viewer.