LLVM API Documentation

llvm::BitcodeReader Class Reference

#include <BitcodeReader.h>

Inheritance diagram for llvm::BitcodeReader:
[legend]
Collaboration diagram for llvm::BitcodeReader:
[legend]

List of all members.

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.


Detailed Description

Definition at line 128 of file BitcodeReader.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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]

Definition at line 188 of file BitcodeReader.h.

Referenced by ParseBitcode().

const char* llvm::BitcodeReader::getErrorString (  )  const [inline]

Definition at line 192 of file BitcodeReader.h.

Referenced by llvm::getBitcodeModuleProvider().

bool BitcodeReader::ParseBitcode (  ) 


The documentation for this class was generated from the following files: