aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-24 22:40:05 +0000
committerChris Lattner <sabre@nondot.org>2008-11-24 22:40:05 +0000
commit1e6f8f2cb9a1364d7c1a10cd7700399a1db644fd (patch)
treed0b535c2508f318754a30d1d61501547945069c0 /lib/Transforms/Scalar/CodeGenPrepare.cpp
parent0d9ee182b08117a39d36fb05eea1f478c16ba6dd (diff)
downloadexternal_llvm-1e6f8f2cb9a1364d7c1a10cd7700399a1db644fd.zip
external_llvm-1e6f8f2cb9a1364d7c1a10cd7700399a1db644fd.tar.gz
external_llvm-1e6f8f2cb9a1364d7c1a10cd7700399a1db644fd.tar.bz2
minor cleanups to debug code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp57
1 files changed, 33 insertions, 24 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 96c2e70..71bd402 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -485,40 +485,44 @@ static void EraseDeadInstructions(Value *V) {
}
namespace {
+ /// ExtAddrMode - This is an extended version of TargetLowering::AddrMode
+ /// which holds actual Value*'s for register values.
+ struct ExtAddrMode : public TargetLowering::AddrMode {
+ Value *BaseReg;
+ Value *ScaledReg;
+ ExtAddrMode() : BaseReg(0), ScaledReg(0) {}
+ void print(OStream &OS) const;
+ void dump() const {
+ print(cerr);
+ cerr << '\n';
+ }
+ };
+} // end anonymous namespace
+
+static OStream &operator<<(OStream &OS, const ExtAddrMode &AM) {
+ AM.print(OS);
+ return OS;
+}
-/// ExtAddrMode - This is an extended version of TargetLowering::AddrMode which
-/// holds actual Value*'s for register values.
-struct ExtAddrMode : public TargetLowering::AddrMode {
- Value *BaseReg;
- Value *ScaledReg;
- ExtAddrMode() : BaseReg(0), ScaledReg(0) {}
- void dump() const;
-};
-static std::ostream &operator<<(std::ostream &OS, const ExtAddrMode &AM) {
+void ExtAddrMode::print(OStream &OS) const {
bool NeedPlus = false;
OS << "[";
- if (AM.BaseGV)
+ if (BaseGV)
OS << (NeedPlus ? " + " : "")
- << "GV:%" << AM.BaseGV->getName(), NeedPlus = true;
+ << "GV:%" << BaseGV->getName(), NeedPlus = true;
- if (AM.BaseOffs)
- OS << (NeedPlus ? " + " : "") << AM.BaseOffs, NeedPlus = true;
+ if (BaseOffs)
+ OS << (NeedPlus ? " + " : "") << BaseOffs, NeedPlus = true;
- if (AM.BaseReg)
+ if (BaseReg)
OS << (NeedPlus ? " + " : "")
- << "Base:%" << AM.BaseReg->getName(), NeedPlus = true;
- if (AM.Scale)
+ << "Base:%" << BaseReg->getName(), NeedPlus = true;
+ if (Scale)
OS << (NeedPlus ? " + " : "")
- << AM.Scale << "*%" << AM.ScaledReg->getName(), NeedPlus = true;
-
- return OS << "]";
-}
-
-void ExtAddrMode::dump() const {
- cerr << *this << "\n";
-}
+ << Scale << "*%" << ScaledReg->getName(), NeedPlus = true;
+ OS << ']';
}
static bool TryMatchingScaledValue(Value *ScaleReg, int64_t Scale,
@@ -572,6 +576,11 @@ static bool FindMaximalLegalAddressingMode(Value *Addr, const Type *AccessTy,
if (Instruction *I = dyn_cast_or_null<Instruction>(AddrInst))
AddrModeInsts.push_back(I);
+#if 0
+ if (AddrInst && !AddrInst->hasOneUse())
+ ;
+ else
+#endif
switch (Opcode) {
case Instruction::PtrToInt:
// PtrToInt is always a noop, as we know that the int type is pointer sized.