blob: 4377d5bd71acfc8dc3f182a919519e5eaf55d2f3 [file] [log] [blame]
Chris Lattner6b944532002-10-28 01:16:38 +00001//===-- MachineFunction.cpp -----------------------------------------------===//
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +00002//
John Criswellb576c942003-10-20 19:43:21 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-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 Evlogimenos76d9dac2004-09-05 18:41:35 +00007//
John Criswellb576c942003-10-20 19:43:21 +00008//===----------------------------------------------------------------------===//
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +00009//
Chris Lattner6b944532002-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 Lattnerf2868ce2002-02-03 07:54:50 +000015
Chris Lattnerd2b7cec2007-02-14 05:52:17 +000016#include "llvm/DerivedTypes.h"
Bill Wendling20c568f2009-06-30 22:38:32 +000017#include "llvm/Function.h"
18#include "llvm/Instructions.h"
Bill Wendling20c568f2009-06-30 22:38:32 +000019#include "llvm/Config/config.h"
Chris Lattner4d149cd2003-01-13 00:23:03 +000020#include "llvm/CodeGen/MachineConstantPool.h"
David Greene098612b2009-08-19 22:16:11 +000021#include "llvm/CodeGen/MachineFunction.h"
Chris Lattner84bc5422007-12-31 04:13:23 +000022#include "llvm/CodeGen/MachineFunctionPass.h"
23#include "llvm/CodeGen/MachineFrameInfo.h"
24#include "llvm/CodeGen/MachineInstr.h"
Nate Begeman37efe672006-04-22 18:53:45 +000025#include "llvm/CodeGen/MachineJumpTableInfo.h"
Chris Lattner84bc5422007-12-31 04:13:23 +000026#include "llvm/CodeGen/MachineRegisterInfo.h"
Chris Lattner16c45e92003-12-20 10:20:58 +000027#include "llvm/CodeGen/Passes.h"
Chris Lattnerbeeb93e2010-01-26 05:58:28 +000028#include "llvm/MC/MCAsmInfo.h"
29#include "llvm/MC/MCContext.h"
Devang Patelc99fd872010-01-19 06:09:04 +000030#include "llvm/Analysis/DebugInfo.h"
David Greenedc554812010-01-04 23:39:17 +000031#include "llvm/Support/Debug.h"
Owen Anderson07000c62006-05-12 06:33:49 +000032#include "llvm/Target/TargetData.h"
Bill Wendling20c568f2009-06-30 22:38:32 +000033#include "llvm/Target/TargetLowering.h"
Chris Lattnerf2868ce2002-02-03 07:54:50 +000034#include "llvm/Target/TargetMachine.h"
Chris Lattner8bd66e62002-12-28 21:00:25 +000035#include "llvm/Target/TargetFrameInfo.h"
Chris Lattnerbeeb93e2010-01-26 05:58:28 +000036#include "llvm/ADT/SmallString.h"
37#include "llvm/ADT/STLExtras.h"
Chris Lattnerf28bbda2006-10-03 20:19:23 +000038#include "llvm/Support/GraphWriter.h"
Chris Lattner944fac72008-08-23 22:23:09 +000039#include "llvm/Support/raw_ostream.h"
Chris Lattner07f32d42003-12-20 09:17:07 +000040using namespace llvm;
Chris Lattnerf2868ce2002-02-03 07:54:50 +000041
Chris Lattner227c3d32002-10-28 01:12:41 +000042namespace {
Nick Lewycky6726b6d2009-10-25 06:33:48 +000043 struct Printer : public MachineFunctionPass {
Devang Patel19974732007-05-03 01:11:54 +000044 static char ID;
Devang Patel794fd752007-05-01 21:15:47 +000045
Chris Lattnercf143a42009-08-23 03:13:20 +000046 raw_ostream &OS;
Chris Lattnerd4baf0f2004-02-01 05:25:07 +000047 const std::string Banner;
Brian Gaeke09caa372004-01-30 21:53:46 +000048
Chris Lattnercf143a42009-08-23 03:13:20 +000049 Printer(raw_ostream &os, const std::string &banner)
Dan Gohmanae73dc12008-09-04 17:05:41 +000050 : MachineFunctionPass(&ID), OS(os), Banner(banner) {}
Brian Gaeke09caa372004-01-30 21:53:46 +000051
Chris Lattner10491642002-10-30 00:48:05 +000052 const char *getPassName() const { return "MachineFunction Printer"; }
53
54 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
55 AU.setPreservesAll();
Dan Gohmanad2afc22009-07-31 18:16:33 +000056 MachineFunctionPass::getAnalysisUsage(AU);
Chris Lattner10491642002-10-30 00:48:05 +000057 }
58
Chris Lattner16c45e92003-12-20 10:20:58 +000059 bool runOnMachineFunction(MachineFunction &MF) {
Dan Gohman0ba90f32009-10-31 20:19:03 +000060 OS << "# " << Banner << ":\n";
Chris Lattnercf143a42009-08-23 03:13:20 +000061 MF.print(OS);
Chris Lattner10491642002-10-30 00:48:05 +000062 return false;
63 }
64 };
Devang Patel19974732007-05-03 01:11:54 +000065 char Printer::ID = 0;
Chris Lattner227c3d32002-10-28 01:12:41 +000066}
67
Daniel Dunbar275872e2009-08-03 01:02:24 +000068/// Returns a newly-created MachineFunction Printer pass. The default banner is
69/// empty.
Brian Gaeke09caa372004-01-30 21:53:46 +000070///
Chris Lattnercf143a42009-08-23 03:13:20 +000071FunctionPass *llvm::createMachineFunctionPrinterPass(raw_ostream &OS,
Chris Lattnerce9c41e2005-01-23 22:13:58 +000072 const std::string &Banner){
Brian Gaeke09caa372004-01-30 21:53:46 +000073 return new Printer(OS, Banner);
Chris Lattner10491642002-10-30 00:48:05 +000074}
75
Chris Lattnerb84822f2010-01-26 04:35:26 +000076//===----------------------------------------------------------------------===//
Chris Lattner227c3d32002-10-28 01:12:41 +000077// MachineFunction implementation
Chris Lattnerb84822f2010-01-26 04:35:26 +000078//===----------------------------------------------------------------------===//
Chris Lattner9d5d7592005-01-29 18:41:25 +000079
Chris Lattnera70e2e32009-09-15 22:44:26 +000080// Out of line virtual method.
81MachineFunctionInfo::~MachineFunctionInfo() {}
82
Dan Gohmanfed90b62008-07-28 21:51:04 +000083void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
Dan Gohman8e5f2c62008-07-07 23:14:23 +000084 MBB->getParent()->DeleteMachineBasicBlock(MBB);
Tanya Lattner792699c2004-05-24 06:11:51 +000085}
Chris Lattner227c3d32002-10-28 01:12:41 +000086
Chris Lattnerb84822f2010-01-26 04:35:26 +000087MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
88 unsigned FunctionNum)
Dan Gohmanf266f892009-07-31 18:35:51 +000089 : Fn(F), Target(TM) {
Matthijs Kooijmane2b997b2008-10-13 12:37:16 +000090 if (TM.getRegisterInfo())
91 RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
92 MachineRegisterInfo(*TM.getRegisterInfo());
93 else
94 RegInfo = 0;
Chris Lattnerad828162004-08-16 22:36:34 +000095 MFInfo = 0;
Dan Gohman8e5f2c62008-07-07 23:14:23 +000096 FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
97 MachineFrameInfo(*TM.getFrameInfo());
Charles Davis5dfa2672010-02-19 18:17:13 +000098 if (Fn->hasFnAttr(Attribute::StackAlignment))
99 FrameInfo->setMaxAlignment(Attribute::getStackAlignmentFromAttrs(
100 Fn->getAttributes().getFnAttributes()));
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000101 ConstantPool = new (Allocator.Allocate<MachineConstantPool>())
102 MachineConstantPool(TM.getTargetData());
Bill Wendling20c568f2009-06-30 22:38:32 +0000103 Alignment = TM.getTargetLowering()->getFunctionAlignment(F);
Chris Lattnerb84822f2010-01-26 04:35:26 +0000104 FunctionNumber = FunctionNum;
Chris Lattner071c62f2010-01-25 23:26:13 +0000105 JumpTableInfo = 0;
Chris Lattner831fdcf2002-12-25 05:03:22 +0000106}
107
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000108MachineFunction::~MachineFunction() {
Chris Lattner4b9a4002004-07-01 06:29:07 +0000109 BasicBlocks.clear();
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000110 InstructionRecycler.clear(Allocator);
111 BasicBlockRecycler.clear(Allocator);
Bill Wendlingdd37b362009-06-25 00:32:48 +0000112 if (RegInfo) {
113 RegInfo->~MachineRegisterInfo();
114 Allocator.Deallocate(RegInfo);
115 }
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000116 if (MFInfo) {
Bill Wendlingdd37b362009-06-25 00:32:48 +0000117 MFInfo->~MachineFunctionInfo();
118 Allocator.Deallocate(MFInfo);
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000119 }
120 FrameInfo->~MachineFrameInfo(); Allocator.Deallocate(FrameInfo);
121 ConstantPool->~MachineConstantPool(); Allocator.Deallocate(ConstantPool);
Chris Lattner071c62f2010-01-25 23:26:13 +0000122
123 if (JumpTableInfo) {
124 JumpTableInfo->~MachineJumpTableInfo();
125 Allocator.Deallocate(JumpTableInfo);
126 }
Chris Lattner10491642002-10-30 00:48:05 +0000127}
128
Chris Lattner071c62f2010-01-25 23:26:13 +0000129/// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
130/// does already exist, allocate one.
131MachineJumpTableInfo *MachineFunction::
132getOrCreateJumpTableInfo(unsigned EntryKind) {
133 if (JumpTableInfo) return JumpTableInfo;
134
135 JumpTableInfo = new (Allocator.Allocate<MachineJumpTableInfo>())
136 MachineJumpTableInfo((MachineJumpTableInfo::JTEntryKind)EntryKind);
137 return JumpTableInfo;
138}
Chris Lattnere70cab02006-10-03 19:18:57 +0000139
140/// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
141/// recomputes them. This guarantees that the MBB numbers are sequential,
142/// dense, and match the ordering of the blocks within the function. If a
143/// specific MachineBasicBlock is specified, only that block and those after
144/// it are renumbered.
145void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) {
146 if (empty()) { MBBNumbering.clear(); return; }
147 MachineFunction::iterator MBBI, E = end();
148 if (MBB == 0)
149 MBBI = begin();
150 else
151 MBBI = MBB;
152
153 // Figure out the block number this should have.
154 unsigned BlockNo = 0;
Chris Lattnerf28bbda2006-10-03 20:19:23 +0000155 if (MBBI != begin())
156 BlockNo = prior(MBBI)->getNumber()+1;
Chris Lattnere70cab02006-10-03 19:18:57 +0000157
158 for (; MBBI != E; ++MBBI, ++BlockNo) {
159 if (MBBI->getNumber() != (int)BlockNo) {
160 // Remove use of the old number.
161 if (MBBI->getNumber() != -1) {
162 assert(MBBNumbering[MBBI->getNumber()] == &*MBBI &&
163 "MBB number mismatch!");
164 MBBNumbering[MBBI->getNumber()] = 0;
165 }
166
167 // If BlockNo is already taken, set that block's number to -1.
168 if (MBBNumbering[BlockNo])
169 MBBNumbering[BlockNo]->setNumber(-1);
170
171 MBBNumbering[BlockNo] = MBBI;
172 MBBI->setNumber(BlockNo);
173 }
174 }
175
176 // Okay, all the blocks are renumbered. If we have compactified the block
177 // numbering, shrink MBBNumbering now.
178 assert(BlockNo <= MBBNumbering.size() && "Mismatch!");
179 MBBNumbering.resize(BlockNo);
180}
181
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000182/// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
183/// of `new MachineInstr'.
184///
185MachineInstr *
Bill Wendling9bc96a52009-02-03 00:55:04 +0000186MachineFunction::CreateMachineInstr(const TargetInstrDesc &TID,
187 DebugLoc DL, bool NoImp) {
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000188 return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
Bill Wendling9bc96a52009-02-03 00:55:04 +0000189 MachineInstr(TID, DL, NoImp);
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000190}
Chris Lattnere70cab02006-10-03 19:18:57 +0000191
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000192/// CloneMachineInstr - Create a new MachineInstr which is a copy of the
Dan Gohmanf451cb82010-02-10 16:03:48 +0000193/// 'Orig' instruction, identical in all ways except the instruction
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000194/// has no parent, prev, or next.
195///
196MachineInstr *
197MachineFunction::CloneMachineInstr(const MachineInstr *Orig) {
198 return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
199 MachineInstr(*this, *Orig);
200}
201
202/// DeleteMachineInstr - Delete the given MachineInstr.
203///
204void
205MachineFunction::DeleteMachineInstr(MachineInstr *MI) {
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000206 MI->~MachineInstr();
207 InstructionRecycler.Deallocate(Allocator, MI);
208}
209
210/// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
211/// instead of `new MachineBasicBlock'.
212///
213MachineBasicBlock *
214MachineFunction::CreateMachineBasicBlock(const BasicBlock *bb) {
215 return new (BasicBlockRecycler.Allocate<MachineBasicBlock>(Allocator))
216 MachineBasicBlock(*this, bb);
217}
218
219/// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
220///
221void
222MachineFunction::DeleteMachineBasicBlock(MachineBasicBlock *MBB) {
223 assert(MBB->getParent() == this && "MBB parent mismatch!");
224 MBB->~MachineBasicBlock();
225 BasicBlockRecycler.Deallocate(Allocator, MBB);
226}
227
Dan Gohmanc76909a2009-09-25 20:36:54 +0000228MachineMemOperand *
229MachineFunction::getMachineMemOperand(const Value *v, unsigned f,
230 int64_t o, uint64_t s,
231 unsigned base_alignment) {
232 return new (Allocator.Allocate<MachineMemOperand>())
233 MachineMemOperand(v, f, o, s, base_alignment);
234}
235
236MachineMemOperand *
237MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
238 int64_t Offset, uint64_t Size) {
239 return new (Allocator.Allocate<MachineMemOperand>())
240 MachineMemOperand(MMO->getValue(), MMO->getFlags(),
241 int64_t(uint64_t(MMO->getOffset()) +
242 uint64_t(Offset)),
243 Size, MMO->getBaseAlignment());
244}
245
246MachineInstr::mmo_iterator
247MachineFunction::allocateMemRefsArray(unsigned long Num) {
248 return Allocator.Allocate<MachineMemOperand *>(Num);
249}
250
Dan Gohman91e69c32009-10-09 18:10:05 +0000251std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
252MachineFunction::extractLoadMemRefs(MachineInstr::mmo_iterator Begin,
253 MachineInstr::mmo_iterator End) {
254 // Count the number of load mem refs.
255 unsigned Num = 0;
256 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
257 if ((*I)->isLoad())
258 ++Num;
259
260 // Allocate a new array and populate it with the load information.
261 MachineInstr::mmo_iterator Result = allocateMemRefsArray(Num);
262 unsigned Index = 0;
263 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
264 if ((*I)->isLoad()) {
265 if (!(*I)->isStore())
266 // Reuse the MMO.
267 Result[Index] = *I;
268 else {
269 // Clone the MMO and unset the store flag.
270 MachineMemOperand *JustLoad =
271 getMachineMemOperand((*I)->getValue(),
272 (*I)->getFlags() & ~MachineMemOperand::MOStore,
273 (*I)->getOffset(), (*I)->getSize(),
274 (*I)->getBaseAlignment());
275 Result[Index] = JustLoad;
276 }
277 ++Index;
278 }
279 }
280 return std::make_pair(Result, Result + Num);
281}
282
283std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
284MachineFunction::extractStoreMemRefs(MachineInstr::mmo_iterator Begin,
285 MachineInstr::mmo_iterator End) {
286 // Count the number of load mem refs.
287 unsigned Num = 0;
288 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
289 if ((*I)->isStore())
290 ++Num;
291
292 // Allocate a new array and populate it with the store information.
293 MachineInstr::mmo_iterator Result = allocateMemRefsArray(Num);
294 unsigned Index = 0;
295 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
296 if ((*I)->isStore()) {
297 if (!(*I)->isLoad())
298 // Reuse the MMO.
299 Result[Index] = *I;
300 else {
301 // Clone the MMO and unset the load flag.
302 MachineMemOperand *JustStore =
303 getMachineMemOperand((*I)->getValue(),
304 (*I)->getFlags() & ~MachineMemOperand::MOLoad,
305 (*I)->getOffset(), (*I)->getSize(),
306 (*I)->getBaseAlignment());
307 Result[Index] = JustStore;
308 }
309 ++Index;
310 }
311 }
312 return std::make_pair(Result, Result + Num);
313}
314
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000315void MachineFunction::dump() const {
David Greenedc554812010-01-04 23:39:17 +0000316 print(dbgs());
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000317}
Chris Lattner10491642002-10-30 00:48:05 +0000318
Chris Lattnerd74c5562009-08-23 01:12:47 +0000319void MachineFunction::print(raw_ostream &OS) const {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000320 OS << "# Machine code for function " << Fn->getName() << ":\n";
Chris Lattner955fad12002-12-28 20:37:16 +0000321
322 // Print Frame Information
Dan Gohman8e5f2c62008-07-07 23:14:23 +0000323 FrameInfo->print(*this, OS);
Nate Begeman37efe672006-04-22 18:53:45 +0000324
325 // Print JumpTable Information
Chris Lattner071c62f2010-01-25 23:26:13 +0000326 if (JumpTableInfo)
327 JumpTableInfo->print(OS);
Chris Lattner4d149cd2003-01-13 00:23:03 +0000328
329 // Print Constant Pool
Chris Lattnerd74c5562009-08-23 01:12:47 +0000330 ConstantPool->print(OS);
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000331
Dan Gohman6f0d0242008-02-10 18:45:23 +0000332 const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000333
Matthijs Kooijmane2b997b2008-10-13 12:37:16 +0000334 if (RegInfo && !RegInfo->livein_empty()) {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000335 OS << "Function Live Ins: ";
Chris Lattner84bc5422007-12-31 04:13:23 +0000336 for (MachineRegisterInfo::livein_iterator
337 I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
Dan Gohman6f0d0242008-02-10 18:45:23 +0000338 if (TRI)
Dan Gohman0ba90f32009-10-31 20:19:03 +0000339 OS << "%" << TRI->getName(I->first);
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000340 else
Dan Gohman0ba90f32009-10-31 20:19:03 +0000341 OS << " %physreg" << I->first;
Chris Lattner4e920272006-05-16 05:55:30 +0000342
343 if (I->second)
Dan Gohman0ba90f32009-10-31 20:19:03 +0000344 OS << " in reg%" << I->second;
345
Chris Lattner7896c9f2009-12-03 00:50:42 +0000346 if (llvm::next(I) != E)
Dan Gohman0ba90f32009-10-31 20:19:03 +0000347 OS << ", ";
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000348 }
Chris Lattnerd74c5562009-08-23 01:12:47 +0000349 OS << '\n';
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000350 }
Matthijs Kooijmane2b997b2008-10-13 12:37:16 +0000351 if (RegInfo && !RegInfo->liveout_empty()) {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000352 OS << "Function Live Outs: ";
Chris Lattner84bc5422007-12-31 04:13:23 +0000353 for (MachineRegisterInfo::liveout_iterator
Dan Gohman0ba90f32009-10-31 20:19:03 +0000354 I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I){
Dan Gohman6f0d0242008-02-10 18:45:23 +0000355 if (TRI)
Dan Gohman0ba90f32009-10-31 20:19:03 +0000356 OS << '%' << TRI->getName(*I);
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000357 else
Dan Gohman0ba90f32009-10-31 20:19:03 +0000358 OS << "%physreg" << *I;
359
Chris Lattner7896c9f2009-12-03 00:50:42 +0000360 if (llvm::next(I) != E)
Dan Gohman0ba90f32009-10-31 20:19:03 +0000361 OS << " ";
362 }
Chris Lattnerd74c5562009-08-23 01:12:47 +0000363 OS << '\n';
Chris Lattnera1f68ca2005-08-31 22:34:59 +0000364 }
365
Dan Gohman0ba90f32009-10-31 20:19:03 +0000366 for (const_iterator BB = begin(), E = end(); BB != E; ++BB) {
367 OS << '\n';
Chris Lattner2d8e3d22009-08-23 00:47:04 +0000368 BB->print(OS);
Dan Gohman0ba90f32009-10-31 20:19:03 +0000369 }
Brian Gaeke47b71642004-03-29 21:58:31 +0000370
Dan Gohman0ba90f32009-10-31 20:19:03 +0000371 OS << "\n# End machine code for function " << Fn->getName() << ".\n\n";
Chris Lattner10491642002-10-30 00:48:05 +0000372}
373
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000374namespace llvm {
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000375 template<>
376 struct DOTGraphTraits<const MachineFunction*> : public DefaultDOTGraphTraits {
Tobias Grossera10d5982009-11-30 12:38:13 +0000377
378 DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
379
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000380 static std::string getGraphName(const MachineFunction *F) {
Daniel Dunbarf6ccee52009-07-24 08:24:36 +0000381 return "CFG for '" + F->getFunction()->getNameStr() + "' function";
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000382 }
383
Tobias Grosser56f4ef32009-11-30 12:38:47 +0000384 std::string getNodeLabel(const MachineBasicBlock *Node,
385 const MachineFunction *Graph) {
386 if (isSimple () && Node->getBasicBlock() &&
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000387 !Node->getBasicBlock()->getName().empty())
Daniel Dunbarf6ccee52009-07-24 08:24:36 +0000388 return Node->getBasicBlock()->getNameStr() + ":";
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000389
Chris Lattnercf143a42009-08-23 03:13:20 +0000390 std::string OutStr;
391 {
392 raw_string_ostream OSS(OutStr);
393
Tobias Grosser56f4ef32009-11-30 12:38:47 +0000394 if (isSimple())
Chris Lattnercf143a42009-08-23 03:13:20 +0000395 OSS << Node->getNumber() << ':';
396 else
397 Node->print(OSS);
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000398 }
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000399
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000400 if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
401
402 // Process string output to make it nicer...
403 for (unsigned i = 0; i != OutStr.length(); ++i)
404 if (OutStr[i] == '\n') { // Left justify
405 OutStr[i] = '\\';
406 OutStr.insert(OutStr.begin()+i+1, 'l');
407 }
408 return OutStr;
409 }
410 };
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000411}
412
413void MachineFunction::viewCFG() const
414{
Jim Laskey851a22d2005-10-12 12:09:05 +0000415#ifndef NDEBUG
Daniel Dunbarf6ccee52009-07-24 08:24:36 +0000416 ViewGraph(this, "mf" + getFunction()->getNameStr());
Reid Spencer9d5b5322006-06-27 16:49:46 +0000417#else
Daniel Dunbar43ed2672009-08-23 08:50:52 +0000418 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
419 << "systems with Graphviz or gv!\n";
Reid Spencer9d5b5322006-06-27 16:49:46 +0000420#endif // NDEBUG
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000421}
422
423void MachineFunction::viewCFGOnly() const
424{
Owen Anderson8cbc94a2009-06-24 17:37:09 +0000425#ifndef NDEBUG
Daniel Dunbarf6ccee52009-07-24 08:24:36 +0000426 ViewGraph(this, "mf" + getFunction()->getNameStr(), true);
Owen Anderson8cbc94a2009-06-24 17:37:09 +0000427#else
Daniel Dunbar43ed2672009-08-23 08:50:52 +0000428 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
429 << "systems with Graphviz or gv!\n";
Owen Anderson8cbc94a2009-06-24 17:37:09 +0000430#endif // NDEBUG
Alkis Evlogimenos71bf4042004-07-08 00:47:58 +0000431}
432
Bob Wilson998e1252009-04-20 18:36:57 +0000433/// addLiveIn - Add the specified physical register as a live-in value and
434/// create a corresponding virtual register for it.
435unsigned MachineFunction::addLiveIn(unsigned PReg,
436 const TargetRegisterClass *RC) {
437 assert(RC->contains(PReg) && "Not the correct regclass!");
438 unsigned VReg = getRegInfo().createVirtualRegister(RC);
439 getRegInfo().addLiveIn(PReg, VReg);
440 return VReg;
441}
442
Devang Patel6b61f582010-01-16 06:09:35 +0000443/// getDILocation - Get the DILocation for a given DebugLoc object.
444DILocation MachineFunction::getDILocation(DebugLoc DL) const {
Bill Wendling44f6ac62009-02-03 22:55:54 +0000445 unsigned Idx = DL.getIndex();
Bill Wendling85e3af92009-02-03 22:49:58 +0000446 assert(Idx < DebugLocInfo.DebugLocations.size() &&
447 "Invalid index into debug locations!");
Devang Patel6b61f582010-01-16 06:09:35 +0000448 return DILocation(DebugLocInfo.DebugLocations[Idx]);
Bill Wendling85e3af92009-02-03 22:49:58 +0000449}
450
Chris Lattner589c6f62010-01-26 06:28:43 +0000451
452/// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
453/// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
454/// normal 'L' label is returned.
455MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx,
456 bool isLinkerPrivate) const {
457 assert(JumpTableInfo && "No jump tables");
458
Chandler Carruthde4c0802010-01-27 10:27:10 +0000459 assert(JTI < JumpTableInfo->getJumpTables().size() && "Invalid JTI!");
Chris Lattner589c6f62010-01-26 06:28:43 +0000460 const MCAsmInfo &MAI = *getTarget().getMCAsmInfo();
461
462 const char *Prefix = isLinkerPrivate ? MAI.getLinkerPrivateGlobalPrefix() :
463 MAI.getPrivateGlobalPrefix();
464 SmallString<60> Name;
465 raw_svector_ostream(Name)
466 << Prefix << "JTI" << getFunctionNumber() << '_' << JTI;
467 return Ctx.GetOrCreateSymbol(Name.str());
468}
469
470
Chris Lattner955fad12002-12-28 20:37:16 +0000471//===----------------------------------------------------------------------===//
Chris Lattnereb24db92002-12-28 21:08:26 +0000472// MachineFrameInfo implementation
Chris Lattner955fad12002-12-28 20:37:16 +0000473//===----------------------------------------------------------------------===//
474
Chris Lattner1612faa2008-01-25 07:19:06 +0000475/// CreateFixedObject - Create a new object at a fixed location on the stack.
476/// All fixed objects should be created before other objects are created for
477/// efficiency. By default, fixed objects are immutable. This returns an
478/// index with a negative value.
479///
480int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
David Greene3f2bf852009-11-12 20:49:22 +0000481 bool Immutable, bool isSS) {
Chris Lattner1612faa2008-01-25 07:19:06 +0000482 assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
David Greene3f2bf852009-11-12 20:49:22 +0000483 Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable,
484 isSS));
Chris Lattner1612faa2008-01-25 07:19:06 +0000485 return -++NumFixedObjects;
486}
487
488
Jakob Stoklund Olesen4a0f08c2009-08-13 16:19:33 +0000489BitVector
490MachineFrameInfo::getPristineRegs(const MachineBasicBlock *MBB) const {
491 assert(MBB && "MBB must be valid");
492 const MachineFunction *MF = MBB->getParent();
493 assert(MF && "MBB must be part of a MachineFunction");
494 const TargetMachine &TM = MF->getTarget();
495 const TargetRegisterInfo *TRI = TM.getRegisterInfo();
496 BitVector BV(TRI->getNumRegs());
497
498 // Before CSI is calculated, no registers are considered pristine. They can be
499 // freely used and PEI will make sure they are saved.
500 if (!isCalleeSavedInfoValid())
501 return BV;
502
503 for (const unsigned *CSR = TRI->getCalleeSavedRegs(MF); CSR && *CSR; ++CSR)
504 BV.set(*CSR);
505
506 // The entry MBB always has all CSRs pristine.
507 if (MBB == &MF->front())
508 return BV;
509
510 // On other MBBs the saved CSRs are not pristine.
511 const std::vector<CalleeSavedInfo> &CSI = getCalleeSavedInfo();
512 for (std::vector<CalleeSavedInfo>::const_iterator I = CSI.begin(),
513 E = CSI.end(); I != E; ++I)
514 BV.reset(I->getReg());
515
516 return BV;
517}
518
519
Chris Lattnerd74c5562009-08-23 01:12:47 +0000520void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{
Dan Gohman0ba90f32009-10-31 20:19:03 +0000521 if (Objects.empty()) return;
522
Matthijs Kooijman06140882008-11-03 11:16:43 +0000523 const TargetFrameInfo *FI = MF.getTarget().getFrameInfo();
524 int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0);
Chris Lattner9085d8a2003-01-16 18:35:57 +0000525
Dan Gohman0ba90f32009-10-31 20:19:03 +0000526 OS << "Frame Objects:\n";
527
Chris Lattner955fad12002-12-28 20:37:16 +0000528 for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
529 const StackObject &SO = Objects[i];
Dan Gohman0ba90f32009-10-31 20:19:03 +0000530 OS << " fi#" << (int)(i-NumFixedObjects) << ": ";
Evan Chengd3653122008-02-27 03:04:06 +0000531 if (SO.Size == ~0ULL) {
532 OS << "dead\n";
533 continue;
534 }
Chris Lattner955fad12002-12-28 20:37:16 +0000535 if (SO.Size == 0)
536 OS << "variable sized";
537 else
Dan Gohman0ba90f32009-10-31 20:19:03 +0000538 OS << "size=" << SO.Size;
539 OS << ", align=" << SO.Alignment;
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000540
Chris Lattner955fad12002-12-28 20:37:16 +0000541 if (i < NumFixedObjects)
Dan Gohman0ba90f32009-10-31 20:19:03 +0000542 OS << ", fixed";
Chris Lattner955fad12002-12-28 20:37:16 +0000543 if (i < NumFixedObjects || SO.SPOffset != -1) {
Chris Lattnera401b1e2007-04-25 04:20:54 +0000544 int64_t Off = SO.SPOffset - ValOffset;
Dan Gohman0ba90f32009-10-31 20:19:03 +0000545 OS << ", at location [SP";
Chris Lattner9085d8a2003-01-16 18:35:57 +0000546 if (Off > 0)
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000547 OS << "+" << Off;
Chris Lattner9085d8a2003-01-16 18:35:57 +0000548 else if (Off < 0)
Alkis Evlogimenos76d9dac2004-09-05 18:41:35 +0000549 OS << Off;
Chris Lattner955fad12002-12-28 20:37:16 +0000550 OS << "]";
551 }
552 OS << "\n";
553 }
Chris Lattner955fad12002-12-28 20:37:16 +0000554}
555
Chris Lattner9085d8a2003-01-16 18:35:57 +0000556void MachineFrameInfo::dump(const MachineFunction &MF) const {
David Greenedc554812010-01-04 23:39:17 +0000557 print(MF, dbgs());
Chris Lattner9085d8a2003-01-16 18:35:57 +0000558}
Chris Lattner955fad12002-12-28 20:37:16 +0000559
Chris Lattner955fad12002-12-28 20:37:16 +0000560//===----------------------------------------------------------------------===//
Nate Begeman37efe672006-04-22 18:53:45 +0000561// MachineJumpTableInfo implementation
562//===----------------------------------------------------------------------===//
563
Chris Lattner071c62f2010-01-25 23:26:13 +0000564/// getEntrySize - Return the size of each entry in the jump table.
565unsigned MachineJumpTableInfo::getEntrySize(const TargetData &TD) const {
566 // The size of a jump table entry is 4 bytes unless the entry is just the
567 // address of a block, in which case it is the pointer size.
568 switch (getEntryKind()) {
569 case MachineJumpTableInfo::EK_BlockAddress:
570 return TD.getPointerSize();
571 case MachineJumpTableInfo::EK_GPRel32BlockAddress:
572 case MachineJumpTableInfo::EK_LabelDifference32:
Chris Lattner85fe0782010-01-26 04:05:28 +0000573 case MachineJumpTableInfo::EK_Custom32:
Chris Lattner071c62f2010-01-25 23:26:13 +0000574 return 4;
575 }
576 assert(0 && "Unknown jump table encoding!");
577 return ~0;
578}
579
580/// getEntryAlignment - Return the alignment of each entry in the jump table.
581unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const {
582 // The alignment of a jump table entry is the alignment of int32 unless the
583 // entry is just the address of a block, in which case it is the pointer
584 // alignment.
585 switch (getEntryKind()) {
586 case MachineJumpTableInfo::EK_BlockAddress:
587 return TD.getPointerABIAlignment();
588 case MachineJumpTableInfo::EK_GPRel32BlockAddress:
589 case MachineJumpTableInfo::EK_LabelDifference32:
Chris Lattner85fe0782010-01-26 04:05:28 +0000590 case MachineJumpTableInfo::EK_Custom32:
Chris Lattner071c62f2010-01-25 23:26:13 +0000591 return TD.getABIIntegerTypeAlignment(32);
592 }
593 assert(0 && "Unknown jump table encoding!");
594 return ~0;
595}
596
Nate Begeman37efe672006-04-22 18:53:45 +0000597/// getJumpTableIndex - Create a new jump table entry in the jump table info
598/// or return an existing one.
599///
600unsigned MachineJumpTableInfo::getJumpTableIndex(
Chris Lattnera4eb44a2006-10-28 18:17:09 +0000601 const std::vector<MachineBasicBlock*> &DestBBs) {
Chris Lattnere7251a02006-10-28 18:11:20 +0000602 assert(!DestBBs.empty() && "Cannot create an empty jump table!");
Nate Begeman37efe672006-04-22 18:53:45 +0000603 JumpTables.push_back(MachineJumpTableEntry(DestBBs));
604 return JumpTables.size()-1;
605}
606
Chris Lattnerbeeb93e2010-01-26 05:58:28 +0000607
Dan Gohman593ea052009-04-15 01:18:49 +0000608/// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update
609/// the jump tables to branch to New instead.
Chris Lattnerbeeb93e2010-01-26 05:58:28 +0000610bool MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,
611 MachineBasicBlock *New) {
Dan Gohman593ea052009-04-15 01:18:49 +0000612 assert(Old != New && "Not making a change?");
613 bool MadeChange = false;
Jim Grosbach68bb60f2009-11-14 20:09:13 +0000614 for (size_t i = 0, e = JumpTables.size(); i != e; ++i)
615 ReplaceMBBInJumpTable(i, Old, New);
616 return MadeChange;
617}
618
619/// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
620/// the jump table to branch to New instead.
Chris Lattnerbeeb93e2010-01-26 05:58:28 +0000621bool MachineJumpTableInfo::ReplaceMBBInJumpTable(unsigned Idx,
622 MachineBasicBlock *Old,
623 MachineBasicBlock *New) {
Jim Grosbach68bb60f2009-11-14 20:09:13 +0000624 assert(Old != New && "Not making a change?");
625 bool MadeChange = false;
626 MachineJumpTableEntry &JTE = JumpTables[Idx];
627 for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
628 if (JTE.MBBs[j] == Old) {
629 JTE.MBBs[j] = New;
630 MadeChange = true;
631 }
Dan Gohman593ea052009-04-15 01:18:49 +0000632 return MadeChange;
633}
Nate Begeman37efe672006-04-22 18:53:45 +0000634
Chris Lattnerd74c5562009-08-23 01:12:47 +0000635void MachineJumpTableInfo::print(raw_ostream &OS) const {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000636 if (JumpTables.empty()) return;
637
638 OS << "Jump Tables:\n";
639
Nate Begeman37efe672006-04-22 18:53:45 +0000640 for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000641 OS << " jt#" << i << ": ";
642 for (unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
643 OS << " BB#" << JumpTables[i].MBBs[j]->getNumber();
Nate Begeman37efe672006-04-22 18:53:45 +0000644 }
Dan Gohman0ba90f32009-10-31 20:19:03 +0000645
646 OS << '\n';
Nate Begeman37efe672006-04-22 18:53:45 +0000647}
648
David Greenedc554812010-01-04 23:39:17 +0000649void MachineJumpTableInfo::dump() const { print(dbgs()); }
Nate Begeman37efe672006-04-22 18:53:45 +0000650
651
652//===----------------------------------------------------------------------===//
Chris Lattner4d149cd2003-01-13 00:23:03 +0000653// MachineConstantPool implementation
654//===----------------------------------------------------------------------===//
655
Evan Cheng9abd7c32006-09-14 05:50:57 +0000656const Type *MachineConstantPoolEntry::getType() const {
657 if (isMachineConstantPoolEntry())
Chris Lattnercb459632009-07-21 23:34:23 +0000658 return Val.MachineCPVal->getType();
Evan Cheng9abd7c32006-09-14 05:50:57 +0000659 return Val.ConstVal->getType();
660}
661
Chris Lattnercb459632009-07-21 23:34:23 +0000662
Chris Lattner354c0162009-07-21 23:36:01 +0000663unsigned MachineConstantPoolEntry::getRelocationInfo() const {
Chris Lattnercb459632009-07-21 23:34:23 +0000664 if (isMachineConstantPoolEntry())
Chris Lattner354c0162009-07-21 23:36:01 +0000665 return Val.MachineCPVal->getRelocationInfo();
Chris Lattner7cf12c72009-07-22 00:05:44 +0000666 return Val.ConstVal->getRelocationInfo();
Chris Lattnercb459632009-07-21 23:34:23 +0000667}
668
Evan Chengd6594ae2006-09-12 21:00:35 +0000669MachineConstantPool::~MachineConstantPool() {
670 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
671 if (Constants[i].isMachineConstantPoolEntry())
672 delete Constants[i].Val.MachineCPVal;
673}
674
Dan Gohman83f61202009-10-28 01:12:16 +0000675/// CanShareConstantPoolEntry - Test whether the given two constants
676/// can be allocated the same constant pool entry.
677static bool CanShareConstantPoolEntry(Constant *A, Constant *B,
678 const TargetData *TD) {
679 // Handle the trivial case quickly.
680 if (A == B) return true;
681
682 // If they have the same type but weren't the same constant, quickly
683 // reject them.
684 if (A->getType() == B->getType()) return false;
685
686 // For now, only support constants with the same size.
687 if (TD->getTypeStoreSize(A->getType()) != TD->getTypeStoreSize(B->getType()))
688 return false;
689
690 // If a floating-point value and an integer value have the same encoding,
691 // they can share a constant-pool entry.
692 if (ConstantFP *AFP = dyn_cast<ConstantFP>(A))
693 if (ConstantInt *BI = dyn_cast<ConstantInt>(B))
694 return AFP->getValueAPF().bitcastToAPInt() == BI->getValue();
695 if (ConstantFP *BFP = dyn_cast<ConstantFP>(B))
696 if (ConstantInt *AI = dyn_cast<ConstantInt>(A))
697 return BFP->getValueAPF().bitcastToAPInt() == AI->getValue();
698
699 // Two vectors can share an entry if each pair of corresponding
700 // elements could.
701 if (ConstantVector *AV = dyn_cast<ConstantVector>(A))
702 if (ConstantVector *BV = dyn_cast<ConstantVector>(B)) {
703 if (AV->getType()->getNumElements() != BV->getType()->getNumElements())
704 return false;
705 for (unsigned i = 0, e = AV->getType()->getNumElements(); i != e; ++i)
Dan Gohman60d686d2009-10-31 14:12:53 +0000706 if (!CanShareConstantPoolEntry(AV->getOperand(i),
707 BV->getOperand(i), TD))
Dan Gohman83f61202009-10-28 01:12:16 +0000708 return false;
709 return true;
710 }
711
712 // TODO: Handle other cases.
713
714 return false;
715}
716
Chris Lattner3029f922006-02-09 04:46:04 +0000717/// getConstantPoolIndex - Create a new entry in the constant pool or return
Dan Gohman05ae9832008-09-16 20:45:53 +0000718/// an existing one. User must specify the log2 of the minimum required
719/// alignment for the object.
Chris Lattner3029f922006-02-09 04:46:04 +0000720///
721unsigned MachineConstantPool::getConstantPoolIndex(Constant *C,
722 unsigned Alignment) {
723 assert(Alignment && "Alignment must be specified!");
724 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
Dan Gohman83f61202009-10-28 01:12:16 +0000725
Chris Lattner3029f922006-02-09 04:46:04 +0000726 // Check to see if we already have this constant.
727 //
728 // FIXME, this could be made much more efficient for large constant pools.
Chris Lattner3029f922006-02-09 04:46:04 +0000729 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
Dan Gohman83f61202009-10-28 01:12:16 +0000730 if (!Constants[i].isMachineConstantPoolEntry() &&
731 CanShareConstantPoolEntry(Constants[i].Val.ConstVal, C, TD)) {
732 if ((unsigned)Constants[i].getAlignment() < Alignment)
733 Constants[i].Alignment = Alignment;
Chris Lattner3029f922006-02-09 04:46:04 +0000734 return i;
Dan Gohman83f61202009-10-28 01:12:16 +0000735 }
Chris Lattner3029f922006-02-09 04:46:04 +0000736
Evan Cheng1606e8e2009-03-13 07:51:59 +0000737 Constants.push_back(MachineConstantPoolEntry(C, Alignment));
Chris Lattner3029f922006-02-09 04:46:04 +0000738 return Constants.size()-1;
739}
740
Evan Chengd6594ae2006-09-12 21:00:35 +0000741unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V,
742 unsigned Alignment) {
743 assert(Alignment && "Alignment must be specified!");
744 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
745
746 // Check to see if we already have this constant.
747 //
748 // FIXME, this could be made much more efficient for large constant pools.
Evan Chengd6594ae2006-09-12 21:00:35 +0000749 int Idx = V->getExistingMachineCPValue(this, Alignment);
750 if (Idx != -1)
751 return (unsigned)Idx;
Evan Cheng1606e8e2009-03-13 07:51:59 +0000752
753 Constants.push_back(MachineConstantPoolEntry(V, Alignment));
Evan Chengd6594ae2006-09-12 21:00:35 +0000754 return Constants.size()-1;
755}
756
Chris Lattner62ca3252008-08-23 22:53:13 +0000757void MachineConstantPool::print(raw_ostream &OS) const {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000758 if (Constants.empty()) return;
759
760 OS << "Constant Pool:\n";
Evan Chengb8973bd2006-01-31 22:23:14 +0000761 for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
Dan Gohman0ba90f32009-10-31 20:19:03 +0000762 OS << " cp#" << i << ": ";
Evan Chengd6594ae2006-09-12 21:00:35 +0000763 if (Constants[i].isMachineConstantPoolEntry())
764 Constants[i].Val.MachineCPVal->print(OS);
765 else
766 OS << *(Value*)Constants[i].Val.ConstVal;
Dan Gohman0ba90f32009-10-31 20:19:03 +0000767 OS << ", align=" << Constants[i].getAlignment();
Evan Chengb8973bd2006-01-31 22:23:14 +0000768 OS << "\n";
769 }
Chris Lattner4d149cd2003-01-13 00:23:03 +0000770}
771
David Greenedc554812010-01-04 23:39:17 +0000772void MachineConstantPool::dump() const { print(dbgs()); }