aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2006-12-16 02:15:42 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2006-12-16 02:15:42 +0000
commit4b607748d86b44cc59e5cf3eee194dfd9b0fcd86 (patch)
treedeb29e62faba87d6a7268aa7aad3939fe6d44b50 /include/llvm
parent0b1b9dcf22745b533562134c2f0472098fe085fd (diff)
downloadexternal_llvm-4b607748d86b44cc59e5cf3eee194dfd9b0fcd86.zip
external_llvm-4b607748d86b44cc59e5cf3eee194dfd9b0fcd86.tar.gz
external_llvm-4b607748d86b44cc59e5cf3eee194dfd9b0fcd86.tar.bz2
The best unbreakage yet, addressing Bill's concerns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-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 a64af87..b22922c 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 4cf6a24..896d9ef 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 e19a3eb..77de837 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.