Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- BitcodeReader.h - Internal BitcodeReader impl ------------*- C++ -*-===// | 1 //===- BitcodeReader.h - Internal BitcodeReader impl ------------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 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 header defines the BitcodeReader class. | 10 // This header defines the BitcodeReader class. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 119 |
| 120 Value *getValueFwdRef(unsigned Idx); | 120 Value *getValueFwdRef(unsigned Idx); |
| 121 void AssignValue(Value *V, unsigned Idx); | 121 void AssignValue(Value *V, unsigned Idx); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 class BitcodeReader : public GVMaterializer { | 124 class BitcodeReader : public GVMaterializer { |
| 125 LLVMContext &Context; | 125 LLVMContext &Context; |
| 126 Module *TheModule; | 126 Module *TheModule; |
| 127 MemoryBuffer *Buffer; | 127 MemoryBuffer *Buffer; |
| 128 bool BufferOwned; | 128 bool BufferOwned; |
| 129 BitstreamReader StreamFile; | 129 OwningPtr<BitstreamReader> StreamFile; |
| 130 BitstreamCursor Stream; | 130 BitstreamCursor Stream; |
| 131 BitcodeStreamer* LazyStreamer; | |
|
nlewycky
2011/11/05 00:45:06
* on the right
(google.com) Derek Schuff
2011/11/07 22:33:50
Done.
| |
| 131 | 132 |
| 132 const char *ErrorString; | 133 const char *ErrorString; |
| 133 | 134 |
| 134 std::vector<Type*> TypeList; | 135 std::vector<Type*> TypeList; |
| 135 BitcodeReaderValueList ValueList; | 136 BitcodeReaderValueList ValueList; |
| 136 BitcodeReaderMDValueList MDValueList; | 137 BitcodeReaderMDValueList MDValueList; |
| 137 SmallVector<Instruction *, 64> InstructionList; | 138 SmallVector<Instruction *, 64> InstructionList; |
| 138 | 139 |
| 139 std::vector<std::pair<GlobalVariable*, unsigned> > GlobalInits; | 140 std::vector<std::pair<GlobalVariable*, unsigned> > GlobalInits; |
| 140 std::vector<std::pair<GlobalAlias*, unsigned> > AliasInits; | 141 std::vector<std::pair<GlobalAlias*, unsigned> > AliasInits; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 167 /// DeferredFunctionInfo - When function bodies are initially scanned, this | 168 /// DeferredFunctionInfo - When function bodies are initially scanned, this |
| 168 /// map contains info about where to find deferred function body in the | 169 /// map contains info about where to find deferred function body in the |
| 169 /// stream. | 170 /// stream. |
| 170 DenseMap<Function*, uint64_t> DeferredFunctionInfo; | 171 DenseMap<Function*, uint64_t> DeferredFunctionInfo; |
| 171 | 172 |
| 172 /// BlockAddrFwdRefs - These are blockaddr references to basic blocks. These | 173 /// BlockAddrFwdRefs - These are blockaddr references to basic blocks. These |
| 173 /// are resolved lazily when functions are loaded. | 174 /// are resolved lazily when functions are loaded. |
| 174 typedef std::pair<unsigned, GlobalVariable*> BlockAddrRefTy; | 175 typedef std::pair<unsigned, GlobalVariable*> BlockAddrRefTy; |
| 175 DenseMap<Function*, std::vector<BlockAddrRefTy> > BlockAddrFwdRefs; | 176 DenseMap<Function*, std::vector<BlockAddrRefTy> > BlockAddrFwdRefs; |
| 176 | 177 |
| 178 | |
| 179 | |
|
nlewycky
2011/11/05 00:45:06
Why the two new blank lines? Please minimize your
(google.com) Derek Schuff
2011/11/07 22:33:50
Done.
| |
| 177 public: | 180 public: |
| 178 explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C) | 181 explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C) |
| 179 : Context(C), TheModule(0), Buffer(buffer), BufferOwned(false), | 182 : Context(C), TheModule(0), Buffer(buffer), BufferOwned(false), |
| 180 ErrorString(0), ValueList(C), MDValueList(C) { | 183 LazyStreamer(0), ErrorString(0), ValueList(C), MDValueList(C) { |
| 184 HasReversedFunctionsWithBodies = false; | |
| 185 } | |
| 186 explicit BitcodeReader(BitcodeStreamer* streamer, LLVMContext &C) | |
|
nlewycky
2011/11/05 00:45:06
* on the right
(google.com) Derek Schuff
2011/11/07 22:33:50
Done.
| |
| 187 : Context(C), TheModule(0), Buffer(0), BufferOwned(false), | |
| 188 LazyStreamer(streamer), ErrorString(0), ValueList(C), MDValueList(C) { | |
| 181 HasReversedFunctionsWithBodies = false; | 189 HasReversedFunctionsWithBodies = false; |
| 182 } | 190 } |
| 183 ~BitcodeReader() { | 191 ~BitcodeReader() { |
| 184 FreeState(); | 192 FreeState(); |
| 185 } | 193 } |
| 186 | 194 |
| 187 void FreeState(); | 195 void FreeState(); |
| 188 | 196 |
| 189 /// setBufferOwned - If this is true, the reader will destroy the MemoryBuffer | 197 /// setBufferOwned - If this is true, the reader will destroy the MemoryBuffer |
| 190 /// when the reader is destroyed. | 198 /// when the reader is destroyed. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 | 272 |
| 265 bool ParseOldTypeSymbolTable(); // FIXME: Remove in LLVM 3.1 | 273 bool ParseOldTypeSymbolTable(); // FIXME: Remove in LLVM 3.1 |
| 266 bool ParseValueSymbolTable(); | 274 bool ParseValueSymbolTable(); |
| 267 bool ParseConstants(); | 275 bool ParseConstants(); |
| 268 bool RememberAndSkipFunctionBody(); | 276 bool RememberAndSkipFunctionBody(); |
| 269 bool ParseFunctionBody(Function *F); | 277 bool ParseFunctionBody(Function *F); |
| 270 bool ResolveGlobalAndAliasInits(); | 278 bool ResolveGlobalAndAliasInits(); |
| 271 bool ParseMetadata(); | 279 bool ParseMetadata(); |
| 272 bool ParseMetadataAttachment(); | 280 bool ParseMetadataAttachment(); |
| 273 bool ParseModuleTriple(std::string &Triple); | 281 bool ParseModuleTriple(std::string &Triple); |
| 282 bool InitStream(); | |
| 283 bool InitStreamFromBuffer(); | |
| 284 bool InitLazyStream(); | |
| 274 }; | 285 }; |
| 275 | 286 |
| 276 } // End llvm namespace | 287 } // End llvm namespace |
| 277 | 288 |
| 278 #endif | 289 #endif |
| OLD | NEW |