#include "llvm/Pass.h"
#include <set>
-namespace cfg {
-
//===----------------------------------------------------------------------===//
//
// DominatorBase - Base class that other, more interesting dominator analyses
}
};
-} // End namespace cfg
-
#endif
class Value;
class PHINode;
class Instruction;
-namespace cfg { class LoopInfo; class Loop; }
+class LoopInfo; class Loop;
class InductionVariable {
public:
// Create an induction variable for the specified value. If it is a PHI, and
// if it's recognizable, classify it and fill in instance variables.
//
- InductionVariable(PHINode *PN, cfg::LoopInfo *LoopInfo = 0);
+ InductionVariable(PHINode *PN, LoopInfo *LoopInfo = 0);
// Classify Induction
static enum iType Classify(const Value *Start, const Value *Step,
- const cfg::Loop *L = 0);
+ const Loop *L = 0);
};
#endif
//===- llvm/Analysis/Interval.h - Interval Class Declaration -----*- C++ -*--=//
//
-// This file contains the declaration of the cfg::Interval class, which
+// This file contains the declaration of the Interval class, which
// represents a set of CFG nodes and is a portion of an interval partition.
//
// Intervals have some interesting and useful properties, including the
class BasicBlock;
-namespace cfg {
-
//===----------------------------------------------------------------------===//
//
// Interval Class - An Interval is a set of nodes defined such that every node
bool isLoop() const;
};
-} // End namespace cfg
-
// succ_begin/succ_end - define methods so that Intervals may be used
// just like BasicBlocks can with the succ_* functions, and *::succ_iterator.
//
-inline cfg::Interval::succ_iterator succ_begin(cfg::Interval *I) {
+inline Interval::succ_iterator succ_begin(Interval *I) {
return I->Successors.begin();
}
-inline cfg::Interval::succ_iterator succ_end(cfg::Interval *I) {
+inline Interval::succ_iterator succ_end(Interval *I) {
return I->Successors.end();
}
// pred_begin/pred_end - define methods so that Intervals may be used
// just like BasicBlocks can with the pred_* functions, and *::pred_iterator.
//
-inline cfg::Interval::pred_iterator pred_begin(cfg::Interval *I) {
+inline Interval::pred_iterator pred_begin(Interval *I) {
return I->Predecessors.begin();
}
-inline cfg::Interval::pred_iterator pred_end(cfg::Interval *I) {
+inline Interval::pred_iterator pred_end(Interval *I) {
return I->Predecessors.end();
}
-
#endif
#include <set>
#include <algorithm>
-namespace cfg {
-
// getNodeHeader - Given a source graph node and the source graph, return the
// BasicBlock that is the header node. This is the opposite of
// getSourceGraphNode.
return interval_part_interval_iterator();
}
-} // End namespace cfg
-
#endif
//===- IntervalPartition.h - Interval partition Calculation ------*- C++ -*--=//
//
-// This file contains the declaration of the cfg::IntervalPartition class, which
+// This file contains the declaration of the IntervalPartition class, which
// calculates and represents the interval partition of a function, or a
// preexisting interval partition.
//
#include "llvm/Analysis/Interval.h"
#include "llvm/Pass.h"
-namespace cfg {
-
//===----------------------------------------------------------------------===//
//
// IntervalPartition - This class builds and holds an "interval partition" for
void updatePredecessors(Interval *Int);
};
-} // End namespace cfg
-
#endif
#include "llvm/Pass.h"
#include <set>
-namespace cfg {
- class DominatorSet;
- class LoopInfo;
+class DominatorSet;
+class LoopInfo;
//===----------------------------------------------------------------------===//
// Loop class - Instances of this class are used to represent loops that are
std::map<BasicBlock*, Loop*> BBMap;
std::vector<Loop*> TopLevelLoops;
public:
- static AnalysisID ID; // cfg::LoopInfo Analysis ID
+ static AnalysisID ID; // LoopInfo Analysis ID
// LoopInfo ctor - Calculate the natural loop information for a CFG
LoopInfo(AnalysisID id) { assert(id == ID); }
Loop *ConsiderForLoop(BasicBlock *BB, const DominatorSet &DS);
};
-} // End namespace cfg
-
#endif
#include <iosfwd>
-namespace cfg {
+// This library provides support for printing out Intervals.
+class Interval;
+class IntervalPartition;
- // This library provides support for printing out Intervals.
- class Interval;
- class IntervalPartition;
+void WriteToOutput(const Interval *I, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o, const Interval *I) {
+ WriteToOutput(I, o); return o;
+}
- void WriteToOutput(const Interval *I, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o, const Interval *I) {
- WriteToOutput(I, o); return o;
- }
+void WriteToOutput(const IntervalPartition &IP, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o,
+ const IntervalPartition &IP) {
+ WriteToOutput(IP, o); return o;
+}
- void WriteToOutput(const IntervalPartition &IP, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o,
- const IntervalPartition &IP) {
- WriteToOutput(IP, o); return o;
- }
+// Stuff for printing out Dominator data structures...
+class DominatorSet;
+class ImmediateDominators;
+class DominatorTree;
+class DominanceFrontier;
- // Stuff for printing out Dominator data structures...
- class DominatorSet;
- class ImmediateDominators;
- class DominatorTree;
- class DominanceFrontier;
+void WriteToOutput(const DominatorSet &, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o, const DominatorSet &DS) {
+ WriteToOutput(DS, o); return o;
+}
- void WriteToOutput(const DominatorSet &, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o, const DominatorSet &DS) {
- WriteToOutput(DS, o); return o;
- }
+void WriteToOutput(const ImmediateDominators &, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o,
+ const ImmediateDominators &ID) {
+ WriteToOutput(ID, o); return o;
+}
- void WriteToOutput(const ImmediateDominators &, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o,
- const ImmediateDominators &ID) {
- WriteToOutput(ID, o); return o;
- }
+void WriteToOutput(const DominatorTree &, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o, const DominatorTree &DT) {
+ WriteToOutput(DT, o); return o;
+}
- void WriteToOutput(const DominatorTree &, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o, const DominatorTree &DT) {
- WriteToOutput(DT, o); return o;
- }
+void WriteToOutput(const DominanceFrontier &, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o,
+ const DominanceFrontier &DF) {
+ WriteToOutput(DF, o); return o;
+}
- void WriteToOutput(const DominanceFrontier &, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o,
- const DominanceFrontier &DF) {
- WriteToOutput(DF, o); return o;
- }
+// Stuff for printing out Loop information
+class Loop;
+class LoopInfo;
- // Stuff for printing out Loop information
- class Loop;
- class LoopInfo;
+void WriteToOutput(const LoopInfo &, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o, const LoopInfo &LI) {
+ WriteToOutput(LI, o); return o;
+}
- void WriteToOutput(const LoopInfo &, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o, const LoopInfo &LI) {
- WriteToOutput(LI, o); return o;
- }
-
- void WriteToOutput(const Loop *, std::ostream &o);
- inline std::ostream &operator <<(std::ostream &o, const Loop *L) {
- WriteToOutput(L, o); return o;
- }
-
-} // End namespace CFG
+void WriteToOutput(const Loop *, std::ostream &o);
+inline std::ostream &operator <<(std::ostream &o, const Loop *L) {
+ WriteToOutput(L, o); return o;
+}
class InductionVariable;
void WriteToOutput(const InductionVariable &, std::ostream &o);
#define LLVM_OPT_INDUCTION_VARS_H
#include "llvm/Pass.h"
-namespace cfg { class IntervalPartition; }
+class IntervalPartition;
struct InductionVariableCannonicalize : public FunctionPass {
// doInductionVariableCannonicalize - Simplify induction variables in loops
//
- static bool doIt(Function *F, cfg::IntervalPartition &IP);
+ static bool doIt(Function *F, IntervalPartition &IP);
virtual bool runOnFunction(Function *F);
class MachineRegInfo;
class FunctionLiveVarInfo;
class MachineInstr;
-namespace cfg { class LoopInfo; }
+class LoopInfo;
//----------------------------------------------------------------------------
// Class AddedInstrns:
const TargetMachine &TM; // target machine
const Function *Meth; // name of the function we work on
MachineCodeForMethod &mcInfo; // descriptor for method's native code
- FunctionLiveVarInfo *const LVI; // LV information for this method
+ FunctionLiveVarInfo *const LVI; // LV information for this method
// (already computed for BBs)
LiveRangeInfo LRI; // LR info (will be computed)
const MachineRegInfo &MRI; // Machine Register information
AddedInstrMapType AddedInstrMap; // to store instrns added in this phase
AddedInstrns AddedInstrAtEntry; // to store instrns added at entry
- cfg::LoopInfo *LoopDepthCalc; // to calculate loop depths
+ LoopInfo *LoopDepthCalc; // to calculate loop depths
ReservedColorListType ResColList; // A set of reserved regs if desired.
// currently not used
public:
PhyRegAlloc(Function *F, const TargetMachine& TM, FunctionLiveVarInfo *Lvi,
- cfg::LoopInfo *LoopDepthCalc);
+ LoopInfo *LoopDepthCalc);
~PhyRegAlloc();
// main method called for allocating registers
class MachineRegInfo;
class FunctionLiveVarInfo;
class MachineInstr;
-namespace cfg { class LoopInfo; }
+class LoopInfo;
//----------------------------------------------------------------------------
// Class AddedInstrns:
const TargetMachine &TM; // target machine
const Function *Meth; // name of the function we work on
MachineCodeForMethod &mcInfo; // descriptor for method's native code
- FunctionLiveVarInfo *const LVI; // LV information for this method
+ FunctionLiveVarInfo *const LVI; // LV information for this method
// (already computed for BBs)
LiveRangeInfo LRI; // LR info (will be computed)
const MachineRegInfo &MRI; // Machine Register information
AddedInstrMapType AddedInstrMap; // to store instrns added in this phase
AddedInstrns AddedInstrAtEntry; // to store instrns added at entry
- cfg::LoopInfo *LoopDepthCalc; // to calculate loop depths
+ LoopInfo *LoopDepthCalc; // to calculate loop depths
ReservedColorListType ResColList; // A set of reserved regs if desired.
// currently not used
public:
PhyRegAlloc(Function *F, const TargetMachine& TM, FunctionLiveVarInfo *Lvi,
- cfg::LoopInfo *LoopDepthCalc);
+ LoopInfo *LoopDepthCalc);
~PhyRegAlloc();
// main method called for allocating registers