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

Last change on this file since 5238 was 5238, checked in by cameron, 2 years ago

IR_Gen subdirectory for all IR generation utility functions

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 <toolchain.h>
7#include <IR_Gen/idisa_avx_builder.h>
8#include <IR_Gen/idisa_sse_builder.h>
9#include <IR_Gen/idisa_i64_builder.h>
10#include <IR_Gen/idisa_nvptx_builder.h>
11
12namespace IDISA {
13   
14IDISA_Builder * GetIDISA_Builder(Module * mod) {
15    const bool hasAVX2 = AVX2_available();
16    const bool isArch32Bit = Triple(llvm::sys::getProcessTriple()).isArch32Bit();
17    if (LLVM_LIKELY(codegen::BlockSize == 0)) {  // No BlockSize override: use processor SIMD width
18        codegen::BlockSize = hasAVX2 ? 256 : 128;
19    }
20    if (codegen::BlockSize >= 256) {
21        if (hasAVX2) {
22            return new IDISA_AVX2_Builder(mod, isArch32Bit ? 32 : 64, codegen::BlockSize);
23        }
24    } else if (codegen::BlockSize == 64) {
25        return new IDISA_I64_Builder(mod, isArch32Bit ? 32 : 64);
26    }
27    return new IDISA_SSE2_Builder(mod, isArch32Bit ? 32 : 64, codegen::BlockSize);
28}
29
30IDISA_Builder * GetIDISA_GPU_Builder(Module * mod) {
31    return new IDISA_NVPTX20_Builder(mod, 64);
32}
33
34}
Note: See TracBrowser for help on using the repository browser.