blob: e2c2bd5ed9ed4a1c9c9c1b35fb1e5105a02d210d [file] [log] [blame]
Chris Lattner8494d082002-10-28 01:16:38 +00001//===-- MachineFunction.cpp -----------------------------------------------===//
Alkis Evlogimenos58350a72004-09-05 18:41:35 +00002//
John Criswell482202a2003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Alkis Evlogimenos58350a72004-09-05 18:41:35 +00007//
John Criswell482202a2003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Alkis Evlogimenos58350a72004-09-05 18:41:35 +00009//
Chris Lattner8494d082002-10-28 01:16:38 +000010// Collect native machine code information for a function. This allows
11// target-specific information about the generated code to be stored with each
12// function.
13//
14//===----------------------------------------------------------------------===//
Chris Lattnereda6bd72002-02-03 07:54:50 +000015
Chris Lattner945e4372007-02-14 05:52:17 +000016#include "llvm/DerivedTypes.h"
Bill Wendling31ceb1b2009-06-30 22:38:32 +000017#include "llvm/Function.h"
18#include "llvm/Instructions.h"
Bill Wendling31ceb1b2009-06-30 22:38:32 +000019#include "llvm/Config/config.h"
Chris Lattnerc6807e82003-01-13 00:23:03 +000020#include "llvm/CodeGen/MachineConstantPool.h"
David Greene8230a932009-08-19 22:16:11 +000021#include "llvm/CodeGen/MachineFunction.h"
Chris Lattnera10fff52007-12-31 04:13:23 +000022#include "llvm/CodeGen/MachineFunctionPass.h"
23#include "llvm/CodeGen/MachineFrameInfo.h"
24#include "llvm/CodeGen/MachineInstr.h"
Nate Begeman4ca2ea52006-04-22 18:53:45 +000025#include "llvm/CodeGen/MachineJumpTableInfo.h"
Chris Lattner9f53dcd2010-04-05 05:49:50 +000026#include "llvm/CodeGen/MachineModuleInfo.h"
Chris Lattnera10fff52007-12-31 04:13:23 +000027#include "llvm/CodeGen/MachineRegisterInfo.h"
Chris Lattner4cbb97b2003-12-20 10:20:58 +000028#include "llvm/CodeGen/Passes.h"
Chris Lattner273735b2010-01-26 05:58:28 +000029#include "llvm/MC/MCAsmInfo.h"
30#include "llvm/MC/MCContext.h"
Devang Patel1083b5f2010-01-19 06:09:04 +000031#include "llvm/Analysis/DebugInfo.h"
David Greene66710112010-01-04 23:39:17 +000032#include "llvm/Support/Debug.h"
Owen Anderson8c2c1e92006-05-12 06:33:49 +000033#include "llvm/Target/TargetData.h"
Bill Wendling31ceb1b2009-06-30 22:38:32 +000034#include "llvm/Target/TargetLowering.h"
Chris Lattnereda6bd72002-02-03 07:54:50 +000035#include "llvm/Target/TargetMachine.h"
Chris Lattner871e5912002-12-28 21:00:25 +000036#include "llvm/Target/TargetFrameInfo.h"
Chris Lattner273735b2010-01-26 05:58:28 +000037#include "llvm/ADT/SmallString.h"
38#include "llvm/ADT/STLExtras.h"
Chris Lattnerbd7286e2006-10-03 20:19:23 +000039#include "llvm/Support/GraphWriter.h"
Chris Lattner0c19df42008-08-23 22:23:09 +000040#include "llvm/Support/raw_ostream.h"
Chris Lattner9a3478e2003-12-20 09:17:07 +000041using namespace llvm;
Chris Lattnereda6bd72002-02-03 07:54:50 +000042
Chris Lattner67159522010-01-26 04:35:26 +000043//===----------------------------------------------------------------------===//
Chris Lattner6d8a6c62002-10-28 01:12:41 +000044// MachineFunction implementation
Chris Lattner67159522010-01-26 04:35:26 +000045//===----------------------------------------------------------------------===//
Chris Lattnere6074aa2005-01-29 18:41:25 +000046
Chris Lattnerf2471ec2009-09-15 22:44:26 +000047// Out of line virtual method.
48MachineFunctionInfo::~MachineFunctionInfo() {}
49
Dan Gohman804c95d2008-07-28 21:51:04 +000050void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
Dan Gohman3b460302008-07-07 23:14:23 +000051 MBB->getParent()->DeleteMachineBasicBlock(MBB);
Tanya Lattnera578cb72004-05-24 06:11:51 +000052}
Chris Lattner6d8a6c62002-10-28 01:12:41 +000053
Dan Gohman913c9982010-04-15 04:33:49 +000054MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
Nicolas Geoffray3dbe6cc2010-10-31 20:38:38 +000055 unsigned FunctionNum, MachineModuleInfo &mmi,
56 GCModuleInfo* gmi)
57 : Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi), GMI(gmi) {
Matthijs Kooijmanc8d79882008-10-13 12:37:16 +000058 if (TM.getRegisterInfo())
Dan Gohman01c65a22010-03-18 18:49:47 +000059 RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
Matthijs Kooijmanc8d79882008-10-13 12:37:16 +000060 else
61 RegInfo = 0;
Chris Lattnera1d78022004-08-16 22:36:34 +000062 MFInfo = 0;
Dan Gohman01c65a22010-03-18 18:49:47 +000063 FrameInfo = new (Allocator) MachineFrameInfo(*TM.getFrameInfo());
Charles Davis7e477672010-02-19 18:17:13 +000064 if (Fn->hasFnAttr(Attribute::StackAlignment))
65 FrameInfo->setMaxAlignment(Attribute::getStackAlignmentFromAttrs(
66 Fn->getAttributes().getFnAttributes()));
Dan Gohman01c65a22010-03-18 18:49:47 +000067 ConstantPool = new (Allocator) MachineConstantPool(TM.getTargetData());
Bill Wendling31ceb1b2009-06-30 22:38:32 +000068 Alignment = TM.getTargetLowering()->getFunctionAlignment(F);
Chris Lattner67159522010-01-26 04:35:26 +000069 FunctionNumber = FunctionNum;
Chris Lattnerb6db2c62010-01-25 23:26:13 +000070 JumpTableInfo = 0;
Chris Lattner448fb452002-12-25 05:03:22 +000071}
72
Alkis Evlogimenos58350a72004-09-05 18:41:35 +000073MachineFunction::~MachineFunction() {
Chris Lattner9a60c532004-07-01 06:29:07 +000074 BasicBlocks.clear();
Dan Gohman3b460302008-07-07 23:14:23 +000075 InstructionRecycler.clear(Allocator);
76 BasicBlockRecycler.clear(Allocator);
Bill Wendling7f7eb8a2009-06-25 00:32:48 +000077 if (RegInfo) {
78 RegInfo->~MachineRegisterInfo();
79 Allocator.Deallocate(RegInfo);
80 }
Dan Gohman3b460302008-07-07 23:14:23 +000081 if (MFInfo) {
Bill Wendling7f7eb8a2009-06-25 00:32:48 +000082 MFInfo->~MachineFunctionInfo();
83 Allocator.Deallocate(MFInfo);
Dan Gohman3b460302008-07-07 23:14:23 +000084 }
85 FrameInfo->~MachineFrameInfo(); Allocator.Deallocate(FrameInfo);
86 ConstantPool->~MachineConstantPool(); Allocator.Deallocate(ConstantPool);
Chris Lattnerb6db2c62010-01-25 23:26:13 +000087
88 if (JumpTableInfo) {
89 JumpTableInfo->~MachineJumpTableInfo();
90 Allocator.Deallocate(JumpTableInfo);
91 }
Chris Lattner214808f2002-10-30 00:48:05 +000092}
93
Chris Lattnerb6db2c62010-01-25 23:26:13 +000094/// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
95/// does already exist, allocate one.
96MachineJumpTableInfo *MachineFunction::
97getOrCreateJumpTableInfo(unsigned EntryKind) {
98 if (JumpTableInfo) return JumpTableInfo;
99
Dan Gohman01c65a22010-03-18 18:49:47 +0000100 JumpTableInfo = new (Allocator)
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000101 MachineJumpTableInfo((MachineJumpTableInfo::JTEntryKind)EntryKind);
102 return JumpTableInfo;
103}
Chris Lattner64fd9482006-10-03 19:18:57 +0000104
105/// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
106/// recomputes them. This guarantees that the MBB numbers are sequential,
107/// dense, and match the ordering of the blocks within the function. If a
108/// specific MachineBasicBlock is specified, only that block and those after
109/// it are renumbered.
110void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) {
111 if (empty()) { MBBNumbering.clear(); return; }
112 MachineFunction::iterator MBBI, E = end();
113 if (MBB == 0)
114 MBBI = begin();
115 else
116 MBBI = MBB;
117
118 // Figure out the block number this should have.
119 unsigned BlockNo = 0;
Chris Lattnerbd7286e2006-10-03 20:19:23 +0000120 if (MBBI != begin())
121 BlockNo = prior(MBBI)->getNumber()+1;
Chris Lattner64fd9482006-10-03 19:18:57 +0000122
123 for (; MBBI != E; ++MBBI, ++BlockNo) {
124 if (MBBI->getNumber() != (int)BlockNo) {
125 // Remove use of the old number.
126 if (MBBI->getNumber() != -1) {
127 assert(MBBNumbering[MBBI->getNumber()] == &*MBBI &&
128 "MBB number mismatch!");
129 MBBNumbering[MBBI->getNumber()] = 0;
130 }
131
132 // If BlockNo is already taken, set that block's number to -1.
133 if (MBBNumbering[BlockNo])
134 MBBNumbering[BlockNo]->setNumber(-1);
135
136 MBBNumbering[BlockNo] = MBBI;
137 MBBI->setNumber(BlockNo);
138 }
139 }
140
141 // Okay, all the blocks are renumbered. If we have compactified the block
142 // numbering, shrink MBBNumbering now.
143 assert(BlockNo <= MBBNumbering.size() && "Mismatch!");
144 MBBNumbering.resize(BlockNo);
145}
146
Dan Gohman3b460302008-07-07 23:14:23 +0000147/// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
148/// of `new MachineInstr'.
149///
150MachineInstr *
Bill Wendlinge3c78362009-02-03 00:55:04 +0000151MachineFunction::CreateMachineInstr(const TargetInstrDesc &TID,
152 DebugLoc DL, bool NoImp) {
Dan Gohman3b460302008-07-07 23:14:23 +0000153 return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
Bill Wendlinge3c78362009-02-03 00:55:04 +0000154 MachineInstr(TID, DL, NoImp);
Dan Gohman3b460302008-07-07 23:14:23 +0000155}
Chris Lattner64fd9482006-10-03 19:18:57 +0000156
Dan Gohman3b460302008-07-07 23:14:23 +0000157/// CloneMachineInstr - Create a new MachineInstr which is a copy of the
Dan Gohman4a618822010-02-10 16:03:48 +0000158/// 'Orig' instruction, identical in all ways except the instruction
Dan Gohman3b460302008-07-07 23:14:23 +0000159/// has no parent, prev, or next.
160///
161MachineInstr *
162MachineFunction::CloneMachineInstr(const MachineInstr *Orig) {
163 return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
164 MachineInstr(*this, *Orig);
165}
166
167/// DeleteMachineInstr - Delete the given MachineInstr.
168///
169void
170MachineFunction::DeleteMachineInstr(MachineInstr *MI) {
Dan Gohman3b460302008-07-07 23:14:23 +0000171 MI->~MachineInstr();
172 InstructionRecycler.Deallocate(Allocator, MI);
173}
174
175/// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
176/// instead of `new MachineBasicBlock'.
177///
178MachineBasicBlock *
179MachineFunction::CreateMachineBasicBlock(const BasicBlock *bb) {
180 return new (BasicBlockRecycler.Allocate<MachineBasicBlock>(Allocator))
181 MachineBasicBlock(*this, bb);
182}
183
184/// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
185///
186void
187MachineFunction::DeleteMachineBasicBlock(MachineBasicBlock *MBB) {
188 assert(MBB->getParent() == this && "MBB parent mismatch!");
189 MBB->~MachineBasicBlock();
190 BasicBlockRecycler.Deallocate(Allocator, MBB);
191}
192
Dan Gohman48b185d2009-09-25 20:36:54 +0000193MachineMemOperand *
Chris Lattner00ca0b82010-09-21 04:32:08 +0000194MachineFunction::getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f,
Dan Gohmana94cc6d2010-10-20 00:31:05 +0000195 uint64_t s, unsigned base_alignment,
196 const MDNode *TBAAInfo) {
197 return new (Allocator) MachineMemOperand(PtrInfo, f, s, base_alignment,
198 TBAAInfo);
Dan Gohman48b185d2009-09-25 20:36:54 +0000199}
200
201MachineMemOperand *
202MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
203 int64_t Offset, uint64_t Size) {
Dan Gohman01c65a22010-03-18 18:49:47 +0000204 return new (Allocator)
Chris Lattner00ca0b82010-09-21 04:32:08 +0000205 MachineMemOperand(MachinePointerInfo(MMO->getValue(),
206 MMO->getOffset()+Offset),
Dan Gohmana94cc6d2010-10-20 00:31:05 +0000207 MMO->getFlags(), Size,
208 MMO->getBaseAlignment(), 0);
Dan Gohman48b185d2009-09-25 20:36:54 +0000209}
210
211MachineInstr::mmo_iterator
212MachineFunction::allocateMemRefsArray(unsigned long Num) {
213 return Allocator.Allocate<MachineMemOperand *>(Num);
214}
215
Dan Gohmandd76bb22009-10-09 18:10:05 +0000216std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
217MachineFunction::extractLoadMemRefs(MachineInstr::mmo_iterator Begin,
218 MachineInstr::mmo_iterator End) {
219 // Count the number of load mem refs.
220 unsigned Num = 0;
221 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
222 if ((*I)->isLoad())
223 ++Num;
224
225 // Allocate a new array and populate it with the load information.
226 MachineInstr::mmo_iterator Result = allocateMemRefsArray(Num);
227 unsigned Index = 0;
228 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
229 if ((*I)->isLoad()) {
230 if (!(*I)->isStore())
231 // Reuse the MMO.
232 Result[Index] = *I;
233 else {
234 // Clone the MMO and unset the store flag.
235 MachineMemOperand *JustLoad =
Chris Lattnerb5f49202010-09-21 04:46:39 +0000236 getMachineMemOperand((*I)->getPointerInfo(),
Dan Gohmandd76bb22009-10-09 18:10:05 +0000237 (*I)->getFlags() & ~MachineMemOperand::MOStore,
Dan Gohmana94cc6d2010-10-20 00:31:05 +0000238 (*I)->getSize(), (*I)->getBaseAlignment(),
239 (*I)->getTBAAInfo());
Dan Gohmandd76bb22009-10-09 18:10:05 +0000240 Result[Index] = JustLoad;
241 }
242 ++Index;
243 }
244 }
245 return std::make_pair(Result, Result + Num);
246}
247
248std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
249MachineFunction::extractStoreMemRefs(MachineInstr::mmo_iterator Begin,
250 MachineInstr::mmo_iterator End) {
251 // Count the number of load mem refs.
252 unsigned Num = 0;
253 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
254 if ((*I)->isStore())
255 ++Num;
256
257 // Allocate a new array and populate it with the store information.
258 MachineInstr::mmo_iterator Result = allocateMemRefsArray(Num);
259 unsigned Index = 0;
260 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
261 if ((*I)->isStore()) {
262 if (!(*I)->isLoad())
263 // Reuse the MMO.
264 Result[Index] = *I;
265 else {
266 // Clone the MMO and unset the load flag.
267 MachineMemOperand *JustStore =
Chris Lattnerb5f49202010-09-21 04:46:39 +0000268 getMachineMemOperand((*I)->getPointerInfo(),
Dan Gohmandd76bb22009-10-09 18:10:05 +0000269 (*I)->getFlags() & ~MachineMemOperand::MOLoad,
Dan Gohmana94cc6d2010-10-20 00:31:05 +0000270 (*I)->getSize(), (*I)->getBaseAlignment(),
271 (*I)->getTBAAInfo());
Dan Gohmandd76bb22009-10-09 18:10:05 +0000272 Result[Index] = JustStore;
273 }
274 ++Index;
275 }
276 }
277 return std::make_pair(Result, Result + Num);
278}
279
Dan Gohman3b460302008-07-07 23:14:23 +0000280void MachineFunction::dump() const {
David Greene66710112010-01-04 23:39:17 +0000281 print(dbgs());
Dan Gohman3b460302008-07-07 23:14:23 +0000282}
Chris Lattner214808f2002-10-30 00:48:05 +0000283
Jakob Stoklund Olesenb7050232010-10-26 20:21:46 +0000284void MachineFunction::print(raw_ostream &OS, SlotIndexes *Indexes) const {
Dan Gohman34341e62009-10-31 20:19:03 +0000285 OS << "# Machine code for function " << Fn->getName() << ":\n";
Chris Lattner32525642002-12-28 20:37:16 +0000286
287 // Print Frame Information
Dan Gohman3b460302008-07-07 23:14:23 +0000288 FrameInfo->print(*this, OS);
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000289
290 // Print JumpTable Information
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000291 if (JumpTableInfo)
292 JumpTableInfo->print(OS);
Chris Lattnerc6807e82003-01-13 00:23:03 +0000293
294 // Print Constant Pool
Chris Lattner22d4bfc2009-08-23 01:12:47 +0000295 ConstantPool->print(OS);
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000296
Dan Gohman3a4be0f2008-02-10 18:45:23 +0000297 const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000298
Matthijs Kooijmanc8d79882008-10-13 12:37:16 +0000299 if (RegInfo && !RegInfo->livein_empty()) {
Dan Gohman34341e62009-10-31 20:19:03 +0000300 OS << "Function Live Ins: ";
Chris Lattnera10fff52007-12-31 04:13:23 +0000301 for (MachineRegisterInfo::livein_iterator
302 I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
Dan Gohman3a4be0f2008-02-10 18:45:23 +0000303 if (TRI)
Dan Gohman34341e62009-10-31 20:19:03 +0000304 OS << "%" << TRI->getName(I->first);
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000305 else
Dan Gohman34341e62009-10-31 20:19:03 +0000306 OS << " %physreg" << I->first;
Chris Lattner52d0c782006-05-16 05:55:30 +0000307
308 if (I->second)
Dan Gohman34341e62009-10-31 20:19:03 +0000309 OS << " in reg%" << I->second;
310
Chris Lattnera48f44d2009-12-03 00:50:42 +0000311 if (llvm::next(I) != E)
Dan Gohman34341e62009-10-31 20:19:03 +0000312 OS << ", ";
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000313 }
Chris Lattner22d4bfc2009-08-23 01:12:47 +0000314 OS << '\n';
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000315 }
Matthijs Kooijmanc8d79882008-10-13 12:37:16 +0000316 if (RegInfo && !RegInfo->liveout_empty()) {
Dan Gohman34341e62009-10-31 20:19:03 +0000317 OS << "Function Live Outs: ";
Chris Lattnera10fff52007-12-31 04:13:23 +0000318 for (MachineRegisterInfo::liveout_iterator
Dan Gohman34341e62009-10-31 20:19:03 +0000319 I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I){
Dan Gohman3a4be0f2008-02-10 18:45:23 +0000320 if (TRI)
Dan Gohman34341e62009-10-31 20:19:03 +0000321 OS << '%' << TRI->getName(*I);
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000322 else
Dan Gohman34341e62009-10-31 20:19:03 +0000323 OS << "%physreg" << *I;
324
Chris Lattnera48f44d2009-12-03 00:50:42 +0000325 if (llvm::next(I) != E)
Dan Gohman34341e62009-10-31 20:19:03 +0000326 OS << " ";
327 }
Chris Lattner22d4bfc2009-08-23 01:12:47 +0000328 OS << '\n';
Chris Lattnerd4d10ff2005-08-31 22:34:59 +0000329 }
330
Dan Gohman34341e62009-10-31 20:19:03 +0000331 for (const_iterator BB = begin(), E = end(); BB != E; ++BB) {
332 OS << '\n';
Jakob Stoklund Olesenb7050232010-10-26 20:21:46 +0000333 BB->print(OS, Indexes);
Dan Gohman34341e62009-10-31 20:19:03 +0000334 }
Brian Gaeke2fe0ac92004-03-29 21:58:31 +0000335
Dan Gohman34341e62009-10-31 20:19:03 +0000336 OS << "\n# End machine code for function " << Fn->getName() << ".\n\n";
Chris Lattner214808f2002-10-30 00:48:05 +0000337}
338
Alkis Evlogimenos2c422bb2004-07-08 00:47:58 +0000339namespace llvm {
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000340 template<>
341 struct DOTGraphTraits<const MachineFunction*> : public DefaultDOTGraphTraits {
Tobias Grosser90d33402009-11-30 12:38:13 +0000342
343 DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
344
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000345 static std::string getGraphName(const MachineFunction *F) {
Daniel Dunbar123686852009-07-24 08:24:36 +0000346 return "CFG for '" + F->getFunction()->getNameStr() + "' function";
Alkis Evlogimenos2c422bb2004-07-08 00:47:58 +0000347 }
348
Tobias Grosserdd7f2e72009-11-30 12:38:47 +0000349 std::string getNodeLabel(const MachineBasicBlock *Node,
350 const MachineFunction *Graph) {
Chris Lattner565449d2009-08-23 03:13:20 +0000351 std::string OutStr;
352 {
353 raw_string_ostream OSS(OutStr);
Jakob Stoklund Olesen80717dd2010-10-30 01:26:19 +0000354
355 if (isSimple()) {
356 OSS << "BB#" << Node->getNumber();
357 if (const BasicBlock *BB = Node->getBasicBlock())
358 OSS << ": " << BB->getName();
359 } else
Chris Lattner565449d2009-08-23 03:13:20 +0000360 Node->print(OSS);
Alkis Evlogimenos2c422bb2004-07-08 00:47:58 +0000361 }
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000362
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000363 if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
364
365 // Process string output to make it nicer...
366 for (unsigned i = 0; i != OutStr.length(); ++i)
367 if (OutStr[i] == '\n') { // Left justify
368 OutStr[i] = '\\';
369 OutStr.insert(OutStr.begin()+i+1, 'l');
370 }
371 return OutStr;
372 }
373 };
Alkis Evlogimenos2c422bb2004-07-08 00:47:58 +0000374}
375
376void MachineFunction::viewCFG() const
377{
Jim Laskeyd00db252005-10-12 12:09:05 +0000378#ifndef NDEBUG
Daniel Dunbar123686852009-07-24 08:24:36 +0000379 ViewGraph(this, "mf" + getFunction()->getNameStr());
Reid Spenceree7eaa22006-06-27 16:49:46 +0000380#else
Dan Gohman76920142010-07-07 17:28:45 +0000381 errs() << "MachineFunction::viewCFG is only available in debug builds on "
Daniel Dunbar34ee2032009-08-23 08:50:52 +0000382 << "systems with Graphviz or gv!\n";
Reid Spenceree7eaa22006-06-27 16:49:46 +0000383#endif // NDEBUG
Alkis Evlogimenos2c422bb2004-07-08 00:47:58 +0000384}
385
386void MachineFunction::viewCFGOnly() const
387{
Owen Andersonb70adf22009-06-24 17:37:09 +0000388#ifndef NDEBUG
Daniel Dunbar123686852009-07-24 08:24:36 +0000389 ViewGraph(this, "mf" + getFunction()->getNameStr(), true);
Owen Andersonb70adf22009-06-24 17:37:09 +0000390#else
Dan Gohman76920142010-07-07 17:28:45 +0000391 errs() << "MachineFunction::viewCFGOnly is only available in debug builds on "
Daniel Dunbar34ee2032009-08-23 08:50:52 +0000392 << "systems with Graphviz or gv!\n";
Owen Andersonb70adf22009-06-24 17:37:09 +0000393#endif // NDEBUG
Alkis Evlogimenos2c422bb2004-07-08 00:47:58 +0000394}
395
Bob Wilsonf8b85472009-04-20 18:36:57 +0000396/// addLiveIn - Add the specified physical register as a live-in value and
397/// create a corresponding virtual register for it.
398unsigned MachineFunction::addLiveIn(unsigned PReg,
399 const TargetRegisterClass *RC) {
Evan Cheng1b79bab2010-05-24 21:33:37 +0000400 MachineRegisterInfo &MRI = getRegInfo();
401 unsigned VReg = MRI.getLiveInVirtReg(PReg);
402 if (VReg) {
403 assert(MRI.getRegClass(VReg) == RC && "Register class mismatch!");
404 return VReg;
405 }
406 VReg = MRI.createVirtualRegister(RC);
407 MRI.addLiveIn(PReg, VReg);
Bob Wilsonf8b85472009-04-20 18:36:57 +0000408 return VReg;
409}
410
Chris Lattner8a785d72010-01-26 06:28:43 +0000411/// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
Bill Wendling36321712010-06-29 22:34:52 +0000412/// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
413/// normal 'L' label is returned.
414MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx,
415 bool isLinkerPrivate) const {
Chris Lattner8a785d72010-01-26 06:28:43 +0000416 assert(JumpTableInfo && "No jump tables");
417
Chandler Carruthc07bd402010-01-27 10:27:10 +0000418 assert(JTI < JumpTableInfo->getJumpTables().size() && "Invalid JTI!");
Chris Lattner8a785d72010-01-26 06:28:43 +0000419 const MCAsmInfo &MAI = *getTarget().getMCAsmInfo();
420
Bill Wendling36321712010-06-29 22:34:52 +0000421 const char *Prefix = isLinkerPrivate ? MAI.getLinkerPrivateGlobalPrefix() :
422 MAI.getPrivateGlobalPrefix();
Chris Lattner8a785d72010-01-26 06:28:43 +0000423 SmallString<60> Name;
424 raw_svector_ostream(Name)
425 << Prefix << "JTI" << getFunctionNumber() << '_' << JTI;
Chris Lattner98970432010-03-30 18:10:53 +0000426 return Ctx.GetOrCreateSymbol(Name.str());
Chris Lattner8a785d72010-01-26 06:28:43 +0000427}
428
429
Chris Lattner32525642002-12-28 20:37:16 +0000430//===----------------------------------------------------------------------===//
Chris Lattnerca4362f2002-12-28 21:08:26 +0000431// MachineFrameInfo implementation
Chris Lattner32525642002-12-28 20:37:16 +0000432//===----------------------------------------------------------------------===//
433
Chris Lattner60688322008-01-25 07:19:06 +0000434/// CreateFixedObject - Create a new object at a fixed location on the stack.
435/// All fixed objects should be created before other objects are created for
436/// efficiency. By default, fixed objects are immutable. This returns an
437/// index with a negative value.
438///
439int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
Evan Cheng0664a672010-07-03 00:40:23 +0000440 bool Immutable) {
Chris Lattner60688322008-01-25 07:19:06 +0000441 assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
Evan Chengf3aeb2c2010-07-04 18:52:05 +0000442 // The alignment of the frame index can be determined from its offset from
443 // the incoming frame position. If the frame object is at offset 32 and
444 // the stack is guaranteed to be 16-byte aligned, then we know that the
445 // object is 16-byte aligned.
446 unsigned StackAlign = TFI.getStackAlignment();
447 unsigned Align = MinAlign(SPOffset, StackAlign);
448 Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset, Immutable,
Bill Wendling0ff1ef62010-07-27 01:55:19 +0000449 /*isSS*/false, false));
Chris Lattner60688322008-01-25 07:19:06 +0000450 return -++NumFixedObjects;
451}
452
453
Jakob Stoklund Olesen3de4a602009-08-13 16:19:33 +0000454BitVector
455MachineFrameInfo::getPristineRegs(const MachineBasicBlock *MBB) const {
456 assert(MBB && "MBB must be valid");
457 const MachineFunction *MF = MBB->getParent();
458 assert(MF && "MBB must be part of a MachineFunction");
459 const TargetMachine &TM = MF->getTarget();
460 const TargetRegisterInfo *TRI = TM.getRegisterInfo();
461 BitVector BV(TRI->getNumRegs());
462
463 // Before CSI is calculated, no registers are considered pristine. They can be
464 // freely used and PEI will make sure they are saved.
465 if (!isCalleeSavedInfoValid())
466 return BV;
467
468 for (const unsigned *CSR = TRI->getCalleeSavedRegs(MF); CSR && *CSR; ++CSR)
469 BV.set(*CSR);
470
471 // The entry MBB always has all CSRs pristine.
472 if (MBB == &MF->front())
473 return BV;
474
475 // On other MBBs the saved CSRs are not pristine.
476 const std::vector<CalleeSavedInfo> &CSI = getCalleeSavedInfo();
477 for (std::vector<CalleeSavedInfo>::const_iterator I = CSI.begin(),
478 E = CSI.end(); I != E; ++I)
479 BV.reset(I->getReg());
480
481 return BV;
482}
483
484
Chris Lattner22d4bfc2009-08-23 01:12:47 +0000485void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{
Dan Gohman34341e62009-10-31 20:19:03 +0000486 if (Objects.empty()) return;
487
Matthijs Kooijman2530f5f2008-11-03 11:16:43 +0000488 const TargetFrameInfo *FI = MF.getTarget().getFrameInfo();
489 int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0);
Chris Lattnereb45c982003-01-16 18:35:57 +0000490
Dan Gohman34341e62009-10-31 20:19:03 +0000491 OS << "Frame Objects:\n";
492
Chris Lattner32525642002-12-28 20:37:16 +0000493 for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
494 const StackObject &SO = Objects[i];
Dan Gohman34341e62009-10-31 20:19:03 +0000495 OS << " fi#" << (int)(i-NumFixedObjects) << ": ";
Evan Cheng6d563682008-02-27 03:04:06 +0000496 if (SO.Size == ~0ULL) {
497 OS << "dead\n";
498 continue;
499 }
Chris Lattner32525642002-12-28 20:37:16 +0000500 if (SO.Size == 0)
501 OS << "variable sized";
502 else
Dan Gohman34341e62009-10-31 20:19:03 +0000503 OS << "size=" << SO.Size;
504 OS << ", align=" << SO.Alignment;
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000505
Chris Lattner32525642002-12-28 20:37:16 +0000506 if (i < NumFixedObjects)
Dan Gohman34341e62009-10-31 20:19:03 +0000507 OS << ", fixed";
Chris Lattner32525642002-12-28 20:37:16 +0000508 if (i < NumFixedObjects || SO.SPOffset != -1) {
Chris Lattner9bd98ea2007-04-25 04:20:54 +0000509 int64_t Off = SO.SPOffset - ValOffset;
Dan Gohman34341e62009-10-31 20:19:03 +0000510 OS << ", at location [SP";
Chris Lattnereb45c982003-01-16 18:35:57 +0000511 if (Off > 0)
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000512 OS << "+" << Off;
Chris Lattnereb45c982003-01-16 18:35:57 +0000513 else if (Off < 0)
Alkis Evlogimenos58350a72004-09-05 18:41:35 +0000514 OS << Off;
Chris Lattner32525642002-12-28 20:37:16 +0000515 OS << "]";
516 }
517 OS << "\n";
518 }
Chris Lattner32525642002-12-28 20:37:16 +0000519}
520
Chris Lattnereb45c982003-01-16 18:35:57 +0000521void MachineFrameInfo::dump(const MachineFunction &MF) const {
David Greene66710112010-01-04 23:39:17 +0000522 print(MF, dbgs());
Chris Lattnereb45c982003-01-16 18:35:57 +0000523}
Chris Lattner32525642002-12-28 20:37:16 +0000524
Chris Lattner32525642002-12-28 20:37:16 +0000525//===----------------------------------------------------------------------===//
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000526// MachineJumpTableInfo implementation
527//===----------------------------------------------------------------------===//
528
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000529/// getEntrySize - Return the size of each entry in the jump table.
530unsigned MachineJumpTableInfo::getEntrySize(const TargetData &TD) const {
531 // The size of a jump table entry is 4 bytes unless the entry is just the
532 // address of a block, in which case it is the pointer size.
533 switch (getEntryKind()) {
534 case MachineJumpTableInfo::EK_BlockAddress:
535 return TD.getPointerSize();
536 case MachineJumpTableInfo::EK_GPRel32BlockAddress:
537 case MachineJumpTableInfo::EK_LabelDifference32:
Chris Lattner5fc41602010-01-26 04:05:28 +0000538 case MachineJumpTableInfo::EK_Custom32:
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000539 return 4;
Richard Osborne6d3e92d2010-03-11 14:58:16 +0000540 case MachineJumpTableInfo::EK_Inline:
541 return 0;
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000542 }
543 assert(0 && "Unknown jump table encoding!");
544 return ~0;
545}
546
547/// getEntryAlignment - Return the alignment of each entry in the jump table.
548unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const {
549 // The alignment of a jump table entry is the alignment of int32 unless the
550 // entry is just the address of a block, in which case it is the pointer
551 // alignment.
552 switch (getEntryKind()) {
553 case MachineJumpTableInfo::EK_BlockAddress:
554 return TD.getPointerABIAlignment();
555 case MachineJumpTableInfo::EK_GPRel32BlockAddress:
556 case MachineJumpTableInfo::EK_LabelDifference32:
Chris Lattner5fc41602010-01-26 04:05:28 +0000557 case MachineJumpTableInfo::EK_Custom32:
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000558 return TD.getABIIntegerTypeAlignment(32);
Richard Osborne6d3e92d2010-03-11 14:58:16 +0000559 case MachineJumpTableInfo::EK_Inline:
560 return 1;
Chris Lattnerb6db2c62010-01-25 23:26:13 +0000561 }
562 assert(0 && "Unknown jump table encoding!");
563 return ~0;
564}
565
Bob Wilson3c7cde42010-03-18 18:42:41 +0000566/// createJumpTableIndex - Create a new jump table entry in the jump table info.
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000567///
Bob Wilson3c7cde42010-03-18 18:42:41 +0000568unsigned MachineJumpTableInfo::createJumpTableIndex(
Chris Lattnercde339c2006-10-28 18:17:09 +0000569 const std::vector<MachineBasicBlock*> &DestBBs) {
Chris Lattner28328f92006-10-28 18:11:20 +0000570 assert(!DestBBs.empty() && "Cannot create an empty jump table!");
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000571 JumpTables.push_back(MachineJumpTableEntry(DestBBs));
572 return JumpTables.size()-1;
573}
574
Dan Gohman505065c2009-04-15 01:18:49 +0000575/// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update
576/// the jump tables to branch to New instead.
Chris Lattner273735b2010-01-26 05:58:28 +0000577bool MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,
578 MachineBasicBlock *New) {
Dan Gohman505065c2009-04-15 01:18:49 +0000579 assert(Old != New && "Not making a change?");
580 bool MadeChange = false;
Jim Grosbach9c8609e2009-11-14 20:09:13 +0000581 for (size_t i = 0, e = JumpTables.size(); i != e; ++i)
582 ReplaceMBBInJumpTable(i, Old, New);
583 return MadeChange;
584}
585
586/// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
587/// the jump table to branch to New instead.
Chris Lattner273735b2010-01-26 05:58:28 +0000588bool MachineJumpTableInfo::ReplaceMBBInJumpTable(unsigned Idx,
589 MachineBasicBlock *Old,
590 MachineBasicBlock *New) {
Jim Grosbach9c8609e2009-11-14 20:09:13 +0000591 assert(Old != New && "Not making a change?");
592 bool MadeChange = false;
593 MachineJumpTableEntry &JTE = JumpTables[Idx];
594 for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
595 if (JTE.MBBs[j] == Old) {
596 JTE.MBBs[j] = New;
597 MadeChange = true;
598 }
Dan Gohman505065c2009-04-15 01:18:49 +0000599 return MadeChange;
600}
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000601
Chris Lattner22d4bfc2009-08-23 01:12:47 +0000602void MachineJumpTableInfo::print(raw_ostream &OS) const {
Dan Gohman34341e62009-10-31 20:19:03 +0000603 if (JumpTables.empty()) return;
604
605 OS << "Jump Tables:\n";
606
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000607 for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
Dan Gohman34341e62009-10-31 20:19:03 +0000608 OS << " jt#" << i << ": ";
609 for (unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
610 OS << " BB#" << JumpTables[i].MBBs[j]->getNumber();
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000611 }
Dan Gohman34341e62009-10-31 20:19:03 +0000612
613 OS << '\n';
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000614}
615
David Greene66710112010-01-04 23:39:17 +0000616void MachineJumpTableInfo::dump() const { print(dbgs()); }
Nate Begeman4ca2ea52006-04-22 18:53:45 +0000617
618
619//===----------------------------------------------------------------------===//
Chris Lattnerc6807e82003-01-13 00:23:03 +0000620// MachineConstantPool implementation
621//===----------------------------------------------------------------------===//
622
Evan Cheng4f9299552006-09-14 05:50:57 +0000623const Type *MachineConstantPoolEntry::getType() const {
624 if (isMachineConstantPoolEntry())
Chris Lattnercfb01e22009-07-21 23:34:23 +0000625 return Val.MachineCPVal->getType();
Evan Cheng4f9299552006-09-14 05:50:57 +0000626 return Val.ConstVal->getType();
627}
628
Chris Lattnercfb01e22009-07-21 23:34:23 +0000629
Chris Lattner9bd736e2009-07-21 23:36:01 +0000630unsigned MachineConstantPoolEntry::getRelocationInfo() const {
Chris Lattnercfb01e22009-07-21 23:34:23 +0000631 if (isMachineConstantPoolEntry())
Chris Lattner9bd736e2009-07-21 23:36:01 +0000632 return Val.MachineCPVal->getRelocationInfo();
Chris Lattner4565ef52009-07-22 00:05:44 +0000633 return Val.ConstVal->getRelocationInfo();
Chris Lattnercfb01e22009-07-21 23:34:23 +0000634}
635
Evan Cheng45fe3bc2006-09-12 21:00:35 +0000636MachineConstantPool::~MachineConstantPool() {
637 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
638 if (Constants[i].isMachineConstantPoolEntry())
639 delete Constants[i].Val.MachineCPVal;
640}
641
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000642/// CanShareConstantPoolEntry - Test whether the given two constants
643/// can be allocated the same constant pool entry.
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000644static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000645 const TargetData *TD) {
646 // Handle the trivial case quickly.
647 if (A == B) return true;
648
649 // If they have the same type but weren't the same constant, quickly
650 // reject them.
651 if (A->getType() == B->getType()) return false;
652
653 // For now, only support constants with the same size.
654 if (TD->getTypeStoreSize(A->getType()) != TD->getTypeStoreSize(B->getType()))
655 return false;
656
657 // If a floating-point value and an integer value have the same encoding,
658 // they can share a constant-pool entry.
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000659 if (const ConstantFP *AFP = dyn_cast<ConstantFP>(A))
660 if (const ConstantInt *BI = dyn_cast<ConstantInt>(B))
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000661 return AFP->getValueAPF().bitcastToAPInt() == BI->getValue();
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000662 if (const ConstantFP *BFP = dyn_cast<ConstantFP>(B))
663 if (const ConstantInt *AI = dyn_cast<ConstantInt>(A))
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000664 return BFP->getValueAPF().bitcastToAPInt() == AI->getValue();
665
666 // Two vectors can share an entry if each pair of corresponding
667 // elements could.
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000668 if (const ConstantVector *AV = dyn_cast<ConstantVector>(A))
669 if (const ConstantVector *BV = dyn_cast<ConstantVector>(B)) {
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000670 if (AV->getType()->getNumElements() != BV->getType()->getNumElements())
671 return false;
672 for (unsigned i = 0, e = AV->getType()->getNumElements(); i != e; ++i)
Dan Gohman97abba52009-10-31 14:12:53 +0000673 if (!CanShareConstantPoolEntry(AV->getOperand(i),
674 BV->getOperand(i), TD))
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000675 return false;
676 return true;
677 }
678
679 // TODO: Handle other cases.
680
681 return false;
682}
683
Chris Lattnerf6190822006-02-09 04:46:04 +0000684/// getConstantPoolIndex - Create a new entry in the constant pool or return
Dan Gohman5cf61202008-09-16 20:45:53 +0000685/// an existing one. User must specify the log2 of the minimum required
686/// alignment for the object.
Chris Lattnerf6190822006-02-09 04:46:04 +0000687///
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000688unsigned MachineConstantPool::getConstantPoolIndex(const Constant *C,
Chris Lattnerf6190822006-02-09 04:46:04 +0000689 unsigned Alignment) {
690 assert(Alignment && "Alignment must be specified!");
691 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000692
Chris Lattnerf6190822006-02-09 04:46:04 +0000693 // Check to see if we already have this constant.
694 //
695 // FIXME, this could be made much more efficient for large constant pools.
Chris Lattnerf6190822006-02-09 04:46:04 +0000696 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000697 if (!Constants[i].isMachineConstantPoolEntry() &&
698 CanShareConstantPoolEntry(Constants[i].Val.ConstVal, C, TD)) {
699 if ((unsigned)Constants[i].getAlignment() < Alignment)
700 Constants[i].Alignment = Alignment;
Chris Lattnerf6190822006-02-09 04:46:04 +0000701 return i;
Dan Gohman75d6a4a2009-10-28 01:12:16 +0000702 }
Chris Lattnerf6190822006-02-09 04:46:04 +0000703
Evan Cheng1fb8aed2009-03-13 07:51:59 +0000704 Constants.push_back(MachineConstantPoolEntry(C, Alignment));
Chris Lattnerf6190822006-02-09 04:46:04 +0000705 return Constants.size()-1;
706}
707
Evan Cheng45fe3bc2006-09-12 21:00:35 +0000708unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V,
709 unsigned Alignment) {
710 assert(Alignment && "Alignment must be specified!");
711 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
712
713 // Check to see if we already have this constant.
714 //
715 // FIXME, this could be made much more efficient for large constant pools.
Evan Cheng45fe3bc2006-09-12 21:00:35 +0000716 int Idx = V->getExistingMachineCPValue(this, Alignment);
717 if (Idx != -1)
718 return (unsigned)Idx;
Evan Cheng1fb8aed2009-03-13 07:51:59 +0000719
720 Constants.push_back(MachineConstantPoolEntry(V, Alignment));
Evan Cheng45fe3bc2006-09-12 21:00:35 +0000721 return Constants.size()-1;
722}
723
Chris Lattner838aff32008-08-23 22:53:13 +0000724void MachineConstantPool::print(raw_ostream &OS) const {
Dan Gohman34341e62009-10-31 20:19:03 +0000725 if (Constants.empty()) return;
726
727 OS << "Constant Pool:\n";
Evan Cheng32be2dc2006-01-31 22:23:14 +0000728 for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
Dan Gohman34341e62009-10-31 20:19:03 +0000729 OS << " cp#" << i << ": ";
Evan Cheng45fe3bc2006-09-12 21:00:35 +0000730 if (Constants[i].isMachineConstantPoolEntry())
731 Constants[i].Val.MachineCPVal->print(OS);
732 else
733 OS << *(Value*)Constants[i].Val.ConstVal;
Dan Gohman34341e62009-10-31 20:19:03 +0000734 OS << ", align=" << Constants[i].getAlignment();
Evan Cheng32be2dc2006-01-31 22:23:14 +0000735 OS << "\n";
736 }
Chris Lattnerc6807e82003-01-13 00:23:03 +0000737}
738
David Greene66710112010-01-04 23:39:17 +0000739void MachineConstantPool::dump() const { print(dbgs()); }