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

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

memcpy/memset support for 32-bit systems; more error messages/handling; bug fix for ParabixCharacterClassKernelBuilder?. continued work on parenthesis matching + expandable buffers.

File size: 1.2 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#include <llvm/IR/Module.h>
13
14namespace IDISA {
15   
16IDISA_Builder * GetIDISA_Builder(llvm::Module * mod) {
17    const bool hasAVX2 = AVX2_available();
18    DataLayout DL(mod);
19    Type * const intTy = DL.getIntPtrType(mod->getContext());
20    const auto registerWidth = intTy->getIntegerBitWidth();
21    if (LLVM_LIKELY(codegen::BlockSize == 0)) {  // No BlockSize override: use processor SIMD width
22        codegen::BlockSize = hasAVX2 ? 256 : 128;
23    }
24    if (codegen::BlockSize >= 256) {
25        if (hasAVX2) {
26            return new IDISA_AVX2_Builder(mod, registerWidth, codegen::BlockSize);
27        }
28    } else if (codegen::BlockSize == 64) {
29        return new IDISA_I64_Builder(mod, registerWidth);
30    }
31    return new IDISA_SSE2_Builder(mod, registerWidth, codegen::BlockSize);
32}
33
34IDISA_Builder * GetIDISA_GPU_Builder(llvm::Module * mod) {
35    return new IDISA_NVPTX20_Builder(mod, 64);
36}
37
38}
Note: See TracBrowser for help on using the repository browser.