fix indentation

llvm-svn: 96409
This commit is contained in:
Chris Lattner 2010-02-16 22:38:31 +00:00
parent afac7dad21
commit 314e34b5b8
1 changed files with 66 additions and 62 deletions

View File

@ -737,9 +737,10 @@ void PatternCodeEmitter::EmitChildMatchCode(TreePatternNode *Child,
FoldedFlag = std::make_pair(getValueName(RootName), FoldedFlag = std::make_pair(getValueName(RootName),
CInfo.getNumResults() + (unsigned)HasChain); CInfo.getNumResults() + (unsigned)HasChain);
} }
} else if (const ComplexPattern *CP = Child->getComplexPatternInfo(CGP)) { return;
if (CP->getSelectFunc() == "SelectScalarSSELoad") }
errs() << "FOUND IT\n";
if (const ComplexPattern *CP = Child->getComplexPatternInfo(CGP)) {
EmitMatchCode(Child, Parent, RootName, ChainSuffix, FoundChain); EmitMatchCode(Child, Parent, RootName, ChainSuffix, FoundChain);
bool HasChain = false; bool HasChain = false;
@ -755,73 +756,76 @@ void PatternCodeEmitter::EmitChildMatchCode(TreePatternNode *Child,
FoldedFlag = std::make_pair(getValueName(RootName), FoldedFlag = std::make_pair(getValueName(RootName),
CP->getNumOperands() + (unsigned)HasChain); CP->getNumOperands() + (unsigned)HasChain);
} }
} else { return;
// If this child has a name associated with it, capture it in VarMap. If }
// we already saw this in the pattern, emit code to verify dagness.
if (!Child->getName().empty()) { // If this child has a name associated with it, capture it in VarMap. If
std::string &VarMapEntry = VariableMap[Child->getName()]; // we already saw this in the pattern, emit code to verify dagness.
if (VarMapEntry.empty()) { if (!Child->getName().empty()) {
VarMapEntry = getValueName(RootName); std::string &VarMapEntry = VariableMap[Child->getName()];
} else { if (VarMapEntry.empty()) {
// If we get here, this is a second reference to a specific name. VarMapEntry = getValueName(RootName);
// Since we already have checked that the first reference is valid, } else {
// we don't have to recursively match it, just check that it's the // If we get here, this is a second reference to a specific name.
// same as the previously named thing. // Since we already have checked that the first reference is valid,
emitCheck(VarMapEntry + " == " + getValueName(RootName)); // we don't have to recursively match it, just check that it's the
Duplicates.insert(getValueName(RootName)); // same as the previously named thing.
return; emitCheck(VarMapEntry + " == " + getValueName(RootName));
} Duplicates.insert(getValueName(RootName));
return;
} }
}
// Handle leaves of various types.
if (DefInit *DI = dynamic_cast<DefInit*>(Child->getLeafValue())) { // Handle leaves of various types.
Record *LeafRec = DI->getDef(); if (DefInit *DI = dynamic_cast<DefInit*>(Child->getLeafValue())) {
if (LeafRec->isSubClassOf("RegisterClass") || Record *LeafRec = DI->getDef();
LeafRec->isSubClassOf("PointerLikeRegClass")) { if (LeafRec->isSubClassOf("RegisterClass") ||
// Handle register references. Nothing to do here. LeafRec->isSubClassOf("PointerLikeRegClass")) {
} else if (LeafRec->isSubClassOf("Register")) { // Handle register references. Nothing to do here.
// Handle register references. } else if (LeafRec->isSubClassOf("Register")) {
} else if (LeafRec->getName() == "srcvalue") { // Handle register references.
// Place holder for SRCVALUE nodes. Nothing to do here. } else if (LeafRec->getName() == "srcvalue") {
} else if (LeafRec->isSubClassOf("ValueType")) { // Place holder for SRCVALUE nodes. Nothing to do here.
// Make sure this is the specified value type. } else if (LeafRec->isSubClassOf("ValueType")) {
emitCheck("cast<VTSDNode>(" + getNodeName(RootName) + // Make sure this is the specified value type.
")->getVT() == MVT::" + LeafRec->getName()); emitCheck("cast<VTSDNode>(" + getNodeName(RootName) +
} else if (LeafRec->isSubClassOf("CondCode")) { ")->getVT() == MVT::" + LeafRec->getName());
// Make sure this is the specified cond code. } else if (LeafRec->isSubClassOf("CondCode")) {
emitCheck("cast<CondCodeSDNode>(" + getNodeName(RootName) + // Make sure this is the specified cond code.
")->get() == ISD::" + LeafRec->getName()); emitCheck("cast<CondCodeSDNode>(" + getNodeName(RootName) +
} else { ")->get() == ISD::" + LeafRec->getName());
#ifndef NDEBUG
Child->dump();
errs() << " ";
#endif
assert(0 && "Unknown leaf type!");
}
// If there are node predicates for this, emit the calls.
for (unsigned i = 0, e = Child->getPredicateFns().size(); i != e; ++i)
emitCheck(Child->getPredicateFns()[i] + "(" + getNodeName(RootName) +
")");
} else if (IntInit *II =
dynamic_cast<IntInit*>(Child->getLeafValue())) {
unsigned NTmp = TmpNo++;
emitCode("ConstantSDNode *Tmp"+ utostr(NTmp) +
" = dyn_cast<ConstantSDNode>("+
getNodeName(RootName) + ");");
emitCheck("Tmp" + utostr(NTmp));
unsigned CTmp = TmpNo++;
emitCode("int64_t CN"+ utostr(CTmp) +
" = Tmp" + utostr(NTmp) + "->getSExtValue();");
emitCheck("CN" + utostr(CTmp) + " == "
"INT64_C(" +itostr(II->getValue()) + ")");
} else { } else {
#ifndef NDEBUG #ifndef NDEBUG
Child->dump(); Child->dump();
errs() << " ";
#endif #endif
assert(0 && "Unknown leaf type!"); assert(0 && "Unknown leaf type!");
} }
// If there are node predicates for this, emit the calls.
for (unsigned i = 0, e = Child->getPredicateFns().size(); i != e; ++i)
emitCheck(Child->getPredicateFns()[i] + "(" + getNodeName(RootName) +
")");
return;
} }
if (IntInit *II = dynamic_cast<IntInit*>(Child->getLeafValue())) {
unsigned NTmp = TmpNo++;
emitCode("ConstantSDNode *Tmp"+ utostr(NTmp) +
" = dyn_cast<ConstantSDNode>("+
getNodeName(RootName) + ");");
emitCheck("Tmp" + utostr(NTmp));
unsigned CTmp = TmpNo++;
emitCode("int64_t CN"+ utostr(CTmp) +
" = Tmp" + utostr(NTmp) + "->getSExtValue();");
emitCheck("CN" + utostr(CTmp) + " == "
"INT64_C(" +itostr(II->getValue()) + ")");
return;
}
#ifndef NDEBUG
Child->dump();
#endif
assert(0 && "Unknown leaf type!");
} }
/// EmitResultCode - Emit the action for a pattern. Now that it has matched /// EmitResultCode - Emit the action for a pattern. Now that it has matched