Loading [MathJax]/extensions/tex2jax.js
libTriton version 1.0 build 1599
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
tritonToLLVM.hpp
Go to the documentation of this file.
1
2/*
3** Copyright (C) - Triton
4**
5** This program is under the terms of the Apache License 2.0.
6*/
7
8#ifndef TRITON_TRITONTOLLVM_HPP
9#define TRITON_TRITONTOLLVM_HPP
10
11#include <map>
12#include <memory>
13#include <unordered_map>
14
15#include <triton/ast.hpp>
16#include <triton/dllexport.hpp>
17
18#include <llvm/IR/IRBuilder.h>
19#include <llvm/IR/LLVMContext.h>
20#include <llvm/IR/Module.h>
21
22
23
25namespace triton {
32 namespace ast {
40
42 private:
44 llvm::LLVMContext& llvmContext;
45
47 std::shared_ptr<llvm::Module> llvmModule;
48
50 llvm::IRBuilder<> llvmIR;
51
53 std::map<triton::ast::SharedAbstractNode, llvm::Value*> llvmVars;
54
56 void createFunction(const triton::ast::SharedAbstractNode& node, const char* fname);
57
59 llvm::Value* do_convert(const triton::ast::SharedAbstractNode& node, std::unordered_map<triton::ast::SharedAbstractNode, llvm::Value*>* results);
60
61 public:
63 TRITON_EXPORT TritonToLLVM(llvm::LLVMContext& llvmContext);
64
66 TRITON_EXPORT std::shared_ptr<llvm::Module> convert(const triton::ast::SharedAbstractNode& node, const char* fname="__triton", bool optimize=false);
67 };
68
70 };
72};
73
74#endif /* TRITON_TRITONTOLLVM_HPP */
Converts a Triton's AST to LVM IR.
TRITON_EXPORT std::shared_ptr< llvm::Module > convert(const triton::ast::SharedAbstractNode &node, const char *fname="__triton", bool optimize=false)
Lifts a symbolic expression and all its references to LLVM format. fname represents the name of the L...
TRITON_EXPORT TritonToLLVM(llvm::LLVMContext &llvmContext)
Constructor.
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
Definition ast.hpp:59
The Triton namespace.