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

Last change on this file since 5260 was 5260, checked in by nmedfort, 2 years ago

Changes working towards simplifying accessing stream elements + some modifications to simplify include / forward declarations within the CodeGen? library.

File size: 1.1 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5
6#include "idisa_target.h"
7#include <toolchain.h>
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>
12
13namespace IDISA {
14   
15IDISA_Builder * GetIDISA_Builder(Module * mod) {
16    const bool hasAVX2 = AVX2_available();
17    const bool isArch32Bit = Triple(llvm::sys::getProcessTriple()).isArch32Bit();
18    if (LLVM_LIKELY(codegen::BlockSize == 0)) {  // No BlockSize override: use processor SIMD width
19        codegen::BlockSize = hasAVX2 ? 256 : 128;
20    }
21    if (codegen::BlockSize >= 256) {
22        if (hasAVX2) {
23            return new IDISA_AVX2_Builder(mod, isArch32Bit ? 32 : 64, codegen::BlockSize);
24        }
25    } else if (codegen::BlockSize == 64) {
26        return new IDISA_I64_Builder(mod, isArch32Bit ? 32 : 64);
27    }
28    return new IDISA_SSE2_Builder(mod, isArch32Bit ? 32 : 64, codegen::BlockSize);
29}
30
31IDISA_Builder * GetIDISA_GPU_Builder(Module * mod) {
32    return new IDISA_NVPTX20_Builder(mod, 64);
33}
34
35}
Note: See TracBrowser for help on using the repository browser.