libTriton version 1.0 build 1592
Loading...
Searching...
No Matches
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 <ostream>
14#include <string>
15#include <unordered_map>
16
17#include <triton/ast.hpp>
18#include <triton/dllexport.hpp>
19
20#include <llvm/IR/IRBuilder.h>
21#include <llvm/IR/LLVMContext.h>
22#include <llvm/IR/LegacyPassManager.h>
23#include <llvm/IR/Module.h>
24#include <llvm/Transforms/IPO/PassManagerBuilder.h>
25
26
27
29namespace triton {
36 namespace ast {
44
46 private:
48 llvm::LLVMContext& llvmContext;
49
51 std::shared_ptr<llvm::Module> llvmModule;
52
54 llvm::IRBuilder<> llvmIR;
55
57 std::map<triton::ast::SharedAbstractNode, llvm::Value*> llvmVars;
58
60 void createFunction(const triton::ast::SharedAbstractNode& node, const char* fname);
61
63 llvm::Value* do_convert(const triton::ast::SharedAbstractNode& node, std::unordered_map<triton::ast::SharedAbstractNode, llvm::Value*>* results);
64
65 public:
67 TRITON_EXPORT TritonToLLVM(llvm::LLVMContext& llvmContext);
68
70 TRITON_EXPORT std::shared_ptr<llvm::Module> convert(const triton::ast::SharedAbstractNode& node, const char* fname="__triton", bool optimize=false);
71 };
72
74 };
76};
77
78#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.