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

Side by Side Diff: include/llvm/Bitcode/NaCl/NaClReaderWriter.h

Issue 940243003: PNaCl localmod mods in LLVM to 223109 (local files only) (Closed)
Patch Set: fix comment Created 5 years, 10 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
OLDNEW
1 //===-- llvm/Bitcode/NaCl/NaClReaderWriter.h - ------------------*- C++ -*-===// 1 //===-- llvm/Bitcode/NaCl/NaClReaderWriter.h - ------------------*- C++ -*-===//
2 // NaCl Bitcode reader/writer. 2 // NaCl Bitcode reader/writer.
3 // 3 //
4 // The LLVM Compiler Infrastructure 4 // The LLVM Compiler Infrastructure
5 // 5 //
6 // This file is distributed under the University of Illinois Open Source 6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details. 7 // License. See LICENSE.TXT for details.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
11 // This header defines interfaces to read and write NaCl bitcode wire format 11 // This header defines interfaces to read and write NaCl bitcode wire format
12 // files. 12 // files.
13 // 13 //
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #ifndef LLVM_BITCODE_NACL_NACLREADERWRITER_H 16 #ifndef LLVM_BITCODE_NACL_NACLREADERWRITER_H
17 #define LLVM_BITCODE_NACL_NACLREADERWRITER_H 17 #define LLVM_BITCODE_NACL_NACLREADERWRITER_H
18 18
19 #include "llvm/Support/CommandLine.h" 19 #include "llvm/Support/CommandLine.h"
20 #include "llvm/Support/ErrorOr.h" 20 #include "llvm/Support/ErrorOr.h"
21 #include "llvm/Support/MemoryBuffer.h"
21 22
22 #include <string> 23 #include <string>
23 24
24 namespace llvm { 25 namespace llvm {
25 class MemoryBuffer;
26 class LLVMContext; 26 class LLVMContext;
27 class Module; 27 class Module;
28 class raw_ostream;
29 class NaClBitcodeHeader; 28 class NaClBitcodeHeader;
30 class NaClBitstreamWriter; 29 class NaClBitstreamWriter;
31 class StreamingMemoryObject; 30 class StreamingMemoryObject;
31 class raw_ostream;
32 32
33 /// Defines the data layout used for PNaCl bitcode files. We set the 33 /// Defines the data layout used for PNaCl bitcode files. We set the
34 /// data layout of the module in the bitcode readers rather than in 34 /// data layout of the module in the bitcode readers rather than in
35 /// pnacl-llc so that 'opt' will also use the correct data layout if 35 /// pnacl-llc so that 'opt' will also use the correct data layout if
36 /// it is run on a pexe. 36 /// it is run on a pexe.
37 extern const char *PNaClDataLayout; 37 extern const char *PNaClDataLayout;
38 38
39 /// Allows (function) local symbol tables (unsupported) in PNaCl bitcode 39 /// Allows (function) local symbol tables (unsupported) in PNaCl bitcode
40 /// files. 40 /// files.
41 extern cl::opt<bool> PNaClAllowLocalSymbolTables; 41 extern cl::opt<bool> PNaClAllowLocalSymbolTables;
42 42
43 /// \brief Defines the integer bit size used to model pointers in PNaCl. 43 /// \brief Defines the integer bit size used to model pointers in PNaCl.
44 static const unsigned PNaClIntPtrTypeBitSize = 32; 44 static const unsigned PNaClIntPtrTypeBitSize = 32;
45 45
46 /// getNaClLazyBitcodeModule - Read the header of the specified bitcode buffer 46 /// getNaClLazyBitcodeModule - Read the header of the specified bitcode buffer
jvoung (off chromium) 2015/02/24 18:38:48 New style seems to be to avoid repeating the funct
47 /// and prepare for lazy deserialization of function bodies. If successful, 47 /// and prepare for lazy deserialization of function bodies. If successful,
48 /// takes ownership of 'buffer' and returns a non-null pointer. On 48 /// takes ownership of 'buffer' and returns a non-null pointer. On
49 /// error, this returns an error code and *does not* take ownership of Buffer. 49 /// error, this returns an error code and *does not* take ownership of Buffer.
50 /// 50 ///
51 /// When Verbose is non-null, more descriptive error messages are also 51 /// When Verbose is non-null, more descriptive error messages are also
52 /// written to Verbose. 52 /// written to Verbose.
53 /// 53 ///
54 /// The AcceptSupportedOnly argument is used to decide which PNaCl versions 54 /// The AcceptSupportedOnly argument is used to decide which PNaCl versions
55 /// of the PNaCl bitcode to accept. There are three forms: 55 /// of the PNaCl bitcode to accept. There are three forms:
56 /// 1) Readable and supported. 56 /// 1) Readable and supported.
57 /// 2) Readable and unsupported. Allows testing of code before becoming 57 /// 2) Readable and unsupported. Allows testing of code before becoming
58 /// supported, as well as running experiments on the bitcode format. 58 /// supported, as well as running experiments on the bitcode format.
59 /// 3) Unreadable. 59 /// 3) Unreadable.
60 /// When AcceptSupportedOnly is true, only form 1 is allowed. When 60 /// When AcceptSupportedOnly is true, only form 1 is allowed. When
61 /// AcceptSupportedOnly is false, forms 1 and 2 are allowed. 61 /// AcceptSupportedOnly is false, forms 1 and 2 are allowed.
62 ErrorOr<Module *> getNaClLazyBitcodeModule(MemoryBuffer *Buffer, 62 ErrorOr<Module *> getNaClLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buf fer,
JF 2015/02/24 05:35:36 Linewrap. Does the function take ownership of the
jvoung (off chromium) 2015/02/24 18:38:48 It is conditional/complicated =). See above comme
JF 2015/02/24 19:32:55 That sounds like ownership :-p The updated documen
63 LLVMContext &Context, 63 LLVMContext &Context,
64 raw_ostream *Verbose = nullptr, 64 raw_ostream *Verbose = nullptr,
65 bool AcceptSupportedOnly = true); 65 bool AcceptSupportedOnly = true);
66 66
67 /// getNaClStreamedBitcodeModule - Read the header of the specified stream 67 /// getNaClStreamedBitcodeModule - Read the header of the specified stream
68 /// and prepare for lazy deserialization and streaming of function bodies. 68 /// and prepare for lazy deserialization and streaming of function bodies.
69 /// On error, this returns null, and fills in *ErrMsg with an error 69 /// On error, this returns null, and fills in *ErrMsg with an error
70 /// description if ErrMsg is non-null. 70 /// description if ErrMsg is non-null.
71 /// 71 ///
72 /// See getNaClLazyBitcodeModule for an explanation of arguments 72 /// See getNaClLazyBitcodeModule for an explanation of arguments
73 /// Verbose, AcceptSupportedOnly. 73 /// Verbose, AcceptSupportedOnly.
74 /// TODO(kschimpf): Refactor this and getStreamedBitcodeModule to use 74 /// TODO(kschimpf): Refactor this and getStreamedBitcodeModule to use
75 /// ErrorOr<Module *> API so that all methods have the same interface. 75 /// ErrorOr<Module *> API so that all methods have the same interface.
76 Module *getNaClStreamedBitcodeModule(const std::string &name, 76 Module *getNaClStreamedBitcodeModule(const std::string &name,
77 StreamingMemoryObject *streamer, 77 StreamingMemoryObject *streamer,
78 LLVMContext &Context, 78 LLVMContext &Context,
79 raw_ostream *Verbose = nullptr, 79 raw_ostream *Verbose = nullptr,
80 std::string *ErrMsg = nullptr, 80 std::string *ErrMsg = nullptr,
81 bool AcceptSupportedOnly = true); 81 bool AcceptSupportedOnly = true);
82 82
83 /// NaClParseBitcodeFile - Read the specified bitcode file, 83 /// NaClParseBitcodeFile - Read the specified bitcode file,
84 /// returning the module. This method *never* takes ownership of Buffer. 84 /// returning the module.
85 /// 85 ///
86 /// See getNaClLazyBitcodeModule for an explanation of arguments 86 /// See getNaClLazyBitcodeModule for an explanation of arguments
87 /// Verbose, AcceptSupportedOnly. 87 /// Verbose, AcceptSupportedOnly.
88 ErrorOr<Module *> NaClParseBitcodeFile(MemoryBuffer *Buffer, 88 ErrorOr<Module *> NaClParseBitcodeFile(MemoryBufferRef Buffer,
89 LLVMContext &Context, 89 LLVMContext &Context,
90 raw_ostream *Verbose = nullptr, 90 raw_ostream *Verbose = nullptr,
91 bool AcceptSupportedOnly = true); 91 bool AcceptSupportedOnly = true);
92 92
93 /// NaClWriteBitcodeToFile - Write the specified module to the 93 /// NaClWriteBitcodeToFile - Write the specified module to the
94 /// specified raw output stream, using PNaCl wire format. For 94 /// specified raw output stream, using PNaCl wire format. For
95 /// streams where it matters, the given stream should be in "binary" 95 /// streams where it matters, the given stream should be in "binary"
96 /// mode. 96 /// mode.
97 /// 97 ///
98 /// The AcceptSupportedOnly argument is used to decide which PNaCl versions 98 /// The AcceptSupportedOnly argument is used to decide which PNaCl versions
(...skipping 30 matching lines...) Expand all
129 129
130 /// NaClObjDump - Read PNaCl bitcode file from input, and print a 130 /// NaClObjDump - Read PNaCl bitcode file from input, and print a
131 /// textual representation of its contents. NoRecords and NoAssembly 131 /// textual representation of its contents. NoRecords and NoAssembly
132 /// define what should not be included in the dump. Note: The caller 132 /// define what should not be included in the dump. Note: The caller
133 /// retains ownership of the Input memory buffer. 133 /// retains ownership of the Input memory buffer.
134 bool NaClObjDump(MemoryBuffer *Input, raw_ostream &output, 134 bool NaClObjDump(MemoryBuffer *Input, raw_ostream &output,
135 bool NoRecords, bool NoAssembly); 135 bool NoRecords, bool NoAssembly);
136 136
137 } // end llvm namespace 137 } // end llvm namespace
138 #endif 138 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698