llvm.org GIT mirror llvm / a90dbc1
change OperandsSignature to use SmallVector<char> instead of std::vector<string> since the strings are always exactly one character, and there are usually only 2-3 operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129678 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 17 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
136136 bool isVariadic;
137137
138138 // Provide transparent accessors to the operand list.
139 bool empty() const { return OperandList.empty(); }
139140 unsigned size() const { return OperandList.size(); }
140141 const OperandInfo &operator[](unsigned i) const { return OperandList[i]; }
141142 OperandInfo &operator[](unsigned i) { return OperandList[i]; }
3939 /// types. It has utility methods for emitting text based on the operands.
4040 ///
4141 struct OperandsSignature {
42 std::vector> Operands;
42 SmallVector> Operands;
4343
4444 bool operator<(const OperandsSignature &O) const {
4545 return Operands < O.Operands;
5656
5757 if (!InstPatNode->isLeaf()) {
5858 if (InstPatNode->getOperator()->getName() == "imm") {
59 Operands.push_back("i");
59 Operands.push_back('i');
6060 return true;
6161 }
6262 if (InstPatNode->getOperator()->getName() == "fpimm") {
63 Operands.push_back("f");
63 Operands.push_back('f');
6464 return true;
6565 }
6666 }
7777
7878 if (!Op->isLeaf()) {
7979 if (Op->getOperator()->getName() == "imm") {
80 Operands.push_back("i");
80 Operands.push_back('i');
8181 continue;
8282 }
8383 if (Op->getOperator()->getName() == "fpimm") {
84 Operands.push_back("f");
84 Operands.push_back('f');
8585 continue;
8686 }
8787 // For now, ignore other non-leaf nodes.
121121 return false;
122122 } else
123123 DstRC = RC;
124 Operands.push_back("r");
124 Operands.push_back('r');
125125 }
126126 return true;
127127 }
128128
129129 void PrintParameters(raw_ostream &OS) const {
130130 for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
131 if (Operands[i] == "r") {
131 if (Operands[i] == 'r') {
132132 OS << "unsigned Op" << i << ", bool Op" << i << "IsKill";
133 } else if (Operands[i] == "i") {
133 } else if (Operands[i] == 'i') {
134134 OS << "uint64_t imm" << i;
135 } else if (Operands[i] == "f") {
135 } else if (Operands[i] == 'f') {
136136 OS << "ConstantFP *f" << i;
137137 } else {
138138 assert("Unknown operand kind!");
154154
155155 if (PrintedArg)
156156 OS << ", ";
157 if (Operands[i] == "r") {
157 if (Operands[i] == 'r') {
158158 OS << "Op" << i << ", Op" << i << "IsKill";
159159 PrintedArg = true;
160 } else if (Operands[i] == "i") {
160 } else if (Operands[i] == 'i') {
161161 OS << "imm" << i;
162162 PrintedArg = true;
163 } else if (Operands[i] == "f") {
163 } else if (Operands[i] == 'f') {
164164 OS << "f" << i;
165165 PrintedArg = true;
166166 } else {
172172
173173 void PrintArguments(raw_ostream &OS) const {
174174 for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
175 if (Operands[i] == "r") {
175 if (Operands[i] == 'r') {
176176 OS << "Op" << i << ", Op" << i << "IsKill";
177 } else if (Operands[i] == "i") {
177 } else if (Operands[i] == 'i') {
178178 OS << "imm" << i;
179 } else if (Operands[i] == "f") {
179 } else if (Operands[i] == 'f') {
180180 OS << "f" << i;
181181 } else {
182182 assert("Unknown operand kind!");
265265 if (!Op->isSubClassOf("Instruction"))
266266 continue;
267267 CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op);
268 if (II.Operands.size() == 0)
268 if (II.Operands.empty())
269269 continue;
270270
271271 // For now, ignore multi-instruction patterns.