@@ -10,19 +10,14 @@ Last Update: Mar. 2011
10
10
#ifndef OPTSCHED_BASIC_MACHINE_MODEL_H
11
11
#define OPTSCHED_BASIC_MACHINE_MODEL_H
12
12
13
- // For class ostream.
14
- #include < iostream>
15
- // For class string.
16
- #include < string>
17
- // For class vector.
18
13
#include " opt-sched/Scheduler/defines.h"
14
+ #include < string>
19
15
#include < vector>
20
16
21
17
namespace llvm {
22
18
namespace opt_sched {
23
19
24
- using std::string;
25
- using std::vector;
20
+ class SpecsBuffer ;
26
21
27
22
// The possible types of dependence between two machine instructions.
28
23
enum DependenceType {
@@ -55,7 +50,7 @@ const int MAX_ISSUTYPE_CNT = 20;
55
50
// A description of an instruction type.
56
51
struct InstTypeInfo {
57
52
// The name of the instruction type.
58
- string name;
53
+ std:: string name;
59
54
// Whether instructions of this type can be scheduled only in a particular
60
55
// context.
61
56
bool isCntxtDep;
@@ -77,7 +72,7 @@ struct InstTypeInfo {
77
72
// A description of a issue type/FU.
78
73
struct IssueTypeInfo {
79
74
// The name of the issue type.
80
- string name;
75
+ std:: string name;
81
76
// How many slots of this issue type the machine has per cycle.
82
77
int slotsCount;
83
78
};
@@ -86,12 +81,13 @@ struct IssueTypeInfo {
86
81
class MachineModel {
87
82
public:
88
83
// Loads a machine model description from a file.
89
- MachineModel (const string &modelFile);
84
+ MachineModel (const std::string &modelFile);
85
+ MachineModel (SpecsBuffer &buf);
90
86
// A no-op virtual destructor to allow proper subclassing.
91
87
virtual ~MachineModel () {}
92
88
93
89
// Returns the name of the machine model.
94
- const string &GetModelName () const ;
90
+ const std:: string &GetModelName () const ;
95
91
// Returns the number of instruction types.
96
92
int GetInstTypeCnt () const ;
97
93
// Returns the number of issue types (pipelines).
@@ -104,7 +100,7 @@ class MachineModel {
104
100
// Returns the number of registers of a given type.
105
101
int GetPhysRegCnt (int16_t regType) const ;
106
102
// Returns the name of a given register type.
107
- const string &GetRegTypeName (int16_t regType) const ;
103
+ const std:: string &GetRegTypeName (int16_t regType) const ;
108
104
// Returns the register type given its name.
109
105
int16_t GetRegTypeByName (const char *const regTypeName) const ;
110
106
// Returns the number of issue slots for a given issue type.
@@ -126,8 +122,8 @@ class MachineModel {
126
122
// Returns the instruction type given the name of the instruction as well
127
123
// as the name of the previous instruction (used for context-dependent
128
124
// instructions).
129
- InstType GetInstTypeByName (const string &typeName,
130
- const string &prevName = " " ) const ;
125
+ InstType GetInstTypeByName (const std:: string &typeName,
126
+ const std:: string &prevName = " " ) const ;
131
127
// Return the default instruction type
132
128
InstType getDefaultInstType () const ;
133
129
// Return the default issue type
@@ -161,9 +157,9 @@ class MachineModel {
161
157
issueTypes_[0 ].slotsCount == 1 && !includesUnpipelined_;
162
158
}
163
159
// Add a new instruction type.
164
- void AddInstType (InstTypeInfo & instTypeInfo);
160
+ void AddInstType (InstTypeInfo instTypeInfo);
165
161
// Add a new issue type.
166
- void addIssueType (IssueTypeInfo & IssueTypeInfo);
162
+ void addIssueType (IssueTypeInfo IssueTypeInfo);
167
163
168
164
protected:
169
165
// Creates an uninitialized machine model. For use by subclasses.
@@ -172,13 +168,13 @@ class MachineModel {
172
168
// A description of a register type.
173
169
struct RegTypeInfo {
174
170
// The name of the register.
175
- string name;
171
+ std:: string name;
176
172
// How many register of this type the machine has.
177
173
int count;
178
174
};
179
175
180
176
// The name of the machine model.
181
- string mdlName_;
177
+ std:: string mdlName_;
182
178
// The machine's issue rate. I.e. the total number of issue slots for all
183
179
// issue types.
184
180
int issueRate_;
@@ -188,11 +184,11 @@ class MachineModel {
188
184
bool includesUnpipelined_ = false ;
189
185
190
186
// A vector of instruction type descriptions.
191
- vector<InstTypeInfo> instTypes_;
187
+ std:: vector<InstTypeInfo> instTypes_;
192
188
// A vector of register types with their names and counts.
193
- vector<RegTypeInfo> registerTypes_;
189
+ std:: vector<RegTypeInfo> registerTypes_;
194
190
// A vector of issue types with their names and slot counts.
195
- vector<IssueTypeInfo> issueTypes_;
191
+ std:: vector<IssueTypeInfo> issueTypes_;
196
192
};
197
193
198
194
} // namespace opt_sched
0 commit comments