mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Put the functionality for printing a value to a raw_ostream as an
operand into the Value interface just like the core print method is. That gives a more conistent organization to the IR printing interfaces -- they are all attached to the IR objects themselves. Also, update all the users. This removes the 'Writer.h' header which contained only a single function declaration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/GraphWriter.h"
|
||||
|
||||
@@ -40,7 +39,7 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
|
||||
std::string Str;
|
||||
raw_string_ostream OS(Str);
|
||||
|
||||
WriteAsOperand(OS, Node, false);
|
||||
Node->printAsOperand(OS, false);
|
||||
return OS.str();
|
||||
}
|
||||
|
||||
@@ -51,7 +50,7 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
|
||||
raw_string_ostream OS(Str);
|
||||
|
||||
if (Node->getName().empty()) {
|
||||
WriteAsOperand(OS, Node, false);
|
||||
Node->printAsOperand(OS, false);
|
||||
OS << ":";
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ template<class NodeT>
|
||||
inline raw_ostream &operator<<(raw_ostream &o,
|
||||
const DomTreeNodeBase<NodeT> *Node) {
|
||||
if (Node->getBlock())
|
||||
WriteAsOperand(o, Node->getBlock(), false);
|
||||
Node->getBlock()->printAsOperand(o, false);
|
||||
else
|
||||
o << " <<exit node>>";
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ void LoopBase<BlockT, LoopT>::print(raw_ostream &OS, unsigned Depth) const {
|
||||
for (unsigned i = 0; i < getBlocks().size(); ++i) {
|
||||
if (i) OS << ",";
|
||||
BlockT *BB = getBlocks()[i];
|
||||
WriteAsOperand(OS, BB, false);
|
||||
BB->printAsOperand(OS, false);
|
||||
if (BB == getHeader()) OS << "<header>";
|
||||
if (BB == getLoopLatch()) OS << "<latch>";
|
||||
if (isLoopExiting(BB)) OS << "<exiting>";
|
||||
|
||||
@@ -608,6 +608,9 @@ public:
|
||||
void dump() const;
|
||||
void print(raw_ostream &OS, SlotIndexes* = 0) const;
|
||||
|
||||
// Printing method used by LoopInfo.
|
||||
void printAsOperand(raw_ostream &OS, bool PrintType = true);
|
||||
|
||||
/// getNumber - MachineBasicBlocks are uniquely numbered at the function
|
||||
/// level, unless they're not in a MachineFunction yet, in which case this
|
||||
/// will return -1.
|
||||
@@ -655,8 +658,6 @@ private:
|
||||
|
||||
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
|
||||
|
||||
void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t);
|
||||
|
||||
// This is useful when building IndexedMaps keyed on basic block pointers.
|
||||
struct MBB2NumberFunctor :
|
||||
public std::unary_function<const MachineBasicBlock*, unsigned> {
|
||||
|
||||
@@ -36,6 +36,7 @@ class InlineAsm;
|
||||
class Instruction;
|
||||
class LLVMContext;
|
||||
class MDNode;
|
||||
class Module;
|
||||
class StringRef;
|
||||
class Twine;
|
||||
class Type;
|
||||
@@ -106,6 +107,13 @@ public:
|
||||
///
|
||||
void print(raw_ostream &O, AssemblyAnnotationWriter *AAW = 0) const;
|
||||
|
||||
/// \brief Print the name of this Value out to the specified raw_ostream.
|
||||
/// This is useful when you just want to print 'int %reg126', not the
|
||||
/// instruction that generated it. If you specify a Module for context, then
|
||||
/// even constanst get pretty-printed; for example, the type of a null
|
||||
/// pointer is printed symbolically.
|
||||
void printAsOperand(raw_ostream &O, bool PrintType = true, const Module *M = 0) const;
|
||||
|
||||
/// All values are typed, get the type of this value.
|
||||
///
|
||||
Type *getType() const { return VTy; }
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
//===-- Writer.h - Printer for LLVM IR assembly files -------------*- C++ -*-=//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This functionality is implemented by lib/IR/AsmWriter.cpp.
|
||||
// This library is used to print LLVM assembly language files to an iostream. It
|
||||
// can print LLVM code at a variety of granularities, including Modules,
|
||||
// BasicBlocks, and Instructions. This makes it useful for debugging.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_IR_WRITER_H
|
||||
#define LLVM_IR_WRITER_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
class Value;
|
||||
class raw_ostream;
|
||||
|
||||
// WriteAsOperand - Write the name of the specified value out to the specified
|
||||
// ostream. This can be useful when you just want to print int %reg126, not the
|
||||
// whole instruction that generated it. If you specify a Module for context,
|
||||
// then even constants get pretty-printed; for example, the type of a null
|
||||
// pointer is printed symbolically.
|
||||
//
|
||||
void WriteAsOperand(raw_ostream &, const Value *, bool PrintTy = true,
|
||||
const Module *Context = 0);
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -138,10 +137,10 @@ AliasAnalysisCounter::alias(const Location &LocA, const Location &LocB) {
|
||||
if (PrintAll || (PrintAllFailures && R == MayAlias)) {
|
||||
errs() << AliasString << ":\t";
|
||||
errs() << "[" << LocA.Size << "B] ";
|
||||
WriteAsOperand(errs(), LocA.Ptr, true, M);
|
||||
LocA.Ptr->printAsOperand(errs(), true, M);
|
||||
errs() << ", ";
|
||||
errs() << "[" << LocB.Size << "B] ";
|
||||
WriteAsOperand(errs(), LocB.Ptr, true, M);
|
||||
LocB.Ptr->printAsOperand(errs(), true, M);
|
||||
errs() << "\n";
|
||||
}
|
||||
|
||||
@@ -164,7 +163,7 @@ AliasAnalysisCounter::getModRefInfo(ImmutableCallSite CS,
|
||||
if (PrintAll || (PrintAllFailures && R == ModRef)) {
|
||||
errs() << MRString << ": Ptr: ";
|
||||
errs() << "[" << Loc.Size << "B] ";
|
||||
WriteAsOperand(errs(), Loc.Ptr, true, M);
|
||||
Loc.Ptr->printAsOperand(errs(), true, M);
|
||||
errs() << "\t<->" << *CS.getInstruction() << '\n';
|
||||
}
|
||||
return R;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -94,8 +93,8 @@ static void PrintResults(const char *Msg, bool P, const Value *V1,
|
||||
std::string o1, o2;
|
||||
{
|
||||
raw_string_ostream os1(o1), os2(o2);
|
||||
WriteAsOperand(os1, V1, true, M);
|
||||
WriteAsOperand(os2, V2, true, M);
|
||||
V1->printAsOperand(os1, true, M);
|
||||
V2->printAsOperand(os2, true, M);
|
||||
}
|
||||
|
||||
if (o2 < o1)
|
||||
@@ -111,7 +110,7 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr,
|
||||
Module *M) {
|
||||
if (P) {
|
||||
errs() << " " << Msg << ": Ptr: ";
|
||||
WriteAsOperand(errs(), Ptr, true, M);
|
||||
Ptr->printAsOperand(errs(), true, M);
|
||||
errs() << "\t<->" << *I << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
@@ -566,7 +565,7 @@ void AliasSet::print(raw_ostream &OS) const {
|
||||
OS << "Pointers: ";
|
||||
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||
if (I != begin()) OS << ", ";
|
||||
WriteAsOperand(OS << "(", I.getPointer());
|
||||
I.getPointer()->printAsOperand(OS << "(");
|
||||
OS << ", " << I.getSize() << ")";
|
||||
}
|
||||
}
|
||||
@@ -574,7 +573,7 @@ void AliasSet::print(raw_ostream &OS) const {
|
||||
OS << "\n " << UnknownInsts.size() << " Unknown instructions: ";
|
||||
for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) {
|
||||
if (i) OS << ", ";
|
||||
WriteAsOperand(OS, UnknownInsts[i]);
|
||||
UnknownInsts[i]->printAsOperand(OS);
|
||||
}
|
||||
}
|
||||
OS << "\n";
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "llvm/Analysis/DominanceFrontier.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
@@ -114,7 +113,7 @@ void DominanceFrontierBase::print(raw_ostream &OS, const Module* ) const {
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I) {
|
||||
OS << " DomFrontier for BB ";
|
||||
if (I->first)
|
||||
WriteAsOperand(OS, I->first, false);
|
||||
I->first->printAsOperand(OS, false);
|
||||
else
|
||||
OS << " <<exit node>>";
|
||||
OS << " is:\t";
|
||||
@@ -125,7 +124,7 @@ void DominanceFrontierBase::print(raw_ostream &OS, const Module* ) const {
|
||||
I != E; ++I) {
|
||||
OS << ' ';
|
||||
if (*I)
|
||||
WriteAsOperand(OS, *I, false);
|
||||
(*I)->printAsOperand(OS, false);
|
||||
else
|
||||
OS << "<<exit node>>";
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/InstIterator.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
@@ -248,7 +247,7 @@ bool IVUsers::runOnLoop(Loop *l, LPPassManager &LPM) {
|
||||
|
||||
void IVUsers::print(raw_ostream &OS, const Module *M) const {
|
||||
OS << "IV Users for loop ";
|
||||
WriteAsOperand(OS, L->getHeader(), false);
|
||||
L->getHeader()->printAsOperand(OS, false);
|
||||
if (SE->hasLoopInvariantBackedgeTakenCount(L)) {
|
||||
OS << " with backedge-taken count "
|
||||
<< *SE->getBackedgeTakenCount(L);
|
||||
@@ -258,13 +257,13 @@ void IVUsers::print(raw_ostream &OS, const Module *M) const {
|
||||
for (ilist<IVStrideUse>::const_iterator UI = IVUses.begin(),
|
||||
E = IVUses.end(); UI != E; ++UI) {
|
||||
OS << " ";
|
||||
WriteAsOperand(OS, UI->getOperandValToReplace(), false);
|
||||
UI->getOperandValToReplace()->printAsOperand(OS, false);
|
||||
OS << " = " << *getReplacementExpr(*UI);
|
||||
for (PostIncLoopSet::const_iterator
|
||||
I = UI->PostIncLoops.begin(),
|
||||
E = UI->PostIncLoops.end(); I != E; ++I) {
|
||||
OS << " (post-inc with loop ";
|
||||
WriteAsOperand(OS, (*I)->getHeader(), false);
|
||||
(*I)->getHeader()->printAsOperand(OS, false);
|
||||
OS << ")";
|
||||
}
|
||||
OS << " in ";
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/InstVisitor.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/PassManager.h"
|
||||
@@ -129,7 +128,7 @@ namespace {
|
||||
if (isa<Instruction>(V)) {
|
||||
MessagesStr << *V << '\n';
|
||||
} else {
|
||||
WriteAsOperand(MessagesStr, V, true, Mod);
|
||||
V->printAsOperand(MessagesStr, true, Mod);
|
||||
MessagesStr << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/Analysis/MemoryDependenceAnalysis.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/InstIterator.h"
|
||||
@@ -177,7 +176,7 @@ void MemDepPrinter::print(raw_ostream &OS, const Module *M) const {
|
||||
OS << DepTypeStr[type];
|
||||
if (DepBB) {
|
||||
OS << " in block ";
|
||||
WriteAsOperand(OS, DepBB, /*PrintType=*/false, M);
|
||||
DepBB->printAsOperand(OS, /*PrintType=*/false, M);
|
||||
}
|
||||
if (DepInst) {
|
||||
OS << " from: ";
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/DebugInfo.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "llvm/ADT/SetOperations.h"
|
||||
#include "llvm/Analysis/DominatorInternals.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
using namespace llvm;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Analysis/RegionIterator.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
@@ -215,7 +214,7 @@ std::string Region::getNameStr() const {
|
||||
if (getEntry()->getName().empty()) {
|
||||
raw_string_ostream OS(entryName);
|
||||
|
||||
WriteAsOperand(OS, getEntry(), false);
|
||||
getEntry()->printAsOperand(OS, false);
|
||||
} else
|
||||
entryName = getEntry()->getName();
|
||||
|
||||
@@ -223,7 +222,7 @@ std::string Region::getNameStr() const {
|
||||
if (getExit()->getName().empty()) {
|
||||
raw_string_ostream OS(exitName);
|
||||
|
||||
WriteAsOperand(OS, getExit(), false);
|
||||
getExit()->printAsOperand(OS, false);
|
||||
} else
|
||||
exitName = getExit()->getName();
|
||||
} else
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/ConstantRange.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -138,7 +137,7 @@ void SCEV::dump() const {
|
||||
void SCEV::print(raw_ostream &OS) const {
|
||||
switch (getSCEVType()) {
|
||||
case scConstant:
|
||||
WriteAsOperand(OS, cast<SCEVConstant>(this)->getValue(), false);
|
||||
cast<SCEVConstant>(this)->getValue()->printAsOperand(OS, false);
|
||||
return;
|
||||
case scTruncate: {
|
||||
const SCEVTruncateExpr *Trunc = cast<SCEVTruncateExpr>(this);
|
||||
@@ -174,7 +173,7 @@ void SCEV::print(raw_ostream &OS) const {
|
||||
if (AR->getNoWrapFlags(FlagNW) &&
|
||||
!AR->getNoWrapFlags((NoWrapFlags)(FlagNUW | FlagNSW)))
|
||||
OS << "nw><";
|
||||
WriteAsOperand(OS, AR->getLoop()->getHeader(), /*PrintType=*/false);
|
||||
AR->getLoop()->getHeader()->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << ">";
|
||||
return;
|
||||
}
|
||||
@@ -229,13 +228,13 @@ void SCEV::print(raw_ostream &OS) const {
|
||||
Constant *FieldNo;
|
||||
if (U->isOffsetOf(CTy, FieldNo)) {
|
||||
OS << "offsetof(" << *CTy << ", ";
|
||||
WriteAsOperand(OS, FieldNo, false);
|
||||
FieldNo->printAsOperand(OS, false);
|
||||
OS << ")";
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise just print it normally.
|
||||
WriteAsOperand(OS, U->getValue(), false);
|
||||
U->getValue()->printAsOperand(OS, false);
|
||||
return;
|
||||
}
|
||||
case scCouldNotCompute:
|
||||
@@ -7321,7 +7320,7 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
|
||||
PrintLoopInfo(OS, SE, *I);
|
||||
|
||||
OS << "Loop ";
|
||||
WriteAsOperand(OS, L->getHeader(), /*PrintType=*/false);
|
||||
L->getHeader()->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << ": ";
|
||||
|
||||
SmallVector<BasicBlock *, 8> ExitBlocks;
|
||||
@@ -7337,7 +7336,7 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
|
||||
|
||||
OS << "\n"
|
||||
"Loop ";
|
||||
WriteAsOperand(OS, L->getHeader(), /*PrintType=*/false);
|
||||
L->getHeader()->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << ": ";
|
||||
|
||||
if (!isa<SCEVCouldNotCompute>(SE->getMaxBackedgeTakenCount(L))) {
|
||||
@@ -7359,7 +7358,7 @@ void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
|
||||
ScalarEvolution &SE = *const_cast<ScalarEvolution *>(this);
|
||||
|
||||
OS << "Classifying expressions for: ";
|
||||
WriteAsOperand(OS, F, /*PrintType=*/false);
|
||||
F->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << "\n";
|
||||
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
|
||||
if (isSCEVable(I->getType()) && !isa<CmpInst>(*I)) {
|
||||
@@ -7390,7 +7389,7 @@ void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
|
||||
}
|
||||
|
||||
OS << "Determining loop execution counts for: ";
|
||||
WriteAsOperand(OS, F, /*PrintType=*/false);
|
||||
F->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << "\n";
|
||||
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
|
||||
PrintLoopInfo(OS, &SE, *I);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "llvm/Analysis/Trace.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
@@ -37,7 +36,7 @@ void Trace::print(raw_ostream &O) const {
|
||||
O << "; Trace from function " << F->getName() << ", blocks:\n";
|
||||
for (const_iterator i = begin(), e = end(); i != e; ++i) {
|
||||
O << "; ";
|
||||
WriteAsOperand(O, *i, true, getModule());
|
||||
(*i)->printAsOperand(O, true, getModule());
|
||||
O << "\n";
|
||||
}
|
||||
O << "; Trace parent function: \n" << *F;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
@@ -291,7 +290,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||
return;
|
||||
|
||||
if (isVerbose()) {
|
||||
WriteAsOperand(OutStreamer.GetCommentOS(), GV,
|
||||
GV->printAsOperand(OutStreamer.GetCommentOS(),
|
||||
/*PrintType=*/false, GV->getParent());
|
||||
OutStreamer.GetCommentOS() << '\n';
|
||||
}
|
||||
@@ -470,7 +469,7 @@ void AsmPrinter::EmitFunctionHeader() {
|
||||
OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
|
||||
|
||||
if (isVerbose()) {
|
||||
WriteAsOperand(OutStreamer.GetCommentOS(), F,
|
||||
F->printAsOperand(OutStreamer.GetCommentOS(),
|
||||
/*PrintType=*/false, F->getParent());
|
||||
OutStreamer.GetCommentOS() << '\n';
|
||||
}
|
||||
@@ -1529,7 +1528,7 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
std::string S;
|
||||
raw_string_ostream OS(S);
|
||||
OS << "Unsupported expression in static initializer: ";
|
||||
WriteAsOperand(OS, CE, /*PrintType=*/false,
|
||||
CE->printAsOperand(OS, /*PrintType=*/false,
|
||||
!AP.MF ? 0 : AP.MF->getFunction()->getParent());
|
||||
report_fatal_error(OS.str());
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "llvm/CodeGen/SlotIndexes.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -278,7 +277,7 @@ void MachineBasicBlock::print(raw_ostream &OS, SlotIndexes *Indexes) const {
|
||||
const char *Comma = "";
|
||||
if (const BasicBlock *LBB = getBasicBlock()) {
|
||||
OS << Comma << "derived from LLVM BB ";
|
||||
WriteAsOperand(OS, LBB, /*PrintType=*/false);
|
||||
LBB->printAsOperand(OS, /*PrintType=*/false);
|
||||
Comma = ", ";
|
||||
}
|
||||
if (isLandingPad()) { OS << Comma << "EH LANDING PAD"; Comma = ", "; }
|
||||
@@ -331,6 +330,10 @@ void MachineBasicBlock::print(raw_ostream &OS, SlotIndexes *Indexes) const {
|
||||
}
|
||||
}
|
||||
|
||||
void MachineBasicBlock::printAsOperand(raw_ostream &OS, bool /*PrintType*/) {
|
||||
OS << "BB#" << getNumber();
|
||||
}
|
||||
|
||||
void MachineBasicBlock::removeLiveIn(unsigned Reg) {
|
||||
std::vector<unsigned>::iterator I =
|
||||
std::find(LiveIns.begin(), LiveIns.end(), Reg);
|
||||
@@ -1216,9 +1219,3 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
|
||||
// At this point we have no idea of the liveness of the register.
|
||||
return LQR_Unknown;
|
||||
}
|
||||
|
||||
void llvm::WriteAsOperand(raw_ostream &OS, const MachineBasicBlock *MBB,
|
||||
bool t) {
|
||||
OS << "BB#" << MBB->getNumber();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "llvm/DebugInfo.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -918,7 +917,7 @@ void MachineConstantPool::print(raw_ostream &OS) const {
|
||||
if (Constants[i].isMachineConstantPoolEntry())
|
||||
Constants[i].Val.MachineCPVal->print(OS);
|
||||
else
|
||||
WriteAsOperand(OS, Constants[i].Val.ConstVal, /*PrintType=*/false);
|
||||
Constants[i].Val.ConstVal->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << ", align=" << Constants[i].getAlignment();
|
||||
OS << "\n";
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCInstrDesc.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -352,7 +351,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
OS << "<ga:";
|
||||
WriteAsOperand(OS, getGlobal(), /*PrintType=*/false);
|
||||
getGlobal()->printAsOperand(OS, /*PrintType=*/false);
|
||||
if (getOffset()) OS << "+" << getOffset();
|
||||
OS << '>';
|
||||
break;
|
||||
@@ -363,7 +362,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
|
||||
break;
|
||||
case MachineOperand::MO_BlockAddress:
|
||||
OS << '<';
|
||||
WriteAsOperand(OS, getBlockAddress(), /*PrintType=*/false);
|
||||
getBlockAddress()->printAsOperand(OS, /*PrintType=*/false);
|
||||
if (getOffset()) OS << "+" << getOffset();
|
||||
OS << '>';
|
||||
break;
|
||||
@@ -375,7 +374,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
|
||||
break;
|
||||
case MachineOperand::MO_Metadata:
|
||||
OS << '<';
|
||||
WriteAsOperand(OS, getMetadata(), /*PrintType=*/false);
|
||||
getMetadata()->printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << '>';
|
||||
break;
|
||||
case MachineOperand::MO_MCSymbol:
|
||||
@@ -484,7 +483,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MMO) {
|
||||
if (!MMO.getValue())
|
||||
OS << "<unknown>";
|
||||
else
|
||||
WriteAsOperand(OS, MMO.getValue(), /*PrintType=*/false);
|
||||
MMO.getValue()->printAsOperand(OS, /*PrintType=*/false);
|
||||
|
||||
unsigned AS = MMO.getAddrSpace();
|
||||
if (AS != 0)
|
||||
@@ -509,7 +508,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MMO) {
|
||||
if (const MDNode *TBAAInfo = MMO.getTBAAInfo()) {
|
||||
OS << "(tbaa=";
|
||||
if (TBAAInfo->getNumOperands() > 0)
|
||||
WriteAsOperand(OS, TBAAInfo->getOperand(0), /*PrintType=*/false);
|
||||
TBAAInfo->getOperand(0)->printAsOperand(OS, /*PrintType=*/false);
|
||||
else
|
||||
OS << "<unknown>";
|
||||
OS << ")";
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/GraphWriter.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "llvm/IR/GlobalAlias.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "llvm/DebugInfo.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/GraphWriter.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@@ -385,7 +384,7 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
|
||||
dyn_cast<GlobalAddressSDNode>(this)) {
|
||||
int64_t offset = GADN->getOffset();
|
||||
OS << '<';
|
||||
WriteAsOperand(OS, GADN->getGlobal());
|
||||
GADN->getGlobal()->printAsOperand(OS);
|
||||
OS << '>';
|
||||
if (offset > 0)
|
||||
OS << " + " << offset;
|
||||
@@ -476,9 +475,9 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
|
||||
dyn_cast<BlockAddressSDNode>(this)) {
|
||||
int64_t offset = BA->getOffset();
|
||||
OS << "<";
|
||||
WriteAsOperand(OS, BA->getBlockAddress()->getFunction(), false);
|
||||
BA->getBlockAddress()->getFunction()->printAsOperand(OS, false);
|
||||
OS << ", ";
|
||||
WriteAsOperand(OS, BA->getBlockAddress()->getBasicBlock(), false);
|
||||
BA->getBlockAddress()->getBasicBlock()->printAsOperand(OS, false);
|
||||
OS << ">";
|
||||
if (offset > 0)
|
||||
OS << " + " << offset;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/DebugInfo.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/GraphWriter.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
+27
-34
@@ -32,7 +32,6 @@
|
||||
#include "llvm/IR/PrintModulePass.h"
|
||||
#include "llvm/IR/TypeFinder.h"
|
||||
#include "llvm/IR/ValueSymbolTable.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
@@ -675,8 +674,6 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
|
||||
SlotTracker *Machine,
|
||||
const Module *Context);
|
||||
|
||||
|
||||
|
||||
static const char *getPredicateText(unsigned predicate) {
|
||||
const char * pred = "unknown";
|
||||
switch (predicate) {
|
||||
@@ -1063,11 +1060,8 @@ static void WriteMDNodeBodyInternal(raw_ostream &Out, const MDNode *Node,
|
||||
Out << "}";
|
||||
}
|
||||
|
||||
|
||||
/// WriteAsOperand - Write the name of the specified value out to the specified
|
||||
/// ostream. This can be useful when you just want to print int %reg126, not
|
||||
/// the whole instruction that generated it.
|
||||
///
|
||||
// Full implementation of printing a Value as an operand with support for
|
||||
// TypePrinting, etc.
|
||||
static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine,
|
||||
@@ -1174,31 +1168,6 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
|
||||
Out << "<badref>";
|
||||
}
|
||||
|
||||
void WriteAsOperand(raw_ostream &Out, const Value *V,
|
||||
bool PrintType, const Module *Context) {
|
||||
|
||||
// Fast path: Don't construct and populate a TypePrinting object if we
|
||||
// won't be needing any types printed.
|
||||
if (!PrintType &&
|
||||
((!isa<Constant>(V) && !isa<MDNode>(V)) ||
|
||||
V->hasName() || isa<GlobalValue>(V))) {
|
||||
WriteAsOperandInternal(Out, V, 0, 0, Context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Context == 0) Context = getModuleFromVal(V);
|
||||
|
||||
TypePrinting TypePrinter;
|
||||
if (Context)
|
||||
TypePrinter.incorporateTypes(*Context);
|
||||
if (PrintType) {
|
||||
TypePrinter.print(V->getType(), Out);
|
||||
Out << ' ';
|
||||
}
|
||||
|
||||
WriteAsOperandInternal(Out, V, &TypePrinter, 0, Context);
|
||||
}
|
||||
|
||||
void AssemblyWriter::init() {
|
||||
if (TheModule)
|
||||
TypePrinter.incorporateTypes(*TheModule);
|
||||
@@ -2193,7 +2162,7 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
|
||||
WriteConstantInternal(OS, C, TypePrinter, 0, 0);
|
||||
} else if (isa<InlineAsm>(this) || isa<MDString>(this) ||
|
||||
isa<Argument>(this)) {
|
||||
WriteAsOperand(OS, this, true, 0);
|
||||
this->printAsOperand(OS);
|
||||
} else {
|
||||
// Otherwise we don't know what it is. Call the virtual function to
|
||||
// allow a subclass to print itself.
|
||||
@@ -2201,6 +2170,30 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Value::printAsOperand(raw_ostream &O, bool PrintType, const Module *M) const {
|
||||
// Fast path: Don't construct and populate a TypePrinting object if we
|
||||
// won't be needing any types printed.
|
||||
if (!PrintType &&
|
||||
((!isa<Constant>(this) && !isa<MDNode>(this)) ||
|
||||
hasName() || isa<GlobalValue>(this))) {
|
||||
WriteAsOperandInternal(O, this, 0, 0, M);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!M)
|
||||
M = getModuleFromVal(this);
|
||||
|
||||
TypePrinting TypePrinter;
|
||||
if (M)
|
||||
TypePrinter.incorporateTypes(*M);
|
||||
if (PrintType) {
|
||||
TypePrinter.print(getType(), O);
|
||||
O << ' ';
|
||||
}
|
||||
|
||||
WriteAsOperandInternal(O, this, &TypePrinter, 0, M);
|
||||
}
|
||||
|
||||
// Value::printCustom - subclasses should override this to implement printing.
|
||||
void Value::printCustom(raw_ostream &OS) const {
|
||||
llvm_unreachable("Unknown value to print out!");
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Analysis/DominatorInternals.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/LegacyPassManagers.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
@@ -144,7 +143,7 @@ void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
|
||||
OS << "value";
|
||||
|
||||
OS << " '";
|
||||
WriteAsOperand(OS, V, /*PrintTy=*/false, M);
|
||||
V->printAsOperand(OS, /*PrintTy=*/false, M);
|
||||
OS << "'\n";
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -62,7 +62,6 @@
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/InstVisitor.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/PassManager.h"
|
||||
@@ -101,7 +100,7 @@ namespace { // Anonymous namespace for class
|
||||
if (I->empty() || !I->back().isTerminator()) {
|
||||
dbgs() << "Basic Block in function '" << F.getName()
|
||||
<< "' does not have terminator!\n";
|
||||
WriteAsOperand(dbgs(), I, true);
|
||||
I->printAsOperand(dbgs(), true);
|
||||
dbgs() << "\n";
|
||||
Broken = true;
|
||||
}
|
||||
@@ -348,7 +347,7 @@ namespace {
|
||||
if (isa<Instruction>(V)) {
|
||||
MessagesStr << *V << '\n';
|
||||
} else {
|
||||
WriteAsOperand(MessagesStr, V, true, Mod);
|
||||
V->printAsOperand(MessagesStr, true, Mod);
|
||||
MessagesStr << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@@ -149,7 +148,7 @@ const MCExpr *nvptx::LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||
std::string S;
|
||||
raw_string_ostream OS(S);
|
||||
OS << "Unsupported expression in static initializer: ";
|
||||
WriteAsOperand(OS, CE, /*PrintType=*/ false,
|
||||
CE->printAsOperand(OS, /*PrintType=*/ false,
|
||||
!AP.MF ? 0 : AP.MF->getFunction()->getParent());
|
||||
report_fatal_error(OS.str());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "llvm/IR/Mangler.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@@ -845,7 +844,7 @@ void ExtAddrMode::print(raw_ostream &OS) const {
|
||||
if (BaseGV) {
|
||||
OS << (NeedPlus ? " + " : "")
|
||||
<< "GV:";
|
||||
WriteAsOperand(OS, BaseGV, /*PrintType=*/false);
|
||||
BaseGV->printAsOperand(OS, /*PrintType=*/false);
|
||||
NeedPlus = true;
|
||||
}
|
||||
|
||||
@@ -855,13 +854,13 @@ void ExtAddrMode::print(raw_ostream &OS) const {
|
||||
if (BaseReg) {
|
||||
OS << (NeedPlus ? " + " : "")
|
||||
<< "Base:";
|
||||
WriteAsOperand(OS, BaseReg, /*PrintType=*/false);
|
||||
BaseReg->printAsOperand(OS, /*PrintType=*/false);
|
||||
NeedPlus = true;
|
||||
}
|
||||
if (Scale) {
|
||||
OS << (NeedPlus ? " + " : "")
|
||||
<< Scale << "*";
|
||||
WriteAsOperand(OS, ScaledReg, /*PrintType=*/false);
|
||||
ScaledReg->printAsOperand(OS, /*PrintType=*/false);
|
||||
}
|
||||
|
||||
OS << ']';
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -1712,7 +1711,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
|
||||
!Deps[0].getResult().isDef() && !Deps[0].getResult().isClobber()) {
|
||||
DEBUG(
|
||||
dbgs() << "GVN: non-local load ";
|
||||
WriteAsOperand(dbgs(), LI);
|
||||
LI->printAsOperand(dbgs());
|
||||
dbgs() << " has unknown dependencies\n";
|
||||
);
|
||||
return false;
|
||||
@@ -1890,7 +1889,7 @@ bool GVN::processLoad(LoadInst *L) {
|
||||
DEBUG(
|
||||
// fast print dep, using operator<< on instruction is too slow.
|
||||
dbgs() << "GVN: load ";
|
||||
WriteAsOperand(dbgs(), L);
|
||||
L->printAsOperand(dbgs());
|
||||
Instruction *I = Dep.getInst();
|
||||
dbgs() << " is clobbered by " << *I << '\n';
|
||||
);
|
||||
@@ -1905,7 +1904,7 @@ bool GVN::processLoad(LoadInst *L) {
|
||||
DEBUG(
|
||||
// fast print dep, using operator<< on instruction is too slow.
|
||||
dbgs() << "GVN: load ";
|
||||
WriteAsOperand(dbgs(), L);
|
||||
L->printAsOperand(dbgs());
|
||||
dbgs() << " has unknown dependence\n";
|
||||
);
|
||||
return false;
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ValueHandle.h"
|
||||
@@ -394,7 +393,7 @@ void Formula::print(raw_ostream &OS) const {
|
||||
bool First = true;
|
||||
if (BaseGV) {
|
||||
if (!First) OS << " + "; else First = false;
|
||||
WriteAsOperand(OS, BaseGV, /*PrintType=*/false);
|
||||
BaseGV->printAsOperand(OS, /*PrintType=*/false);
|
||||
}
|
||||
if (BaseOffset != 0) {
|
||||
if (!First) OS << " + "; else First = false;
|
||||
@@ -1080,19 +1079,19 @@ void LSRFixup::print(raw_ostream &OS) const {
|
||||
// Store is common and interesting enough to be worth special-casing.
|
||||
if (StoreInst *Store = dyn_cast<StoreInst>(UserInst)) {
|
||||
OS << "store ";
|
||||
WriteAsOperand(OS, Store->getOperand(0), /*PrintType=*/false);
|
||||
Store->getOperand(0)->printAsOperand(OS, /*PrintType=*/false);
|
||||
} else if (UserInst->getType()->isVoidTy())
|
||||
OS << UserInst->getOpcodeName();
|
||||
else
|
||||
WriteAsOperand(OS, UserInst, /*PrintType=*/false);
|
||||
UserInst->printAsOperand(OS, /*PrintType=*/false);
|
||||
|
||||
OS << ", OperandValToReplace=";
|
||||
WriteAsOperand(OS, OperandValToReplace, /*PrintType=*/false);
|
||||
OperandValToReplace->printAsOperand(OS, /*PrintType=*/false);
|
||||
|
||||
for (PostIncLoopSet::const_iterator I = PostIncLoops.begin(),
|
||||
E = PostIncLoops.end(); I != E; ++I) {
|
||||
OS << ", PostIncLoop=";
|
||||
WriteAsOperand(OS, (*I)->getHeader(), /*PrintType=*/false);
|
||||
(*I)->getHeader()->printAsOperand(OS, /*PrintType=*/false);
|
||||
}
|
||||
|
||||
if (LUIdx != ~size_t(0))
|
||||
@@ -4734,7 +4733,7 @@ LSRInstance::LSRInstance(Loop *L, Pass *P)
|
||||
#endif // DEBUG
|
||||
|
||||
DEBUG(dbgs() << "\nLSR on loop ";
|
||||
WriteAsOperand(dbgs(), L->getHeader(), /*PrintType=*/false);
|
||||
L->getHeader()->printAsOperand(dbgs(), /*PrintType=*/false);
|
||||
dbgs() << ":\n");
|
||||
|
||||
// First, perform some low-level loop optimizations.
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
@@ -67,7 +66,7 @@ static void PrintOps(Instruction *I, const SmallVectorImpl<ValueEntry> &Ops) {
|
||||
<< *Ops[0].Op->getType() << '\t';
|
||||
for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
|
||||
dbgs() << "[ ";
|
||||
WriteAsOperand(dbgs(), Ops[i].Op, false, M);
|
||||
Ops[i].Op->printAsOperand(dbgs(), false, M);
|
||||
dbgs() << ", #" << Ops[i].Rank << "] ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@@ -259,9 +258,9 @@ bool Sinking::SinkInstruction(Instruction *Inst,
|
||||
return false;
|
||||
|
||||
DEBUG(dbgs() << "Sink" << *Inst << " (";
|
||||
WriteAsOperand(dbgs(), Inst->getParent(), false);
|
||||
Inst->getParent()->printAsOperand(dbgs(), false);
|
||||
dbgs() << " -> ";
|
||||
WriteAsOperand(dbgs(), SuccToSinkTo, false);
|
||||
SuccToSinkTo->printAsOperand(dbgs(), false);
|
||||
dbgs() << ")\n");
|
||||
|
||||
// Move the instruction.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Writer.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@@ -309,7 +308,7 @@ llvm::SplitFunctionsOutOfModule(Module *M,
|
||||
for (unsigned i = 0, e = F.size(); i != e; ++i) {
|
||||
Function *TNOF = cast<Function>(VMap[F[i]]);
|
||||
DEBUG(errs() << "Removing function ");
|
||||
DEBUG(WriteAsOperand(errs(), TNOF, false));
|
||||
DEBUG(TNOF->printAsOperand(errs(), false));
|
||||
DEBUG(errs() << "\n");
|
||||
TestFunctions.insert(cast<Function>(NewVMap[TNOF]));
|
||||
DeleteFunctionBody(TNOF); // Function is now external in this module!
|
||||
@@ -330,7 +329,7 @@ llvm::SplitFunctionsOutOfModule(Module *M,
|
||||
if (Function *SafeFn = globalInitUsesExternalBA(GV)) {
|
||||
errs() << "*** Error: when reducing functions, encountered "
|
||||
"the global '";
|
||||
WriteAsOperand(errs(), GV, false);
|
||||
GV->printAsOperand(errs(), false);
|
||||
errs() << "' with an initializer that references blockaddresses "
|
||||
"from safe function '" << SafeFn->getName()
|
||||
<< "' and from test function '" << TestFn->getName() << "'.\n";
|
||||
|
||||
Reference in New Issue
Block a user