OLD | NEW |
1 //===- NaClBitcodeReader.h ------------------------------------*- C++ -*-===// | 1 //===- NaClBitcodeReader.h ------------------------------------*- C++ -*-===// |
2 // Internal NaClBitcodeReader implementation | 2 // Internal NaClBitcodeReader implementation |
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 // |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 ~NaClBitcodeReader() override { | 229 ~NaClBitcodeReader() override { |
230 FreeState(); | 230 FreeState(); |
231 } | 231 } |
232 | 232 |
233 void FreeState(); | 233 void FreeState(); |
234 | 234 |
235 bool isDematerializable(const GlobalValue *GV) const override; | 235 bool isDematerializable(const GlobalValue *GV) const override; |
236 std::error_code materialize(GlobalValue *GV) override; | 236 std::error_code materialize(GlobalValue *GV) override; |
237 std::error_code MaterializeModule(Module *M) override; | 237 std::error_code MaterializeModule(Module *M) override; |
| 238 std::vector<StructType *> getIdentifiedStructTypes() const override; |
238 void Dematerialize(GlobalValue *GV) override; | 239 void Dematerialize(GlobalValue *GV) override; |
239 void releaseBuffer(); | 240 void releaseBuffer(); |
240 | 241 |
241 std::error_code Error(ErrorType E) const { | 242 std::error_code Error(ErrorType E) const { |
242 return std::error_code(E, BitcodeErrorCategory()); | 243 return std::error_code(E, BitcodeErrorCategory()); |
243 } | 244 } |
244 | 245 |
245 /// Generates the corresponding verbose Message, then generates error. | 246 /// Generates the corresponding verbose Message, then generates error. |
246 std::error_code Error(ErrorType E, const std::string &Message) const; | 247 std::error_code Error(ErrorType E, const std::string &Message) const; |
247 | 248 |
248 /// @brief Main interface to parsing a bitcode buffer. | 249 /// @brief Main interface to parsing a bitcode buffer. |
249 /// @returns true if an error occurred. | 250 /// @returns true if an error occurred. |
250 std::error_code ParseBitcodeInto(Module *M); | 251 std::error_code ParseBitcodeInto(Module *M); |
251 | 252 |
252 /// Convert alignment exponent (i.e. power of two (or zero)) to the | 253 /// Convert alignment exponent (i.e. power of two (or zero)) to the |
253 /// corresponding alignment to use. If alignment is too large, it generates | 254 /// corresponding alignment to use. If alignment is too large, it generates |
254 /// an error message and returns corresponding error code. | 255 /// an error message and returns corresponding error code. |
255 std::error_code getAlignmentValue(uint64_t Exponent, unsigned &Alignment); | 256 std::error_code getAlignmentValue(uint64_t Exponent, unsigned &Alignment); |
256 | 257 |
| 258 // GVMaterializer interface. It's a no-op for PNaCl bitcode, which has no |
| 259 // metadata. |
| 260 std::error_code materializeMetadata() override { return std::error_code(); }; |
| 261 |
| 262 // GVMaterializer interface. Causes debug info to be stripped from the module |
| 263 // on materialization. It's a no-op for PNaCl bitcode, which has no metadata. |
| 264 void setStripDebugInfo() override {}; |
| 265 |
257 private: | 266 private: |
258 // Returns false if Header is acceptable. | 267 // Returns false if Header is acceptable. |
259 bool AcceptHeader() const { | 268 bool AcceptHeader() const { |
260 return !(Header.IsSupported() || | 269 return !(Header.IsSupported() || |
261 (!AcceptSupportedBitcodeOnly && Header.IsReadable())); | 270 (!AcceptSupportedBitcodeOnly && Header.IsReadable())); |
262 } | 271 } |
263 uint32_t GetPNaClVersion() const { | 272 uint32_t GetPNaClVersion() const { |
264 return Header.GetPNaClVersion(); | 273 return Header.GetPNaClVersion(); |
265 } | 274 } |
266 Type *getTypeByID(unsigned ID); | 275 Type *getTypeByID(unsigned ID); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 std::error_code InitStreamFromBuffer(); | 359 std::error_code InitStreamFromBuffer(); |
351 std::error_code InitLazyStream(); | 360 std::error_code InitLazyStream(); |
352 std::error_code FindFunctionInStream( | 361 std::error_code FindFunctionInStream( |
353 Function *F, | 362 Function *F, |
354 DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator); | 363 DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator); |
355 }; | 364 }; |
356 | 365 |
357 } // End llvm namespace | 366 } // End llvm namespace |
358 | 367 |
359 #endif | 368 #endif |
OLD | NEW |