aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineInstr.h
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/CodeGen/MachineInstr.h
parent0b1b9dcf22745b533562134c2f0472098fe085fd (diff)
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/CodeGen/MachineInstr.h')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h24
1 files changed, 20 insertions, 4 deletions
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.