summaryrefslogtreecommitdiff
path: root/backend/src/llvm/llvm_to_gen.hpp
blob: 73e88194a503085547ddd8d84165d12c7616e530 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* 
 * Copyright © 2012 Intel Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Benjamin Segovia <benjamin.segovia@intel.com>
 */

/**
 * \file llvm_to_gen.hpp
 * \author Benjamin Segovia <benjamin.segovia@intel.com>
 */
#ifndef __GBE_IR_LLVM_TO_GEN_HPP__
#define __GBE_IR_LLVM_TO_GEN_HPP__
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 39
#include "llvm/IR/LLVMContext.h"
#endif

namespace gbe {
  namespace ir {
    // The code is output into an IR unit
    class Unit;
  } /* namespace ir */

  /*! Convert the LLVM IR code to a GEN IR code,
		  optLevel 0 equal to clang -O1 and 1 equal to clang -O2*/
  bool llvmToGen(ir::Unit &unit, const void* module,
                 int optLevel, bool strictMath, int profiling, std::string &errors);
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 39
  extern llvm::LLVMContext& GBEGetLLVMContext();
#endif

} /* namespace gbe */

#endif /* __GBE_IR_LLVM_TO_GEN_HPP__ */