1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

Make helper functions static.

Found by -Wmissing-prototypes. NFC.

llvm-svn: 231664
This commit is contained in:
Benjamin Kramer 2015-03-09 16:23:46 +00:00
parent 4ecbba8a1a
commit 5ce1e9672a
14 changed files with 71 additions and 66 deletions

View File

@ -851,8 +851,9 @@ int LoopInterchangeProfitability::getInstrOrderCost() {
return GoodOrder - BadOrder;
}
bool isProfitabileForVectorization(unsigned InnerLoopId, unsigned OuterLoopId,
CharMatrix &DepMatrix) {
static bool isProfitabileForVectorization(unsigned InnerLoopId,
unsigned OuterLoopId,
CharMatrix &DepMatrix) {
// TODO: Improve this heuristic to catch more cases.
// If the inner loop is loop independent or doesn't carry any dependency it is
// profitable to move this to outer position.

View File

@ -1165,11 +1165,11 @@ static AttributeSet legalizeCallAttributes(AttributeSet AS) {
/// statepointToken - statepoint instruction to which relocates should be
/// bound.
/// Builder - Llvm IR builder to be used to construct new calls.
void CreateGCRelocates(ArrayRef<llvm::Value *> liveVariables,
const int liveStart,
ArrayRef<llvm::Value *> basePtrs,
Instruction *statepointToken, IRBuilder<> Builder) {
static void CreateGCRelocates(ArrayRef<llvm::Value *> liveVariables,
const int liveStart,
ArrayRef<llvm::Value *> basePtrs,
Instruction *statepointToken,
IRBuilder<> Builder) {
SmallVector<Instruction *, 64> NewDefs;
NewDefs.reserve(liveVariables.size());

View File

@ -2533,10 +2533,9 @@ getReductionBinOp(LoopVectorizationLegality::ReductionKind Kind) {
}
}
Value *createMinMaxOp(IRBuilder<> &Builder,
LoopVectorizationLegality::MinMaxReductionKind RK,
Value *Left,
Value *Right) {
static Value *createMinMaxOp(IRBuilder<> &Builder,
LoopVectorizationLegality::MinMaxReductionKind RK,
Value *Left, Value *Right) {
CmpInst::Predicate P = CmpInst::ICMP_NE;
switch (RK) {
default:

View File

@ -91,9 +91,9 @@ static void VisitComponent(StringRef Name,
/// are required to link the given components.
/// \param IncludeNonInstalled - Whether non-installed components should be
/// reported.
void ComputeLibsForComponents(const std::vector<StringRef> &Components,
std::vector<StringRef> &RequiredLibs,
bool IncludeNonInstalled) {
static void ComputeLibsForComponents(const std::vector<StringRef> &Components,
std::vector<StringRef> &RequiredLibs,
bool IncludeNonInstalled) {
std::set<AvailableComponent*> VisitedComponents;
// Build a map of component names to information.
@ -126,7 +126,7 @@ void ComputeLibsForComponents(const std::vector<StringRef> &Components,
/* *** */
void usage() {
static void usage() {
errs() << "\
usage: llvm-config <OPTION>... [<COMPONENT>...]\n\
\n\

View File

@ -23,9 +23,10 @@
#include <system_error>
using namespace llvm;
void reportCoverage(StringRef SourceFile, StringRef ObjectDir,
const std::string &InputGCNO, const std::string &InputGCDA,
bool DumpGCOV, const GCOVOptions &Options) {
static void reportCoverage(StringRef SourceFile, StringRef ObjectDir,
const std::string &InputGCNO,
const std::string &InputGCDA, bool DumpGCOV,
const GCOVOptions &Options) {
SmallString<128> CoverageFileStem(ObjectDir);
if (CoverageFileStem.empty()) {
// If no directory was specified with -o, look next to the source file.

View File

@ -32,7 +32,7 @@ int convertForTestingMain(int argc, const char *argv[]);
int gcovMain(int argc, const char *argv[]);
/// \brief Top level help.
int helpMain(int argc, const char *argv[]) {
static int helpMain(int argc, const char *argv[]) {
errs() << "OVERVIEW: LLVM code coverage tool\n\n"
<< "USAGE: llvm-cov {gcov|report|show}\n";
return 0;

View File

@ -79,8 +79,8 @@ struct ModuleInfo {
};
}
void handleDiagnostics(lto_codegen_diagnostic_severity_t Severity,
const char *Msg, void *) {
static void handleDiagnostics(lto_codegen_diagnostic_severity_t Severity,
const char *Msg, void *) {
switch (Severity) {
case LTO_DS_NOTE:
errs() << "note: ";
@ -98,7 +98,7 @@ void handleDiagnostics(lto_codegen_diagnostic_severity_t Severity,
errs() << Msg << "\n";
}
std::unique_ptr<LTOModule>
static std::unique_ptr<LTOModule>
getLocalLTOModule(StringRef Path, std::unique_ptr<MemoryBuffer> &Buffer,
const TargetOptions &Options, std::string &Error) {
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
@ -118,7 +118,7 @@ getLocalLTOModule(StringRef Path, std::unique_ptr<MemoryBuffer> &Buffer,
/// functionality that's exposed by the C API to list symbols. Moreover, this
/// provides testing coverage for modules that have been created in their own
/// contexts.
int listSymbols(StringRef Command, const TargetOptions &Options) {
static int listSymbols(StringRef Command, const TargetOptions &Options) {
for (auto &Filename : InputFilenames) {
std::string Error;
std::unique_ptr<MemoryBuffer> Buffer;

View File

@ -1608,8 +1608,8 @@ struct DisassembleInfo {
// names and addends of the symbolic expression to add for the operand. The
// value of TagType is currently 1 (for the LLVMOpInfo1 struct). If symbolic
// information is returned then this function returns 1 else it returns 0.
int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
uint64_t Size, int TagType, void *TagBuf) {
static int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
uint64_t Size, int TagType, void *TagBuf) {
struct DisassembleInfo *info = (struct DisassembleInfo *)DisInfo;
struct LLVMOpInfo1 *op_info = (struct LLVMOpInfo1 *)TagBuf;
uint64_t value = op_info->Value;
@ -1993,8 +1993,8 @@ int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
// GuessCstringPointer is passed the address of what might be a pointer to a
// literal string in a cstring section. If that address is in a cstring section
// it returns a pointer to that string. Else it returns nullptr.
const char *GuessCstringPointer(uint64_t ReferenceValue,
struct DisassembleInfo *info) {
static const char *GuessCstringPointer(uint64_t ReferenceValue,
struct DisassembleInfo *info) {
uint32_t LoadCommandCount = info->O->getHeader().ncmds;
MachOObjectFile::LoadCommandInfo Load = info->O->getFirstLoadCommandInfo();
for (unsigned I = 0;; ++I) {
@ -2279,8 +2279,9 @@ static uint64_t GuessPointerPointer(uint64_t ReferenceValue,
// offset into the section, number of bytes left in the section past the offset
// and which section is was being referenced. If the Address is not in a
// section nullptr is returned.
const char *get_pointer_64(uint64_t Address, uint32_t &offset, uint32_t &left,
SectionRef &S, DisassembleInfo *info) {
static const char *get_pointer_64(uint64_t Address, uint32_t &offset,
uint32_t &left, SectionRef &S,
DisassembleInfo *info) {
offset = 0;
left = 0;
S = SectionRef();
@ -2302,8 +2303,8 @@ const char *get_pointer_64(uint64_t Address, uint32_t &offset, uint32_t &left,
// get_symbol_64() returns the name of a symbol (or nullptr) and the address of
// the symbol indirectly through n_value. Based on the relocation information
// for the specified section offset in the specified section reference.
const char *get_symbol_64(uint32_t sect_offset, SectionRef S,
DisassembleInfo *info, uint64_t &n_value) {
static const char *get_symbol_64(uint32_t sect_offset, SectionRef S,
DisassembleInfo *info, uint64_t &n_value) {
n_value = 0;
if (info->verbose == false)
return nullptr;
@ -2437,9 +2438,9 @@ static const char *get_dyld_bind_info_symbolname(uint64_t ReferenceValue,
// address of the pointer, so when the pointer is zero as it can be in an .o
// file, that is used to look for an external relocation entry with a symbol
// name.
const char *get_objc2_64bit_class_name(uint64_t pointer_value,
uint64_t ReferenceValue,
struct DisassembleInfo *info) {
static const char *get_objc2_64bit_class_name(uint64_t pointer_value,
uint64_t ReferenceValue,
struct DisassembleInfo *info) {
const char *r;
uint32_t offset, left;
SectionRef S;
@ -2488,8 +2489,8 @@ const char *get_objc2_64bit_class_name(uint64_t pointer_value,
// get_objc2_64bit_cfstring_name is used for disassembly and is passed a
// pointer to a cfstring and returns its name or nullptr.
const char *get_objc2_64bit_cfstring_name(uint64_t ReferenceValue,
struct DisassembleInfo *info) {
static const char *get_objc2_64bit_cfstring_name(uint64_t ReferenceValue,
struct DisassembleInfo *info) {
const char *r, *name;
uint32_t offset, left;
SectionRef S;
@ -2522,8 +2523,8 @@ const char *get_objc2_64bit_cfstring_name(uint64_t ReferenceValue,
// who's symbol's n_value is the real pointer to the selector name. If that is
// the case the real pointer to the selector name is returned else 0 is
// returned
uint64_t get_objc2_64bit_selref(uint64_t ReferenceValue,
struct DisassembleInfo *info) {
static uint64_t get_objc2_64bit_selref(uint64_t ReferenceValue,
struct DisassembleInfo *info) {
uint32_t offset, left;
SectionRef S;
@ -2555,9 +2556,10 @@ uint64_t get_objc2_64bit_selref(uint64_t ReferenceValue,
//
// If there is no item in the Mach-O file for the address passed in as
// ReferenceValue nullptr is returned and ReferenceType is unchanged.
const char *GuessLiteralPointer(uint64_t ReferenceValue, uint64_t ReferencePC,
uint64_t *ReferenceType,
struct DisassembleInfo *info) {
static const char *GuessLiteralPointer(uint64_t ReferenceValue,
uint64_t ReferencePC,
uint64_t *ReferenceType,
struct DisassembleInfo *info) {
// First see if there is an external relocation entry at the ReferencePC.
uint64_t sect_addr = info->S.getAddress();
uint64_t sect_offset = ReferencePC - sect_addr;
@ -2691,10 +2693,11 @@ const char *GuessLiteralPointer(uint64_t ReferenceValue, uint64_t ReferencePC,
// SymbolValue is checked to be an address of literal pointer, symbol pointer,
// or an Objective-C meta data reference. If so the output ReferenceType is
// set to correspond to that as well as setting the ReferenceName.
const char *SymbolizerSymbolLookUp(void *DisInfo, uint64_t ReferenceValue,
uint64_t *ReferenceType,
uint64_t ReferencePC,
const char **ReferenceName) {
static const char *SymbolizerSymbolLookUp(void *DisInfo,
uint64_t ReferenceValue,
uint64_t *ReferenceType,
uint64_t ReferencePC,
const char **ReferenceName) {
struct DisassembleInfo *info = (struct DisassembleInfo *)DisInfo;
// If no verbose symbolic information is wanted then just return nullptr.
if (info->verbose == false) {

View File

@ -38,8 +38,8 @@ static void exitWithError(const Twine &Message, StringRef Whence = "") {
enum ProfileKinds { instr, sample };
void mergeInstrProfile(const cl::list<std::string> &Inputs,
StringRef OutputFilename) {
static void mergeInstrProfile(const cl::list<std::string> &Inputs,
StringRef OutputFilename) {
if (OutputFilename.compare("-") == 0)
exitWithError("Cannot write indexed profdata format to stdout.");
@ -65,9 +65,9 @@ void mergeInstrProfile(const cl::list<std::string> &Inputs,
Writer.write(Output);
}
void mergeSampleProfile(const cl::list<std::string> &Inputs,
StringRef OutputFilename,
sampleprof::SampleProfileFormat OutputFormat) {
static void mergeSampleProfile(const cl::list<std::string> &Inputs,
StringRef OutputFilename,
sampleprof::SampleProfileFormat OutputFormat) {
using namespace sampleprof;
auto WriterOrErr = SampleProfileWriter::create(OutputFilename, OutputFormat);
if (std::error_code EC = WriterOrErr.getError())
@ -97,7 +97,7 @@ void mergeSampleProfile(const cl::list<std::string> &Inputs,
Writer->write(ProfileMap);
}
int merge_main(int argc, const char *argv[]) {
static int merge_main(int argc, const char *argv[]) {
cl::list<std::string> Inputs(cl::Positional, cl::Required, cl::OneOrMore,
cl::desc("<filenames...>"));
@ -130,9 +130,9 @@ int merge_main(int argc, const char *argv[]) {
return 0;
}
int showInstrProfile(std::string Filename, bool ShowCounts,
bool ShowAllFunctions, std::string ShowFunction,
raw_fd_ostream &OS) {
static int showInstrProfile(std::string Filename, bool ShowCounts,
bool ShowAllFunctions, std::string ShowFunction,
raw_fd_ostream &OS) {
auto ReaderOrErr = InstrProfReader::create(Filename);
if (std::error_code EC = ReaderOrErr.getError())
exitWithError(EC.message(), Filename);
@ -183,9 +183,9 @@ int showInstrProfile(std::string Filename, bool ShowCounts,
return 0;
}
int showSampleProfile(std::string Filename, bool ShowCounts,
bool ShowAllFunctions, std::string ShowFunction,
raw_fd_ostream &OS) {
static int showSampleProfile(std::string Filename, bool ShowCounts,
bool ShowAllFunctions, std::string ShowFunction,
raw_fd_ostream &OS) {
using namespace sampleprof;
auto ReaderOrErr = SampleProfileReader::create(Filename, getGlobalContext());
if (std::error_code EC = ReaderOrErr.getError())
@ -201,7 +201,7 @@ int showSampleProfile(std::string Filename, bool ShowCounts,
return 0;
}
int show_main(int argc, const char *argv[]) {
static int show_main(int argc, const char *argv[]) {
cl::opt<std::string> Filename(cl::Positional, cl::Required,
cl::desc("<profdata-file>"));

View File

@ -339,7 +339,7 @@ static int checkAllExpressions(RuntimeDyldChecker &Checker) {
return 0;
}
std::map<void*, uint64_t>
static std::map<void *, uint64_t>
applySpecificSectionMappings(RuntimeDyldChecker &Checker) {
std::map<void*, uint64_t> SpecificMappings;
@ -397,9 +397,9 @@ applySpecificSectionMappings(RuntimeDyldChecker &Checker) {
// Defaults to zero. Set to something big
// (e.g. 1 << 32) to stress-test stubs, GOTs, etc.
//
void remapSections(const llvm::Triple &TargetTriple,
const TrivialMemoryManager &MemMgr,
RuntimeDyldChecker &Checker) {
static void remapSections(const llvm::Triple &TargetTriple,
const TrivialMemoryManager &MemMgr,
RuntimeDyldChecker &Checker) {
// Set up a work list (section addr/size pairs).
typedef std::list<std::pair<void*, uint64_t>> WorklistT;

View File

@ -42,7 +42,7 @@ static int ReturnValue = EXIT_SUCCESS;
namespace llvm {
bool error(std::error_code EC) {
static bool error(std::error_code EC) {
if (!EC)
return false;

View File

@ -247,7 +247,7 @@ static void AddStandardLinkPasses(legacy::PassManagerBase &PM) {
// CodeGen-related helper functions.
//
CodeGenOpt::Level GetCodeGenOptLevel() {
static CodeGenOpt::Level GetCodeGenOptLevel() {
if (OptLevelO1)
return CodeGenOpt::Less;
if (OptLevelO2)

View File

@ -282,7 +282,7 @@ raw_ostream &operator<<(raw_ostream &OS, const num_zeros_impl &NZI) {
return OS;
}
num_zeros_impl num_zeros(size_t N) {
static num_zeros_impl num_zeros(size_t N) {
num_zeros_impl NZI(N);
return NZI;
}

View File

@ -62,7 +62,8 @@ static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
typedef int (*ConvertFuncPtr)(yaml::Input & YIn, raw_ostream &Out);
int convertYAML(yaml::Input & YIn, raw_ostream &Out, ConvertFuncPtr Convert) {
static int convertYAML(yaml::Input &YIn, raw_ostream &Out,
ConvertFuncPtr Convert) {
unsigned CurDocNum = 0;
do {
if (++CurDocNum == DocNum)