[llvm-commits] [llvm] r59989 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp

Chris Lattner sabre at nondot.org
Mon Nov 24 14:40:05 PST 2008


Author: lattner
Date: Mon Nov 24 16:40:05 2008
New Revision: 59989

URL: http://llvm.org/viewvc/llvm-project?rev=59989&view=rev
Log:
minor cleanups to debug code, no functionality change.

Modified:
    llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=59989&r1=59988&r2=59989&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Nov 24 16:40:05 2008
@@ -485,40 +485,44 @@
 }
 
 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 @@
   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.





More information about the llvm-commits mailing list