forked from cgeyer/llvm-cbg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cbg.h
129 lines (117 loc) · 4.43 KB
/
cbg.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//===-- cbg.h - Top-level interface for cbg representation --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the entry points for global functions defined in the LLVM
// cbg back-end.
//
//===----------------------------------------------------------------------===//
#ifndef TARGET_CBG_H
#define TARGET_CBG_H
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
namespace llvm {
class FunctionPass;
class LoopPass;
class cbgTargetMachine;
class formatted_raw_ostream;
FunctionPass *createcbgISelDag(cbgTargetMachine &TM);
FunctionPass *createcbgDelaySlotFillerPass(TargetMachine &TM);
FunctionPass *createcbgFPMoverPass(TargetMachine &TM);
// Function pass for finding loops which can be transformed
// to hardware loops
FunctionPass *createcbgHWLoopPass(TargetMachine &TM, unsigned loopDepth, bool rIndexVar);
// Function pass for inserting predicated blocks instead of branches
FunctionPass *createcbgPredBlockCCPass(TargetMachine &TM);
FunctionPass *createcbgPredBlockRegPass(TargetMachine &TM);
FunctionPass *createcbgPredInstrCCPass(TargetMachine &TM);
FunctionPass *createcbgPredInstrRegPass(TargetMachine &TM);
extern Target ThecbgTarget;
} // end namespace llvm;
// Defines symbolic names for cbg registers. This defines a mapping from
// register name to register number.
//
#include "cbgGenRegisterNames.inc"
// Defines symbolic names for the cbg instructions.
//
#include "cbgGenInstrNames.inc"
namespace llvm {
// Enums corresponding to cbg condition codes, both icc's and fcc's. These
// values must be kept in sync with the ones in the .td file.
namespace CBGCC {
enum CondCodes {
//ICC_A = 8 , // Always
//ICC_N = 0 , // Never
ICC_NE = 9 , // Not Equal
ICC_E = 1 , // Equal
ICC_G = 10 , // Greater
ICC_LE = 2 , // Less or Equal
ICC_GE = 11 , // Greater or Equal
ICC_L = 3 , // Less
ICC_GU = 12 , // Greater Unsigned
ICC_LEU = 4 , // Less or Equal Unsigned
ICC_CC = 13 , // Carry Clear/Great or Equal Unsigned
ICC_CS = 5 , // Carry Set/Less Unsigned
ICC_POS = 14 , // Positive
ICC_NEG = 6 , // Negative
ICC_VC = 15 , // Overflow Clear
ICC_VS = 7 , // Overflow Set
//FCC_A = 8+16, // Always
//FCC_N = 0+16, // Never
FCC_U = 7+16, // Unordered
FCC_G = 6+16, // Greater
FCC_UG = 5+16, // Unordered or Greater
FCC_L = 4+16, // Less
FCC_UL = 3+16, // Unordered or Less
FCC_LG = 2+16, // Less or Greater
FCC_NE = 1+16, // Not Equal
FCC_E = 9+16, // Equal
FCC_UE = 10+16, // Unordered or Equal
FCC_GE = 11+16, // Greater or Equal
FCC_UGE = 12+16, // Unordered or Greater or Equal
FCC_LE = 13+16, // Less or Equal
FCC_ULE = 14+16, // Unordered or Less or Equal
FCC_O = 15+16 // Ordered
};
}
inline static const char *CBGCondCodeToString(CBGCC::CondCodes CC) {
switch (CC) {
default: llvm_unreachable("Unknown condition code");
case CBGCC::ICC_NE: return "ne";
case CBGCC::ICC_E: return "e";
case CBGCC::ICC_G: return "g";
case CBGCC::ICC_LE: return "le";
case CBGCC::ICC_GE: return "ge";
case CBGCC::ICC_L: return "l";
case CBGCC::ICC_GU: return "gu";
case CBGCC::ICC_LEU: return "leu";
case CBGCC::ICC_CC: return "cc";
case CBGCC::ICC_CS: return "cs";
case CBGCC::ICC_POS: return "pos";
case CBGCC::ICC_NEG: return "neg";
case CBGCC::ICC_VC: return "vc";
case CBGCC::ICC_VS: return "vs";
case CBGCC::FCC_U: return "u";
case CBGCC::FCC_G: return "g";
case CBGCC::FCC_UG: return "ug";
case CBGCC::FCC_L: return "l";
case CBGCC::FCC_UL: return "ul";
case CBGCC::FCC_LG: return "lg";
case CBGCC::FCC_NE: return "ne";
case CBGCC::FCC_E: return "e";
case CBGCC::FCC_UE: return "ue";
case CBGCC::FCC_GE: return "ge";
case CBGCC::FCC_UGE: return "uge";
case CBGCC::FCC_LE: return "le";
case CBGCC::FCC_ULE: return "ule";
case CBGCC::FCC_O: return "o";
}
}
} // end namespace llvm
#endif