Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/IceGlobalContext.h

Issue 455593004: Subzero: Add a random number generator. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceGlobalContext.cpp » ('j') | src/IceGlobalContext.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===// 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file declares aspects of the compilation that persist across 10 // This file declares aspects of the compilation that persist across
11 // multiple functions. 11 // multiple functions.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H 15 #ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H
16 #define SUBZERO_SRC_ICEGLOBALCONTEXT_H 16 #define SUBZERO_SRC_ICEGLOBALCONTEXT_H
17 17
18 #include "llvm/ADT/OwningPtr.h" 18 #include "llvm/ADT/OwningPtr.h"
19 #include "llvm/Support/Allocator.h" 19 #include "llvm/Support/Allocator.h"
20 #include "llvm/Support/raw_ostream.h" 20 #include "llvm/Support/raw_ostream.h"
21 21
22 #include "IceDefs.h" 22 #include "IceDefs.h"
23 #include "IceIntrinsics.h" 23 #include "IceIntrinsics.h"
24 #include "IceTypes.h" 24 #include "IceTypes.h"
25 #include "IceRNG.h"
Jim Stichnoth 2014/08/08 05:05:38 alphabetize includes
wala 2014/08/08 16:36:13 Done.
25 26
26 namespace Ice { 27 namespace Ice {
27 28
28 // TODO: Accesses to all non-const fields of GlobalContext need to 29 // TODO: Accesses to all non-const fields of GlobalContext need to
29 // be synchronized, especially the constant pool, the allocator, and 30 // be synchronized, especially the constant pool, the allocator, and
30 // the output streams. 31 // the output streams.
31 class GlobalContext { 32 class GlobalContext {
32 public: 33 public:
33 GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit, 34 GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit,
34 VerboseMask Mask, TargetArch Arch, OptLevel Opt, 35 VerboseMask Mask, TargetArch Arch, OptLevel Opt,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 Constant *getConstantZero(Type Ty); 85 Constant *getConstantZero(Type Ty);
85 // getConstantPool() returns a copy of the constant pool for 86 // getConstantPool() returns a copy of the constant pool for
86 // constants of a given type. 87 // constants of a given type.
87 ConstantList getConstantPool(Type Ty) const; 88 ConstantList getConstantPool(Type Ty) const;
88 89
89 // Allocate data of type T using the global allocator. 90 // Allocate data of type T using the global allocator.
90 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } 91 template <typename T> T *allocate() { return Allocator.Allocate<T>(); }
91 92
92 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } 93 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; }
93 94
95 RandomNumberGenerator &getRNG() { return RNG; }
Jim Stichnoth 2014/08/08 05:05:38 Please add TODOs in appropriate places: 1. Switch
wala 2014/08/08 16:36:13 Done.
96
94 private: 97 private:
95 Ostream *StrDump; // Stream for dumping / diagnostics 98 Ostream *StrDump; // Stream for dumping / diagnostics
96 Ostream *StrEmit; // Stream for code emission 99 Ostream *StrEmit; // Stream for code emission
97 100
98 llvm::BumpPtrAllocator Allocator; 101 llvm::BumpPtrAllocator Allocator;
99 VerboseMask VMask; 102 VerboseMask VMask;
100 llvm::OwningPtr<class ConstantPool> ConstPool; 103 llvm::OwningPtr<class ConstantPool> ConstPool;
101 Intrinsics IntrinsicsInfo; 104 Intrinsics IntrinsicsInfo;
102 const TargetArch Arch; 105 const TargetArch Arch;
103 const OptLevel Opt; 106 const OptLevel Opt;
104 const IceString TestPrefix; 107 const IceString TestPrefix;
105 bool HasEmittedFirstMethod; 108 bool HasEmittedFirstMethod;
109 RandomNumberGenerator RNG;
106 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; 110 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION;
107 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; 111 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION;
108 112
109 // Private helpers for mangleName() 113 // Private helpers for mangleName()
110 typedef llvm::SmallVector<char, 32> ManglerVector; 114 typedef llvm::SmallVector<char, 32> ManglerVector;
111 void incrementSubstitutions(ManglerVector &OldName) const; 115 void incrementSubstitutions(ManglerVector &OldName) const;
112 }; 116 };
113 117
114 } // end of namespace Ice 118 } // end of namespace Ice
115 119
116 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H 120 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « no previous file | src/IceGlobalContext.cpp » ('j') | src/IceGlobalContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698