Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 1 | //===- FastISelEmitter.cpp - Generate an instruction selector -------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This tablegen backend emits a "fast" instruction selector. |
| 11 | // |
| 12 | // This instruction selection method is designed to emit very poor code |
| 13 | // quickly. Also, it is not designed to do much lowering, so most illegal |
| 14 | // types (e.g. i64 on 32-bit targets) and operations (e.g. calls) are not |
| 15 | // supported and cannot easily be added. Blocks containing operations |
| 16 | // that are not supported need to be handled by a more capable selector, |
| 17 | // such as the SelectionDAG selector. |
| 18 | // |
| 19 | // The intended use for "fast" instruction selection is "-O0" mode |
| 20 | // compilation, where the quality of the generated code is irrelevant when |
| 21 | // weighed against the speed at which the code can be generated. |
| 22 | // |
| 23 | // If compile time is so important, you might wonder why we don't just |
| 24 | // skip codegen all-together, emit LLVM bytecode files, and execute them |
| 25 | // with an interpreter. The answer is that it would complicate linking and |
| 26 | // debugging, and also because that isn't how a compiler is expected to |
| 27 | // work in some circles. |
| 28 | // |
| 29 | // If you need better generated code or more lowering than what this |
| 30 | // instruction selector provides, use the SelectionDAG (DAGISel) instruction |
| 31 | // selector instead. If you're looking here because SelectionDAG isn't fast |
| 32 | // enough, consider looking into improving the SelectionDAG infastructure |
| 33 | // instead. At the time of this writing there remain several major |
| 34 | // opportunities for improvement. |
| 35 | // |
| 36 | //===----------------------------------------------------------------------===// |
| 37 | |
| 38 | #include "FastISelEmitter.h" |
| 39 | #include "Record.h" |
| 40 | #include "llvm/Support/Debug.h" |
| 41 | #include "llvm/Support/Streams.h" |
| 42 | #include "llvm/ADT/VectorExtras.h" |
| 43 | using namespace llvm; |
| 44 | |
| 45 | namespace { |
| 46 | |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 47 | /// InstructionMemo - This class holds additional information about an |
| 48 | /// instruction needed to emit code for it. |
| 49 | /// |
| 50 | struct InstructionMemo { |
| 51 | std::string Name; |
| 52 | const CodeGenRegisterClass *RC; |
| 53 | unsigned char SubRegNo; |
| 54 | std::vector<std::string>* PhysRegs; |
| 55 | }; |
| 56 | |
Dan Gohman | 04b7dfb | 2008-08-19 18:06:12 +0000 | [diff] [blame] | 57 | /// OperandsSignature - This class holds a description of a list of operand |
| 58 | /// types. It has utility methods for emitting text based on the operands. |
| 59 | /// |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 60 | struct OperandsSignature { |
| 61 | std::vector<std::string> Operands; |
| 62 | |
| 63 | bool operator<(const OperandsSignature &O) const { |
| 64 | return Operands < O.Operands; |
| 65 | } |
| 66 | |
| 67 | bool empty() const { return Operands.empty(); } |
| 68 | |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 69 | /// initialize - Examine the given pattern and initialize the contents |
| 70 | /// of the Operands array accordingly. Return true if all the operands |
| 71 | /// are supported, false otherwise. |
| 72 | /// |
| 73 | bool initialize(TreePatternNode *InstPatNode, |
| 74 | const CodeGenTarget &Target, |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 75 | MVT::SimpleValueType VT) { |
Owen Anderson | 6d0c25e | 2008-08-25 20:20:32 +0000 | [diff] [blame] | 76 | if (!InstPatNode->isLeaf() && |
| 77 | InstPatNode->getOperator()->getName() == "imm") { |
| 78 | Operands.push_back("i"); |
| 79 | return true; |
| 80 | } |
Dan Gohman | 10df0fa | 2008-08-27 01:09:54 +0000 | [diff] [blame] | 81 | if (!InstPatNode->isLeaf() && |
| 82 | InstPatNode->getOperator()->getName() == "fpimm") { |
| 83 | Operands.push_back("f"); |
| 84 | return true; |
| 85 | } |
Owen Anderson | 6d0c25e | 2008-08-25 20:20:32 +0000 | [diff] [blame] | 86 | |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 87 | const CodeGenRegisterClass *DstRC = 0; |
| 88 | |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 89 | for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) { |
| 90 | TreePatternNode *Op = InstPatNode->getChild(i); |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 91 | // For now, filter out any operand with a predicate. |
| 92 | if (!Op->getPredicateFn().empty()) |
| 93 | return false; |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 94 | // For now, filter out any operand with multiple values. |
| 95 | if (Op->getExtTypes().size() != 1) |
| 96 | return false; |
| 97 | // For now, all the operands must have the same type. |
| 98 | if (Op->getTypeNum(0) != VT) |
| 99 | return false; |
| 100 | if (!Op->isLeaf()) { |
| 101 | if (Op->getOperator()->getName() == "imm") { |
| 102 | Operands.push_back("i"); |
| 103 | return true; |
| 104 | } |
Dan Gohman | 10df0fa | 2008-08-27 01:09:54 +0000 | [diff] [blame] | 105 | if (Op->getOperator()->getName() == "fpimm") { |
| 106 | Operands.push_back("f"); |
| 107 | return true; |
| 108 | } |
Dan Gohman | 833ddf8 | 2008-08-27 16:18:22 +0000 | [diff] [blame] | 109 | // For now, ignore other non-leaf nodes. |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 110 | return false; |
| 111 | } |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 112 | DefInit *OpDI = dynamic_cast<DefInit*>(Op->getLeafValue()); |
| 113 | if (!OpDI) |
| 114 | return false; |
| 115 | Record *OpLeafRec = OpDI->getDef(); |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 116 | // For now, the only other thing we accept is register operands. |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 117 | |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 118 | const CodeGenRegisterClass *RC = 0; |
| 119 | if (OpLeafRec->isSubClassOf("RegisterClass")) |
| 120 | RC = &Target.getRegisterClass(OpLeafRec); |
| 121 | else if (OpLeafRec->isSubClassOf("Register")) |
| 122 | RC = Target.getRegisterClassForRegister(OpLeafRec); |
| 123 | else |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 124 | return false; |
| 125 | // For now, require the register operands' register classes to all |
| 126 | // be the same. |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 127 | if (!RC) |
| 128 | return false; |
Dan Gohman | cf711aa | 2008-08-19 20:58:14 +0000 | [diff] [blame] | 129 | // For now, all the operands must have the same register class. |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 130 | if (DstRC) { |
| 131 | if (DstRC != RC) |
| 132 | return false; |
| 133 | } else |
| 134 | DstRC = RC; |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 135 | Operands.push_back("r"); |
| 136 | } |
| 137 | return true; |
| 138 | } |
| 139 | |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 140 | void PrintParameters(std::ostream &OS) const { |
| 141 | for (unsigned i = 0, e = Operands.size(); i != e; ++i) { |
| 142 | if (Operands[i] == "r") { |
| 143 | OS << "unsigned Op" << i; |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 144 | } else if (Operands[i] == "i") { |
| 145 | OS << "uint64_t imm" << i; |
Dan Gohman | 10df0fa | 2008-08-27 01:09:54 +0000 | [diff] [blame] | 146 | } else if (Operands[i] == "f") { |
| 147 | OS << "ConstantFP *f" << i; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 148 | } else { |
| 149 | assert("Unknown operand kind!"); |
| 150 | abort(); |
| 151 | } |
| 152 | if (i + 1 != e) |
| 153 | OS << ", "; |
| 154 | } |
| 155 | } |
| 156 | |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 157 | void PrintArguments(std::ostream &OS, |
| 158 | const std::vector<std::string>& PR) const { |
| 159 | assert(PR.size() == Operands.size()); |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 160 | bool PrintedArg = false; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 161 | for (unsigned i = 0, e = Operands.size(); i != e; ++i) { |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 162 | if (PR[i] != "") |
| 163 | // Implicit physical register operand. |
| 164 | continue; |
| 165 | |
| 166 | if (PrintedArg) |
| 167 | OS << ", "; |
| 168 | if (Operands[i] == "r") { |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 169 | OS << "Op" << i; |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 170 | PrintedArg = true; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 171 | } else if (Operands[i] == "i") { |
| 172 | OS << "imm" << i; |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 173 | PrintedArg = true; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 174 | } else if (Operands[i] == "f") { |
| 175 | OS << "f" << i; |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 176 | PrintedArg = true; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 177 | } else { |
| 178 | assert("Unknown operand kind!"); |
| 179 | abort(); |
| 180 | } |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 181 | } |
| 182 | } |
| 183 | |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 184 | void PrintArguments(std::ostream &OS) const { |
| 185 | for (unsigned i = 0, e = Operands.size(); i != e; ++i) { |
| 186 | if (Operands[i] == "r") { |
| 187 | OS << "Op" << i; |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 188 | } else if (Operands[i] == "i") { |
| 189 | OS << "imm" << i; |
Dan Gohman | 10df0fa | 2008-08-27 01:09:54 +0000 | [diff] [blame] | 190 | } else if (Operands[i] == "f") { |
| 191 | OS << "f" << i; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 192 | } else { |
| 193 | assert("Unknown operand kind!"); |
| 194 | abort(); |
| 195 | } |
| 196 | if (i + 1 != e) |
| 197 | OS << ", "; |
| 198 | } |
| 199 | } |
| 200 | |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 201 | |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 202 | void PrintManglingSuffix(std::ostream &OS, |
| 203 | const std::vector<std::string>& PR) const { |
| 204 | for (unsigned i = 0, e = Operands.size(); i != e; ++i) { |
| 205 | if (PR[i] != "") |
| 206 | // Implicit physical register operand. e.g. Instruction::Mul expect to |
| 207 | // select to a binary op. On x86, mul may take a single operand with |
| 208 | // the other operand being implicit. We must emit something that looks |
| 209 | // like a binary instruction except for the very inner FastEmitInst_* |
| 210 | // call. |
| 211 | continue; |
| 212 | OS << Operands[i]; |
| 213 | } |
| 214 | } |
| 215 | |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 216 | void PrintManglingSuffix(std::ostream &OS) const { |
| 217 | for (unsigned i = 0, e = Operands.size(); i != e; ++i) { |
| 218 | OS << Operands[i]; |
| 219 | } |
| 220 | } |
| 221 | }; |
| 222 | |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 223 | class FastISelMap { |
| 224 | typedef std::map<std::string, InstructionMemo> PredMap; |
| 225 | typedef std::map<MVT::SimpleValueType, PredMap> RetPredMap; |
| 226 | typedef std::map<MVT::SimpleValueType, RetPredMap> TypeRetPredMap; |
| 227 | typedef std::map<std::string, TypeRetPredMap> OpcodeTypeRetPredMap; |
| 228 | typedef std::map<OperandsSignature, OpcodeTypeRetPredMap> OperandsOpcodeTypeRetPredMap; |
| 229 | |
| 230 | OperandsOpcodeTypeRetPredMap SimplePatterns; |
| 231 | |
| 232 | std::string InstNS; |
| 233 | |
| 234 | public: |
| 235 | explicit FastISelMap(std::string InstNS); |
| 236 | |
| 237 | void CollectPatterns(CodeGenDAGPatterns &CGP); |
| 238 | void PrintClass(std::ostream &OS); |
| 239 | void PrintFunctionDefinitions(std::ostream &OS); |
| 240 | }; |
| 241 | |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) { |
| 245 | return CGP.getSDNodeInfo(Op).getEnumName(); |
| 246 | } |
| 247 | |
| 248 | static std::string getLegalCName(std::string OpName) { |
| 249 | std::string::size_type pos = OpName.find("::"); |
| 250 | if (pos != std::string::npos) |
| 251 | OpName.replace(pos, 2, "_"); |
| 252 | return OpName; |
| 253 | } |
| 254 | |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 255 | FastISelMap::FastISelMap(std::string instns) |
| 256 | : InstNS(instns) { |
| 257 | } |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 258 | |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 259 | void FastISelMap::CollectPatterns(CodeGenDAGPatterns &CGP) { |
| 260 | const CodeGenTarget &Target = CGP.getTargetInfo(); |
| 261 | |
| 262 | // Determine the target's namespace name. |
| 263 | InstNS = Target.getInstNamespace() + "::"; |
| 264 | assert(InstNS.size() > 2 && "Can't determine target-specific namespace!"); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 265 | |
Dan Gohman | 0bfb752 | 2008-08-22 00:28:15 +0000 | [diff] [blame] | 266 | // Scan through all the patterns and record the simple ones. |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 267 | for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), |
| 268 | E = CGP.ptm_end(); I != E; ++I) { |
| 269 | const PatternToMatch &Pattern = *I; |
| 270 | |
| 271 | // For now, just look at Instructions, so that we don't have to worry |
| 272 | // about emitting multiple instructions for a pattern. |
| 273 | TreePatternNode *Dst = Pattern.getDstPattern(); |
| 274 | if (Dst->isLeaf()) continue; |
| 275 | Record *Op = Dst->getOperator(); |
| 276 | if (!Op->isSubClassOf("Instruction")) |
| 277 | continue; |
| 278 | CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName()); |
| 279 | if (II.OperandList.empty()) |
| 280 | continue; |
Dan Gohman | 379cad4 | 2008-08-19 20:36:33 +0000 | [diff] [blame] | 281 | |
Evan Cheng | 34fc6ce | 2008-09-07 08:19:51 +0000 | [diff] [blame] | 282 | // For now, ignore multi-instruction patterns. |
| 283 | bool MultiInsts = false; |
| 284 | for (unsigned i = 0, e = Dst->getNumChildren(); i != e; ++i) { |
| 285 | TreePatternNode *ChildOp = Dst->getChild(i); |
| 286 | if (ChildOp->isLeaf()) |
| 287 | continue; |
| 288 | if (ChildOp->getOperator()->isSubClassOf("Instruction")) { |
| 289 | MultiInsts = true; |
| 290 | break; |
| 291 | } |
| 292 | } |
| 293 | if (MultiInsts) |
| 294 | continue; |
| 295 | |
Dan Gohman | 379cad4 | 2008-08-19 20:36:33 +0000 | [diff] [blame] | 296 | // For now, ignore instructions where the first operand is not an |
| 297 | // output register. |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 298 | const CodeGenRegisterClass *DstRC = 0; |
| 299 | unsigned SubRegNo = ~0; |
| 300 | if (Op->getName() != "EXTRACT_SUBREG") { |
| 301 | Record *Op0Rec = II.OperandList[0].Rec; |
| 302 | if (!Op0Rec->isSubClassOf("RegisterClass")) |
| 303 | continue; |
| 304 | DstRC = &Target.getRegisterClass(Op0Rec); |
| 305 | if (!DstRC) |
| 306 | continue; |
| 307 | } else { |
| 308 | SubRegNo = static_cast<IntInit*>( |
| 309 | Dst->getChild(1)->getLeafValue())->getValue(); |
| 310 | } |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 311 | |
| 312 | // Inspect the pattern. |
| 313 | TreePatternNode *InstPatNode = Pattern.getSrcPattern(); |
| 314 | if (!InstPatNode) continue; |
| 315 | if (InstPatNode->isLeaf()) continue; |
| 316 | |
| 317 | Record *InstPatOp = InstPatNode->getOperator(); |
| 318 | std::string OpcodeName = getOpcodeName(InstPatOp, CGP); |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 319 | MVT::SimpleValueType RetVT = InstPatNode->getTypeNum(0); |
| 320 | MVT::SimpleValueType VT = RetVT; |
| 321 | if (InstPatNode->getNumChildren()) |
| 322 | VT = InstPatNode->getChild(0)->getTypeNum(0); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 323 | |
| 324 | // For now, filter out instructions which just set a register to |
Dan Gohman | f4137b5 | 2008-08-19 20:30:54 +0000 | [diff] [blame] | 325 | // an Operand or an immediate, like MOV32ri. |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 326 | if (InstPatOp->isSubClassOf("Operand")) |
| 327 | continue; |
Dan Gohman | f4137b5 | 2008-08-19 20:30:54 +0000 | [diff] [blame] | 328 | |
| 329 | // For now, filter out any instructions with predicates. |
| 330 | if (!InstPatNode->getPredicateFn().empty()) |
| 331 | continue; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 332 | |
Dan Gohman | 379cad4 | 2008-08-19 20:36:33 +0000 | [diff] [blame] | 333 | // Check all the operands. |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 334 | OperandsSignature Operands; |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 335 | if (!Operands.initialize(InstPatNode, Target, VT)) |
Dan Gohman | d1d2ee8 | 2008-08-19 20:56:30 +0000 | [diff] [blame] | 336 | continue; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 337 | |
| 338 | std::vector<std::string>* PhysRegInputs = new std::vector<std::string>(); |
| 339 | if (!InstPatNode->isLeaf() && |
| 340 | (InstPatNode->getOperator()->getName() == "imm" || |
| 341 | InstPatNode->getOperator()->getName() == "fpimmm")) |
| 342 | PhysRegInputs->push_back(""); |
| 343 | else if (!InstPatNode->isLeaf()) { |
| 344 | for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) { |
| 345 | TreePatternNode *Op = InstPatNode->getChild(i); |
| 346 | if (!Op->isLeaf()) { |
| 347 | PhysRegInputs->push_back(""); |
| 348 | continue; |
| 349 | } |
| 350 | |
| 351 | DefInit *OpDI = dynamic_cast<DefInit*>(Op->getLeafValue()); |
| 352 | Record *OpLeafRec = OpDI->getDef(); |
| 353 | std::string PhysReg; |
| 354 | if (OpLeafRec->isSubClassOf("Register")) { |
| 355 | PhysReg += static_cast<StringInit*>(OpLeafRec->getValue( \ |
| 356 | "Namespace")->getValue())->getValue(); |
| 357 | PhysReg += "::"; |
| 358 | |
| 359 | std::vector<CodeGenRegister> Regs = Target.getRegisters(); |
| 360 | for (unsigned i = 0; i < Regs.size(); ++i) { |
| 361 | if (Regs[i].TheDef == OpLeafRec) { |
| 362 | PhysReg += Regs[i].getName(); |
| 363 | break; |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | PhysRegInputs->push_back(PhysReg); |
| 369 | } |
| 370 | } else |
| 371 | PhysRegInputs->push_back(""); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 372 | |
Dan Gohman | 22bb311 | 2008-08-22 00:20:26 +0000 | [diff] [blame] | 373 | // Get the predicate that guards this pattern. |
| 374 | std::string PredicateCheck = Pattern.getPredicateCheck(); |
| 375 | |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 376 | // Ok, we found a pattern that we can handle. Remember it. |
Dan Gohman | 520b50c | 2008-08-21 00:35:26 +0000 | [diff] [blame] | 377 | InstructionMemo Memo = { |
| 378 | Pattern.getDstPattern()->getOperator()->getName(), |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 379 | DstRC, |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 380 | SubRegNo, |
| 381 | PhysRegInputs |
Dan Gohman | 520b50c | 2008-08-21 00:35:26 +0000 | [diff] [blame] | 382 | }; |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 383 | assert(!SimplePatterns[Operands][OpcodeName][VT][RetVT].count(PredicateCheck) && |
Dan Gohman | 22bb311 | 2008-08-22 00:20:26 +0000 | [diff] [blame] | 384 | "Duplicate pattern!"); |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 385 | SimplePatterns[Operands][OpcodeName][VT][RetVT][PredicateCheck] = Memo; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 386 | } |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 387 | } |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 388 | |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 389 | void FastISelMap::PrintFunctionDefinitions(std::ostream &OS) { |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 390 | // Now emit code for all the patterns that we collected. |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 391 | for (OperandsOpcodeTypeRetPredMap::const_iterator OI = SimplePatterns.begin(), |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 392 | OE = SimplePatterns.end(); OI != OE; ++OI) { |
| 393 | const OperandsSignature &Operands = OI->first; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 394 | const OpcodeTypeRetPredMap &OTM = OI->second; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 395 | |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 396 | for (OpcodeTypeRetPredMap::const_iterator I = OTM.begin(), E = OTM.end(); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 397 | I != E; ++I) { |
| 398 | const std::string &Opcode = I->first; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 399 | const TypeRetPredMap &TM = I->second; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 400 | |
| 401 | OS << "// FastEmit functions for " << Opcode << ".\n"; |
| 402 | OS << "\n"; |
| 403 | |
| 404 | // Emit one function for each opcode,type pair. |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 405 | for (TypeRetPredMap::const_iterator TI = TM.begin(), TE = TM.end(); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 406 | TI != TE; ++TI) { |
| 407 | MVT::SimpleValueType VT = TI->first; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 408 | const RetPredMap &RM = TI->second; |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 409 | if (RM.size() != 1) { |
| 410 | for (RetPredMap::const_iterator RI = RM.begin(), RE = RM.end(); |
| 411 | RI != RE; ++RI) { |
| 412 | MVT::SimpleValueType RetVT = RI->first; |
| 413 | const PredMap &PM = RI->second; |
| 414 | bool HasPred = false; |
Dan Gohman | 22bb311 | 2008-08-22 00:20:26 +0000 | [diff] [blame] | 415 | |
Evan Cheng | c3f44b0 | 2008-09-03 00:03:49 +0000 | [diff] [blame] | 416 | OS << "unsigned FastEmit_" |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 417 | << getLegalCName(Opcode) |
| 418 | << "_" << getLegalCName(getName(VT)) |
| 419 | << "_" << getLegalCName(getName(RetVT)) << "_"; |
| 420 | Operands.PrintManglingSuffix(OS); |
| 421 | OS << "("; |
| 422 | Operands.PrintParameters(OS); |
| 423 | OS << ") {\n"; |
Dan Gohman | 22bb311 | 2008-08-22 00:20:26 +0000 | [diff] [blame] | 424 | |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 425 | // Emit code for each possible instruction. There may be |
| 426 | // multiple if there are subtarget concerns. |
| 427 | for (PredMap::const_iterator PI = PM.begin(), PE = PM.end(); |
| 428 | PI != PE; ++PI) { |
| 429 | std::string PredicateCheck = PI->first; |
| 430 | const InstructionMemo &Memo = PI->second; |
| 431 | |
| 432 | if (PredicateCheck.empty()) { |
| 433 | assert(!HasPred && |
| 434 | "Multiple instructions match, at least one has " |
| 435 | "a predicate and at least one doesn't!"); |
| 436 | } else { |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 437 | OS << " if (" + PredicateCheck + ") {\n"; |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 438 | OS << " "; |
| 439 | HasPred = true; |
| 440 | } |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 441 | |
| 442 | for (unsigned i = 0; i < Memo.PhysRegs->size(); ++i) { |
| 443 | if ((*Memo.PhysRegs)[i] != "") |
| 444 | OS << " TII.copyRegToReg(*MBB, MBB->end(), " |
| 445 | << (*Memo.PhysRegs)[i] << ", Op" << i << ", " |
| 446 | << "TM.getRegisterInfo()->getPhysicalRegisterRegClass(" |
| 447 | << (*Memo.PhysRegs)[i] << "), " |
| 448 | << "MRI.getRegClass(Op" << i << "));\n"; |
| 449 | } |
| 450 | |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 451 | OS << " return FastEmitInst_"; |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 452 | if (Memo.SubRegNo == (unsigned char)~0) { |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 453 | Operands.PrintManglingSuffix(OS, *Memo.PhysRegs); |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 454 | OS << "(" << InstNS << Memo.Name << ", "; |
| 455 | OS << InstNS << Memo.RC->getName() << "RegisterClass"; |
| 456 | if (!Operands.empty()) |
| 457 | OS << ", "; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 458 | Operands.PrintArguments(OS, *Memo.PhysRegs); |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 459 | OS << ");\n"; |
| 460 | } else { |
| 461 | OS << "extractsubreg(Op0, "; |
| 462 | OS << (unsigned)Memo.SubRegNo; |
| 463 | OS << ");\n"; |
| 464 | } |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 465 | |
| 466 | if (HasPred) |
Evan Cheng | d07b46e | 2008-09-07 08:23:06 +0000 | [diff] [blame] | 467 | OS << " }\n"; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 468 | |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 469 | } |
| 470 | // Return 0 if none of the predicates were satisfied. |
| 471 | if (HasPred) |
| 472 | OS << " return 0;\n"; |
| 473 | OS << "}\n"; |
| 474 | OS << "\n"; |
| 475 | } |
| 476 | |
| 477 | // Emit one function for the type that demultiplexes on return type. |
Evan Cheng | c3f44b0 | 2008-09-03 00:03:49 +0000 | [diff] [blame] | 478 | OS << "unsigned FastEmit_" |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 479 | << getLegalCName(Opcode) << "_" |
Owen Anderson | abb1f16 | 2008-08-26 01:22:59 +0000 | [diff] [blame] | 480 | << getLegalCName(getName(VT)) << "_"; |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 481 | Operands.PrintManglingSuffix(OS); |
| 482 | OS << "(MVT::SimpleValueType RetVT"; |
| 483 | if (!Operands.empty()) |
| 484 | OS << ", "; |
| 485 | Operands.PrintParameters(OS); |
| 486 | OS << ") {\nswitch (RetVT) {\n"; |
| 487 | for (RetPredMap::const_iterator RI = RM.begin(), RE = RM.end(); |
| 488 | RI != RE; ++RI) { |
| 489 | MVT::SimpleValueType RetVT = RI->first; |
| 490 | OS << " case " << getName(RetVT) << ": return FastEmit_" |
| 491 | << getLegalCName(Opcode) << "_" << getLegalCName(getName(VT)) |
| 492 | << "_" << getLegalCName(getName(RetVT)) << "_"; |
| 493 | Operands.PrintManglingSuffix(OS); |
| 494 | OS << "("; |
| 495 | Operands.PrintArguments(OS); |
| 496 | OS << ");\n"; |
| 497 | } |
| 498 | OS << " default: return 0;\n}\n}\n\n"; |
| 499 | |
| 500 | } else { |
| 501 | // Non-variadic return type. |
Evan Cheng | c3f44b0 | 2008-09-03 00:03:49 +0000 | [diff] [blame] | 502 | OS << "unsigned FastEmit_" |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 503 | << getLegalCName(Opcode) << "_" |
| 504 | << getLegalCName(getName(VT)) << "_"; |
Dan Gohman | 22bb311 | 2008-08-22 00:20:26 +0000 | [diff] [blame] | 505 | Operands.PrintManglingSuffix(OS); |
Owen Anderson | 0f84e4e | 2008-08-25 23:58:18 +0000 | [diff] [blame] | 506 | OS << "(MVT::SimpleValueType RetVT"; |
| 507 | if (!Operands.empty()) |
| 508 | OS << ", "; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 509 | Operands.PrintParameters(OS); |
| 510 | OS << ") {\n"; |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 511 | |
Owen Anderson | 70647e8 | 2008-08-26 18:50:00 +0000 | [diff] [blame] | 512 | OS << " if (RetVT != " << getName(RM.begin()->first) |
| 513 | << ")\n return 0;\n"; |
| 514 | |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 515 | const PredMap &PM = RM.begin()->second; |
| 516 | bool HasPred = false; |
| 517 | |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 518 | // Emit code for each possible instruction. There may be |
| 519 | // multiple if there are subtarget concerns. |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 520 | for (PredMap::const_iterator PI = PM.begin(), PE = PM.end(); PI != PE; |
| 521 | ++PI) { |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 522 | std::string PredicateCheck = PI->first; |
| 523 | const InstructionMemo &Memo = PI->second; |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 524 | |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 525 | if (PredicateCheck.empty()) { |
| 526 | assert(!HasPred && |
| 527 | "Multiple instructions match, at least one has " |
| 528 | "a predicate and at least one doesn't!"); |
| 529 | } else { |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 530 | OS << " if (" + PredicateCheck + ") {\n"; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 531 | OS << " "; |
| 532 | HasPred = true; |
| 533 | } |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 534 | |
| 535 | for (unsigned i = 0; i < Memo.PhysRegs->size(); ++i) { |
| 536 | if ((*Memo.PhysRegs)[i] != "") |
| 537 | OS << " TII.copyRegToReg(*MBB, MBB->end(), " |
| 538 | << (*Memo.PhysRegs)[i] << ", Op" << i << ", " |
| 539 | << "TM.getRegisterInfo()->getPhysicalRegisterRegClass(" |
| 540 | << (*Memo.PhysRegs)[i] << "), " |
| 541 | << "MRI.getRegClass(Op" << i << "));\n"; |
| 542 | } |
| 543 | |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 544 | OS << " return FastEmitInst_"; |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 545 | |
| 546 | if (Memo.SubRegNo == (unsigned char)~0) { |
Evan Cheng | 98d2d07 | 2008-09-08 08:39:33 +0000 | [diff] [blame^] | 547 | Operands.PrintManglingSuffix(OS, *Memo.PhysRegs); |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 548 | OS << "(" << InstNS << Memo.Name << ", "; |
| 549 | OS << InstNS << Memo.RC->getName() << "RegisterClass"; |
| 550 | if (!Operands.empty()) |
| 551 | OS << ", "; |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 552 | Operands.PrintArguments(OS, *Memo.PhysRegs); |
Owen Anderson | b5dbcb5 | 2008-08-28 18:06:12 +0000 | [diff] [blame] | 553 | OS << ");\n"; |
| 554 | } else { |
| 555 | OS << "extractsubreg(Op0, "; |
| 556 | OS << (unsigned)Memo.SubRegNo; |
| 557 | OS << ");\n"; |
| 558 | } |
Owen Anderson | 667d8f7 | 2008-08-29 17:45:56 +0000 | [diff] [blame] | 559 | |
| 560 | if (HasPred) |
| 561 | OS << " }\n"; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 562 | } |
Owen Anderson | 71669e5 | 2008-08-26 00:42:26 +0000 | [diff] [blame] | 563 | |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 564 | // Return 0 if none of the predicates were satisfied. |
| 565 | if (HasPred) |
| 566 | OS << " return 0;\n"; |
| 567 | OS << "}\n"; |
| 568 | OS << "\n"; |
Dan Gohman | 22bb311 | 2008-08-22 00:20:26 +0000 | [diff] [blame] | 569 | } |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 570 | } |
| 571 | |
| 572 | // Emit one function for the opcode that demultiplexes based on the type. |
Evan Cheng | c3f44b0 | 2008-09-03 00:03:49 +0000 | [diff] [blame] | 573 | OS << "unsigned FastEmit_" |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 574 | << getLegalCName(Opcode) << "_"; |
| 575 | Operands.PrintManglingSuffix(OS); |
Owen Anderson | 0f84e4e | 2008-08-25 23:58:18 +0000 | [diff] [blame] | 576 | OS << "(MVT::SimpleValueType VT, MVT::SimpleValueType RetVT"; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 577 | if (!Operands.empty()) |
| 578 | OS << ", "; |
| 579 | Operands.PrintParameters(OS); |
| 580 | OS << ") {\n"; |
| 581 | OS << " switch (VT) {\n"; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 582 | for (TypeRetPredMap::const_iterator TI = TM.begin(), TE = TM.end(); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 583 | TI != TE; ++TI) { |
| 584 | MVT::SimpleValueType VT = TI->first; |
| 585 | std::string TypeName = getName(VT); |
| 586 | OS << " case " << TypeName << ": return FastEmit_" |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 587 | << getLegalCName(Opcode) << "_" << getLegalCName(TypeName) << "_"; |
| 588 | Operands.PrintManglingSuffix(OS); |
Owen Anderson | 0f84e4e | 2008-08-25 23:58:18 +0000 | [diff] [blame] | 589 | OS << "(RetVT"; |
| 590 | if (!Operands.empty()) |
| 591 | OS << ", "; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 592 | Operands.PrintArguments(OS); |
| 593 | OS << ");\n"; |
| 594 | } |
| 595 | OS << " default: return 0;\n"; |
| 596 | OS << " }\n"; |
| 597 | OS << "}\n"; |
| 598 | OS << "\n"; |
| 599 | } |
| 600 | |
Dan Gohman | 0bfb752 | 2008-08-22 00:28:15 +0000 | [diff] [blame] | 601 | OS << "// Top-level FastEmit function.\n"; |
| 602 | OS << "\n"; |
| 603 | |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 604 | // Emit one function for the operand signature that demultiplexes based |
| 605 | // on opcode and type. |
Evan Cheng | c3f44b0 | 2008-09-03 00:03:49 +0000 | [diff] [blame] | 606 | OS << "unsigned FastEmit_"; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 607 | Operands.PrintManglingSuffix(OS); |
Owen Anderson | 0f84e4e | 2008-08-25 23:58:18 +0000 | [diff] [blame] | 608 | OS << "(MVT::SimpleValueType VT, MVT::SimpleValueType RetVT, ISD::NodeType Opcode"; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 609 | if (!Operands.empty()) |
| 610 | OS << ", "; |
| 611 | Operands.PrintParameters(OS); |
| 612 | OS << ") {\n"; |
| 613 | OS << " switch (Opcode) {\n"; |
Owen Anderson | 7b2e579 | 2008-08-25 23:43:09 +0000 | [diff] [blame] | 614 | for (OpcodeTypeRetPredMap::const_iterator I = OTM.begin(), E = OTM.end(); |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 615 | I != E; ++I) { |
| 616 | const std::string &Opcode = I->first; |
| 617 | |
| 618 | OS << " case " << Opcode << ": return FastEmit_" |
Dan Gohman | d5fe57d | 2008-08-21 01:41:07 +0000 | [diff] [blame] | 619 | << getLegalCName(Opcode) << "_"; |
| 620 | Operands.PrintManglingSuffix(OS); |
Owen Anderson | 0f84e4e | 2008-08-25 23:58:18 +0000 | [diff] [blame] | 621 | OS << "(VT, RetVT"; |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 622 | if (!Operands.empty()) |
| 623 | OS << ", "; |
| 624 | Operands.PrintArguments(OS); |
| 625 | OS << ");\n"; |
| 626 | } |
| 627 | OS << " default: return 0;\n"; |
| 628 | OS << " }\n"; |
| 629 | OS << "}\n"; |
| 630 | OS << "\n"; |
| 631 | } |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | void FastISelEmitter::run(std::ostream &OS) { |
| 635 | const CodeGenTarget &Target = CGP.getTargetInfo(); |
| 636 | |
| 637 | // Determine the target's namespace name. |
| 638 | std::string InstNS = Target.getInstNamespace() + "::"; |
| 639 | assert(InstNS.size() > 2 && "Can't determine target-specific namespace!"); |
| 640 | |
| 641 | EmitSourceFileHeader("\"Fast\" Instruction Selector for the " + |
| 642 | Target.getName() + " target", OS); |
| 643 | |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 644 | FastISelMap F(InstNS); |
| 645 | F.CollectPatterns(CGP); |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 646 | F.PrintFunctionDefinitions(OS); |
Dan Gohman | c7f72de | 2008-08-21 00:19:05 +0000 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | FastISelEmitter::FastISelEmitter(RecordKeeper &R) |
| 650 | : Records(R), |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 651 | CGP(R) { |
Dan Gohman | b0cf29c | 2008-08-13 20:19:35 +0000 | [diff] [blame] | 652 | } |
Dan Gohman | 72d63af | 2008-08-26 21:21:20 +0000 | [diff] [blame] | 653 | |