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

Side by Side Diff: src/IceGlobalContext.h

Issue 205613002: Initial skeleton of Subzero. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Use non-anonymous structs so that array_lengthof works Created 6 years, 7 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 | « src/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares aspects of the compilation that persist across
11 // multiple functions.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H
16 #define SUBZERO_SRC_ICEGLOBALCONTEXT_H
17
18 #include "llvm/ADT/OwningPtr.h"
19 #include "llvm/Support/Allocator.h"
20 #include "llvm/Support/raw_ostream.h"
21
22 #include "IceDefs.h"
23 #include "IceTypes.h"
24
25 namespace Ice {
26
27 // TODO: Accesses to all non-const fields of GlobalContext need to
28 // be synchronized, especially the constant pool, the allocator, and
29 // the output streams.
30 class GlobalContext {
31 public:
32 GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit,
33 VerboseMask Mask, IceString TestPrefix);
34 ~GlobalContext();
35
36 // Returns true if any of the specified options in the verbose mask
37 // are set. If the argument is omitted, it checks if any verbose
38 // options at all are set. IceV_Timing is treated specially, so
39 // that running with just IceV_Timing verbosity doesn't trigger an
40 // avalanche of extra output.
41 bool isVerbose(VerboseMask Mask = (IceV_All & ~IceV_Timing)) const {
42 return VMask & Mask;
43 }
44 void setVerbose(VerboseMask Mask) { VMask = Mask; }
45 void addVerbose(VerboseMask Mask) { VMask |= Mask; }
46 void subVerbose(VerboseMask Mask) { VMask &= ~Mask; }
47
48 Ostream &getStrDump() { return StrDump; }
49 Ostream &getStrEmit() { return StrEmit; }
50
51 // When emitting assembly, we allow a string to be prepended to
52 // names of translated functions. This makes it easier to create an
53 // execution test against a reference translator like llc, with both
54 // translators using the same bitcode as input.
55 IceString getTestPrefix() const { return TestPrefix; }
56 IceString mangleName(const IceString &Name) const;
57
58 // Manage Constants.
59 // getConstant*() functions are not const because they might add
60 // something to the constant pool.
61 Constant *getConstantInt(Type Ty, uint64_t ConstantInt64);
62 Constant *getConstantFloat(float Value);
63 Constant *getConstantDouble(double Value);
64 // Returns a symbolic constant.
65 Constant *getConstantSym(Type Ty, int64_t Offset, const IceString &Name = "",
66 bool SuppressMangling = false);
67
68 // Allocate data of type T using the global allocator.
69 template <typename T> T *allocate() { return Allocator.Allocate<T>(); }
70
71 private:
72 Ostream StrDump; // Stream for dumping / diagnostics
73 Ostream StrEmit; // Stream for code emission
74
75 llvm::BumpPtrAllocator Allocator;
76 VerboseMask VMask;
77 llvm::OwningPtr<class ConstantPool> ConstPool;
78 const IceString TestPrefix;
79 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION;
80 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION;
81 };
82
83 } // end of namespace Ice
84
85 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « src/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698