mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
Doxygen-ified comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8778 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
697ebcadbf
commit
5208ba1292
@ -24,43 +24,35 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
//
|
/// FileExists - determines if the specified filename exists and is readable.
|
||||||
// Function: FileExists ()
|
///
|
||||||
//
|
/// Inputs:
|
||||||
// Description:
|
/// FN - The name of the file.
|
||||||
// Determine if the specified filename exists and is readable.
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// None.
|
||||||
// FN - The name of the file.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// TRUE - The file exists and is readable.
|
||||||
// None.
|
/// FALSE - The file does not exist or is unreadable.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// TRUE - The file exists and is readable.
|
|
||||||
// FALSE - The file does not exist or is unreadable.
|
|
||||||
//
|
|
||||||
static inline bool FileExists(const std::string &FN) {
|
static inline bool FileExists(const std::string &FN) {
|
||||||
return access(FN.c_str(), R_OK | F_OK) != -1;
|
return access(FN.c_str(), R_OK | F_OK) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// IsArchive - determines if the specified file is an ar archive
|
||||||
// Function: IsArchive ()
|
/// by checking the magic string at the beginning of the file.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// Determine if the specified file is an ar archive. It determines this by
|
/// filename - A C++ string containing the name of the file.
|
||||||
// checking the magic string at the beginning of the file.
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// None.
|
||||||
// filename - A C++ string containing the name of the file.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// TRUE - The file is an archive.
|
||||||
// None.
|
/// FALSE - The file is not an archive.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// TRUE - The file is an archive.
|
|
||||||
// FALSE - The file is not an archive.
|
|
||||||
//
|
|
||||||
static inline bool IsArchive(const std::string &filename) {
|
static inline bool IsArchive(const std::string &filename) {
|
||||||
std::string ArchiveMagic("!<arch>\012");
|
std::string ArchiveMagic("!<arch>\012");
|
||||||
char buf[1 + ArchiveMagic.size()];
|
char buf[1 + ArchiveMagic.size()];
|
||||||
@ -70,24 +62,20 @@ static inline bool IsArchive(const std::string &filename) {
|
|||||||
return ArchiveMagic == buf;
|
return ArchiveMagic == buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// FindLib - locates a particular library. It will prepend and append
|
||||||
// Function: FindLib ()
|
/// various directories, prefixes, and suffixes until it can find the library.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function locates a particular library. It will prepend and append
|
/// Filename - Name of the file to find.
|
||||||
// various directories, prefixes, and suffixes until it can find the library.
|
/// Paths - List of directories to search.
|
||||||
//
|
///
|
||||||
// Inputs:
|
/// Outputs:
|
||||||
// Filename - Name of the file to find.
|
/// None.
|
||||||
// Paths - List of directories to search.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// The name of the file is returned.
|
||||||
// None.
|
/// If the file is not found, an empty string is returned.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// The name of the file is returned.
|
|
||||||
// If the file is not found, an empty string is returned.
|
|
||||||
//
|
|
||||||
static std::string
|
static std::string
|
||||||
FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
||||||
// Determine if the pathname can be found as it stands.
|
// Determine if the pathname can be found as it stands.
|
||||||
@ -124,22 +112,19 @@ FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// GetAllDefinedSymbols - finds all of the defined symbols in the specified
|
||||||
// Function: GetAllDefinedSymbols ()
|
/// module.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// Find all of the defined symbols in the specified module.
|
/// M - The module in which to find defined symbols.
|
||||||
//
|
///
|
||||||
// Inputs:
|
/// Outputs:
|
||||||
// M - The module in which to find defined symbols.
|
/// DefinedSymbols - A set of C++ strings that will contain the name of all
|
||||||
//
|
/// defined symbols.
|
||||||
// Outputs:
|
///
|
||||||
// DefinedSymbols - A set of C++ strings that will contain the name of all
|
/// Return value:
|
||||||
// defined symbols.
|
/// None.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// None.
|
|
||||||
//
|
|
||||||
void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||||
@ -149,25 +134,21 @@ void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
|||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
|
||||||
// Function: GetAllUndefinedSymbols ()
|
/// 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
|
||||||
// Description:
|
/// each other but aren't currently (thus we need to treat it as resolved).
|
||||||
// This 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
|
/// Inputs:
|
||||||
// same name but different LLVM types that will be resolved to each other but
|
/// M - The module in which to find undefined symbols.
|
||||||
// aren't currently (thus we need to treat it as resolved).
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// UndefinedSymbols - A set of C++ strings containing the name of all
|
||||||
// M - The module in which to find undefined symbols.
|
/// undefined symbols.
|
||||||
//
|
///
|
||||||
// Outputs:
|
/// Return value:
|
||||||
// UndefinedSymbols - A set of C++ strings containing the name of all
|
/// None.
|
||||||
// undefined symbols.
|
///
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// None.
|
|
||||||
//
|
|
||||||
void
|
void
|
||||||
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||||
std::set<std::string> DefinedSymbols;
|
std::set<std::string> DefinedSymbols;
|
||||||
@ -198,22 +179,18 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
/// LoadObject - reads the specified bytecode object file.
|
||||||
// Function: LoadObject ()
|
///
|
||||||
//
|
/// Inputs:
|
||||||
// Description:
|
/// FN - The name of the file to load.
|
||||||
// Read the specified bytecode object file.
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// OutErrorMessage - The error message to give back to the caller.
|
||||||
// FN - The name of the file to load.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// A pointer to a module represening the bytecode file is returned.
|
||||||
// OutErrorMessage - The error message to give back to the caller.
|
/// If an error occurs, the pointer is 0.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// A pointer to a module represening the bytecode file is returned.
|
|
||||||
// If an error occurs, the pointer is 0.
|
|
||||||
//
|
|
||||||
std::auto_ptr<Module>
|
std::auto_ptr<Module>
|
||||||
LoadObject(const std::string & FN, std::string &OutErrorMessage) {
|
LoadObject(const std::string & FN, std::string &OutErrorMessage) {
|
||||||
std::string ErrorMessage;
|
std::string ErrorMessage;
|
||||||
@ -224,25 +201,21 @@ LoadObject(const std::string & FN, std::string &OutErrorMessage) {
|
|||||||
return std::auto_ptr<Module>();
|
return std::auto_ptr<Module>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkInArchive - opens an archive library and link in all objects which
|
||||||
// Function: LinkInArchive ()
|
/// provide symbols that are currently undefined.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function will open an archive library and link in all objects which
|
/// M - The module in which to link the archives.
|
||||||
// provide symbols that are currently undefined.
|
/// Filename - The pathname of the archive.
|
||||||
//
|
/// Verbose - Flags whether verbose messages should be printed.
|
||||||
// Inputs:
|
///
|
||||||
// M - The module in which to link the archives.
|
/// Outputs:
|
||||||
// Filename - The pathname of the archive.
|
/// ErrorMessage - A C++ string detailing what error occurred, if any.
|
||||||
// Verbose - Flags whether verbose messages should be printed.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// TRUE - An error occurred.
|
||||||
// ErrorMessage - A C++ string detailing what error occurred, if any.
|
/// FALSE - No errors.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// TRUE - An error occurred.
|
|
||||||
// FALSE - No errors.
|
|
||||||
//
|
|
||||||
static bool LinkInArchive(Module *M,
|
static bool LinkInArchive(Module *M,
|
||||||
const std::string &Filename,
|
const std::string &Filename,
|
||||||
std::string &ErrorMessage,
|
std::string &ErrorMessage,
|
||||||
@ -315,25 +288,21 @@ static bool LinkInArchive(Module *M,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkInFile - opens an archive library and link in all objects which
|
||||||
// Function: LinkInFile ()
|
/// provide symbols that are currently undefined.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function will open an archive library and link in all objects which
|
/// HeadModule - The module in which to link the archives.
|
||||||
// provide symbols that are currently undefined.
|
/// Filename - The pathname of the archive.
|
||||||
//
|
/// Verbose - Flags whether verbose messages should be printed.
|
||||||
// Inputs:
|
///
|
||||||
// HeadModule - The module in which to link the archives.
|
/// Outputs:
|
||||||
// Filename - The pathname of the archive.
|
/// ErrorMessage - A C++ string detailing what error occurred, if any.
|
||||||
// Verbose - Flags whether verbose messages should be printed.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// TRUE - An error occurred.
|
||||||
// ErrorMessage - A C++ string detailing what error occurred, if any.
|
/// FALSE - No errors.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// TRUE - An error occurred.
|
|
||||||
// FALSE - No errors.
|
|
||||||
//
|
|
||||||
static bool LinkInFile(Module *HeadModule,
|
static bool LinkInFile(Module *HeadModule,
|
||||||
const std::string &Filename,
|
const std::string &Filename,
|
||||||
std::string &ErrorMessage,
|
std::string &ErrorMessage,
|
||||||
@ -345,31 +314,26 @@ static bool LinkInFile(Module *HeadModule,
|
|||||||
return LinkModules(HeadModule, M.get(), &ErrorMessage);
|
return LinkModules(HeadModule, M.get(), &ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkFiles - takes a module and a list of files and links them all together.
|
||||||
// Function: LinkFiles ()
|
/// It locates the file either in the current directory, as its absolute
|
||||||
//
|
/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH.
|
||||||
// Description:
|
///
|
||||||
// This function takes a module and a list of files and links them all
|
/// Inputs:
|
||||||
// together. It locates the file either in the current directory, as it's
|
/// progname - The name of the program (infamous argv[0]).
|
||||||
// absolute or relative pathname, or as a file somewhere in
|
/// HeadModule - The module under which all files will be linked.
|
||||||
// LLVM_LIB_SEARCH_PATH.
|
/// Files - A vector of C++ strings indicating the LLVM bytecode filenames
|
||||||
//
|
/// to be linked. The names can refer to a mixture of pure LLVM
|
||||||
// Inputs:
|
/// bytecode files and archive (ar) formatted files.
|
||||||
// progname - The name of the program (infamous argv[0]).
|
/// Verbose - Flags whether verbose output should be printed while linking.
|
||||||
// HeadModule - The module under which all files will be linked.
|
///
|
||||||
// Files - A vector of C++ strings indicating the LLVM bytecode filenames
|
/// Outputs:
|
||||||
// to be linked. The names can refer to a mixture of pure LLVM
|
/// HeadModule - The module will have the specified LLVM bytecode files linked
|
||||||
// bytecode files and archive (ar) formatted files.
|
/// in.
|
||||||
// Verbose - Flags whether verbose output should be printed while linking.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// FALSE - No errors.
|
||||||
// HeadModule - The module will have the specified LLVM bytecode files linked
|
/// TRUE - Some error occurred.
|
||||||
// in.
|
///
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// FALSE - No errors.
|
|
||||||
// TRUE - Some error occurred.
|
|
||||||
//
|
|
||||||
bool LinkFiles(const char *progname,
|
bool LinkFiles(const char *progname,
|
||||||
Module *HeadModule,
|
Module *HeadModule,
|
||||||
const std::vector<std::string> &Files,
|
const std::vector<std::string> &Files,
|
||||||
@ -427,28 +391,24 @@ bool LinkFiles(const char *progname,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkLibraries - takes the specified library files and links them into the
|
||||||
// Function: LinkLibraries ()
|
/// main bytecode object file.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function takes the specified library files and links them into the
|
/// progname - The name of the program (infamous argv[0]).
|
||||||
// main bytecode object file.
|
/// HeadModule - The module into which all necessary libraries will be linked.
|
||||||
//
|
/// Libraries - The list of libraries to link into the module.
|
||||||
// Inputs:
|
/// LibPaths - The list of library paths in which to find libraries.
|
||||||
// progname - The name of the program (infamous argv[0]).
|
/// Verbose - Flags whether verbose messages should be printed.
|
||||||
// HeadModule - The module into which all necessary libraries will be linked.
|
/// Native - Flags whether native code is being generated.
|
||||||
// Libraries - The list of libraries to link into the module.
|
///
|
||||||
// LibPaths - The list of library paths in which to find libraries.
|
/// Outputs:
|
||||||
// Verbose - Flags whether verbose messages should be printed.
|
/// HeadModule - The module will have all necessary libraries linked in.
|
||||||
// Native - Flags whether native code is being generated.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// FALSE - No error.
|
||||||
// HeadModule - The module will have all necessary libraries linked in.
|
/// TRUE - Error.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// FALSE - No error.
|
|
||||||
// TRUE - Error.
|
|
||||||
//
|
|
||||||
bool LinkLibraries(const char *progname,
|
bool LinkLibraries(const char *progname,
|
||||||
Module *HeadModule,
|
Module *HeadModule,
|
||||||
const std::vector<std::string> &Libraries,
|
const std::vector<std::string> &Libraries,
|
||||||
|
@ -24,43 +24,35 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
//
|
/// FileExists - determines if the specified filename exists and is readable.
|
||||||
// Function: FileExists ()
|
///
|
||||||
//
|
/// Inputs:
|
||||||
// Description:
|
/// FN - The name of the file.
|
||||||
// Determine if the specified filename exists and is readable.
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// None.
|
||||||
// FN - The name of the file.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// TRUE - The file exists and is readable.
|
||||||
// None.
|
/// FALSE - The file does not exist or is unreadable.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// TRUE - The file exists and is readable.
|
|
||||||
// FALSE - The file does not exist or is unreadable.
|
|
||||||
//
|
|
||||||
static inline bool FileExists(const std::string &FN) {
|
static inline bool FileExists(const std::string &FN) {
|
||||||
return access(FN.c_str(), R_OK | F_OK) != -1;
|
return access(FN.c_str(), R_OK | F_OK) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// IsArchive - determines if the specified file is an ar archive
|
||||||
// Function: IsArchive ()
|
/// by checking the magic string at the beginning of the file.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// Determine if the specified file is an ar archive. It determines this by
|
/// filename - A C++ string containing the name of the file.
|
||||||
// checking the magic string at the beginning of the file.
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// None.
|
||||||
// filename - A C++ string containing the name of the file.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// TRUE - The file is an archive.
|
||||||
// None.
|
/// FALSE - The file is not an archive.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// TRUE - The file is an archive.
|
|
||||||
// FALSE - The file is not an archive.
|
|
||||||
//
|
|
||||||
static inline bool IsArchive(const std::string &filename) {
|
static inline bool IsArchive(const std::string &filename) {
|
||||||
std::string ArchiveMagic("!<arch>\012");
|
std::string ArchiveMagic("!<arch>\012");
|
||||||
char buf[1 + ArchiveMagic.size()];
|
char buf[1 + ArchiveMagic.size()];
|
||||||
@ -70,24 +62,20 @@ static inline bool IsArchive(const std::string &filename) {
|
|||||||
return ArchiveMagic == buf;
|
return ArchiveMagic == buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// FindLib - locates a particular library. It will prepend and append
|
||||||
// Function: FindLib ()
|
/// various directories, prefixes, and suffixes until it can find the library.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function locates a particular library. It will prepend and append
|
/// Filename - Name of the file to find.
|
||||||
// various directories, prefixes, and suffixes until it can find the library.
|
/// Paths - List of directories to search.
|
||||||
//
|
///
|
||||||
// Inputs:
|
/// Outputs:
|
||||||
// Filename - Name of the file to find.
|
/// None.
|
||||||
// Paths - List of directories to search.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// The name of the file is returned.
|
||||||
// None.
|
/// If the file is not found, an empty string is returned.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// The name of the file is returned.
|
|
||||||
// If the file is not found, an empty string is returned.
|
|
||||||
//
|
|
||||||
static std::string
|
static std::string
|
||||||
FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
||||||
// Determine if the pathname can be found as it stands.
|
// Determine if the pathname can be found as it stands.
|
||||||
@ -124,22 +112,19 @@ FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// GetAllDefinedSymbols - finds all of the defined symbols in the specified
|
||||||
// Function: GetAllDefinedSymbols ()
|
/// module.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// Find all of the defined symbols in the specified module.
|
/// M - The module in which to find defined symbols.
|
||||||
//
|
///
|
||||||
// Inputs:
|
/// Outputs:
|
||||||
// M - The module in which to find defined symbols.
|
/// DefinedSymbols - A set of C++ strings that will contain the name of all
|
||||||
//
|
/// defined symbols.
|
||||||
// Outputs:
|
///
|
||||||
// DefinedSymbols - A set of C++ strings that will contain the name of all
|
/// Return value:
|
||||||
// defined symbols.
|
/// None.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// None.
|
|
||||||
//
|
|
||||||
void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||||
@ -149,25 +134,21 @@ void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
|||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
|
||||||
// Function: GetAllUndefinedSymbols ()
|
/// 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
|
||||||
// Description:
|
/// each other but aren't currently (thus we need to treat it as resolved).
|
||||||
// This 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
|
/// Inputs:
|
||||||
// same name but different LLVM types that will be resolved to each other but
|
/// M - The module in which to find undefined symbols.
|
||||||
// aren't currently (thus we need to treat it as resolved).
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// UndefinedSymbols - A set of C++ strings containing the name of all
|
||||||
// M - The module in which to find undefined symbols.
|
/// undefined symbols.
|
||||||
//
|
///
|
||||||
// Outputs:
|
/// Return value:
|
||||||
// UndefinedSymbols - A set of C++ strings containing the name of all
|
/// None.
|
||||||
// undefined symbols.
|
///
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// None.
|
|
||||||
//
|
|
||||||
void
|
void
|
||||||
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||||
std::set<std::string> DefinedSymbols;
|
std::set<std::string> DefinedSymbols;
|
||||||
@ -198,22 +179,18 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
/// LoadObject - reads the specified bytecode object file.
|
||||||
// Function: LoadObject ()
|
///
|
||||||
//
|
/// Inputs:
|
||||||
// Description:
|
/// FN - The name of the file to load.
|
||||||
// Read the specified bytecode object file.
|
///
|
||||||
//
|
/// Outputs:
|
||||||
// Inputs:
|
/// OutErrorMessage - The error message to give back to the caller.
|
||||||
// FN - The name of the file to load.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// A pointer to a module represening the bytecode file is returned.
|
||||||
// OutErrorMessage - The error message to give back to the caller.
|
/// If an error occurs, the pointer is 0.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// A pointer to a module represening the bytecode file is returned.
|
|
||||||
// If an error occurs, the pointer is 0.
|
|
||||||
//
|
|
||||||
std::auto_ptr<Module>
|
std::auto_ptr<Module>
|
||||||
LoadObject(const std::string & FN, std::string &OutErrorMessage) {
|
LoadObject(const std::string & FN, std::string &OutErrorMessage) {
|
||||||
std::string ErrorMessage;
|
std::string ErrorMessage;
|
||||||
@ -224,25 +201,21 @@ LoadObject(const std::string & FN, std::string &OutErrorMessage) {
|
|||||||
return std::auto_ptr<Module>();
|
return std::auto_ptr<Module>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkInArchive - opens an archive library and link in all objects which
|
||||||
// Function: LinkInArchive ()
|
/// provide symbols that are currently undefined.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function will open an archive library and link in all objects which
|
/// M - The module in which to link the archives.
|
||||||
// provide symbols that are currently undefined.
|
/// Filename - The pathname of the archive.
|
||||||
//
|
/// Verbose - Flags whether verbose messages should be printed.
|
||||||
// Inputs:
|
///
|
||||||
// M - The module in which to link the archives.
|
/// Outputs:
|
||||||
// Filename - The pathname of the archive.
|
/// ErrorMessage - A C++ string detailing what error occurred, if any.
|
||||||
// Verbose - Flags whether verbose messages should be printed.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// TRUE - An error occurred.
|
||||||
// ErrorMessage - A C++ string detailing what error occurred, if any.
|
/// FALSE - No errors.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// TRUE - An error occurred.
|
|
||||||
// FALSE - No errors.
|
|
||||||
//
|
|
||||||
static bool LinkInArchive(Module *M,
|
static bool LinkInArchive(Module *M,
|
||||||
const std::string &Filename,
|
const std::string &Filename,
|
||||||
std::string &ErrorMessage,
|
std::string &ErrorMessage,
|
||||||
@ -315,25 +288,21 @@ static bool LinkInArchive(Module *M,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkInFile - opens an archive library and link in all objects which
|
||||||
// Function: LinkInFile ()
|
/// provide symbols that are currently undefined.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function will open an archive library and link in all objects which
|
/// HeadModule - The module in which to link the archives.
|
||||||
// provide symbols that are currently undefined.
|
/// Filename - The pathname of the archive.
|
||||||
//
|
/// Verbose - Flags whether verbose messages should be printed.
|
||||||
// Inputs:
|
///
|
||||||
// HeadModule - The module in which to link the archives.
|
/// Outputs:
|
||||||
// Filename - The pathname of the archive.
|
/// ErrorMessage - A C++ string detailing what error occurred, if any.
|
||||||
// Verbose - Flags whether verbose messages should be printed.
|
///
|
||||||
//
|
/// Return Value:
|
||||||
// Outputs:
|
/// TRUE - An error occurred.
|
||||||
// ErrorMessage - A C++ string detailing what error occurred, if any.
|
/// FALSE - No errors.
|
||||||
//
|
///
|
||||||
// Return Value:
|
|
||||||
// TRUE - An error occurred.
|
|
||||||
// FALSE - No errors.
|
|
||||||
//
|
|
||||||
static bool LinkInFile(Module *HeadModule,
|
static bool LinkInFile(Module *HeadModule,
|
||||||
const std::string &Filename,
|
const std::string &Filename,
|
||||||
std::string &ErrorMessage,
|
std::string &ErrorMessage,
|
||||||
@ -345,31 +314,26 @@ static bool LinkInFile(Module *HeadModule,
|
|||||||
return LinkModules(HeadModule, M.get(), &ErrorMessage);
|
return LinkModules(HeadModule, M.get(), &ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkFiles - takes a module and a list of files and links them all together.
|
||||||
// Function: LinkFiles ()
|
/// It locates the file either in the current directory, as its absolute
|
||||||
//
|
/// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH.
|
||||||
// Description:
|
///
|
||||||
// This function takes a module and a list of files and links them all
|
/// Inputs:
|
||||||
// together. It locates the file either in the current directory, as it's
|
/// progname - The name of the program (infamous argv[0]).
|
||||||
// absolute or relative pathname, or as a file somewhere in
|
/// HeadModule - The module under which all files will be linked.
|
||||||
// LLVM_LIB_SEARCH_PATH.
|
/// Files - A vector of C++ strings indicating the LLVM bytecode filenames
|
||||||
//
|
/// to be linked. The names can refer to a mixture of pure LLVM
|
||||||
// Inputs:
|
/// bytecode files and archive (ar) formatted files.
|
||||||
// progname - The name of the program (infamous argv[0]).
|
/// Verbose - Flags whether verbose output should be printed while linking.
|
||||||
// HeadModule - The module under which all files will be linked.
|
///
|
||||||
// Files - A vector of C++ strings indicating the LLVM bytecode filenames
|
/// Outputs:
|
||||||
// to be linked. The names can refer to a mixture of pure LLVM
|
/// HeadModule - The module will have the specified LLVM bytecode files linked
|
||||||
// bytecode files and archive (ar) formatted files.
|
/// in.
|
||||||
// Verbose - Flags whether verbose output should be printed while linking.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// FALSE - No errors.
|
||||||
// HeadModule - The module will have the specified LLVM bytecode files linked
|
/// TRUE - Some error occurred.
|
||||||
// in.
|
///
|
||||||
//
|
|
||||||
// Return value:
|
|
||||||
// FALSE - No errors.
|
|
||||||
// TRUE - Some error occurred.
|
|
||||||
//
|
|
||||||
bool LinkFiles(const char *progname,
|
bool LinkFiles(const char *progname,
|
||||||
Module *HeadModule,
|
Module *HeadModule,
|
||||||
const std::vector<std::string> &Files,
|
const std::vector<std::string> &Files,
|
||||||
@ -427,28 +391,24 @@ bool LinkFiles(const char *progname,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// LinkLibraries - takes the specified library files and links them into the
|
||||||
// Function: LinkLibraries ()
|
/// main bytecode object file.
|
||||||
//
|
///
|
||||||
// Description:
|
/// Inputs:
|
||||||
// This function takes the specified library files and links them into the
|
/// progname - The name of the program (infamous argv[0]).
|
||||||
// main bytecode object file.
|
/// HeadModule - The module into which all necessary libraries will be linked.
|
||||||
//
|
/// Libraries - The list of libraries to link into the module.
|
||||||
// Inputs:
|
/// LibPaths - The list of library paths in which to find libraries.
|
||||||
// progname - The name of the program (infamous argv[0]).
|
/// Verbose - Flags whether verbose messages should be printed.
|
||||||
// HeadModule - The module into which all necessary libraries will be linked.
|
/// Native - Flags whether native code is being generated.
|
||||||
// Libraries - The list of libraries to link into the module.
|
///
|
||||||
// LibPaths - The list of library paths in which to find libraries.
|
/// Outputs:
|
||||||
// Verbose - Flags whether verbose messages should be printed.
|
/// HeadModule - The module will have all necessary libraries linked in.
|
||||||
// Native - Flags whether native code is being generated.
|
///
|
||||||
//
|
/// Return value:
|
||||||
// Outputs:
|
/// FALSE - No error.
|
||||||
// HeadModule - The module will have all necessary libraries linked in.
|
/// TRUE - Error.
|
||||||
//
|
///
|
||||||
// Return value:
|
|
||||||
// FALSE - No error.
|
|
||||||
// TRUE - Error.
|
|
||||||
//
|
|
||||||
bool LinkLibraries(const char *progname,
|
bool LinkLibraries(const char *progname,
|
||||||
Module *HeadModule,
|
Module *HeadModule,
|
||||||
const std::vector<std::string> &Libraries,
|
const std::vector<std::string> &Libraries,
|
||||||
|
Loading…
Reference in New Issue
Block a user