[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Evan Cheng evan.cheng at apple.com
Wed Mar 7 16:59:35 PST 2007



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.226 -> 1.227
---
Log message:

Added ContainsRelocations() to check if a constant might only be resolvable at load time.

---
Diffs of the changes:  (+11 -0)

 Constants.cpp |   11 +++++++++++
 1 files changed, 11 insertions(+)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.226 llvm/lib/VMCore/Constants.cpp:1.227
--- llvm/lib/VMCore/Constants.cpp:1.226	Thu Mar  1 13:30:34 2007
+++ llvm/lib/VMCore/Constants.cpp	Wed Mar  7 18:59:12 2007
@@ -90,6 +90,17 @@
   }
 }
 
+/// ContaintsRelocations - Return true if the constant value contains
+/// relocations which cannot be resolved at compile time.
+bool Constant::ContainsRelocations() const {
+  if (isa<GlobalValue>(this))
+    return true;
+  for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+    if (getOperand(i)->ContainsRelocations())
+      return true;
+  return false;
+}
+
 // Static constructor to create a '0' constant of arbitrary type...
 Constant *Constant::getNullValue(const Type *Ty) {
   switch (Ty->getTypeID()) {






More information about the llvm-commits mailing list