[llvm-commits] [llvm] r76646 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h include/llvm/CodeGen/MachineBasicBlock.h include/llvm/CodeGen/MachineFunction.h include/llvm/Support/Dump.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineBasicBlock.cpp lib/CodeGen/MachineFunction.cpp
Chris Lattner
sabre at nondot.org
Tue Jul 21 14:12:58 PDT 2009
Author: lattner
Date: Tue Jul 21 16:12:58 2009
New Revision: 76646
URL: http://llvm.org/viewvc/llvm-project?rev=76646&view=rev
Log:
revert r76602, 76603, and r76615, pending design discussions.
Removed:
llvm/trunk/include/llvm/Support/Dump.h
Modified:
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/include/llvm/CodeGen/MachineFunction.h
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
llvm/trunk/lib/CodeGen/MachineFunction.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=76646&r1=76645&r2=76646&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Jul 21 16:12:58 2009
@@ -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 @@
/// 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 @@
}
/// 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 @@
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
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=76646&r1=76645&r2=76646&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Jul 21 16:12:58 2009
@@ -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 @@
// 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
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=76646&r1=76645&r2=76646&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Tue Jul 21 16:12:58 2009
@@ -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 @@
/// 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
Removed: llvm/trunk/include/llvm/Support/Dump.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dump.h?rev=76645&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/Dump.h (original)
+++ llvm/trunk/include/llvm/Support/Dump.h (removed)
@@ -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
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=76646&r1=76645&r2=76646&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Jul 21 16:12:58 2009
@@ -464,7 +464,7 @@
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 @@
}
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
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=76646&r1=76645&r2=76646&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Tue Jul 21 16:12:58 2009
@@ -148,8 +148,7 @@
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 @@
}
for (const_iterator I = begin(); I != end(); ++I) {
- OS << prefix(*I);
OS << "\t";
I->print(OS, &getParent()->getTarget());
}
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=76646&r1=76645&r2=76646&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Jul 21 16:12:58 2009
@@ -252,8 +252,7 @@
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 @@
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";
}
More information about the llvm-commits
mailing list