source: icGREP/icgrep-devel/icgrep/IR_Gen/idisa_target.cpp @ 5324

Last change on this file since 5324 was 5324, checked in by nmedfort, 3 years ago

Attempt to diagnose / fix issue on jenkins server.

File size: 1.6 KB
RevLine 
[4984]1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5
[5260]6#include "idisa_target.h"
[5033]7#include <toolchain.h>
[5238]8#include <IR_Gen/idisa_avx_builder.h>
9#include <IR_Gen/idisa_sse_builder.h>
10#include <IR_Gen/idisa_i64_builder.h>
11#include <IR_Gen/idisa_nvptx_builder.h>
[5320]12#include <llvm/IR/Module.h>
[5323]13#include <llvm/ADT/Triple.h>
[4984]14
[5033]15namespace IDISA {
16   
[5267]17IDISA_Builder * GetIDISA_Builder(llvm::Module * mod) {
[5323]18    if (LLVM_UNLIKELY(mod == nullptr)) {
19        report_fatal_error("GetIDISA_Builder: module cannot be null");
20    }
21    if (LLVM_LIKELY(mod->getTargetTriple().empty())) {
22        mod->setTargetTriple(llvm::sys::getProcessTriple());
23    }
24    Triple T(mod->getTargetTriple());
[5324]25    unsigned registerWidth = 0;
26    if (T.isArch64Bit()) {
27        registerWidth = 64;
28    } else if (T.isArch32Bit()) {
29        registerWidth = 32;
30    } else if (T.isArch16Bit()) {
31        registerWidth = 16;
[5323]32    }
[5324]33    const bool hasAVX2 = AVX2_available();
[5217]34    if (LLVM_LIKELY(codegen::BlockSize == 0)) {  // No BlockSize override: use processor SIMD width
35        codegen::BlockSize = hasAVX2 ? 256 : 128;
[4984]36    }
[5217]37    if (codegen::BlockSize >= 256) {
[4984]38        if (hasAVX2) {
[5320]39            return new IDISA_AVX2_Builder(mod, registerWidth, codegen::BlockSize);
[4984]40        }
[5217]41    } else if (codegen::BlockSize == 64) {
[5320]42        return new IDISA_I64_Builder(mod, registerWidth);
[4984]43    }
[5320]44    return new IDISA_SSE2_Builder(mod, registerWidth, codegen::BlockSize);
[4984]45}
46
[5267]47IDISA_Builder * GetIDISA_GPU_Builder(llvm::Module * mod) {
[5151]48    return new IDISA_NVPTX20_Builder(mod, 64);
[5037]49}
[5151]50
51}
Note: See TracBrowser for help on using the repository browser.