IR2Vec
Loading...
Searching...
No Matches
Symbolic.h
1//===- Symbolic.h - Symbolic Encodings of IR2Vec ---------------*- C++ -*-===//
2//
3// Part of the IR2Vec Project, under the Apache License v2.0 with LLVM
4// Exceptions. See the LICENSE file for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef __IR2Vec_Symbolic_H__
10#define __IR2Vec_Symbolic_H__
11
12#include "utils.h"
13
14#include "llvm/ADT/MapVector.h"
15#include "llvm/IR/BasicBlock.h"
16#include "llvm/IR/Function.h"
17#include "llvm/Pass.h"
18#include "llvm/Support/raw_ostream.h"
19
20#include <fstream>
21#include <map>
22
24
25private:
26 llvm::Module &M;
27 IR2Vec::Vector pgmVector;
28
29 IR2Vec::Vector getValue(std::string key);
30 IR2Vec::Vector bb2Vec(llvm::BasicBlock &B,
31 llvm::SmallVector<llvm::Function *, 15> &funcStack);
32 IR2Vec::Vector func2Vec(llvm::Function &F,
33 llvm::SmallVector<llvm::Function *, 15> &funcStack);
34 std::string res;
35 llvm::SmallMapVector<const llvm::Function *, IR2Vec::Vector, 16> funcVecMap;
36 llvm::SmallMapVector<const llvm::Instruction *, IR2Vec::Vector, 128>
37 instVecMap;
38
39public:
40 IR2Vec_Symbolic(llvm::Module &M) : M{M} {
41 pgmVector = IR2Vec::Vector(DIM, 0);
42 res = "";
43 }
44
45 void generateSymbolicEncodings(std::ostream *o = nullptr);
46 void generateSymbolicEncodingsForFunction(std::ostream *o = nullptr,
47 std::string name = "");
48 llvm::SmallMapVector<const llvm::Instruction *, IR2Vec::Vector, 128>
49 getInstVecMap() {
50 return instVecMap;
51 }
52
53 llvm::SmallMapVector<const llvm::Function *, IR2Vec::Vector, 16>
54 getFuncVecMap() {
55 return funcVecMap;
56 }
57
58 IR2Vec::Vector getProgramVector() { return pgmVector; }
59};
60
61#endif
Definition Symbolic.h:23