mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
Convert a few more uses of llvm/Support/Streams.h to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77033 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fef8bb24de
commit
6c1980b335
@ -20,7 +20,6 @@
|
|||||||
#define LLVM_TRANSFORMS_UTILS_ADDRMODEMATCHER_H
|
#define LLVM_TRANSFORMS_UTILS_ADDRMODEMATCHER_H
|
||||||
|
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/Support/Streams.h"
|
|
||||||
#include "llvm/Target/TargetLowering.h"
|
#include "llvm/Target/TargetLowering.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -30,18 +29,19 @@ class Instruction;
|
|||||||
class Value;
|
class Value;
|
||||||
class Type;
|
class Type;
|
||||||
class User;
|
class User;
|
||||||
|
class raw_ostream;
|
||||||
|
|
||||||
/// ExtAddrMode - This is an extended version of TargetLowering::AddrMode
|
/// ExtAddrMode - This is an extended version of TargetLowering::AddrMode
|
||||||
/// which holds actual Value*'s for register values.
|
/// which holds actual Value*'s for register values.
|
||||||
struct ExtAddrMode : public TargetLowering::AddrMode {
|
struct ExtAddrMode : public TargetLowering::AddrMode {
|
||||||
Value *BaseReg;
|
Value *BaseReg;
|
||||||
Value *ScaledReg;
|
Value *ScaledReg;
|
||||||
ExtAddrMode() : BaseReg(0), ScaledReg(0) {}
|
ExtAddrMode() : BaseReg(0), ScaledReg(0) {}
|
||||||
void print(OStream &OS) const;
|
void print(raw_ostream &OS) const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline OStream &operator<<(OStream &OS, const ExtAddrMode &AM) {
|
static inline raw_ostream &operator<<(raw_ostream &OS, const ExtAddrMode &AM) {
|
||||||
AM.print(OS);
|
AM.print(OS);
|
||||||
return OS;
|
return OS;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/Support/PatternMatch.h"
|
#include "llvm/Support/PatternMatch.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::PatternMatch;
|
using namespace llvm::PatternMatch;
|
||||||
|
|
||||||
@ -578,7 +579,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
|
|||||||
|
|
||||||
// If all the instructions matched are already in this BB, don't do anything.
|
// If all the instructions matched are already in this BB, don't do anything.
|
||||||
if (!AnyNonLocal) {
|
if (!AnyNonLocal) {
|
||||||
DEBUG(cerr << "CGP: Found local addrmode: " << AddrMode << "\n");
|
DEBUG(errs() << "CGP: Found local addrmode: " << AddrMode << "\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,13 +594,13 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
|
|||||||
// computation.
|
// computation.
|
||||||
Value *&SunkAddr = SunkAddrs[Addr];
|
Value *&SunkAddr = SunkAddrs[Addr];
|
||||||
if (SunkAddr) {
|
if (SunkAddr) {
|
||||||
DEBUG(cerr << "CGP: Reusing nonlocal addrmode: " << AddrMode << " for "
|
DEBUG(errs() << "CGP: Reusing nonlocal addrmode: " << AddrMode << " for "
|
||||||
<< *MemoryInst);
|
<< *MemoryInst);
|
||||||
if (SunkAddr->getType() != Addr->getType())
|
if (SunkAddr->getType() != Addr->getType())
|
||||||
SunkAddr = new BitCastInst(SunkAddr, Addr->getType(), "tmp", InsertPt);
|
SunkAddr = new BitCastInst(SunkAddr, Addr->getType(), "tmp", InsertPt);
|
||||||
} else {
|
} else {
|
||||||
DEBUG(cerr << "CGP: SINKING nonlocal addrmode: " << AddrMode << " for "
|
DEBUG(errs() << "CGP: SINKING nonlocal addrmode: " << AddrMode << " for "
|
||||||
<< *MemoryInst);
|
<< *MemoryInst);
|
||||||
const Type *IntPtrTy = TLI->getTargetData()->getIntPtrType();
|
const Type *IntPtrTy = TLI->getTargetData()->getIntPtrType();
|
||||||
|
|
||||||
Value *Result = 0;
|
Value *Result = 0;
|
||||||
|
@ -19,17 +19,18 @@
|
|||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/Support/PatternMatch.h"
|
#include "llvm/Support/PatternMatch.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::PatternMatch;
|
using namespace llvm::PatternMatch;
|
||||||
|
|
||||||
void ExtAddrMode::print(OStream &OS) const {
|
void ExtAddrMode::print(raw_ostream &OS) const {
|
||||||
bool NeedPlus = false;
|
bool NeedPlus = false;
|
||||||
OS << "[";
|
OS << "[";
|
||||||
if (BaseGV) {
|
if (BaseGV) {
|
||||||
OS << (NeedPlus ? " + " : "")
|
OS << (NeedPlus ? " + " : "")
|
||||||
<< "GV:";
|
<< "GV:";
|
||||||
WriteAsOperand(*OS.stream(), BaseGV, /*PrintType=*/false);
|
WriteAsOperand(OS, BaseGV, /*PrintType=*/false);
|
||||||
NeedPlus = true;
|
NeedPlus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,13 +40,13 @@ void ExtAddrMode::print(OStream &OS) const {
|
|||||||
if (BaseReg) {
|
if (BaseReg) {
|
||||||
OS << (NeedPlus ? " + " : "")
|
OS << (NeedPlus ? " + " : "")
|
||||||
<< "Base:";
|
<< "Base:";
|
||||||
WriteAsOperand(*OS.stream(), BaseReg, /*PrintType=*/false);
|
WriteAsOperand(OS, BaseReg, /*PrintType=*/false);
|
||||||
NeedPlus = true;
|
NeedPlus = true;
|
||||||
}
|
}
|
||||||
if (Scale) {
|
if (Scale) {
|
||||||
OS << (NeedPlus ? " + " : "")
|
OS << (NeedPlus ? " + " : "")
|
||||||
<< Scale << "*";
|
<< Scale << "*";
|
||||||
WriteAsOperand(*OS.stream(), ScaledReg, /*PrintType=*/false);
|
WriteAsOperand(OS, ScaledReg, /*PrintType=*/false);
|
||||||
NeedPlus = true;
|
NeedPlus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ void ExtAddrMode::print(OStream &OS) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExtAddrMode::dump() const {
|
void ExtAddrMode::dump() const {
|
||||||
print(cerr);
|
print(errs());
|
||||||
cerr << '\n';
|
cerr << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,14 +122,6 @@ static raw_ostream& operator<<(raw_ostream &O,
|
|||||||
return O << "]";
|
return O << "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
static OStream& operator<<(OStream &O, const LowerSwitch::CaseVector &C) {
|
|
||||||
if (O.stream()) {
|
|
||||||
raw_os_ostream OS(*O.stream());
|
|
||||||
OS << C;
|
|
||||||
}
|
|
||||||
return O;
|
|
||||||
}
|
|
||||||
|
|
||||||
// switchConvert - Convert the switch statement into a binary lookup of
|
// switchConvert - Convert the switch statement into a binary lookup of
|
||||||
// the case values. The function recursively builds this tree.
|
// the case values. The function recursively builds this tree.
|
||||||
//
|
//
|
||||||
@ -144,9 +136,9 @@ BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End,
|
|||||||
|
|
||||||
unsigned Mid = Size / 2;
|
unsigned Mid = Size / 2;
|
||||||
std::vector<CaseRange> LHS(Begin, Begin + Mid);
|
std::vector<CaseRange> LHS(Begin, Begin + Mid);
|
||||||
DOUT << "LHS: " << LHS << "\n";
|
DEBUG(errs() << "LHS: " << LHS << "\n");
|
||||||
std::vector<CaseRange> RHS(Begin + Mid, End);
|
std::vector<CaseRange> RHS(Begin + Mid, End);
|
||||||
DOUT << "RHS: " << RHS << "\n";
|
DEBUG(errs() << "RHS: " << RHS << "\n");
|
||||||
|
|
||||||
CaseRange& Pivot = *(Begin + Mid);
|
CaseRange& Pivot = *(Begin + Mid);
|
||||||
DEBUG(errs() << "Pivot ==> "
|
DEBUG(errs() << "Pivot ==> "
|
||||||
@ -314,9 +306,9 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
|
|||||||
CaseVector Cases;
|
CaseVector Cases;
|
||||||
unsigned numCmps = Clusterify(Cases, SI);
|
unsigned numCmps = Clusterify(Cases, SI);
|
||||||
|
|
||||||
DOUT << "Clusterify finished. Total clusters: " << Cases.size()
|
DEBUG(errs() << "Clusterify finished. Total clusters: " << Cases.size()
|
||||||
<< ". Total compares: " << numCmps << "\n";
|
<< ". Total compares: " << numCmps << "\n");
|
||||||
DOUT << "Cases: " << Cases << "\n";
|
DEBUG(errs() << "Cases: " << Cases << "\n");
|
||||||
|
|
||||||
BasicBlock* SwitchBlock = switchConvert(Cases.begin(), Cases.end(), Val,
|
BasicBlock* SwitchBlock = switchConvert(Cases.begin(), Cases.end(), Val,
|
||||||
OrigBlock, NewDefault);
|
OrigBlock, NewDefault);
|
||||||
|
Loading…
Reference in New Issue
Block a user