llvm.org GIT mirror llvm / e4b461c
Reformat linebreaks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244430 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 4 years ago
24 changed file(s) with 43 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
2020
2121 class APSInt : public APInt {
2222 bool IsUnsigned;
23
2324 public:
2425 /// Default constructor that creates an uninitialized APInt.
2526 explicit APSInt() : IsUnsigned(false) {}
244245 APSInt LLVM_ATTRIBUTE_UNUSED_RESULT Or(const APSInt& RHS) const {
245246 return this->operator|(RHS);
246247 }
247
248248
249249 APSInt operator^(const APSInt& RHS) const {
250250 assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
4141 static_assert(sizeof(typename MapTy::value_type) == sizeof(ValueT),
4242 "DenseMap buckets unexpectedly large!");
4343 MapTy TheMap;
44
4445 public:
4546 typedef ValueT key_type;
4647 typedef ValueT value_type;
7879 class Iterator {
7980 typename MapTy::iterator I;
8081 friend class DenseSet;
82
8183 public:
8284 typedef typename MapTy::iterator::difference_type difference_type;
8385 typedef ValueT value_type;
98100 class ConstIterator {
99101 typename MapTy::const_iterator I;
100102 friend class DenseSet;
103
101104 public:
102105 typedef typename MapTy::const_iterator::difference_type difference_type;
103106 typedef ValueT value_type;
5656 df_iterator_storage(const df_iterator_storage &S) : Visited(S.Visited) {}
5757 SetType &Visited;
5858 };
59
6059
6160 // Generic Depth First Iterator
6261 template
7675 // First element is node pointer, second is the 'next child' to visit
7776 // if the int in PointerIntTy is 0, the 'next child' to visit is invalid
7877 std::vector > VisitStack;
78
7979 private:
8080 inline df_iterator(NodeType *Node) {
8181 this->Visited.insert(Node);
194194 }
195195 };
196196
197
198197 // Provide global constructors that automatically figure out correct types...
199198 //
200199 template
235234 SetTy &S) {
236235 return make_range(df_ext_begin(G, S), df_ext_end(G, S));
237236 }
238
239237
240238 // Provide global definitions of inverse depth first iterators...
241239 template
136136 void *NextInFoldingSetBucket;
137137
138138 public:
139
140139 Node() : NextInFoldingSetBucket(nullptr) {}
141140
142141 // Accessors
181180 bool empty() const { return NumNodes == 0; }
182181
183182 private:
184
185183 /// GrowHashTable - Double the size of the hash table and rehash everything.
186184 ///
187185 void GrowHashTable();
188186
189187 protected:
190
191188 /// GetNodeProfile - Instantiations of the FoldingSet template implement
192189 /// this function to gather data bits for the given node.
193190 virtual void GetNodeProfile(Node *N, FoldingSetNodeID &ID) const = 0;
268265 class FoldingSetNodeIDRef {
269266 const unsigned *Data;
270267 size_t Size;
268
271269 public:
272270 FoldingSetNodeIDRef() : Data(nullptr), Size(0) {}
273271 FoldingSetNodeIDRef(const unsigned *D, size_t S) : Data(D), Size(S) {}
497495
498496 Ctx getContext() const { return Context; }
499497
500
501498 typedef FoldingSetIterator iterator;
502499 iterator begin() { return iterator(Buckets); }
503500 iterator end() { return iterator(Buckets+NumBuckets); }
613610 }
614611 };
615612
616
617613 template
618614 class FoldingSetIterator : public FoldingSetIteratorImpl {
619615 public:
664660 return Ptr != RHS.Ptr;
665661 }
666662 };
667
668663
669664 template
670665 class FoldingSetBucketIterator : public FoldingSetBucketIteratorImpl {
693688 template
694689 class FoldingSetNodeWrapper : public FoldingSetNode {
695690 T data;
691
696692 public:
697693 template
698694 explicit FoldingSetNodeWrapper(Ts &&... Args)
715711 /// information that would otherwise only be required for recomputing an ID.
716712 class FastFoldingSetNode : public FoldingSetNode {
717713 FoldingSetNodeID FastID;
714
718715 protected:
719716 explicit FastFoldingSetNode(const FoldingSetNodeID &ID) : FastID(ID) {}
717
720718 public:
721719 void Profile(FoldingSetNodeID &ID) const {
722720 ID.AddNodeID(FastID);
5353 ImutContainerInfo::Profile(ID, V.second);
5454 }
5555 };
56
5756
5857 template
5958 typename ValInfo = ImutKeyValueInfo >
6161 // ShiftedIntMask - This is the bits for the integer shifted in place.
6262 ShiftedIntMask = (uintptr_t)(IntMask << IntShift)
6363 };
64
6465 public:
6566 PointerIntPair() : Value(0) {}
6667 PointerIntPair(PointerTy PtrVal, IntType IntVal) {
4646 K Key;
4747 V Val;
4848 ScopedHashTableVal(const K &key, const V &val) : Key(key), Val(val) {}
49 public:
50
49
50 public:
5151 const K &getKey() const { return Key; }
5252 const V &getValue() const { return Val; }
5353 V &getValue() { return Val; }
9191 ScopedHashTableVal *LastValInScope;
9292 void operator=(ScopedHashTableScope&) = delete;
9393 ScopedHashTableScope(ScopedHashTableScope&) = delete;
94
9495 public:
9596 ScopedHashTableScope(ScopedHashTable &HT);
9697 ~ScopedHashTableScope();
108109 }
109110 };
110111
111
112112 template >
113113 class ScopedHashTableIterator {
114114 ScopedHashTableVal *Node;
115
115116 public:
116117 ScopedHashTableIterator(ScopedHashTableVal *node) : Node(node) {}
117118
140141 }
141142 };
142143
143
144144 template
145145 class ScopedHashTable {
146146 public:
148148 /// to the name of the scope for this hash table.
149149 typedef ScopedHashTableScope ScopeTy;
150150 typedef unsigned size_type;
151
151152 private:
152153 typedef ScopedHashTableVal ValTy;
153154 DenseMap TopLevelMap;
158159 ScopedHashTable(const ScopedHashTable&); // NOT YET IMPLEMENTED
159160 void operator=(const ScopedHashTable&); // NOT YET IMPLEMENTED
160161 friend class ScopedHashTableScope;
162
161163 public:
162164 ScopedHashTable() : CurScope(nullptr) {}
163165 ScopedHashTable(AllocatorTy A) : CurScope(0), Allocator(A) {}
164166 ~ScopedHashTable() {
165167 assert(!CurScope && TopLevelMap.empty() && "Scope imbalance!");
166168 }
167
168169
169170 /// Access to the allocator.
170171 AllocatorTy &getAllocator() { return Allocator; }
171171 return true;
172172 }
173173
174
175174 /// \brief Count the number of elements of a given key in the SetVector.
176175 /// \returns 0 if the element is not in the SetVector, 1 if it is.
177176 size_type count(const key_type &key) const {
4747 ///
4848 class SmallPtrSetImplBase {
4949 friend class SmallPtrSetIteratorImpl;
50
5051 protected:
5152 /// SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
5253 const void **SmallArray;
132133 void Grow(unsigned NewSize);
133134
134135 void operator=(const SmallPtrSetImplBase &RHS) = delete;
136
135137 protected:
136138 /// swap - Swaps the elements of two sets.
137139 /// Note: This method assumes that both sets have the same small size.
147149 protected:
148150 const void *const *Bucket;
149151 const void *const *End;
152
150153 public:
151154 explicit SmallPtrSetIteratorImpl(const void *const *BP, const void*const *E)
152155 : Bucket(BP), End(E) {
230233 struct RoundUpToPowerOfTwo {
231234 enum { Val = RoundUpToPowerOfTwoH::Val };
232235 };
233
234236
235237 /// \brief A templated base class for \c SmallPtrSet which provides the
236238 /// typesafe interface that is common across all small sizes.
242244 typedef PointerLikeTypeTraits PtrTraits;
243245
244246 SmallPtrSetImpl(const SmallPtrSetImpl&) = delete;
247
245248 protected:
246249 // Constructors that forward to the base.
247250 SmallPtrSetImpl(const void **SmallStorage, const SmallPtrSetImpl &that)
302305 enum { SmallSizePowTwo = RoundUpToPowerOfTwo::Val };
303306 /// SmallStorage - Fixed size storage used in 'small mode'.
304307 const void *SmallStorage[SmallSizePowTwo];
308
305309 public:
306310 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
307311 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
332336 SmallPtrSetImplBase::swap(RHS);
333337 }
334338 };
335
336339 }
337340
338341 namespace std {
3636 std::set Set;
3737 typedef typename SmallVector::const_iterator VIterator;
3838 typedef typename SmallVector::iterator mutable_iterator;
39
3940 public:
4041 typedef size_t size_type;
4142 SmallSet() {}
107108 Vector.clear();
108109 Set.clear();
109110 }
111
110112 private:
111113 bool isSmall() const { return Set.empty(); }
112114
2929 /// StringMapEntryBase - Shared base class of StringMapEntry instances.
3030 class StringMapEntryBase {
3131 unsigned StrLen;
32
3233 public:
3334 explicit StringMapEntryBase(unsigned Len) : StrLen(Len) {}
3435
4748 unsigned NumItems;
4849 unsigned NumTombstones;
4950 unsigned ItemSize;
51
5052 protected:
5153 explicit StringMapImpl(unsigned itemSize)
5254 : TheTable(nullptr),
8486 /// RemoveKey - Remove the StringMapEntry for the specified key from the
8587 /// table, returning it. If the key is not in the table, this returns null.
8688 StringMapEntryBase *RemoveKey(StringRef Key);
89
8790 private:
8891 void init(unsigned Size);
92
8993 public:
9094 static StringMapEntryBase *getTombstoneVal() {
9195 return (StringMapEntryBase*)-1;
111115 template
112116 class StringMapEntry : public StringMapEntryBase {
113117 StringMapEntry(StringMapEntry &E) = delete;
118
114119 public:
115120 ValueTy second;
116121
204209 }
205210 };
206211
207
208212 /// StringMap - This is an unconventional map that is specialized for handling
209213 /// keys that are "strings", which are basically ranges of bytes. This does some
210214 /// funky memory allocation and hashing things to make it extremely efficient,
212216 template
213217 class StringMap : public StringMapImpl {
214218 AllocatorTy Allocator;
219
215220 public:
216221 typedef StringMapEntry MapEntryTy;
217222
385390 }
386391 };
387392
388
389393 template
390394 class StringMapConstIterator {
391395 protected:
392396 StringMapEntryBase **Ptr;
397
393398 public:
394399 typedef StringMapEntry value_type;
395400
446451 return static_cast*>(*this->Ptr);
447452 }
448453 };
449
450454 }
451455
452456 #endif
149149 return Val.getAddrOfPtr1();
150150
151151 return Val.template get()->begin();
152
153152 }
154153 iterator end() {
155154 if (Val.template is())
107107 CrashRecoveryContext *context;
108108 CrashRecoveryContextCleanup(CrashRecoveryContext *context)
109109 : context(context), cleanupFired(false) {}
110
110111 public:
111112 bool cleanupFired;
112113
128129 T *resource;
129130 CrashRecoveryContextCleanupBase(CrashRecoveryContext *context, T* resource)
130131 : CrashRecoveryContextCleanup(context), resource(resource) {}
132
131133 public:
132134 static DERIVED *create(T *x) {
133135 if (x) {
179181 template >
180182 class CrashRecoveryContextCleanupRegistrar {
181183 CrashRecoveryContextCleanup *cleanup;
184
182185 public:
183186 CrashRecoveryContextCleanupRegistrar(T *x)
184187 : cleanup(Cleanup::create(x)) {
641641 };
642642 };
643643
644
645644 } // End of namespace dwarf
646645
647646 } // End of namespace llvm
155155 friend bool equivalent(file_status A, file_status B);
156156 file_type Type;
157157 perms Perms;
158
158159 public:
159160 #if defined(LLVM_ON_UNIX)
160161 file_status() : fs_st_dev(0), fs_st_ino(0), fs_st_mtime(0),
117117 unsigned Width;
118118 bool RightJustify;
119119 friend class raw_ostream;
120
120121 public:
121122 FormattedString(StringRef S, unsigned W, bool R)
122123 : Str(S), Width(W), RightJustify(R) { }
145146 bool Upper;
146147 bool HexPrefix;
147148 friend class raw_ostream;
149
148150 public:
149151 FormattedNumber(uint64_t HV, int64_t DV, unsigned W, bool H, bool U,
150152 bool Prefix)
187189 return FormattedNumber(0, N, Width, false, false, false);
188190 }
189191
190
191192 } // end namespace llvm
192193
193194 #endif
1919 /// faster than the almost-linear O(n*alpha(n)) version, even for large CFGs.
2020 ///
2121 //===----------------------------------------------------------------------===//
22
2322
2423 #ifndef LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H
2524 #define LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H
286285
287286 DT.updateDFSNumbers();
288287 }
289
290288 }
291289
292290 #endif
140140 SG_FVMLIB = 0x2u,
141141 SG_NORELOC = 0x4u,
142142 SG_PROTECTED_VERSION_1 = 0x8u,
143
144143
145144 // Constant masks for the "flags" field in llvm::MachO::section and
146145 // llvm::MachO::section_64
333332 EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE = 0x02u
334333 };
335334
336
337335 enum {
338336 // Constant masks for the "n_type" field in llvm::MachO::nlist and
339337 // llvm::MachO::nlist_64
505503 // Must be followed by ARM64_RELOC_PAGE21 or ARM64_RELOC_PAGEOFF12.
506504 ARM64_RELOC_ADDEND = 10,
507505
508
509506 // Constant values for the r_type field in an x86_64 architecture
510507 // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
511508 // structure
528525 VM_PROT_WRITE = 0x2,
529526 VM_PROT_EXECUTE = 0x4
530527 };
531
532528
533529 // Structs from
534530
783779 flags:8;
784780 };
785781
786
787782 struct twolevel_hints_command {
788783 uint32_t cmd;
789784 uint32_t cmdsize;
922917 uint64_t entryoff;
923918 uint64_t stacksize;
924919 };
925
926920
927921 // Structs from
928922 struct fat_header {
993987 uint16_t n_desc;
994988 uint64_t n_value;
995989 };
996
997990
998991 // Byte order swapping functions for MachO structs
999992
3131 MemoryBlock(void *addr, size_t size) : Address(addr), Size(size) { }
3232 void *base() const { return Address; }
3333 size_t size() const { return Size; }
34
3435 private:
3536 void *Address; ///< Address of first byte of memory area
3637 size_t Size; ///< Size, in bytes of the memory area
130131 /// @brief Release Read/Write/Execute memory.
131132 static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = nullptr);
132133
133
134134 /// InvalidateInstructionCache - Before the JIT can run a block of code
135135 /// that has been emitted it must invalidate the instruction cache on some
136136 /// platforms.
2121 /// Represents a location in source code.
2222 class SMLoc {
2323 const char *Ptr;
24
2425 public:
2526 SMLoc() : Ptr(nullptr) {}
2627
5960 } // end namespace llvm
6061
6162 #endif
62
158158 #else
159159 return true;
160160 #endif
161 }
162
161 }
163162 }
164163
165164 #endif
4141 double getSystemTime() const { return SystemTime; }
4242 double getWallTime() const { return WallTime; }
4343 ssize_t getMemUsed() const { return MemUsed; }
44
45
44
4645 // operator< - Allow sorting.
4746 bool operator<(const TimeRecord &T) const {
4847 // Sort by Wall Time elapsed, as it is the only thing really accurate
116115 friend class TimerGroup;
117116 };
118117
119
120118 /// The TimeRegion class is used as a helper class to call the startTimer() and
121119 /// stopTimer() methods of the Timer class. When the object is constructed, it
122120 /// starts the timer specified as its argument. When it is destroyed, it stops
125123 class TimeRegion {
126124 Timer *T;
127125 TimeRegion(const TimeRegion &) = delete;
126
128127 public:
129128 explicit TimeRegion(Timer &t) : T(&t) {
130129 T->startTimer();
137136 }
138137 };
139138
140
141139 /// NamedRegionTimer - This class is basically a combination of TimeRegion and
142140 /// Timer. It allows you to declare a new timer, AND specify the region to
143141 /// time, all in one statement. All timers with the same name are merged. This
149147 explicit NamedRegionTimer(StringRef Name, StringRef GroupName,
150148 bool Enabled = true);
151149 };
152
153150
154151 /// The TimerGroup class is used to group together related timers into a single
155152 /// report that is printed when the TimerGroup is destroyed. It is illegal to
164161 TimerGroup **Prev, *Next; // Doubly linked list of TimerGroup's.
165162 TimerGroup(const TimerGroup &TG) = delete;
166163 void operator=(const TimerGroup &TG) = delete;
164
167165 public:
168166 explicit TimerGroup(StringRef name);
169167 ~TimerGroup();
223223
224224 /// indent - Insert 'NumSpaces' spaces.
225225 raw_ostream &indent(unsigned NumSpaces);
226
227226
228227 /// Changes the foreground color of text that will be output from this point
229228 /// forward.
470469 /// Return the current position within the stream, not counting the bytes
471470 /// currently in the buffer.
472471 uint64_t current_pos() const override { return OS.size(); }
472
473473 public:
474474 explicit raw_string_ostream(std::string &O) : OS(O) {}
475475 ~raw_string_ostream() override;
509509 explicit raw_svector_ostream(SmallVectorImpl &O);
510510 ~raw_svector_ostream() override;
511511
512
513512 /// This is called when the SmallVector we're appending to is changed outside
514513 /// of the raw_svector_ostream's control. It is only safe to do this if the
515514 /// raw_svector_ostream has previously been flushed.