source: icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h @ 4665

Last change on this file since 4665 was 4665, checked in by nmedfort, 4 years ago

Made pablo compiler reenterant through alternate compile method that takes a Module parameter.

File size: 2.4 KB
Line 
1#ifndef IDISA_BUILDER_H
2#define IDISA_BUILDER_H
3
4/*
5 *  Copyright (c) 2015 International Characters.
6 *  This software is licensed to the public under the Open Software License 3.0.
7 *  icgrep is a trademark of International Characters.
8 */
9#include <llvm/IR/Module.h>
10#include <llvm/IR/Type.h>
11#include <llvm/IR/Value.h>
12#include <llvm/IR/IRBuilder.h>
13
14using namespace llvm;
15
16namespace IDISA {
17
18class IDISA_Builder {
19public:
20
21    IDISA_Builder(Type * bitBlockType)
22    : mMod(nullptr)
23    , mLLVMBuilder(nullptr)
24    , mBitBlockType(bitBlockType)
25    , mBitBlockSize(bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth()) {
26
27    }
28
29    void initialize(Module * m, IRBuilder <> * b) {
30        mMod = m;
31        mLLVMBuilder = b;
32    }
33       
34    Value * simd_add(unsigned fw, Value * a, Value * b);
35    Value * simd_sub(unsigned fw, Value * a, Value * b);
36    Value * simd_mult(unsigned fw, Value * a, Value * b);
37    Value * simd_eq(unsigned fw, Value * a, Value * b);
38    Value * simd_gt(unsigned fw, Value * a, Value * b);
39    Value * simd_ugt(unsigned fw, Value * a, Value * b);
40    Value * simd_lt(unsigned fw, Value * a, Value * b);
41    Value * simd_ult(unsigned fw, Value * a, Value * b);
42    Value * simd_max(unsigned fw, Value * a, Value * b);
43    Value * simd_umax(unsigned fw, Value * a, Value * b);
44    Value * simd_min(unsigned fw, Value * a, Value * b);
45    Value * simd_umin(unsigned fw, Value * a, Value * b);
46   
47    Value * simd_slli(unsigned fw, Value * a, unsigned shift);
48    Value * simd_srli(unsigned fw, Value * a, unsigned shift);
49    Value * simd_srai(unsigned fw, Value * a, unsigned shift);
50   
51    Value * simd_cttz(unsigned fw, Value * a);
52   
53    Value * esimd_mergeh(unsigned fw, Value * a, Value * b);
54    Value * esimd_mergel(unsigned fw, Value * a, Value * b);
55   
56    Value * hsimd_packh(unsigned fw, Value * a, Value * b);
57    Value * hsimd_packl(unsigned fw, Value * a, Value * b);
58    Value * hsimd_signmask(unsigned fw, Value * a);
59
60    Value * mvmd_dslli(unsigned fw, Value * a, Value * b, unsigned shift);
61   
62    Value * bitblock_any(Value * a);
63
64
65private:
66    Module * mMod;
67    IRBuilder <> * mLLVMBuilder;
68    Type * mBitBlockType;
69    unsigned mBitBlockSize;
70   
71    Value * bitBlockCast(Value * a);
72    VectorType * fwVectorType(unsigned fw);
73    Value * fwCast(unsigned fw, Value * a);
74};
75
76}
77#endif // IDISA_BUILDER_H
Note: See TracBrowser for help on using the repository browser.