1 //===-- MachineFunction.cpp -----------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Collect native machine code information for a function. This allows
11 // target-specific information about the generated code to be stored with each
14 //===----------------------------------------------------------------------===//
16 #include "llvm/DerivedTypes.h"
17 #include "llvm/Function.h"
18 #include "llvm/Instructions.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/Config/config.h"
21 #include "llvm/CodeGen/MachineConstantPool.h"
22 #include "llvm/CodeGen/MachineFunction.h"
23 #include "llvm/CodeGen/MachineFunctionPass.h"
24 #include "llvm/CodeGen/MachineFrameInfo.h"
25 #include "llvm/CodeGen/MachineInstr.h"
26 #include "llvm/CodeGen/MachineJumpTableInfo.h"
27 #include "llvm/CodeGen/MachineRegisterInfo.h"
28 #include "llvm/CodeGen/Passes.h"
29 #include "llvm/Analysis/DebugInfo.h"
30 #include "llvm/Support/Debug.h"
31 #include "llvm/Target/TargetData.h"
32 #include "llvm/Target/TargetLowering.h"
33 #include "llvm/Target/TargetMachine.h"
34 #include "llvm/Target/TargetFrameInfo.h"
35 #include "llvm/Support/GraphWriter.h"
36 #include "llvm/Support/raw_ostream.h"
40 struct Printer : public MachineFunctionPass {
44 const std::string Banner;
46 Printer(raw_ostream &os, const std::string &banner)
47 : MachineFunctionPass(&ID), OS(os), Banner(banner) {}
49 const char *getPassName() const { return "MachineFunction Printer"; }
51 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
53 MachineFunctionPass::getAnalysisUsage(AU);
56 bool runOnMachineFunction(MachineFunction &MF) {
57 OS << "# " << Banner << ":\n";
65 /// Returns a newly-created MachineFunction Printer pass. The default banner is
68 FunctionPass *llvm::createMachineFunctionPrinterPass(raw_ostream &OS,
69 const std::string &Banner){
70 return new Printer(OS, Banner);
73 //===---------------------------------------------------------------------===//
74 // MachineFunction implementation
75 //===---------------------------------------------------------------------===//
77 // Out of line virtual method.
78 MachineFunctionInfo::~MachineFunctionInfo() {}
80 void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
81 MBB->getParent()->DeleteMachineBasicBlock(MBB);
84 MachineFunction::MachineFunction(Function *F,
85 const TargetMachine &TM)
87 if (TM.getRegisterInfo())
88 RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
89 MachineRegisterInfo(*TM.getRegisterInfo());
93 FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
94 MachineFrameInfo(*TM.getFrameInfo());
95 ConstantPool = new (Allocator.Allocate<MachineConstantPool>())
96 MachineConstantPool(TM.getTargetData());
97 Alignment = TM.getTargetLowering()->getFunctionAlignment(F);
102 MachineFunction::~MachineFunction() {
104 InstructionRecycler.clear(Allocator);
105 BasicBlockRecycler.clear(Allocator);
107 RegInfo->~MachineRegisterInfo();
108 Allocator.Deallocate(RegInfo);
111 MFInfo->~MachineFunctionInfo();
112 Allocator.Deallocate(MFInfo);
114 FrameInfo->~MachineFrameInfo(); Allocator.Deallocate(FrameInfo);
115 ConstantPool->~MachineConstantPool(); Allocator.Deallocate(ConstantPool);
118 JumpTableInfo->~MachineJumpTableInfo();
119 Allocator.Deallocate(JumpTableInfo);
123 /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
124 /// does already exist, allocate one.
125 MachineJumpTableInfo *MachineFunction::
126 getOrCreateJumpTableInfo(unsigned EntryKind) {
127 if (JumpTableInfo) return JumpTableInfo;
129 JumpTableInfo = new (Allocator.Allocate<MachineJumpTableInfo>())
130 MachineJumpTableInfo((MachineJumpTableInfo::JTEntryKind)EntryKind);
131 return JumpTableInfo;
134 /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
135 /// recomputes them. This guarantees that the MBB numbers are sequential,
136 /// dense, and match the ordering of the blocks within the function. If a
137 /// specific MachineBasicBlock is specified, only that block and those after
138 /// it are renumbered.
139 void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) {
140 if (empty()) { MBBNumbering.clear(); return; }
141 MachineFunction::iterator MBBI, E = end();
147 // Figure out the block number this should have.
148 unsigned BlockNo = 0;
150 BlockNo = prior(MBBI)->getNumber()+1;
152 for (; MBBI != E; ++MBBI, ++BlockNo) {
153 if (MBBI->getNumber() != (int)BlockNo) {
154 // Remove use of the old number.
155 if (MBBI->getNumber() != -1) {
156 assert(MBBNumbering[MBBI->getNumber()] == &*MBBI &&
157 "MBB number mismatch!");
158 MBBNumbering[MBBI->getNumber()] = 0;
161 // If BlockNo is already taken, set that block's number to -1.
162 if (MBBNumbering[BlockNo])
163 MBBNumbering[BlockNo]->setNumber(-1);
165 MBBNumbering[BlockNo] = MBBI;
166 MBBI->setNumber(BlockNo);
170 // Okay, all the blocks are renumbered. If we have compactified the block
171 // numbering, shrink MBBNumbering now.
172 assert(BlockNo <= MBBNumbering.size() && "Mismatch!");
173 MBBNumbering.resize(BlockNo);
176 /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
177 /// of `new MachineInstr'.
180 MachineFunction::CreateMachineInstr(const TargetInstrDesc &TID,
181 DebugLoc DL, bool NoImp) {
182 return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
183 MachineInstr(TID, DL, NoImp);
186 /// CloneMachineInstr - Create a new MachineInstr which is a copy of the
187 /// 'Orig' instruction, identical in all ways except the the instruction
188 /// has no parent, prev, or next.
191 MachineFunction::CloneMachineInstr(const MachineInstr *Orig) {
192 return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
193 MachineInstr(*this, *Orig);
196 /// DeleteMachineInstr - Delete the given MachineInstr.
199 MachineFunction::DeleteMachineInstr(MachineInstr *MI) {
201 InstructionRecycler.Deallocate(Allocator, MI);
204 /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
205 /// instead of `new MachineBasicBlock'.
208 MachineFunction::CreateMachineBasicBlock(const BasicBlock *bb) {
209 return new (BasicBlockRecycler.Allocate<MachineBasicBlock>(Allocator))
210 MachineBasicBlock(*this, bb);
213 /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
216 MachineFunction::DeleteMachineBasicBlock(MachineBasicBlock *MBB) {
217 assert(MBB->getParent() == this && "MBB parent mismatch!");
218 MBB->~MachineBasicBlock();
219 BasicBlockRecycler.Deallocate(Allocator, MBB);
223 MachineFunction::getMachineMemOperand(const Value *v, unsigned f,
224 int64_t o, uint64_t s,
225 unsigned base_alignment) {
226 return new (Allocator.Allocate<MachineMemOperand>())
227 MachineMemOperand(v, f, o, s, base_alignment);
231 MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
232 int64_t Offset, uint64_t Size) {
233 return new (Allocator.Allocate<MachineMemOperand>())
234 MachineMemOperand(MMO->getValue(), MMO->getFlags(),
235 int64_t(uint64_t(MMO->getOffset()) +
237 Size, MMO->getBaseAlignment());
240 MachineInstr::mmo_iterator
241 MachineFunction::allocateMemRefsArray(unsigned long Num) {
242 return Allocator.Allocate<MachineMemOperand *>(Num);
245 std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
246 MachineFunction::extractLoadMemRefs(MachineInstr::mmo_iterator Begin,
247 MachineInstr::mmo_iterator End) {
248 // Count the number of load mem refs.
250 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
254 // Allocate a new array and populate it with the load information.
255 MachineInstr::mmo_iterator Result = allocateMemRefsArray(Num);
257 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
258 if ((*I)->isLoad()) {
259 if (!(*I)->isStore())
263 // Clone the MMO and unset the store flag.
264 MachineMemOperand *JustLoad =
265 getMachineMemOperand((*I)->getValue(),
266 (*I)->getFlags() & ~MachineMemOperand::MOStore,
267 (*I)->getOffset(), (*I)->getSize(),
268 (*I)->getBaseAlignment());
269 Result[Index] = JustLoad;
274 return std::make_pair(Result, Result + Num);
277 std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
278 MachineFunction::extractStoreMemRefs(MachineInstr::mmo_iterator Begin,
279 MachineInstr::mmo_iterator End) {
280 // Count the number of load mem refs.
282 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
286 // Allocate a new array and populate it with the store information.
287 MachineInstr::mmo_iterator Result = allocateMemRefsArray(Num);
289 for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
290 if ((*I)->isStore()) {
295 // Clone the MMO and unset the load flag.
296 MachineMemOperand *JustStore =
297 getMachineMemOperand((*I)->getValue(),
298 (*I)->getFlags() & ~MachineMemOperand::MOLoad,
299 (*I)->getOffset(), (*I)->getSize(),
300 (*I)->getBaseAlignment());
301 Result[Index] = JustStore;
306 return std::make_pair(Result, Result + Num);
309 void MachineFunction::dump() const {
313 void MachineFunction::print(raw_ostream &OS) const {
314 OS << "# Machine code for function " << Fn->getName() << ":\n";
316 // Print Frame Information
317 FrameInfo->print(*this, OS);
319 // Print JumpTable Information
321 JumpTableInfo->print(OS);
323 // Print Constant Pool
324 ConstantPool->print(OS);
326 const TargetRegisterInfo *TRI = getTarget().getRegisterInfo();
328 if (RegInfo && !RegInfo->livein_empty()) {
329 OS << "Function Live Ins: ";
330 for (MachineRegisterInfo::livein_iterator
331 I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
333 OS << "%" << TRI->getName(I->first);
335 OS << " %physreg" << I->first;
338 OS << " in reg%" << I->second;
340 if (llvm::next(I) != E)
345 if (RegInfo && !RegInfo->liveout_empty()) {
346 OS << "Function Live Outs: ";
347 for (MachineRegisterInfo::liveout_iterator
348 I = RegInfo->liveout_begin(), E = RegInfo->liveout_end(); I != E; ++I){
350 OS << '%' << TRI->getName(*I);
352 OS << "%physreg" << *I;
354 if (llvm::next(I) != E)
360 for (const_iterator BB = begin(), E = end(); BB != E; ++BB) {
365 OS << "\n# End machine code for function " << Fn->getName() << ".\n\n";
370 struct DOTGraphTraits<const MachineFunction*> : public DefaultDOTGraphTraits {
372 DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
374 static std::string getGraphName(const MachineFunction *F) {
375 return "CFG for '" + F->getFunction()->getNameStr() + "' function";
378 std::string getNodeLabel(const MachineBasicBlock *Node,
379 const MachineFunction *Graph) {
380 if (isSimple () && Node->getBasicBlock() &&
381 !Node->getBasicBlock()->getName().empty())
382 return Node->getBasicBlock()->getNameStr() + ":";
386 raw_string_ostream OSS(OutStr);
389 OSS << Node->getNumber() << ':';
394 if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
396 // Process string output to make it nicer...
397 for (unsigned i = 0; i != OutStr.length(); ++i)
398 if (OutStr[i] == '\n') { // Left justify
400 OutStr.insert(OutStr.begin()+i+1, 'l');
407 void MachineFunction::viewCFG() const
410 ViewGraph(this, "mf" + getFunction()->getNameStr());
412 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
413 << "systems with Graphviz or gv!\n";
417 void MachineFunction::viewCFGOnly() const
420 ViewGraph(this, "mf" + getFunction()->getNameStr(), true);
422 errs() << "SelectionDAG::viewGraph is only available in debug builds on "
423 << "systems with Graphviz or gv!\n";
427 /// addLiveIn - Add the specified physical register as a live-in value and
428 /// create a corresponding virtual register for it.
429 unsigned MachineFunction::addLiveIn(unsigned PReg,
430 const TargetRegisterClass *RC) {
431 assert(RC->contains(PReg) && "Not the correct regclass!");
432 unsigned VReg = getRegInfo().createVirtualRegister(RC);
433 getRegInfo().addLiveIn(PReg, VReg);
437 /// getDILocation - Get the DILocation for a given DebugLoc object.
438 DILocation MachineFunction::getDILocation(DebugLoc DL) const {
439 unsigned Idx = DL.getIndex();
440 assert(Idx < DebugLocInfo.DebugLocations.size() &&
441 "Invalid index into debug locations!");
442 return DILocation(DebugLocInfo.DebugLocations[Idx]);
445 //===----------------------------------------------------------------------===//
446 // MachineFrameInfo implementation
447 //===----------------------------------------------------------------------===//
449 /// CreateFixedObject - Create a new object at a fixed location on the stack.
450 /// All fixed objects should be created before other objects are created for
451 /// efficiency. By default, fixed objects are immutable. This returns an
452 /// index with a negative value.
454 int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
455 bool Immutable, bool isSS) {
456 assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
457 Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable,
459 return -++NumFixedObjects;
464 MachineFrameInfo::getPristineRegs(const MachineBasicBlock *MBB) const {
465 assert(MBB && "MBB must be valid");
466 const MachineFunction *MF = MBB->getParent();
467 assert(MF && "MBB must be part of a MachineFunction");
468 const TargetMachine &TM = MF->getTarget();
469 const TargetRegisterInfo *TRI = TM.getRegisterInfo();
470 BitVector BV(TRI->getNumRegs());
472 // Before CSI is calculated, no registers are considered pristine. They can be
473 // freely used and PEI will make sure they are saved.
474 if (!isCalleeSavedInfoValid())
477 for (const unsigned *CSR = TRI->getCalleeSavedRegs(MF); CSR && *CSR; ++CSR)
480 // The entry MBB always has all CSRs pristine.
481 if (MBB == &MF->front())
484 // On other MBBs the saved CSRs are not pristine.
485 const std::vector<CalleeSavedInfo> &CSI = getCalleeSavedInfo();
486 for (std::vector<CalleeSavedInfo>::const_iterator I = CSI.begin(),
487 E = CSI.end(); I != E; ++I)
488 BV.reset(I->getReg());
494 void MachineFrameInfo::print(const MachineFunction &MF, raw_ostream &OS) const{
495 if (Objects.empty()) return;
497 const TargetFrameInfo *FI = MF.getTarget().getFrameInfo();
498 int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0);
500 OS << "Frame Objects:\n";
502 for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
503 const StackObject &SO = Objects[i];
504 OS << " fi#" << (int)(i-NumFixedObjects) << ": ";
505 if (SO.Size == ~0ULL) {
510 OS << "variable sized";
512 OS << "size=" << SO.Size;
513 OS << ", align=" << SO.Alignment;
515 if (i < NumFixedObjects)
517 if (i < NumFixedObjects || SO.SPOffset != -1) {
518 int64_t Off = SO.SPOffset - ValOffset;
519 OS << ", at location [SP";
530 void MachineFrameInfo::dump(const MachineFunction &MF) const {
534 //===----------------------------------------------------------------------===//
535 // MachineJumpTableInfo implementation
536 //===----------------------------------------------------------------------===//
538 /// getEntrySize - Return the size of each entry in the jump table.
539 unsigned MachineJumpTableInfo::getEntrySize(const TargetData &TD) const {
540 // The size of a jump table entry is 4 bytes unless the entry is just the
541 // address of a block, in which case it is the pointer size.
542 switch (getEntryKind()) {
543 case MachineJumpTableInfo::EK_BlockAddress:
544 return TD.getPointerSize();
545 case MachineJumpTableInfo::EK_GPRel32BlockAddress:
546 case MachineJumpTableInfo::EK_LabelDifference32:
547 case MachineJumpTableInfo::EK_Custom32:
550 assert(0 && "Unknown jump table encoding!");
554 /// getEntryAlignment - Return the alignment of each entry in the jump table.
555 unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const {
556 // The alignment of a jump table entry is the alignment of int32 unless the
557 // entry is just the address of a block, in which case it is the pointer
559 switch (getEntryKind()) {
560 case MachineJumpTableInfo::EK_BlockAddress:
561 return TD.getPointerABIAlignment();
562 case MachineJumpTableInfo::EK_GPRel32BlockAddress:
563 case MachineJumpTableInfo::EK_LabelDifference32:
564 case MachineJumpTableInfo::EK_Custom32:
565 return TD.getABIIntegerTypeAlignment(32);
567 assert(0 && "Unknown jump table encoding!");
571 /// getJumpTableIndex - Create a new jump table entry in the jump table info
572 /// or return an existing one.
574 unsigned MachineJumpTableInfo::getJumpTableIndex(
575 const std::vector<MachineBasicBlock*> &DestBBs) {
576 assert(!DestBBs.empty() && "Cannot create an empty jump table!");
577 JumpTables.push_back(MachineJumpTableEntry(DestBBs));
578 return JumpTables.size()-1;
581 /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update
582 /// the jump tables to branch to New instead.
584 MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,
585 MachineBasicBlock *New) {
586 assert(Old != New && "Not making a change?");
587 bool MadeChange = false;
588 for (size_t i = 0, e = JumpTables.size(); i != e; ++i)
589 ReplaceMBBInJumpTable(i, Old, New);
593 /// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
594 /// the jump table to branch to New instead.
596 MachineJumpTableInfo::ReplaceMBBInJumpTable(unsigned Idx,
597 MachineBasicBlock *Old,
598 MachineBasicBlock *New) {
599 assert(Old != New && "Not making a change?");
600 bool MadeChange = false;
601 MachineJumpTableEntry &JTE = JumpTables[Idx];
602 for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
603 if (JTE.MBBs[j] == Old) {
610 void MachineJumpTableInfo::print(raw_ostream &OS) const {
611 if (JumpTables.empty()) return;
613 OS << "Jump Tables:\n";
615 for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
616 OS << " jt#" << i << ": ";
617 for (unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
618 OS << " BB#" << JumpTables[i].MBBs[j]->getNumber();
624 void MachineJumpTableInfo::dump() const { print(dbgs()); }
627 //===----------------------------------------------------------------------===//
628 // MachineConstantPool implementation
629 //===----------------------------------------------------------------------===//
631 const Type *MachineConstantPoolEntry::getType() const {
632 if (isMachineConstantPoolEntry())
633 return Val.MachineCPVal->getType();
634 return Val.ConstVal->getType();
638 unsigned MachineConstantPoolEntry::getRelocationInfo() const {
639 if (isMachineConstantPoolEntry())
640 return Val.MachineCPVal->getRelocationInfo();
641 return Val.ConstVal->getRelocationInfo();
644 MachineConstantPool::~MachineConstantPool() {
645 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
646 if (Constants[i].isMachineConstantPoolEntry())
647 delete Constants[i].Val.MachineCPVal;
650 /// CanShareConstantPoolEntry - Test whether the given two constants
651 /// can be allocated the same constant pool entry.
652 static bool CanShareConstantPoolEntry(Constant *A, Constant *B,
653 const TargetData *TD) {
654 // Handle the trivial case quickly.
655 if (A == B) return true;
657 // If they have the same type but weren't the same constant, quickly
659 if (A->getType() == B->getType()) return false;
661 // For now, only support constants with the same size.
662 if (TD->getTypeStoreSize(A->getType()) != TD->getTypeStoreSize(B->getType()))
665 // If a floating-point value and an integer value have the same encoding,
666 // they can share a constant-pool entry.
667 if (ConstantFP *AFP = dyn_cast<ConstantFP>(A))
668 if (ConstantInt *BI = dyn_cast<ConstantInt>(B))
669 return AFP->getValueAPF().bitcastToAPInt() == BI->getValue();
670 if (ConstantFP *BFP = dyn_cast<ConstantFP>(B))
671 if (ConstantInt *AI = dyn_cast<ConstantInt>(A))
672 return BFP->getValueAPF().bitcastToAPInt() == AI->getValue();
674 // Two vectors can share an entry if each pair of corresponding
676 if (ConstantVector *AV = dyn_cast<ConstantVector>(A))
677 if (ConstantVector *BV = dyn_cast<ConstantVector>(B)) {
678 if (AV->getType()->getNumElements() != BV->getType()->getNumElements())
680 for (unsigned i = 0, e = AV->getType()->getNumElements(); i != e; ++i)
681 if (!CanShareConstantPoolEntry(AV->getOperand(i),
682 BV->getOperand(i), TD))
687 // TODO: Handle other cases.
692 /// getConstantPoolIndex - Create a new entry in the constant pool or return
693 /// an existing one. User must specify the log2 of the minimum required
694 /// alignment for the object.
696 unsigned MachineConstantPool::getConstantPoolIndex(Constant *C,
697 unsigned Alignment) {
698 assert(Alignment && "Alignment must be specified!");
699 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
701 // Check to see if we already have this constant.
703 // FIXME, this could be made much more efficient for large constant pools.
704 for (unsigned i = 0, e = Constants.size(); i != e; ++i)
705 if (!Constants[i].isMachineConstantPoolEntry() &&
706 CanShareConstantPoolEntry(Constants[i].Val.ConstVal, C, TD)) {
707 if ((unsigned)Constants[i].getAlignment() < Alignment)
708 Constants[i].Alignment = Alignment;
712 Constants.push_back(MachineConstantPoolEntry(C, Alignment));
713 return Constants.size()-1;
716 unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V,
717 unsigned Alignment) {
718 assert(Alignment && "Alignment must be specified!");
719 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
721 // Check to see if we already have this constant.
723 // FIXME, this could be made much more efficient for large constant pools.
724 int Idx = V->getExistingMachineCPValue(this, Alignment);
726 return (unsigned)Idx;
728 Constants.push_back(MachineConstantPoolEntry(V, Alignment));
729 return Constants.size()-1;
732 void MachineConstantPool::print(raw_ostream &OS) const {
733 if (Constants.empty()) return;
735 OS << "Constant Pool:\n";
736 for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
737 OS << " cp#" << i << ": ";
738 if (Constants[i].isMachineConstantPoolEntry())
739 Constants[i].Val.MachineCPVal->print(OS);
741 OS << *(Value*)Constants[i].Val.ConstVal;
742 OS << ", align=" << Constants[i].getAlignment();
747 void MachineConstantPool::dump() const { print(dbgs()); }