summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-04 09:19:43 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-04 09:19:43 +0000
commit387e059c047d65c57ae574328bdbd27a2b2cad31 (patch)
treefbde5643ba25498bec723c3c4a52d1a7b25e51c7 /llvm/lib
parent230f29f91028f81eeb0e152ab9be5b20c7770537 (diff)
downloadbcm5719-llvm-387e059c047d65c57ae574328bdbd27a2b2cad31.tar.gz
bcm5719-llvm-387e059c047d65c57ae574328bdbd27a2b2cad31.zip
[cleanup] Add a getOperandNo method to the Use class and implement it
out-of-line so that it can refer to the methods on User. As a consequence, this removes the need to define one template method if value_use_iterator in the extremely strange User.h header (!!!). This makse Use.h slightly less peculiar. The only remaining real peculiarity is the definition of Use::set in Value.h llvm-svn: 202805
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Use.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/Use.cpp b/llvm/lib/IR/Use.cpp
index 5f01e238e04..60a0c566889 100644
--- a/llvm/lib/IR/Use.cpp
+++ b/llvm/lib/IR/Use.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/IR/Use.h"
+#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include <new>
@@ -44,6 +45,10 @@ User *Use::getUser() const {
: reinterpret_cast<User *>(const_cast<Use *>(End));
}
+unsigned Use::getOperandNo() const {
+ return this - getUser()->op_begin();
+}
+
// Sets up the waymarking algoritm's tags for a series of Uses. See the
// algorithm details here:
//
OpenPOWER on IntegriCloud