mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a6057117e
commit
2bfe24c418
@ -37,12 +37,10 @@ namespace llvm {
|
||||
class Value;
|
||||
class User;
|
||||
class Use;
|
||||
template<typename>
|
||||
struct simplify_type;
|
||||
template <typename> struct simplify_type;
|
||||
|
||||
// Use** is only 4-byte aligned.
|
||||
template<>
|
||||
class PointerLikeTypeTraits<Use**> {
|
||||
template <> class PointerLikeTypeTraits<Use **> {
|
||||
public:
|
||||
static inline void *getAsVoidPointer(Use **P) { return P; }
|
||||
static inline Use **getFromVoidPointer(void *P) {
|
||||
@ -83,18 +81,14 @@ private:
|
||||
|
||||
/// Destructor - Only for zap()
|
||||
~Use() {
|
||||
if (Val) removeFromList();
|
||||
if (Val)
|
||||
removeFromList();
|
||||
}
|
||||
|
||||
enum PrevPtrTag { zeroDigitTag
|
||||
, oneDigitTag
|
||||
, stopTag
|
||||
, fullStopTag };
|
||||
enum PrevPtrTag { zeroDigitTag, oneDigitTag, stopTag, fullStopTag };
|
||||
|
||||
/// Constructor
|
||||
Use(PrevPtrTag tag) : Val(0) {
|
||||
Prev.setInt(tag);
|
||||
}
|
||||
Use(PrevPtrTag tag) : Val(0) { Prev.setInt(tag); }
|
||||
|
||||
public:
|
||||
operator Value *() const { return Val; }
|
||||
@ -139,19 +133,19 @@ private:
|
||||
Use *Next;
|
||||
PointerIntPair<Use **, 2, PrevPtrTag> Prev;
|
||||
|
||||
void setPrev(Use **NewPrev) {
|
||||
Prev.setPointer(NewPrev);
|
||||
}
|
||||
void setPrev(Use **NewPrev) { Prev.setPointer(NewPrev); }
|
||||
void addToList(Use **List) {
|
||||
Next = *List;
|
||||
if (Next) Next->setPrev(&Next);
|
||||
if (Next)
|
||||
Next->setPrev(&Next);
|
||||
setPrev(List);
|
||||
*List = this;
|
||||
}
|
||||
void removeFromList() {
|
||||
Use **StrippedPrev = Prev.getPointer();
|
||||
*StrippedPrev = Next;
|
||||
if (Next) Next->setPrev(StrippedPrev);
|
||||
if (Next)
|
||||
Next->setPrev(StrippedPrev);
|
||||
}
|
||||
|
||||
friend class Value;
|
||||
@ -161,19 +155,13 @@ private:
|
||||
/// casting operators.
|
||||
template <> struct simplify_type<Use> {
|
||||
typedef Value *SimpleType;
|
||||
static SimpleType getSimplifiedValue(Use &Val) {
|
||||
return Val.get();
|
||||
}
|
||||
static SimpleType getSimplifiedValue(Use &Val) { return Val.get(); }
|
||||
};
|
||||
template <> struct simplify_type<const Use> {
|
||||
typedef /*const*/ Value *SimpleType;
|
||||
static SimpleType getSimplifiedValue(const Use &Val) {
|
||||
return Val.get();
|
||||
}
|
||||
static SimpleType getSimplifiedValue(const Use &Val) { return Val.get(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename UserTy> // UserTy == 'User' or 'const User'
|
||||
class value_use_iterator : public std::iterator<std::forward_iterator_tag,
|
||||
UserTy*, ptrdiff_t> {
|
||||
|
@ -41,8 +41,7 @@ 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()
|
||||
return ref->getInt() ? ref->getPointer()
|
||||
: reinterpret_cast<User *>(const_cast<Use *>(End));
|
||||
}
|
||||
|
||||
@ -56,14 +55,11 @@ Use *Use::initTags(Use * const Start, Use *Stop) {
|
||||
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
|
||||
};
|
||||
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++]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user