aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/LiveInterval.h7
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h5
-rw-r--r--include/llvm/CodeGen/MachineInstr.h24
3 files changed, 30 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index a64af87d91..b22922c84c 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -56,13 +56,18 @@ namespace llvm {
}
void dump() const;
+ void print(std::ostream &os) const;
private:
LiveRange(); // DO NOT IMPLEMENT
};
std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
- OStream& operator<<(OStream& os, const LiveRange &LR);
+ inline OStream& operator<<(OStream& os, const LiveRange &LR) {
+ if (os.stream()) LR.print(*os.stream());
+ return os;
+ }
+
inline bool operator<(unsigned V, const LiveRange &LR) {
return V < LR.start;
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 4cf6a24e45..896d9efe03 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -226,7 +226,10 @@ private: // Methods used to maintain doubly linked list of blocks...
};
std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB);
-OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB);
+inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) {
+ if (OS.stream()) MBB.print(*OS.stream());
+ return OS;
+}
//===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index e19a3ebfbe..77de83768e 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -76,6 +76,9 @@ private:
int offset;
MachineOperand() {}
+
+ void print(std::ostream &os) const;
+
public:
MachineOperand(const MachineOperand &M) {
*this = M;
@@ -285,8 +288,14 @@ public:
IsDead = false;
}
- friend OStream& operator<<(OStream& os, const MachineOperand& mop);
- friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop);
+ friend OStream& operator<<(OStream& os, const MachineOperand& mop) {
+ if (os.stream()) mop.print(*os.stream());
+ return os;
+ }
+ friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop) {
+ mop.print(os);
+ return os;
+ }
friend class MachineInstr;
};
@@ -398,9 +407,16 @@ public:
if (OS.stream()) print(*OS.stream(), TM);
}
void print(std::ostream &OS, const TargetMachine *TM) const;
+ void print(std::ostream &OS) const;
void dump() const;
- friend OStream& operator<<(OStream& os, const MachineInstr& minstr);
- friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr);
+ friend OStream& operator<<(OStream& os, const MachineInstr& minstr) {
+ if (os.stream()) minstr.print(*os.stream());
+ return os;
+ }
+ friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr){
+ minstr.print(os);
+ return os;
+ }
//===--------------------------------------------------------------------===//
// Accessors to add operands when building up machine instructions.