* Pull BasicBlock::pred_* and BasicBlock::succ_* out of BasicBlock.h and into
llvm/Support/CFG.h
* Make pred & succ iterators for intervals global functions
* Add #includes that are now neccesary because BasicBlock.h doesn't include
InstrTypes.h anymore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1750 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
index 6e6d14c..edf84d4 100644
--- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
+++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp
@@ -17,6 +17,7 @@
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h" // FIXME: Remove when AnalysisUsage sets can be symbolic!
#include "llvm/Target/TargetMachine.h"
#include "llvm/BasicBlock.h"
+#include "llvm/Instruction.h"
#include "SchedPriorities.h"
#include <ext/hash_set>
#include <algorithm>
@@ -1287,14 +1288,11 @@
SchedGraph *graph)
{
const MachineInstrInfo& mii = S.getInstrInfo();
- const TerminatorInst *termInstr = bb->getTerminator();
+ const Instruction *termInstr = (Instruction*)bb->getTerminator();
MachineCodeForInstruction &termMvec=MachineCodeForInstruction::get(termInstr);
vector<SchedGraphNode*> delayNodeVec;
const MachineInstr* brInstr = NULL;
- assert(termInstr->getOpcode() != Instruction::Call
- && "Call used as terminator?");
-
if (termInstr->getOpcode() != Instruction::Ret)
{
// To find instructions that need delay slots without searching the full
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.h b/lib/Target/SparcV9/InstrSched/SchedGraph.h
index 80355e4..fb6087c 100644
--- a/lib/Target/SparcV9/InstrSched/SchedGraph.h
+++ b/lib/Target/SparcV9/InstrSched/SchedGraph.h
@@ -391,13 +391,13 @@
// for <const SchedGraphNode, SchedGraphNode::const_iterator>.
//
template <class _NodeType, class _EdgeType, class _EdgeIter>
-class PredIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
+class SGPredIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
protected:
_EdgeIter oi;
public:
- typedef PredIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
+ typedef SGPredIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
- inline PredIterator(_EdgeIter startEdge) : oi(startEdge) {}
+ inline SGPredIterator(_EdgeIter startEdge) : oi(startEdge) {}
inline bool operator==(const _Self& x) const { return oi == x.oi; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
@@ -420,13 +420,13 @@
};
template <class _NodeType, class _EdgeType, class _EdgeIter>
-class SuccIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
+class SGSuccIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
protected:
_EdgeIter oi;
public:
- typedef SuccIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
+ typedef SGSuccIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
- inline SuccIterator(_EdgeIter startEdge) : oi(startEdge) {}
+ inline SGSuccIterator(_EdgeIter startEdge) : oi(startEdge) {}
inline bool operator==(const _Self& x) const { return oi == x.oi; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
@@ -451,9 +451,9 @@
// sg_pred_iterator
// sg_pred_const_iterator
//
-typedef PredIterator<SchedGraphNode, SchedGraphEdge, SchedGraphNode::iterator>
+typedef SGPredIterator<SchedGraphNode, SchedGraphEdge, SchedGraphNode::iterator>
sg_pred_iterator;
-typedef PredIterator<const SchedGraphNode, const SchedGraphEdge,SchedGraphNode::const_iterator>
+typedef SGPredIterator<const SchedGraphNode, const SchedGraphEdge,SchedGraphNode::const_iterator>
sg_pred_const_iterator;
inline sg_pred_iterator pred_begin( SchedGraphNode *N) {
@@ -474,9 +474,9 @@
// sg_succ_iterator
// sg_succ_const_iterator
//
-typedef SuccIterator<SchedGraphNode, SchedGraphEdge, SchedGraphNode::iterator>
+typedef SGSuccIterator<SchedGraphNode, SchedGraphEdge, SchedGraphNode::iterator>
sg_succ_iterator;
-typedef SuccIterator<const SchedGraphNode, const SchedGraphEdge,SchedGraphNode::const_iterator>
+typedef SGSuccIterator<const SchedGraphNode, const SchedGraphEdge,SchedGraphNode::const_iterator>
sg_succ_const_iterator;
inline sg_succ_iterator succ_begin( SchedGraphNode *N) {
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
index cd0ca66..af02e57 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
@@ -159,7 +159,7 @@
void InsertPhiElimInst(BasicBlock *BB, MachineInstr *CpMI) {
- TerminatorInst *TermInst = BB->getTerminator();
+ Instruction *TermInst = (Instruction*)BB->getTerminator();
MachineCodeForInstruction &MC4Term = MachineCodeForInstruction::get(TermInst);
MachineInstr *FirstMIOfTerm = *( MC4Term.begin() );
diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
index 84adecd..1468301 100644
--- a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
+++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
@@ -8,6 +8,7 @@
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/BasicBlock.h"
+#include "llvm/Support/CFG.h"
#include "Support/SetOperations.h"
/// BROKEN: Should not include sparc stuff directly into here
@@ -197,8 +198,8 @@
//
bool needAnotherIt = false;
- for (BasicBlock::pred_const_iterator PI = BB->pred_begin(),
- PE = BB->pred_begin(); PI != PE ; ++PI) {
+ for (pred_const_iterator PI = pred_begin(BB), PE = pred_begin(BB);
+ PI != PE ; ++PI) {
BBLiveVar *PredLVBB = BBLiveVar::GetFromBB(*PI);
// do set union
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index b026ccd..a4556d1 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -84,15 +84,16 @@
void InsertPrologEpilogCode::InsertEpilogCode(Method* method)
{
- for (Method::iterator I=method->begin(), E=method->end(); I != E; ++I)
- if ((*I)->getTerminator()->getOpcode() == Instruction::Ret)
+ for (Method::iterator I=method->begin(), E=method->end(); I != E; ++I) {
+ Instruction *TermInst = (Instruction*)(*I)->getTerminator();
+ if (TermInst->getOpcode() == Instruction::Ret)
{
BasicBlock* exitBB = *I;
unsigned N = GetInstructionsForEpilog(exitBB, Target, minstrVec);
MachineCodeForBasicBlock& bbMvec = exitBB->getMachineInstrVec();
MachineCodeForInstruction &termMvec =
- MachineCodeForInstruction::get(exitBB->getTerminator());
+ MachineCodeForInstruction::get(TermInst);
// Remove the NOPs in the delay slots of the return instruction
const MachineInstrInfo &mii = Target.getInstrInfo();
@@ -115,6 +116,7 @@
// Append the epilog code to the end of the basic block.
bbMvec.push_back(minstrVec[0]);
}
+ }
}