assert((!EnableFastISelAbort || EnableFastISel) &&
"-fast-isel-abort requires -fast-isel");
- Function &Fn = *mf.getFunction();
+ const Function &Fn = *mf.getFunction();
const TargetInstrInfo &TII = *TM.getInstrInfo();
const TargetRegisterInfo &TRI = *TM.getRegisterInfo();
FastIS->setCurDebugLoc(DL);
// If the function doesn't have a default debug location yet, set
- // it. This is kind of a hack.
+ // it. This is a total hack.
if (MF->getDefaultDebugLoc().isUnknown())
MF->setDefaultDebugLoc(DL);
}
SDB->setCurrentBasicBlock(BB);
// Lower all of the non-terminator instructions. If a call is emitted
- // as a tail call, cease emitting nodes for this block.
+ // as a tail call, cease emitting nodes for this block. Terminators
+ // are handled below.
for (BasicBlock::const_iterator I = Begin;
- I != End && !SDB->HasTailCall; ++I) {
+ I != End && !SDB->HasTailCall && !isa<TerminatorInst>(I);
+ ++I) {
SetDebugLoc(I, SDB, 0, MF);
-
- // Visit the instruction. Terminators are handled below.
- if (!isa<TerminatorInst>(I))
- SDB->visit(*I);
-
+ SDB->visit(*I);
ResetDebugLoc(SDB, 0);
}
BI->dump();
}
- if (!BI->getType()->isVoidTy()) {
+ if (!BI->getType()->isVoidTy() && !BI->use_empty()) {
unsigned &R = FuncInfo->ValueMap[BI];
if (!R)
R = FuncInfo->CreateRegForValue(BI);
}
}
+namespace {
struct MatchScope {
/// FailIndex - If this match fails, this is the index to continue with.
bool HasChainNodesMatched, HasFlagResultNodesMatched;
};
+}
+
SDNode *SelectionDAGISel::
SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
unsigned TableSize) {