LLVM API Documentation
#include <BitcodeReader.h>
Public Member Functions | |
| BitcodeReader (MemoryBuffer *buffer) | |
| ~BitcodeReader () | |
| void | FreeState () |
| void | releaseMemoryBuffer () |
| virtual bool | materializeFunction (Function *F, std::string *ErrInfo=0) |
| virtual Module * | materializeModule (std::string *ErrInfo=0) |
| virtual void | dematerializeFunction (Function *F) |
| virtual Module * | releaseModule (std::string *ErrInfo=0) |
| Release our hold on the generated module. | |
| bool | Error (const char *Str) |
| const char * | getErrorString () const |
| bool | ParseBitcode () |
| Main interface to parsing a bitcode buffer. | |
Definition at line 128 of file BitcodeReader.h.
| llvm::BitcodeReader::BitcodeReader | ( | MemoryBuffer * | buffer | ) | [inline, explicit] |
Definition at line 166 of file BitcodeReader.h.
| llvm::BitcodeReader::~BitcodeReader | ( | ) | [inline] |
Definition at line 170 of file BitcodeReader.h.
| void BitcodeReader::FreeState | ( | ) |
Definition at line 29 of file BitcodeReader.cpp.
References llvm::BitcodeReaderValueList::clear(), and llvm::swap().
Referenced by releaseModule().
| void llvm::BitcodeReader::releaseMemoryBuffer | ( | ) | [inline] |
releaseMemoryBuffer - This causes the reader to completely forget about the memory buffer it contains, which prevents the buffer from being destroyed when it is deleted.
Definition at line 179 of file BitcodeReader.h.
Referenced by llvm::getBitcodeModuleProvider(), and llvm::ParseBitcodeFile().
| bool BitcodeReader::materializeFunction | ( | Function * | F, | |
| std::string * | ErrInfo = 0 | |||
| ) | [virtual] |
materializeFunction - make sure the given function is fully read. If the module is corrupt, this returns true and fills in the optional string with information about the problem. If successful, this returns false.
Implements llvm::ModuleProvider.
Definition at line 1981 of file BitcodeReader.cpp.
References E, llvm::GlobalValue::hasNotBeenReadFromBitcode(), llvm::BitstreamReader::JumpToBit(), llvm::GlobalValue::setLinkage(), llvm::UpgradeIntrinsicCall(), llvm::Value::use_begin(), and llvm::Value::use_end().
Referenced by materializeModule().
| Module * BitcodeReader::materializeModule | ( | std::string * | ErrInfo = 0 |
) | [virtual] |
materializeModule - make sure the entire Module has been completely read. On error, return null and fill in the error string if specified.
Implements llvm::ModuleProvider.
Definition at line 2027 of file BitcodeReader.cpp.
References E, llvm::Instruction::eraseFromParent(), llvm::GlobalValue::hasNotBeenReadFromBitcode(), materializeFunction(), llvm::User::replaceUsesOfWith(), llvm::swap(), llvm::ModuleProvider::TheModule, llvm::UpgradeIntrinsicCall(), llvm::Value::use_begin(), and llvm::Value::use_end().
Referenced by llvm::ParseBitcodeFile().
| void BitcodeReader::dematerializeFunction | ( | Function * | ) | [virtual] |
dematerializeFunction - If the given function is read in, and if the module provider supports it, release the memory for the function, and set it up to be materialized lazily. If the provider doesn't support this capability, this method is a noop.
Reimplemented from llvm::ModuleProvider.
Definition at line 2014 of file BitcodeReader.cpp.
References llvm::Function::deleteBody(), llvm::GlobalValue::GhostLinkage, llvm::GlobalValue::hasNotBeenReadFromBitcode(), llvm::Function::isDeclaration(), and llvm::GlobalValue::setLinkage().
| Module * BitcodeReader::releaseModule | ( | std::string * | ErrInfo = 0 |
) | [virtual] |
Release our hold on the generated module.
This method is provided by the parent ModuleProvde class and overriden here. It simply releases the module from its provided and frees up our state.
Reimplemented from llvm::ModuleProvider.
Definition at line 2063 of file BitcodeReader.cpp.
References FreeState(), M, and llvm::ModuleProvider::releaseModule().
Referenced by llvm::ParseBitcodeFile().
| bool llvm::BitcodeReader::Error | ( | const char * | Str | ) | [inline] |
| const char* llvm::BitcodeReader::getErrorString | ( | ) | const [inline] |
| bool BitcodeReader::ParseBitcode | ( | ) |
Main interface to parsing a bitcode buffer.
Definition at line 1329 of file BitcodeReader.cpp.
References llvm::BitstreamReader::AtEndOfStream(), llvm::bitc::BLOCKINFO_BLOCK_ID, llvm::bitc::ENTER_SUBBLOCK, Error(), llvm::MemoryBuffer::getBufferIdentifier(), llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), llvm::BitstreamReader::init(), llvm::bitc::MODULE_BLOCK_ID, llvm::BitstreamReader::Read(), llvm::BitstreamReader::ReadBlockInfoBlock(), llvm::BitstreamReader::ReadCode(), llvm::BitstreamReader::ReadSubBlockID(), llvm::BitstreamReader::SkipBlock(), SkipWrapperHeader(), and llvm::ModuleProvider::TheModule.
Referenced by llvm::getBitcodeModuleProvider().