blob: 849e647a1f0136f544f883722604b44aa4ff6113 [file] [log] [blame]
Chris Lattner035dfbe2002-08-09 20:08:06 +00001//===-- MachineInstr.cpp --------------------------------------------------===//
Misha Brukmanedf128a2005-04-21 22:36:52 +00002//
John Criswellb576c942003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
Misha Brukmanedf128a2005-04-21 22:36:52 +00007//
John Criswellb576c942003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Brian Gaeke21326fc2004-02-13 04:39:32 +00009//
10// Methods common to all machine instructions.
11//
Chris Lattner035dfbe2002-08-09 20:08:06 +000012//===----------------------------------------------------------------------===//
Vikram S. Adve70bc4b52001-07-21 12:41:50 +000013
Chris Lattner822b4fb2001-09-07 17:18:30 +000014#include "llvm/CodeGen/MachineInstr.h"
Chris Lattner8517e1f2004-02-19 16:17:08 +000015#include "llvm/CodeGen/MachineFunction.h"
Chris Lattner10491642002-10-30 00:48:05 +000016#include "llvm/Target/TargetMachine.h"
Chris Lattner3501fea2003-01-14 22:00:31 +000017#include "llvm/Target/TargetInstrInfo.h"
Chris Lattner2a79a092002-10-30 00:58:19 +000018#include "llvm/Target/MRegisterInfo.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000019#include "llvm/Support/LeakDetector.h"
Reid Spencer954da372004-07-04 12:19:56 +000020#include <iostream>
21
Chris Lattner0742b592004-02-23 18:38:20 +000022using namespace llvm;
Brian Gaeked0fde302003-11-11 22:41:34 +000023
Chris Lattnerf1757c42002-10-29 17:40:30 +000024// Global variable holding an array of descriptors for machine instructions.
25// The actual object needs to be created separately for each target machine.
Chris Lattner3501fea2003-01-14 22:00:31 +000026// This variable is initialized and reset by class TargetInstrInfo.
Misha Brukmanedf128a2005-04-21 22:36:52 +000027//
Chris Lattnerf1757c42002-10-29 17:40:30 +000028// FIXME: This should be a property of the target so that more than one target
29// at a time can be active...
30//
Chris Lattner11d1f212004-02-23 18:40:08 +000031namespace llvm {
Chris Lattner0742b592004-02-23 18:38:20 +000032 extern const TargetInstrDescriptor *TargetInstrDescriptors;
33}
Ruchira Sasanka69917e22001-10-18 22:40:02 +000034
Chris Lattnerddd7fcb2002-10-29 23:19:00 +000035/// MachineInstr ctor - This constructor only does a _reserve_ of the operands,
36/// not a resize for them. It is expected that if you use this that you call
37/// add* methods below to fill up the operands, instead of the Set methods.
38/// Eventually, the "resizing" ctors will be phased out.
39///
Chris Lattner8b915b42006-05-04 18:16:01 +000040MachineInstr::MachineInstr(short opcode, unsigned numOperands)
Evan Chengd7de4962006-11-13 23:34:06 +000041 : Opcode(opcode), parent(0), NumImplicitOps(0) {
Chris Lattner943b5e12006-05-04 19:14:44 +000042 Operands.reserve(numOperands);
Alkis Evlogimenosaad5c052004-02-16 07:17:43 +000043 // Make sure that we get added to a machine basicblock
44 LeakDetector::addGarbageObject(this);
Chris Lattner72791222002-10-28 20:59:49 +000045}
46
Evan Chengd7de4962006-11-13 23:34:06 +000047void MachineInstr::addImplicitDefUseOperands(const TargetInstrDescriptor &TID) {
48 if (TID.ImplicitDefs)
49 for (const unsigned *ImpDefs = TID.ImplicitDefs; *ImpDefs; ++ImpDefs) {
50 MachineOperand Op;
51 Op.opType = MachineOperand::MO_Register;
52 Op.IsDef = true;
53 Op.IsImp = true;
54 Op.IsKill = false;
55 Op.IsDead = false;
56 Op.contents.RegNo = *ImpDefs;
57 Op.offset = 0;
58 Operands.push_back(Op);
59 }
60 if (TID.ImplicitUses)
61 for (const unsigned *ImpUses = TID.ImplicitUses; *ImpUses; ++ImpUses) {
62 MachineOperand Op;
63 Op.opType = MachineOperand::MO_Register;
64 Op.IsDef = false;
65 Op.IsImp = true;
66 Op.IsKill = false;
67 Op.IsDead = false;
68 Op.contents.RegNo = *ImpUses;
69 Op.offset = 0;
70 Operands.push_back(Op);
71 }
72}
73
74/// MachineInstr ctor - This constructor create a MachineInstr and add the
75/// implicit operands. It reserves space for numOperand operands.
76MachineInstr::MachineInstr(const TargetInstrInfo &TII, short opcode,
77 unsigned numOperands)
78 : Opcode(opcode), parent(0), NumImplicitOps(0) {
79 const TargetInstrDescriptor &TID = TII.get(opcode);
80 if (TID.ImplicitDefs)
81 for (const unsigned *ImpDefs = TID.ImplicitDefs; *ImpDefs; ++ImpDefs)
82 NumImplicitOps++;
83 if (TID.ImplicitUses)
84 for (const unsigned *ImpUses = TID.ImplicitUses; *ImpUses; ++ImpUses)
85 NumImplicitOps++;
86 Operands.reserve(NumImplicitOps + numOperands);
87 addImplicitDefUseOperands(TID);
88 // Make sure that we get added to a machine basicblock
89 LeakDetector::addGarbageObject(this);
90}
91
Chris Lattnerddd7fcb2002-10-29 23:19:00 +000092/// MachineInstr ctor - Work exactly the same as the ctor above, except that the
93/// MachineInstr is created and added to the end of the specified basic block.
94///
Alkis Evlogimenosab8672c2004-02-12 18:49:07 +000095MachineInstr::MachineInstr(MachineBasicBlock *MBB, short opcode,
Chris Lattnerddd7fcb2002-10-29 23:19:00 +000096 unsigned numOperands)
Evan Chengd7de4962006-11-13 23:34:06 +000097 : Opcode(opcode), parent(0), NumImplicitOps(0) {
Chris Lattnerddd7fcb2002-10-29 23:19:00 +000098 assert(MBB && "Cannot use inserting ctor with null basic block!");
Evan Chengd7de4962006-11-13 23:34:06 +000099 const TargetInstrDescriptor &TID = MBB->getParent()->getTarget().
100 getInstrInfo()->get(opcode);
101 if (TID.ImplicitDefs)
102 for (const unsigned *ImpDefs = TID.ImplicitDefs; *ImpDefs; ++ImpDefs)
103 NumImplicitOps++;
104 if (TID.ImplicitUses)
105 for (const unsigned *ImpUses = TID.ImplicitUses; *ImpUses; ++ImpUses)
106 NumImplicitOps++;
107 Operands.reserve(NumImplicitOps + numOperands);
108 addImplicitDefUseOperands(TID);
Alkis Evlogimenosaad5c052004-02-16 07:17:43 +0000109 // Make sure that we get added to a machine basicblock
110 LeakDetector::addGarbageObject(this);
Chris Lattnerddd7fcb2002-10-29 23:19:00 +0000111 MBB->push_back(this); // Add instruction to end of basic block!
112}
113
Misha Brukmance22e762004-07-09 14:45:17 +0000114/// MachineInstr ctor - Copies MachineInstr arg exactly
115///
Tanya Lattner466b5342004-05-23 19:35:12 +0000116MachineInstr::MachineInstr(const MachineInstr &MI) {
117 Opcode = MI.getOpcode();
Chris Lattner943b5e12006-05-04 19:14:44 +0000118 Operands.reserve(MI.getNumOperands());
Tanya Lattnerb5159ed2004-05-23 20:58:02 +0000119
Evan Chengd7de4962006-11-13 23:34:06 +0000120 NumImplicitOps = MI.NumImplicitOps;
Misha Brukmance22e762004-07-09 14:45:17 +0000121 // Add operands
Chris Lattner943b5e12006-05-04 19:14:44 +0000122 for (unsigned i = 0; i != MI.getNumOperands(); ++i)
123 Operands.push_back(MI.getOperand(i));
Tanya Lattner0c63e032004-05-24 03:14:18 +0000124
Misha Brukmance22e762004-07-09 14:45:17 +0000125 // Set parent, next, and prev to null
Tanya Lattner0c63e032004-05-24 03:14:18 +0000126 parent = 0;
127 prev = 0;
128 next = 0;
Tanya Lattner466b5342004-05-23 19:35:12 +0000129}
130
131
Misha Brukmance22e762004-07-09 14:45:17 +0000132MachineInstr::~MachineInstr() {
Alkis Evlogimenosaad5c052004-02-16 07:17:43 +0000133 LeakDetector::removeGarbageObject(this);
134}
135
Chris Lattner48d7c062006-04-17 21:35:41 +0000136/// removeFromParent - This method unlinks 'this' from the containing basic
137/// block, and returns it, but does not delete it.
138MachineInstr *MachineInstr::removeFromParent() {
139 assert(getParent() && "Not embedded in a basic block!");
140 getParent()->remove(this);
141 return this;
142}
143
144
Brian Gaeke21326fc2004-02-13 04:39:32 +0000145/// OperandComplete - Return true if it's illegal to add a new operand
146///
Chris Lattner2a90ba62004-02-12 16:09:53 +0000147bool MachineInstr::OperandsComplete() const {
148 int NumOperands = TargetInstrDescriptors[Opcode].numOperands;
Evan Cheng8d3af5e2006-06-15 07:22:16 +0000149 if ((TargetInstrDescriptors[Opcode].Flags & M_VARIABLE_OPS) == 0 &&
Evan Chengd7de4962006-11-13 23:34:06 +0000150 getNumOperands()-NumImplicitOps >= (unsigned)NumOperands)
Vikram S. Adve34977822003-05-31 07:39:06 +0000151 return true; // Broken: we have all the operands of this instruction!
Chris Lattner413746e2002-10-28 20:48:39 +0000152 return false;
153}
154
Chris Lattner8ace2cd2006-10-20 22:39:59 +0000155/// isIdenticalTo - Return true if this operand is identical to the specified
156/// operand.
157bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
158 if (getType() != Other.getType()) return false;
159
160 switch (getType()) {
161 default: assert(0 && "Unrecognized operand type");
162 case MachineOperand::MO_Register:
163 return getReg() == Other.getReg() && isDef() == Other.isDef();
164 case MachineOperand::MO_Immediate:
165 return getImm() == Other.getImm();
166 case MachineOperand::MO_MachineBasicBlock:
167 return getMBB() == Other.getMBB();
168 case MachineOperand::MO_FrameIndex:
169 return getFrameIndex() == Other.getFrameIndex();
170 case MachineOperand::MO_ConstantPoolIndex:
171 return getConstantPoolIndex() == Other.getConstantPoolIndex() &&
172 getOffset() == Other.getOffset();
173 case MachineOperand::MO_JumpTableIndex:
174 return getJumpTableIndex() == Other.getJumpTableIndex();
175 case MachineOperand::MO_GlobalAddress:
176 return getGlobal() == Other.getGlobal() && getOffset() == Other.getOffset();
177 case MachineOperand::MO_ExternalSymbol:
Chris Lattner13a04122006-10-25 18:08:14 +0000178 return !strcmp(getSymbolName(), Other.getSymbolName()) &&
Chris Lattner8ace2cd2006-10-20 22:39:59 +0000179 getOffset() == Other.getOffset();
180 }
181}
182
Evan Chengd7de4962006-11-13 23:34:06 +0000183/// setOpcode - Replace the opcode of the current instruction with a new one.
184///
185void MachineInstr::setOpcode(unsigned Op) {
186 Operands.erase(Operands.begin(), Operands.begin()+NumImplicitOps);
187 NumImplicitOps = 0;
188 Opcode = Op;
189 if (!getParent())
190 return;
191 const TargetInstrDescriptor &TID = getParent()->getParent()->
192 getTarget().getInstrInfo()->get(Op);
Evan Cheng3ba433a2006-11-11 10:20:02 +0000193 if (TID.ImplicitDefs)
Evan Chengd7de4962006-11-13 23:34:06 +0000194 for (const unsigned *ImpDefs = TID.ImplicitDefs; *ImpDefs; ++ImpDefs) {
195 MachineOperand Op;
196 Op.opType = MachineOperand::MO_Register;
197 Op.IsDef = true;
198 Op.IsImp = true;
199 Op.IsKill = false;
200 Op.IsDead = false;
201 Op.contents.RegNo = *ImpDefs;
202 Op.offset = 0;
203 Operands.insert(Operands.begin()+NumImplicitOps, Op);
204 NumImplicitOps++;
205 }
Evan Cheng3ba433a2006-11-11 10:20:02 +0000206 if (TID.ImplicitUses)
Evan Chengd7de4962006-11-13 23:34:06 +0000207 for (const unsigned *ImpUses = TID.ImplicitUses; *ImpUses; ++ImpUses) {
208 MachineOperand Op;
209 Op.opType = MachineOperand::MO_Register;
210 Op.IsDef = false;
211 Op.IsImp = true;
212 Op.IsKill = false;
213 Op.IsDead = false;
214 Op.contents.RegNo = *ImpUses;
215 Op.offset = 0;
216 Operands.insert(Operands.begin()+NumImplicitOps, Op);
217 NumImplicitOps++;
218 }
Evan Cheng3ba433a2006-11-11 10:20:02 +0000219}
220
Chris Lattner8ace2cd2006-10-20 22:39:59 +0000221
Brian Gaeke21326fc2004-02-13 04:39:32 +0000222void MachineInstr::dump() const {
Chris Lattner925b7712003-08-03 20:24:29 +0000223 std::cerr << " " << *this;
Vikram S. Adve70bc4b52001-07-21 12:41:50 +0000224}
225
Chris Lattner2a79a092002-10-30 00:58:19 +0000226static inline void OutputReg(std::ostream &os, unsigned RegNo,
227 const MRegisterInfo *MRI = 0) {
Alkis Evlogimenosddcfd9e2004-02-27 01:52:34 +0000228 if (!RegNo || MRegisterInfo::isPhysicalRegister(RegNo)) {
Chris Lattner8517e1f2004-02-19 16:17:08 +0000229 if (MRI)
Chris Lattner2a79a092002-10-30 00:58:19 +0000230 os << "%" << MRI->get(RegNo).Name;
231 else
Chris Lattner8517e1f2004-02-19 16:17:08 +0000232 os << "%mreg(" << RegNo << ")";
Chris Lattner2a79a092002-10-30 00:58:19 +0000233 } else
Chris Lattner8517e1f2004-02-19 16:17:08 +0000234 os << "%reg" << RegNo;
Vikram S. Adve8c6936a2002-09-16 15:18:53 +0000235}
236
Chris Lattner10491642002-10-30 00:48:05 +0000237static void print(const MachineOperand &MO, std::ostream &OS,
Tanya Lattnerb1407622004-06-25 00:13:11 +0000238 const TargetMachine *TM) {
Misha Brukmance22e762004-07-09 14:45:17 +0000239 const MRegisterInfo *MRI = 0;
Misha Brukmanedf128a2005-04-21 22:36:52 +0000240
Misha Brukmance22e762004-07-09 14:45:17 +0000241 if (TM) MRI = TM->getRegisterInfo();
Tanya Lattnerb1407622004-06-25 00:13:11 +0000242
Chris Lattner10491642002-10-30 00:48:05 +0000243 switch (MO.getType()) {
Chris Lattner2d90ac72006-05-04 18:05:43 +0000244 case MachineOperand::MO_Register:
Chris Lattner4efeab22006-05-04 01:26:39 +0000245 OutputReg(OS, MO.getReg(), MRI);
Chris Lattner10491642002-10-30 00:48:05 +0000246 break;
Chris Lattner63b3d712006-05-04 17:21:20 +0000247 case MachineOperand::MO_Immediate:
Evan Cheng00aff7d2006-05-26 08:00:14 +0000248 OS << MO.getImmedValue();
Chris Lattner10491642002-10-30 00:48:05 +0000249 break;
Chris Lattner2109f502002-12-15 20:35:25 +0000250 case MachineOperand::MO_MachineBasicBlock:
Brian Gaeke988b7ba2004-06-17 22:26:53 +0000251 OS << "mbb<"
Chris Lattner2109f502002-12-15 20:35:25 +0000252 << ((Value*)MO.getMachineBasicBlock()->getBasicBlock())->getName()
Brian Gaeke988b7ba2004-06-17 22:26:53 +0000253 << "," << (void*)MO.getMachineBasicBlock() << ">";
Chris Lattner2109f502002-12-15 20:35:25 +0000254 break;
Chris Lattner10cb79b2002-12-28 20:37:37 +0000255 case MachineOperand::MO_FrameIndex:
256 OS << "<fi#" << MO.getFrameIndex() << ">";
257 break;
Chris Lattner8d95ef42003-01-13 00:23:24 +0000258 case MachineOperand::MO_ConstantPoolIndex:
259 OS << "<cp#" << MO.getConstantPoolIndex() << ">";
260 break;
Nate Begeman37efe672006-04-22 18:53:45 +0000261 case MachineOperand::MO_JumpTableIndex:
262 OS << "<jt#" << MO.getJumpTableIndex() << ">";
263 break;
Chris Lattner8d95ef42003-01-13 00:23:24 +0000264 case MachineOperand::MO_GlobalAddress:
Chris Lattnerca4f6eb2004-10-15 04:38:41 +0000265 OS << "<ga:" << ((Value*)MO.getGlobal())->getName();
266 if (MO.getOffset()) OS << "+" << MO.getOffset();
267 OS << ">";
Chris Lattner8d95ef42003-01-13 00:23:24 +0000268 break;
269 case MachineOperand::MO_ExternalSymbol:
Chris Lattnerca4f6eb2004-10-15 04:38:41 +0000270 OS << "<es:" << MO.getSymbolName();
271 if (MO.getOffset()) OS << "+" << MO.getOffset();
272 OS << ">";
Chris Lattner8d95ef42003-01-13 00:23:24 +0000273 break;
Chris Lattner10491642002-10-30 00:48:05 +0000274 default:
275 assert(0 && "Unrecognized operand type");
276 }
Chris Lattner10491642002-10-30 00:48:05 +0000277}
278
Tanya Lattnerb1407622004-06-25 00:13:11 +0000279void MachineInstr::print(std::ostream &OS, const TargetMachine *TM) const {
Chris Lattner6a592272002-10-30 01:55:38 +0000280 unsigned StartOp = 0;
Chris Lattner10491642002-10-30 00:48:05 +0000281
Chris Lattner6a592272002-10-30 01:55:38 +0000282 // Specialize printing if op#0 is definition
Chris Lattnerd8f44e02006-09-05 20:19:27 +0000283 if (getNumOperands() && getOperand(0).isReg() && getOperand(0).isDef()) {
Chris Lattner0742b592004-02-23 18:38:20 +0000284 ::print(getOperand(0), OS, TM);
Chris Lattner6a592272002-10-30 01:55:38 +0000285 OS << " = ";
286 ++StartOp; // Don't print this operand again!
287 }
Tanya Lattnerb1407622004-06-25 00:13:11 +0000288
Misha Brukmance22e762004-07-09 14:45:17 +0000289 // Must check if Target machine is not null because machine BB could not
290 // be attached to a Machine function yet
291 if (TM)
Tanya Lattnerb1407622004-06-25 00:13:11 +0000292 OS << TM->getInstrInfo()->getName(getOpcode());
Misha Brukmanedf128a2005-04-21 22:36:52 +0000293
Chris Lattner6a592272002-10-30 01:55:38 +0000294 for (unsigned i = StartOp, e = getNumOperands(); i != e; ++i) {
Vikram S. Adve5f2180c2003-05-27 00:05:23 +0000295 const MachineOperand& mop = getOperand(i);
Chris Lattner6a592272002-10-30 01:55:38 +0000296 if (i != StartOp)
297 OS << ",";
298 OS << " ";
Chris Lattner0742b592004-02-23 18:38:20 +0000299 ::print(mop, OS, TM);
Misha Brukmanedf128a2005-04-21 22:36:52 +0000300
Evan Cheng438f7bc2006-11-10 08:43:01 +0000301 if (mop.isReg()) {
Evan Chengd7de4962006-11-13 23:34:06 +0000302 if (mop.isDef() || mop.isKill() || mop.isDead() || mop.isImplicit()) {
303 OS << "<";
304 bool NeedComma = false;
305 if (mop.isImplicit()) {
306 OS << (mop.isDef() ? "imp-def" : "imp-use");
307 NeedComma = true;
308 } else if (mop.isDef()) {
309 OS << "def";
310 NeedComma = true;
311 }
312 if (mop.isKill() || mop.isDead()) {
313 if (NeedComma)
314 OS << ",";
315 if (mop.isKill())
316 OS << "kill";
317 if (mop.isDead())
318 OS << "dead";
319 }
320 OS << ">";
321 }
Evan Cheng438f7bc2006-11-10 08:43:01 +0000322 }
Chris Lattner10491642002-10-30 00:48:05 +0000323 }
Misha Brukmanedf128a2005-04-21 22:36:52 +0000324
Chris Lattner10491642002-10-30 00:48:05 +0000325 OS << "\n";
326}
327
Chris Lattner34fb2ca2006-05-04 00:49:59 +0000328std::ostream &llvm::operator<<(std::ostream &os, const MachineInstr &MI) {
Chris Lattner8517e1f2004-02-19 16:17:08 +0000329 // If the instruction is embedded into a basic block, we can find the target
330 // info for the instruction.
331 if (const MachineBasicBlock *MBB = MI.getParent()) {
332 const MachineFunction *MF = MBB->getParent();
Misha Brukmance22e762004-07-09 14:45:17 +0000333 if (MF)
Tanya Lattnerb1407622004-06-25 00:13:11 +0000334 MI.print(os, &MF->getTarget());
335 else
336 MI.print(os, 0);
Chris Lattner8517e1f2004-02-19 16:17:08 +0000337 return os;
338 }
339
340 // Otherwise, print it out in the "raw" format without symbolic register names
341 // and such.
Chris Lattner2a90ba62004-02-12 16:09:53 +0000342 os << TargetInstrDescriptors[MI.getOpcode()].Name;
Misha Brukmanedf128a2005-04-21 22:36:52 +0000343
Misha Brukmance22e762004-07-09 14:45:17 +0000344 for (unsigned i = 0, N = MI.getNumOperands(); i < N; i++) {
Chris Lattner8d95ef42003-01-13 00:23:24 +0000345 os << "\t" << MI.getOperand(i);
Chris Lattnerd8f44e02006-09-05 20:19:27 +0000346 if (MI.getOperand(i).isReg() && MI.getOperand(i).isDef())
347 os << "<d>";
Ruchira Sasanka8d243372001-11-14 20:05:23 +0000348 }
Misha Brukmanedf128a2005-04-21 22:36:52 +0000349
Chris Lattner697954c2002-01-20 22:54:45 +0000350 return os << "\n";
Vikram S. Adve70bc4b52001-07-21 12:41:50 +0000351}
352
Chris Lattner34fb2ca2006-05-04 00:49:59 +0000353std::ostream &llvm::operator<<(std::ostream &OS, const MachineOperand &MO) {
Misha Brukmance22e762004-07-09 14:45:17 +0000354 switch (MO.getType()) {
Chris Lattner2d90ac72006-05-04 18:05:43 +0000355 case MachineOperand::MO_Register:
Chris Lattner4efeab22006-05-04 01:26:39 +0000356 OutputReg(OS, MO.getReg());
Misha Brukmance22e762004-07-09 14:45:17 +0000357 break;
Chris Lattner63b3d712006-05-04 17:21:20 +0000358 case MachineOperand::MO_Immediate:
Misha Brukmance22e762004-07-09 14:45:17 +0000359 OS << (long)MO.getImmedValue();
360 break;
Misha Brukmance22e762004-07-09 14:45:17 +0000361 case MachineOperand::MO_MachineBasicBlock:
362 OS << "<mbb:"
363 << ((Value*)MO.getMachineBasicBlock()->getBasicBlock())->getName()
364 << "@" << (void*)MO.getMachineBasicBlock() << ">";
365 break;
366 case MachineOperand::MO_FrameIndex:
367 OS << "<fi#" << MO.getFrameIndex() << ">";
368 break;
369 case MachineOperand::MO_ConstantPoolIndex:
370 OS << "<cp#" << MO.getConstantPoolIndex() << ">";
371 break;
Nate Begeman37efe672006-04-22 18:53:45 +0000372 case MachineOperand::MO_JumpTableIndex:
373 OS << "<jt#" << MO.getJumpTableIndex() << ">";
374 break;
Misha Brukmance22e762004-07-09 14:45:17 +0000375 case MachineOperand::MO_GlobalAddress:
376 OS << "<ga:" << ((Value*)MO.getGlobal())->getName() << ">";
377 break;
378 case MachineOperand::MO_ExternalSymbol:
379 OS << "<es:" << MO.getSymbolName() << ">";
380 break;
381 default:
382 assert(0 && "Unrecognized operand type");
383 break;
384 }
Misha Brukmanedf128a2005-04-21 22:36:52 +0000385
Chris Lattner10cb79b2002-12-28 20:37:37 +0000386 return OS;
Vikram S. Adve70bc4b52001-07-21 12:41:50 +0000387}