klee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ModuleUtil.cpp File Reference
#include "klee/Internal/Support/ModuleUtil.h"
#include "klee/Config/Version.h"
#include "../Core/Common.h"
#include "../Core/SpecialFunctionHandler.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/IR/Module.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/DataStream.h"
#include "llvm/Linker.h"
#include "llvm/Assembly/AssemblyAnnotationWriter.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Support/Path.h"
#include <map>
#include <set>
#include <fstream>
#include <sstream>
#include <string>
Include dependency graph for ModuleUtil.cpp:

Go to the source code of this file.

Functions

static void GetAllUndefinedSymbols (Module *M, std::set< std::string > &UndefinedSymbols)
 
static void CleanUpLinkBCA (std::vector< Module * > &archiveModules)
 
static bool linkBCA (object::Archive *archive, Module *composite, std::string &errorMessage)
 
static bool valueIsOnlyCalled (const Value *v)
 

Function Documentation

static void CleanUpLinkBCA ( std::vector< Module * > &  archiveModules)
static

A helper function for linkBCA() which cleans up memory allocated by that function.

Definition at line 160 of file ModuleUtil.cpp.

Referenced by linkBCA().

Here is the caller graph for this function:

static void GetAllUndefinedSymbols ( Module *  M,
std::set< std::string > &  UndefinedSymbols 
)
static

Based on GetAllUndefinedSymbols() from LLVM3.2

GetAllUndefinedSymbols - calculates the set of undefined symbols that still exist in an LLVM module. This is a bit tricky because there may be two symbols with the same name but different LLVM types that will be resolved to each other but aren't currently (thus we need to treat it as resolved).

Inputs: M - The module in which to find undefined symbols.

Outputs: UndefinedSymbols - A set of C++ strings containing the name of all undefined symbols.

Definition at line 76 of file ModuleUtil.cpp.

Referenced by linkBCA().

Here is the caller graph for this function:

static bool linkBCA ( object::Archive *  archive,
Module *  composite,
std::string &  errorMessage 
)
static

A helper function for klee::linkWithLibrary() that links in an archive of bitcode modules into a composite bitcode module

Parameters
[in]archiveArchive of bitcode modules
[in,out]compositeThe bitcode module to link against the archive
[out]errorMessageSet to an error message if linking fails
Returns
True if linking succeeds otherwise false

Definition at line 178 of file ModuleUtil.cpp.

References CleanUpLinkBCA(), and GetAllUndefinedSymbols().

Here is the call graph for this function:

static bool valueIsOnlyCalled ( const Value *  v)
static

Definition at line 439 of file ModuleUtil.cpp.