aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Use.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-04 08:53:41 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-04 08:53:41 +0000
commit618bd1b75b2f2a0857232bea55c7441dd7b24619 (patch)
treee721b0ca81751c868e909939acfcbb45d8544ff1 /llvm/lib/IR/Use.cpp
parent06d49183ecf59bb2a8fa45032e39b7afbbe43429 (diff)
downloadllvm-618bd1b75b2f2a0857232bea55c7441dd7b24619.zip
llvm-618bd1b75b2f2a0857232bea55c7441dd7b24619.tar.gz
llvm-618bd1b75b2f2a0857232bea55c7441dd7b24619.tar.bz2
[cleanup] Run clang-format over the Use code. It was *really*
inconsistent both with itself and with LLVM at large with formatting. The *s were on the wrong side, the indent was off, etc etc. This is much cleaner. Also, go clang-format laying out the array of tags in nice columns. llvm-svn: 202799
Diffstat (limited to 'llvm/lib/IR/Use.cpp')
-rw-r--r--llvm/lib/IR/Use.cpp66
1 files changed, 31 insertions, 35 deletions
diff --git a/llvm/lib/IR/Use.cpp b/llvm/lib/IR/Use.cpp
index 20c47a5..b6720e5 100644
--- a/llvm/lib/IR/Use.cpp
+++ b/llvm/lib/IR/Use.cpp
@@ -40,10 +40,9 @@ void Use::swap(Use &RHS) {
User *Use::getUser() const {
const Use *End = getImpliedUser();
- const UserRef *ref = reinterpret_cast<const UserRef*>(End);
- return ref->getInt()
- ? ref->getPointer()
- : reinterpret_cast<User*>(const_cast<Use*>(End));
+ const UserRef *ref = reinterpret_cast<const UserRef *>(End);
+ return ref->getInt() ? ref->getPointer()
+ : reinterpret_cast<User *>(const_cast<Use *>(End));
}
// Sets up the waymarking algoritm's tags for a series of Uses. See the
@@ -51,31 +50,28 @@ User *Use::getUser() const {
//
// http://www.llvm.org/docs/ProgrammersManual.html#UserLayout
//
-Use *Use::initTags(Use * const Start, Use *Stop) {
+Use *Use::initTags(Use *const Start, Use *Stop) {
ptrdiff_t Done = 0;
while (Done < 20) {
if (Start == Stop--)
return Start;
- static const PrevPtrTag tags[20] = { fullStopTag, oneDigitTag, stopTag,
- oneDigitTag, oneDigitTag, stopTag,
- zeroDigitTag, oneDigitTag, oneDigitTag,
- stopTag, zeroDigitTag, oneDigitTag,
- zeroDigitTag, oneDigitTag, stopTag,
- oneDigitTag, oneDigitTag, oneDigitTag,
- oneDigitTag, stopTag
- };
- new(Stop) Use(tags[Done++]);
+ static const PrevPtrTag tags[20] = {
+ fullStopTag, oneDigitTag, stopTag, oneDigitTag, oneDigitTag,
+ stopTag, zeroDigitTag, oneDigitTag, oneDigitTag, stopTag,
+ zeroDigitTag, oneDigitTag, zeroDigitTag, oneDigitTag, stopTag,
+ oneDigitTag, oneDigitTag, oneDigitTag, oneDigitTag, stopTag};
+ new (Stop) Use(tags[Done++]);
}
ptrdiff_t Count = Done;
while (Start != Stop) {
--Stop;
if (!Count) {
- new(Stop) Use(stopTag);
+ new (Stop) Use(stopTag);
++Done;
Count = Done;
} else {
- new(Stop) Use(PrevPtrTag(Count & 1));
+ new (Stop) Use(PrevPtrTag(Count & 1));
Count >>= 1;
++Done;
}
@@ -97,29 +93,29 @@ const Use *Use::getImpliedUser() const {
while (true) {
unsigned Tag = (Current++)->Prev.getInt();
switch (Tag) {
- case zeroDigitTag:
- case oneDigitTag:
- continue;
+ case zeroDigitTag:
+ case oneDigitTag:
+ continue;
- case stopTag: {
- ++Current;
- ptrdiff_t Offset = 1;
- while (true) {
- unsigned Tag = Current->Prev.getInt();
- switch (Tag) {
- case zeroDigitTag:
- case oneDigitTag:
- ++Current;
- Offset = (Offset << 1) + Tag;
- continue;
- default:
- return Current + Offset;
- }
+ case stopTag: {
+ ++Current;
+ ptrdiff_t Offset = 1;
+ while (true) {
+ unsigned Tag = Current->Prev.getInt();
+ switch (Tag) {
+ case zeroDigitTag:
+ case oneDigitTag:
+ ++Current;
+ Offset = (Offset << 1) + Tag;
+ continue;
+ default:
+ return Current + Offset;
}
}
+ }
- case fullStopTag:
- return Current;
+ case fullStopTag:
+ return Current;
}
}
}