llvm.org GIT mirror llvm / d1769e3
Whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244431 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 5 years ago
33 changed file(s) with 121 addition(s) and 121 deletion(s). Raw diff Collapse all Expand all
15271527 /// \returns the nearest log base 2 of this APInt. Ties round up.
15281528 ///
15291529 /// NOTE: When we have a BitWidth of 1, we define:
1530 ///
1530 ///
15311531 /// log2(0) = UINT32_MAX
15321532 /// log2(1) = 0
15331533 ///
285285 }
286286
287287 /// \brief Determine if two APSInts have the same value, zero- or
288 /// sign-extending as needed.
288 /// sign-extending as needed.
289289 static bool isSameValue(const APSInt &I1, const APSInt &I2) {
290290 return !compareValues(I1, I2);
291291 }
6767 /// \return - True on success.
6868 bool Search(const changeset_ty &Changes, const changesetlist_ty &Sets,
6969 changeset_ty &Res);
70
70
7171 protected:
7272 /// UpdatedSearchState - Callback used when the search state changes.
7373 virtual void UpdatedSearchState(const changeset_ty &Changes,
5757 return LHS == RHS;
5858 }
5959 };
60
60
6161 // Provide DenseMapInfo for unsigned ints.
6262 template<> struct DenseMapInfo {
6363 static inline unsigned getEmptyKey() { return ~0U; }
150150 detail::DenseSetEmpty Empty;
151151 return TheMap.insert(std::make_pair(V, Empty));
152152 }
153
153
154154 // Range insertion of values.
155155 template
156156 void insert(InputIt I, InputIt E) {
7979 private:
8080 inline df_iterator(NodeType *Node) {
8181 this->Visited.insert(Node);
82 VisitStack.push_back(std::make_pair(PointerIntTy(Node, 0),
82 VisitStack.push_back(std::make_pair(PointerIntTy(Node, 0),
8383 GT::child_begin(Node)));
8484 }
85 inline df_iterator() {
86 // End is when stack is empty
85 inline df_iterator() {
86 // End is when stack is empty
8787 }
8888 inline df_iterator(NodeType *Node, SetType &S)
8989 : df_iterator_storage(S) {
9090 if (!S.count(Node)) {
91 VisitStack.push_back(std::make_pair(PointerIntTy(Node, 0),
91 VisitStack.push_back(std::make_pair(PointerIntTy(Node, 0),
9292 GT::child_begin(Node)));
9393 this->Visited.insert(Node);
9494 }
114114 // Has our next sibling been visited?
115115 if (Next && this->Visited.insert(Next).second) {
116116 // No, do it now.
117 VisitStack.push_back(std::make_pair(PointerIntTy(Next, 0),
117 VisitStack.push_back(std::make_pair(PointerIntTy(Next, 0),
118118 GT::child_begin(Next)));
119119 return;
120120 }
716716 explicit FastFoldingSetNode(const FoldingSetNodeID &ID) : FastID(ID) {}
717717
718718 public:
719 void Profile(FoldingSetNodeID &ID) const {
720 ID.AddNodeID(FastID);
719 void Profile(FoldingSetNodeID &ID) const {
720 ID.AddNodeID(FastID);
721721 }
722722 };
723723
9999 public:
100100 Factory(bool canonicalize = true)
101101 : Canonicalize(canonicalize) {}
102
102
103103 Factory(BumpPtrAllocator& Alloc, bool canonicalize = true)
104104 : F(Alloc), Canonicalize(canonicalize) {}
105105
144144 TreeTy *getRootWithoutRetain() const {
145145 return Root;
146146 }
147
147
148148 void manualRetain() {
149149 if (Root) Root->retain();
150150 }
151
151
152152 void manualRelease() {
153153 if (Root) Root->release();
154154 }
222222
223223 return nullptr;
224224 }
225
225
226226 /// getMaxElement - Returns the pair in the ImmutableMap for
227227 /// which key is the highest in the ordering of keys in the map. This
228228 /// method returns NULL if the map is empty.
258258 typedef typename ValInfo::data_type_ref data_type_ref;
259259 typedef ImutAVLTree TreeTy;
260260 typedef typename TreeTy::Factory FactoryTy;
261
261
262262 protected:
263263 TreeTy *Root;
264264 FactoryTy *Factory;
265
265
266266 public:
267267 /// Constructs a map from a pointer to a tree root. In general one
268268 /// should use a Factory object to create maps instead of directly
269269 /// invoking the constructor, but there are cases where make this
270270 /// constructor public is useful.
271 explicit ImmutableMapRef(const TreeTy* R, FactoryTy *F)
271 explicit ImmutableMapRef(const TreeTy* R, FactoryTy *F)
272272 : Root(const_cast(R)),
273273 Factory(F) {
274274 if (Root) { Root->retain(); }
280280 Factory(F.getTreeFactory()) {
281281 if (Root) { Root->retain(); }
282282 }
283
283
284284 ImmutableMapRef(const ImmutableMapRef &X)
285285 : Root(X.Root),
286286 Factory(X.Factory) {
291291 if (Root != X.Root) {
292292 if (X.Root)
293293 X.Root->retain();
294
294
295295 if (Root)
296296 Root->release();
297
297
298298 Root = X.Root;
299299 Factory = X.Factory;
300300 }
305305 if (Root)
306306 Root->release();
307307 }
308
308
309309 static inline ImmutableMapRef getEmptyMap(FactoryTy *F) {
310310 return ImmutableMapRef(0, F);
311311 }
327327 TreeTy *NewT = Factory->remove(Root, K);
328328 return ImmutableMapRef(NewT, Factory);
329329 }
330
330
331331 bool contains(key_type_ref K) const {
332332 return Root ? Root->contains(K) : false;
333333 }
334
334
335335 ImmutableMap asImmutableMap() const {
336336 return ImmutableMap(Factory->getCanonicalTree(Root));
337337 }
338
338
339339 bool operator==(const ImmutableMapRef &RHS) const {
340340 return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root;
341341 }
342
342
343343 bool operator!=(const ImmutableMapRef &RHS) const {
344344 return Root && RHS.Root ? Root->isNotEqual(*RHS.Root) : Root != RHS.Root;
345345 }
346
346
347347 bool isEmpty() const { return !Root; }
348
348
349349 //===--------------------------------------------------===//
350350 // For testing.
351351 //===--------------------------------------------------===//
352
352
353353 void verify() const { if (Root) Root->verify(); }
354
354
355355 //===--------------------------------------------------===//
356356 // Iterators.
357357 //===--------------------------------------------------===//
368368
369369 iterator begin() const { return iterator(Root); }
370370 iterator end() const { return iterator(); }
371
371
372372 data_type* lookup(key_type_ref K) const {
373373 if (Root) {
374374 TreeTy* T = Root->find(K);
375375 if (T) return &T->getValue().second;
376376 }
377
377
378378 return 0;
379379 }
380
380
381381 /// getMaxElement - Returns the pair in the ImmutableMap for
382382 /// which key is the highest in the ordering of keys in the map. This
383383 /// method returns NULL if the map is empty.
384384 value_type* getMaxElement() const {
385385 return Root ? &(Root->getMaxElement()->getValue()) : 0;
386386 }
387
387
388388 //===--------------------------------------------------===//
389389 // Utility methods.
390390 //===--------------------------------------------------===//
391
391
392392 unsigned getHeight() const { return Root ? Root->getHeight() : 0; }
393
393
394394 static inline void Profile(FoldingSetNodeID& ID, const ImmutableMapRef &M) {
395395 ID.AddPointer(M.Root);
396396 }
397
397
398398 inline void Profile(FoldingSetNodeID& ID) const {
399399 return Profile(ID, *this);
400400 }
401401 };
402
402
403403 } // end namespace llvm
404404
405405 #endif
8282 PackedVector &Vec;
8383 const unsigned Idx;
8484
85 reference(); // Undefined
85 reference(); // Undefined
8686 public:
87 reference(PackedVector &vec, unsigned idx) : Vec(vec), Idx(idx) { }
87 reference(PackedVector &vec, unsigned idx) : Vec(vec), Idx(idx) { }
8888
8989 reference &operator=(T val) {
9090 Vec.setValue(Vec.Bits, Idx, val);
101101 bool empty() const { return Bits.empty(); }
102102
103103 unsigned size() const { return Bits.size() >> (BitNum-1); }
104
104
105105 void clear() { Bits.clear(); }
106
106
107107 void resize(unsigned N) { Bits.resize(N << (BitNum-1)); }
108108
109109 void reserve(unsigned N) { Bits.reserve(N << (BitNum-1)); }
149149 }
150150 };
151151
152 // Leave BitNum=0 undefined.
152 // Leave BitNum=0 undefined.
153153 template
154154 class PackedVector;
155155
5454 /// IntShift - The number of low bits that we reserve for other uses, and
5555 /// keep zero.
5656 IntShift = (uintptr_t)PtrTraits::NumLowBitsAvailable-IntBits,
57
57
5858 /// IntMask - This is the unshifted mask for valid bits of the int type.
5959 IntMask = (uintptr_t)(((intptr_t)1 << IntBits)-1),
60
60
6161 // ShiftedIntMask - This is the bits for the integer shifted in place.
6262 ShiftedIntMask = (uintptr_t)(IntMask << IntShift)
6363 };
9292 void setInt(IntType IntVal) {
9393 intptr_t IntWord = static_cast(IntVal);
9494 assert((IntWord & ~IntMask) == 0 && "Integer too large for field");
95
95
9696 // Preserve all bits other than the ones we are updating.
9797 Value &= ~ShiftedIntMask; // Remove integer field.
9898 Value |= IntWord << IntShift; // Set new integer.
132132 void setFromOpaqueValue(void *Val) { Value = reinterpret_cast(Val);}
133133
134134 static PointerIntPair getFromOpaqueValue(void *V) {
135 PointerIntPair P; P.setFromOpaqueValue(V); return P;
135 PointerIntPair P; P.setFromOpaqueValue(V); return P;
136136 }
137137
138138 // Allow PointerIntPairs to be created from const void * if and only if the
155155 struct isPodLike > {
156156 static const bool value = true;
157157 };
158
158
159159 // Provide specialization of DenseMapInfo for PointerIntPair.
160160 template
161161 struct DenseMapInfo > {
5555 ScopedHashTableVal *getNextForKey() { return NextForKey; }
5656 const ScopedHashTableVal *getNextForKey() const { return NextForKey; }
5757 ScopedHashTableVal *getNextInScope() { return NextInScope; }
58
58
5959 template
6060 static ScopedHashTableVal *Create(ScopedHashTableVal *nextInScope,
6161 ScopedHashTableVal *nextForKey,
6565 // Set up the value.
6666 new (New) ScopedHashTableVal(key, val);
6767 New->NextInScope = nextInScope;
68 New->NextForKey = nextForKey;
68 New->NextForKey = nextForKey;
6969 return New;
7070 }
71
71
7272 template
7373 void Destroy(AllocatorTy &Allocator) {
7474 // Free memory referenced by the item.
9898
9999 ScopedHashTableScope *getParentScope() { return PrevScope; }
100100 const ScopedHashTableScope *getParentScope() const { return PrevScope; }
101
101
102102 private:
103103 friend class ScopedHashTable;
104104 ScopedHashTableVal *getLastValInScope() {
153153 typedef ScopedHashTableVal ValTy;
154154 DenseMap TopLevelMap;
155155 ScopeTy *CurScope;
156
156
157157 AllocatorTy Allocator;
158
158
159159 ScopedHashTable(const ScopedHashTable&); // NOT YET IMPLEMENTED
160160 void operator=(const ScopedHashTable&); // NOT YET IMPLEMENTED
161161 friend class ScopedHashTableScope;
180180 typename DenseMap::iterator I = TopLevelMap.find(Key);
181181 if (I != TopLevelMap.end())
182182 return I->second->getValue();
183
183
184184 return V();
185185 }
186186
198198 if (I == TopLevelMap.end()) return end();
199199 return iterator(I->second);
200200 }
201
201
202202 ScopeTy *getCurScope() { return CurScope; }
203203 const ScopeTy *getCurScope() const { return CurScope; }
204204
189189 set_.erase(back());
190190 vector_.pop_back();
191191 }
192
192
193193 T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() {
194194 T Ret = back();
195195 pop_back();
180180 template
181181 class SmallPtrSetIterator : public SmallPtrSetIteratorImpl {
182182 typedef PointerLikeTypeTraits PtrTraits;
183
183
184184 public:
185185 typedef PtrTy value_type;
186186 typedef PtrTy reference;
187187 typedef PtrTy pointer;
188188 typedef std::ptrdiff_t difference_type;
189189 typedef std::forward_iterator_tag iterator_category;
190
190
191191 explicit SmallPtrSetIterator(const void *const *BP, const void *const *E)
192192 : SmallPtrSetIteratorImpl(BP, E) {}
193193
9292 for (; I != E; ++I)
9393 insert(*I);
9494 }
95
95
9696 bool erase(const T &V) {
9797 if (!isSmall())
9898 return Set.erase(V);
219219
220220 public:
221221 typedef StringMapEntry MapEntryTy;
222
222
223223 StringMap() : StringMapImpl(static_cast(sizeof(MapEntryTy))) {}
224224 explicit StringMap(unsigned InitialSize)
225225 : StringMapImpl(InitialSize, static_cast(sizeof(MapEntryTy))) {}
1414 #include "llvm/ADT/SmallVector.h"
1515
1616 namespace llvm {
17
17
1818 /// TinyPtrVector - This class is specialized for cases where there are
1919 /// normally 0 or 1 element in a vector, but is general enough to go beyond that
2020 /// when required.
110110
111111 public:
112112 bool cleanupFired;
113
113
114114 virtual ~CrashRecoveryContextCleanup();
115115 virtual void recoverResources() = 0;
116116
145145 CrashRecoveryContextCleanupBase, T> {
146146 public:
147147 CrashRecoveryContextDestructorCleanup(CrashRecoveryContext *context,
148 T *resource)
148 T *resource)
149149 : CrashRecoveryContextCleanupBase<
150150 CrashRecoveryContextDestructorCleanup, T>(context, resource) {}
151151
170170 CrashRecoveryContextCleanupBase, T>
171171 {
172172 public:
173 CrashRecoveryContextReleaseRefCleanup(CrashRecoveryContext *context,
173 CrashRecoveryContextReleaseRefCleanup(CrashRecoveryContext *context,
174174 T *resource)
175175 : CrashRecoveryContextCleanupBase,
176176 T>(context, resource) {}
192192 ~CrashRecoveryContextCleanupRegistrar() {
193193 unregister();
194194 }
195
195
196196 void unregister() {
197197 if (cleanup && !cleanup->cleanupFired)
198198 cleanup->getContext()->unregisterCleanup(cleanup);
609609 const char *AttributeValueString(uint16_t Attr, unsigned Val);
610610
611611 /// \brief Decsribes an entry of the various gnu_pub* debug sections.
612 ///
612 ///
613613 /// The gnu_pub* kind looks like:
614614 ///
615615 /// 0-3 reserved
6666 ///
6767 /// If no error handler is installed the default is to print the message to
6868 /// standard error, followed by a newline.
69 /// After the error handler is called this function will call exit(1), it
69 /// After the error handler is called this function will call exit(1), it
7070 /// does not return.
7171 LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason,
7272 bool gen_crash_diag = true);
9696 // Helper functions so that you can use & and | to manipulate perms bits:
9797 inline perms operator|(perms l , perms r) {
9898 return static_cast(
99 static_cast(l) | static_cast(r));
99 static_cast(l) | static_cast(r));
100100 }
101101 inline perms operator&(perms l , perms r) {
102102 return static_cast(
103 static_cast(l) & static_cast(r));
103 static_cast(l) & static_cast(r));
104104 }
105105 inline perms &operator|=(perms &l, perms r) {
106 l = l | r;
107 return l;
106 l = l | r;
107 return l;
108108 }
109109 inline perms &operator&=(perms &l, perms r) {
110 l = l & r;
111 return l;
110 l = l & r;
111 return l;
112112 }
113113 inline perms operator~(perms x) {
114114 return static_cast(~static_cast(x));
179179 return FormattedNumber(N, 0, Width, true, Upper, false);
180180 }
181181
182 /// format_decimal - Output \p N as a right justified, fixed-width decimal. If
182 /// format_decimal - Output \p N as a right justified, fixed-width decimal. If
183183 /// number will not fit in width, full number is still printed. Examples:
184184 /// OS << format_decimal(0, 5) => " 0"
185185 /// OS << format_decimal(255, 5) => " 255"
8686
8787 // Increment the successor number for the next time we get to it.
8888 ++Worklist.back().second;
89
89
9090 // Visit the successor next, if it isn't already visited.
9191 typename GraphT::NodeType* Succ = *NextSucc;
9292
102102 }
103103
104104 template
105 typename GraphT::NodeType*
105 typename GraphT::NodeType*
106106 Eval(DominatorTreeBase& DT,
107107 typename GraphT::NodeType *VIn, unsigned LastLinked) {
108108 typename DominatorTreeBase::InfoRec &VInInfo =
115115
116116 if (VInInfo.Parent >= LastLinked)
117117 Work.push_back(VIn);
118
118
119119 while (!Work.empty()) {
120120 typename GraphT::NodeType* V = Work.back();
121121 typename DominatorTreeBase::InfoRec &VInfo =
126126 if (Visited.insert(VAncestor).second && VInfo.Parent >= LastLinked) {
127127 Work.push_back(VAncestor);
128128 continue;
129 }
130 Work.pop_back();
129 }
130 Work.pop_back();
131131
132132 // Update VInfo based on Ancestor info
133133 if (VInfo.Parent < LastLinked)
167167 i != e; ++i)
168168 N = DFSPass(DT, DT.Roots[i], N);
169169
170 // it might be that some blocks did not get a DFS number (e.g., blocks of
170 // it might be that some blocks did not get a DFS number (e.g., blocks of
171171 // infinite loops). In these cases an artificial exit node is required.
172172 MultipleRoots |= (DT.isPostDominator() && N != GraphTraits::size(&F));
173173
382382 SELF_LIBRARY_ORDINAL = 0x0,
383383 MAX_LIBRARY_ORDINAL = 0xfd,
384384 DYNAMIC_LOOKUP_ORDINAL = 0xfe,
385 EXECUTABLE_ORDINAL = 0xff
385 EXECUTABLE_ORDINAL = 0xff
386386 };
387387
388388 enum StabType {
551551 inline uint64_t MinAlign(uint64_t A, uint64_t B) {
552552 // The largest power of 2 that divides both A and B.
553553 //
554 // Replace "-Value" by "1+~Value" in the following commented code to avoid
554 // Replace "-Value" by "1+~Value" in the following commented code to avoid
555555 // MSVC warning C4146
556556 // return (A | B) & -(A | B);
557557 return (A | B) & (1 + ~(A | B));
7070 /// If the address following \p NearBlock is not so aligned, it will be
7171 /// rounded up to the next allocation granularity boundary.
7272 ///
73 /// \r a non-null MemoryBlock if the function was successful,
73 /// \r a non-null MemoryBlock if the function was successful,
7474 /// otherwise a null MemoryBlock is with \p EC describing the error.
7575 ///
7676 /// @brief Allocate mapped memory.
8686 ///
8787 /// \r error_success if the function was successful, or an error_code
8888 /// describing the failure if an error occurred.
89 ///
89 ///
9090 /// @brief Release mapped memory.
9191 static std::error_code releaseMappedMemory(MemoryBlock &Block);
9292
215215 /// @result The root directory of \a path if it has one, otherwise
216216 /// "".
217217 StringRef root_directory(StringRef path);
218
218
219219 /// @brief Get root path.
220220 ///
221221 /// Equivalent to root_name + root_directory.
307307 /// @result StringRef of the preferred separator, null-terminated.
308308 StringRef get_separator();
309309
310 /// @brief Get the typical temporary directory for the system, e.g.,
310 /// @brief Get the typical temporary directory for the system, e.g.,
311311 /// "/var/tmp" or "C:/TEMP"
312312 ///
313313 /// @param erasedOnReboot Whether to favor a path that is erased on reboot
1717 #include "llvm/Support/DataTypes.h"
1818
1919 namespace llvm {
20
20
2121 /// PointerLikeTypeTraits - This is a traits object that is used to handle
2222 /// pointer types and things that are just wrappers for pointers as a uniform
2323 /// entity.
3636 static inline T *getFromVoidPointer(void *P) {
3737 return static_cast(P);
3838 }
39
39
4040 /// Note, we assume here that malloc returns objects at least 4-byte aligned.
4141 /// However, this may be wrong, or pointers may be from something other than
4242 /// malloc. In this case, you should specialize this template to reduce this.
4545 /// this is actually true.
4646 enum { NumLowBitsAvailable = 2 };
4747 };
48
48
4949 // Provide PointerLikeTypeTraits for const pointers.
5050 template
5151 class PointerLikeTypeTraits {
7474 // No bits are available!
7575 enum { NumLowBitsAvailable = 0 };
7676 };
77
77
7878 } // end namespace llvm
7979
8080 #endif
5353 assert(Start.isValid() == End.isValid() &&
5454 "Start and end should either both be valid or both be invalid!");
5555 }
56
56
5757 bool isValid() const { return Start.isValid(); }
5858 };
59
59
6060 } // end namespace llvm
6161
6262 #endif
2424
2525 #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target();
2626 #include "llvm/Config/Targets.def"
27
27
2828 // Declare all of the target-MC-initialization functions that are available.
2929 #define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##TargetMC();
3030 #include "llvm/Config/Targets.def"
31
31
3232 // Declare all of the available assembly printer initialization functions.
3333 #define LLVM_ASM_PRINTER(TargetName) void LLVMInitialize##TargetName##AsmPrinter();
3434 #include "llvm/Config/AsmPrinters.def"
5353 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
5454 #include "llvm/Config/Targets.def"
5555 }
56
56
5757 /// InitializeAllTargets - The main program should call this function if it
5858 /// wants access to all available target machines that LLVM is configured to
5959 /// support, to make them available via the TargetRegistry.
6666 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
6767 #include "llvm/Config/Targets.def"
6868 }
69
69
7070 /// InitializeAllTargetMCs - The main program should call this function if it
7171 /// wants access to all available target MC that LLVM is configured to
7272 /// support, to make them available via the TargetRegistry.
7676 #define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC();
7777 #include "llvm/Config/Targets.def"
7878 }
79
79
8080 /// InitializeAllAsmPrinters - The main program should call this function if
8181 /// it wants all asm printers that LLVM is configured to support, to make them
8282 /// available via the TargetRegistry.
8686 #define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
8787 #include "llvm/Config/AsmPrinters.def"
8888 }
89
89
9090 /// InitializeAllAsmParsers - The main program should call this function if it
9191 /// wants all asm parsers that LLVM is configured to support, to make them
9292 /// available via the TargetRegistry.
9696 #define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
9797 #include "llvm/Config/AsmParsers.def"
9898 }
99
99
100100 /// InitializeAllDisassemblers - The main program should call this function if
101101 /// it wants all disassemblers that LLVM is configured to support, to make
102102 /// them available via the TargetRegistry.
106106 #define LLVM_DISASSEMBLER(TargetName) LLVMInitialize##TargetName##Disassembler();
107107 #include "llvm/Config/Disassemblers.def"
108108 }
109
109
110110 /// InitializeNativeTarget - The main program should call this function to
111 /// initialize the native target corresponding to the host. This is useful
111 /// initialize the native target corresponding to the host. This is useful
112112 /// for JIT applications to ensure that the target gets linked in correctly.
113113 ///
114114 /// It is legal for a client to make multiple calls to this function.
122122 #else
123123 return true;
124124 #endif
125 }
125 }
126126
127127 /// InitializeNativeTargetAsmPrinter - The main program should call
128128 /// this function to initialize the native target asm printer.
134134 #else
135135 return true;
136136 #endif
137 }
137 }
138138
139139 /// InitializeNativeTargetAsmParser - The main program should call
140140 /// this function to initialize the native target asm parser.
146146 #else
147147 return true;
148148 #endif
149 }
149 }
150150
151151 /// InitializeNativeTargetDisassembler - The main program should call
152152 /// this function to initialize the native target disassembler.
2020 bool llvm_is_multithreaded();
2121
2222 /// llvm_execute_on_thread - Execute the given \p UserFn on a separate
23 /// thread, passing it the provided \p UserData and waits for thread
23 /// thread, passing it the provided \p UserData and waits for thread
2424 /// completion.
2525 ///
2626 /// This function does not guarantee that the code will actually be executed
2929 ssize_t MemUsed; // Memory allocated (in bytes)
3030 public:
3131 TimeRecord() : WallTime(0), UserTime(0), SystemTime(0), MemUsed(0) {}
32
32
3333 /// getCurrentTime - Get the current time and memory usage. If Start is true
3434 /// we get the memory usage before the time, otherwise we get time before
3535 /// memory usage. This matters if the time to get the memory usage is
3636 /// significant and shouldn't be counted as part of a duration.
3737 static TimeRecord getCurrentTime(bool Start = true);
38
38
3939 double getProcessTime() const { return UserTime+SystemTime; }
4040 double getUserTime() const { return UserTime; }
4141 double getSystemTime() const { return SystemTime; }
4747 // Sort by Wall Time elapsed, as it is the only thing really accurate
4848 return WallTime < T.WallTime;
4949 }
50
50
5151 void operator+=(const TimeRecord &RHS) {
5252 WallTime += RHS.WallTime;
5353 UserTime += RHS.UserTime;
6060 SystemTime -= RHS.SystemTime;
6161 MemUsed -= RHS.MemUsed;
6262 }
63
63
6464 /// print - Print the current timer to standard error, and reset the "Started"
6565 /// flag.
6666 void print(const TimeRecord &Total, raw_ostream &OS) const;
6767 };
68
68
6969 /// Timer - This class is used to track the amount of time spent between
7070 /// invocations of its startTimer()/stopTimer() methods. Given appropriate OS
7171 /// support it can also keep track of the RSS of the program at various points.
7979 std::string Name; // The name of this time variable.
8080 bool Started; // Has this time variable ever been started?
8181 TimerGroup *TG; // The TimerGroup this Timer is in.
82
82
8383 Timer **Prev, *Next; // Doubly linked list of timers in the group.
8484 public:
8585 explicit Timer(StringRef N) : TG(nullptr) { init(N); }
9797 explicit Timer() : TG(nullptr) {}
9898 void init(StringRef N);
9999 void init(StringRef N, TimerGroup &tg);
100
100
101101 const std::string &getName() const { return Name; }
102102 bool isInitialized() const { return TG != nullptr; }
103
103
104104 /// startTimer - Start the timer running. Time between calls to
105105 /// startTimer/stopTimer is counted by the Timer class. Note that these calls
106106 /// must be correctly paired.
157157 std::string Name;
158158 Timer *FirstTimer; // First timer in the group.
159159 std::vector > TimersToPrint;
160
160
161161 TimerGroup **Prev, *Next; // Doubly linked list of TimerGroup's.
162162 TimerGroup(const TimerGroup &TG) = delete;
163163 void operator=(const TimerGroup &TG) = delete;
170170
171171 /// print - Print any started timers in this group and zero them.
172172 void print(raw_ostream &OS);
173
173
174174 /// printAll - This static method prints all timers and clears them all out.
175175 static void printAll(raw_ostream &OS);
176
176
177177 private:
178178 friend class Timer;
179179 void addTimer(Timer &T);
1616
1717 #include "llvm/Support/raw_ostream.h"
1818
19 namespace llvm
19 namespace llvm
2020 {
2121 /// circular_raw_ostream - A raw_ostream which *can* save its data
2222 /// to a circular buffer, or can pass it through directly to an
217217
218218 // Formatted output, see the leftJustify() function in Support/Format.h.
219219 raw_ostream &operator<<(const FormattedString &);
220
220
221221 // Formatted output, see the formatHex() function in Support/Format.h.
222222 raw_ostream &operator<<(const FormattedNumber &);
223
223
224224 /// indent - Insert 'NumSpaces' spaces.
225225 raw_ostream &indent(unsigned NumSpaces);
226226