mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
* Move BasicBlock and Method graph stuff to new "llvm/Support/CFG.h" file
* Move Method::inst_* to new "llvm/Support/InstIterator.h" file * Method.h no longer #includes BasicBlock.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1743 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3,11 +3,9 @@
|
||||
// This file contains the declaration of the BasicBlock class, which represents
|
||||
// a single basic block in the VM.
|
||||
//
|
||||
// Note that basic blocks themselves are Def's, because they are referenced
|
||||
// Note that basic blocks themselves are Value's, because they are referenced
|
||||
// by instructions like branches and can go in switch tables and stuff...
|
||||
//
|
||||
// This may see wierd at first, but it's really pretty cool. :)
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Note that well formed basic blocks are formed of a list of instructions
|
||||
@@ -24,7 +22,6 @@
|
||||
|
||||
#include "llvm/ValueHolder.h"
|
||||
#include "llvm/InstrTypes.h"
|
||||
#include "Support/GraphTraits.h"
|
||||
#include <iterator>
|
||||
|
||||
class Instruction;
|
||||
@@ -253,71 +250,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// GraphTraits specializations for basic block graphs (CFGs)
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a method as a
|
||||
// graph of basic blocks...
|
||||
|
||||
template <> struct GraphTraits<BasicBlock*> {
|
||||
typedef BasicBlock NodeType;
|
||||
typedef BasicBlock::succ_iterator ChildIteratorType;
|
||||
|
||||
static NodeType *getEntryNode(BasicBlock *BB) { return BB; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->succ_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->succ_end();
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct GraphTraits<const BasicBlock*> {
|
||||
typedef const BasicBlock NodeType;
|
||||
typedef BasicBlock::succ_const_iterator ChildIteratorType;
|
||||
|
||||
static NodeType *getEntryNode(const BasicBlock *BB) { return BB; }
|
||||
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->succ_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->succ_end();
|
||||
}
|
||||
};
|
||||
|
||||
// Provide specializations of GraphTraits to be able to treat a method as a
|
||||
// graph of basic blocks... and to walk it in inverse order. Inverse order for
|
||||
// a method is considered to be when traversing the predecessor edges of a BB
|
||||
// instead of the successor edges.
|
||||
//
|
||||
template <> struct GraphTraits<Inverse<BasicBlock*> > {
|
||||
typedef BasicBlock NodeType;
|
||||
typedef BasicBlock::pred_iterator ChildIteratorType;
|
||||
static NodeType *getEntryNode(Inverse<BasicBlock *> G) { return G.Graph; }
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->pred_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->pred_end();
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct GraphTraits<Inverse<const BasicBlock*> > {
|
||||
typedef const BasicBlock NodeType;
|
||||
typedef BasicBlock::pred_const_iterator ChildIteratorType;
|
||||
static NodeType *getEntryNode(Inverse<const BasicBlock*> G) {
|
||||
return G.Graph;
|
||||
}
|
||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||
return N->pred_begin();
|
||||
}
|
||||
static inline ChildIteratorType child_end(NodeType *N) {
|
||||
return N->pred_end();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user