LLVM API Documentation
#include <BitcodeReader.h>
Public Member Functions | |
| BitcodeReader (MemoryBuffer *buffer, LLVMContext &C) | |
| ~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 124 of file BitcodeReader.h.
| llvm::BitcodeReader::BitcodeReader | ( | MemoryBuffer * | buffer, | |
| LLVMContext & | C | |||
| ) | [inline, explicit] |
Definition at line 165 of file BitcodeReader.h.
| llvm::BitcodeReader::~BitcodeReader | ( | ) | [inline] |
| void BitcodeReader::FreeState | ( | ) |
Definition at line 32 of file BitcodeReader.cpp.
References llvm::BitcodeReaderMDValueList::clear(), llvm::BitcodeReaderValueList::clear(), and llvm::swap().
Referenced by releaseModule(), and ~BitcodeReader().
| 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 178 of file BitcodeReader.h.
Referenced by llvm::getBitcodeModuleProvider(), and llvm::ParseBitcodeFile().
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 2122 of file BitcodeReader.cpp.
References E, llvm::GlobalValue::hasNotBeenReadFromBitcode(), llvm::BitstreamCursor::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 2168 of file BitcodeReader.cpp.
References llvm::Module::begin(), E, llvm::Module::end(), llvm::Instruction::eraseFromParent(), llvm::GlobalValue::hasNotBeenReadFromBitcode(), materializeFunction(), llvm::Value::replaceAllUsesWith(), llvm::swap(), llvm::ModuleProvider::TheModule, llvm::UpgradeIntrinsicCall(), llvm::Value::use_begin(), llvm::Value::use_empty(), 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 2155 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 2204 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 1477 of file BitcodeReader.cpp.
References llvm::BitstreamCursor::AtEndOfStream(), llvm::bitc::BLOCKINFO_BLOCK_ID, llvm::bitc::ENTER_SUBBLOCK, Error(), llvm::MemoryBuffer::getBufferIdentifier(), llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), llvm::BitstreamReader::init(), llvm::BitstreamCursor::init(), llvm::isBitcodeWrapper(), llvm::bitc::MODULE_BLOCK_ID, llvm::BitstreamCursor::Read(), llvm::BitstreamCursor::ReadBlockInfoBlock(), llvm::BitstreamCursor::ReadCode(), llvm::BitstreamCursor::ReadSubBlockID(), llvm::SkipBitcodeWrapperHeader(), llvm::BitstreamCursor::SkipBlock(), and llvm::ModuleProvider::TheModule.
Referenced by llvm::getBitcodeModuleProvider().