diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 9d9cc5a2ec0..1685923e433 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -90,6 +90,17 @@ bool Constant::canTrap() const { } } +/// 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()) { |

