-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLLVMDAGInfo.h
77 lines (63 loc) · 2.07 KB
/
LLVMDAGInfo.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//===- LLVMDAGInfo.h - --------------------------------------*- C++ -*-----===//
//
// The ArchC Project - Compiler Backend Generation
//
//===----------------------------------------------------------------------===//
//
// This file contains all LLVM's SelectionDAG information necessary to generate
// the matcher code. For example, we need to know what is the ISD enumeration
// name of a specific node. In the future, this information ought to be parsed
// from tablegen files in order to the backend generator be more flexible when
// the LLVM target independent code generator gets updated.
//
//===----------------------------------------------------------------------===//
#ifndef LLVMDAGINFO_H
#define LLVMDAGINFO_H
#include "InsnSelector/TransformationRules.h"
#include <string>
#include <map>
#include <vector>
namespace LLVMDAGInfo {
using std::string;
using std::map;
using std::vector;
using std::list;
using backendgen::OperandTransformation;
typedef string (*GetNodeFunc)(const string&, list<const OperandTransformation*>*);
typedef string (*MatchNodeFunc)(const string&, const string&);
struct LLVMNodeInfo {
bool HasChain;
bool HasInFlag;
bool HasOutFlag;
bool MatchChildren;
string EnumName;
string NodeName;
GetNodeFunc GetNode;
MatchNodeFunc MatchNode;
LLVMNodeInfo(const string& E, const string& N, bool M,
bool C, bool InF, bool OutF,
GetNodeFunc GetF, MatchNodeFunc MatchF):
HasChain(C),
HasInFlag(InF),
HasOutFlag(OutF),
MatchChildren(M),
EnumName(E),
NodeName(N),
GetNode(GetF),
MatchNode(MatchF){}
};
struct NameNotFoundException {};
class LLVMNodeInfoMan {
static LLVMNodeInfoMan* ref;
// Private constructor and destructor
LLVMNodeInfoMan();
~LLVMNodeInfoMan();
vector<LLVMNodeInfo> Nodes;
map<string, const LLVMNodeInfo*> Map;
public:
static LLVMNodeInfoMan* getReference();
static void dispose();
const LLVMNodeInfo * getInfo(const string &Name) const;
};
};
#endif