revert r76602, 76603, and r76615, pending design discussions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76646 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-07-21 21:12:58 +00:00
parent 7558f11849
commit 3380d5c4aa
7 changed files with 19 additions and 90 deletions

View File

@ -27,9 +27,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Dump.h"
#include <cmath>
#include <sstream>
namespace llvm {
@ -81,7 +79,7 @@ namespace llvm {
/// FunctionSize - The number of instructions present in the function
uint64_t FunctionSize;
typedef DenseMap<const MachineInstr*, unsigned> Mi2IndexMap;
typedef DenseMap<MachineInstr*, unsigned> Mi2IndexMap;
Mi2IndexMap mi2iMap_;
typedef std::vector<MachineInstr*> Index2MiMap;
@ -200,7 +198,7 @@ namespace llvm {
}
/// getInstructionIndex - returns the base index of instr
unsigned getInstructionIndex(const MachineInstr* instr) const {
unsigned getInstructionIndex(MachineInstr* instr) const {
Mi2IndexMap::const_iterator it = mi2iMap_.find(instr);
assert(it != mi2iMap_.end() && "Invalid instruction!");
return it->second;
@ -540,26 +538,6 @@ namespace llvm {
void printRegName(unsigned reg) const;
};
// IntervalPrefixPrinter - Print live interval indices before each
// instruction.
class IntervalPrefixPrinter : public PrefixPrinter {
private:
const LiveIntervals &liinfo;
public:
IntervalPrefixPrinter(const LiveIntervals &lii)
: liinfo(lii) {};
std::string operator()(const MachineBasicBlock &) const {
return("");
};
std::string operator()(const MachineInstr &instr) const {
std::stringstream out;
out << liinfo.getInstructionIndex(&instr);
return(out.str());
};
};
} // End llvm namespace
#endif

View File

@ -16,7 +16,6 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/Support/Dump.h"
namespace llvm {
@ -310,12 +309,8 @@ public:
// Debugging methods.
void dump() const;
void print(std::ostream &OS,
const PrefixPrinter &prefix = PrefixPrinter()) const;
void print(std::ostream *OS,
const PrefixPrinter &prefix = PrefixPrinter()) const {
if (OS) print(*OS, prefix);
}
void print(std::ostream &OS) const;
void print(std::ostream *OS) const { if (OS) print(*OS); }
/// getNumber - MachineBasicBlocks are uniquely numbered at the function
/// level, unless they're not in a MachineFunction yet, in which case this

View File

@ -20,7 +20,6 @@
#include "llvm/ADT/ilist.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/Dump.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/Support/Annotation.h"
#include "llvm/Support/Allocator.h"
@ -208,12 +207,8 @@ public:
/// print - Print out the MachineFunction in a format suitable for debugging
/// to the specified stream.
///
void print(std::ostream &OS,
const PrefixPrinter &prefix = PrefixPrinter()) const;
void print(std::ostream *OS,
const PrefixPrinter &prefix = PrefixPrinter()) const {
if (OS) print(*OS, prefix);
}
void print(std::ostream &OS) const;
void print(std::ostream *OS) const { if (OS) print(*OS); }
/// viewCFG - This function is meant for use from the debugger. You can just
/// say 'call F->viewCFG()' and a ghostview window should pop up from the

View File

@ -1,41 +0,0 @@
//===- llvm/Support/Dump.h - Easy way to tailor dump output -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides the PrefixPrinter interface to pass to MachineFunction
// and MachineBasicBlock print methods to output additional information before
// blocks and instructions are printed.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_DUMP_H
#define LLVM_SUPPORT_DUMP_H
namespace llvm {
class MachineBasicBlock;
class MachineInstr;
// PrefixPrinter - Print some additional information before printing
// basic blocks and instructions.
class PrefixPrinter {
public:
virtual ~PrefixPrinter() {}
virtual std::string operator()(const MachineBasicBlock &) const {
return("");
};
virtual std::string operator()(const MachineInstr &) const {
return("");
};
};
} // End llvm namespace
#endif

View File

@ -464,7 +464,7 @@ void LiveIntervals::scaleNumbering(int factor) {
i2miMap_.resize(highestSlot + 1);
for (Mi2IndexMap::iterator MI = mi2iMap_.begin(), ME = mi2iMap_.end();
MI != ME; ++MI) {
i2miMap_[MI->second] = const_cast<MachineInstr *>(MI->first);
i2miMap_[MI->second] = MI->first;
}
}
@ -501,7 +501,14 @@ void LiveIntervals::print(std::ostream &O, const Module* ) const {
}
O << "********** MACHINEINSTRS **********\n";
mf_->print(O, IntervalPrefixPrinter(*this));
for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();
mbbi != mbbe; ++mbbi) {
O << ((Value*)mbbi->getBasicBlock())->getName() << ":\n";
for (MachineBasicBlock::iterator mii = mbbi->begin(),
mie = mbbi->end(); mii != mie; ++mii) {
O << getInstructionIndex(mii) << '\t' << *mii;
}
}
}
/// conflictsWithPhysRegDef - Returns true if the specified register

View File

@ -148,8 +148,7 @@ static inline void OutputReg(std::ostream &os, unsigned RegNo,
os << " %reg" << RegNo;
}
void MachineBasicBlock::print(std::ostream &OS,
const PrefixPrinter &prefix) const {
void MachineBasicBlock::print(std::ostream &OS) const {
const MachineFunction *MF = getParent();
if(!MF) {
OS << "Can't print out MachineBasicBlock because parent MachineFunction"
@ -182,7 +181,6 @@ void MachineBasicBlock::print(std::ostream &OS,
}
for (const_iterator I = begin(); I != end(); ++I) {
OS << prefix(*I);
OS << "\t";
I->print(OS, &getParent()->getTarget());
}

View File

@ -252,8 +252,7 @@ void MachineFunction::dump() const {
print(*cerr.stream());
}
void MachineFunction::print(std::ostream &OS,
const PrefixPrinter &prefix) const {
void MachineFunction::print(std::ostream &OS) const {
OS << "# Machine code for " << Fn->getName () << "():\n";
// Print Frame Information
@ -295,10 +294,8 @@ void MachineFunction::print(std::ostream &OS,
OS << "\n";
}
for (const_iterator BB = begin(); BB != end(); ++BB) {
OS << prefix(*BB);
BB->print(OS, prefix);
}
for (const_iterator BB = begin(); BB != end(); ++BB)
BB->print(OS);
OS << "\n# End machine code for " << Fn->getName () << "().\n\n";
}