mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Fix type truncation warnings
Avoid type truncation warnings from a 32-bit bot due to size_t not being unsigned long long, by converting the variables and constants to unsigned. This was introduced by r278338 and caused warnings here: http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/15527/steps/build_llvmclang/logs/warnings%20%287%29 llvm-svn: 278406
This commit is contained in:
parent
15bcd62e14
commit
2110ec3312
@ -84,7 +84,7 @@ struct Config {
|
|||||||
///
|
///
|
||||||
/// Note that in out-of-process backend scenarios, none of the hooks will be
|
/// Note that in out-of-process backend scenarios, none of the hooks will be
|
||||||
/// called for ThinLTO tasks.
|
/// called for ThinLTO tasks.
|
||||||
typedef std::function<bool(size_t Task, Module &)> ModuleHookFn;
|
typedef std::function<bool(unsigned Task, Module &)> ModuleHookFn;
|
||||||
|
|
||||||
/// This module hook is called after linking (regular LTO) or loading
|
/// This module hook is called after linking (regular LTO) or loading
|
||||||
/// (ThinLTO) the module, before modifying it.
|
/// (ThinLTO) the module, before modifying it.
|
||||||
@ -191,7 +191,7 @@ struct Config {
|
|||||||
/// return a output stream to write the native object to.
|
/// return a output stream to write the native object to.
|
||||||
///
|
///
|
||||||
/// Stream callbacks must be thread safe.
|
/// Stream callbacks must be thread safe.
|
||||||
typedef std::function<std::unique_ptr<raw_pwrite_stream>(size_t Task)>
|
typedef std::function<std::unique_ptr<raw_pwrite_stream>(unsigned Task)>
|
||||||
AddStreamFn;
|
AddStreamFn;
|
||||||
|
|
||||||
/// A derived class of LLVMContext that initializes itself according to a given
|
/// A derived class of LLVMContext that initializes itself according to a given
|
||||||
|
@ -291,7 +291,7 @@ public:
|
|||||||
/// Returns an upper bound on the number of tasks that the client may expect.
|
/// Returns an upper bound on the number of tasks that the client may expect.
|
||||||
/// This may only be called after all IR object files have been added. For a
|
/// This may only be called after all IR object files have been added. For a
|
||||||
/// full description of tasks see LTOBackend.h.
|
/// full description of tasks see LTOBackend.h.
|
||||||
size_t getMaxTasks() const;
|
unsigned getMaxTasks() const;
|
||||||
|
|
||||||
/// Runs the LTO pipeline. This function calls the supplied AddStream function
|
/// Runs the LTO pipeline. This function calls the supplied AddStream function
|
||||||
/// to add native object files to the link.
|
/// to add native object files to the link.
|
||||||
@ -343,16 +343,16 @@ private:
|
|||||||
/// that we use partition 0 for all parallel LTO code generation partitions.
|
/// that we use partition 0 for all parallel LTO code generation partitions.
|
||||||
/// Any partitioning of the combined LTO object is done internally by the
|
/// Any partitioning of the combined LTO object is done internally by the
|
||||||
/// LTO backend.
|
/// LTO backend.
|
||||||
size_t Partition = Unknown;
|
unsigned Partition = Unknown;
|
||||||
|
|
||||||
/// Special partition numbers.
|
/// Special partition numbers.
|
||||||
enum {
|
enum {
|
||||||
/// A partition number has not yet been assigned to this global.
|
/// A partition number has not yet been assigned to this global.
|
||||||
Unknown = -1ull,
|
Unknown = -1u,
|
||||||
|
|
||||||
/// This global is either used by more than one partition or has an
|
/// This global is either used by more than one partition or has an
|
||||||
/// external reference, and therefore cannot be internalized.
|
/// external reference, and therefore cannot be internalized.
|
||||||
External = -2ull,
|
External = -2u,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ private:
|
|||||||
void addSymbolToGlobalRes(object::IRObjectFile *Obj,
|
void addSymbolToGlobalRes(object::IRObjectFile *Obj,
|
||||||
SmallPtrSet<GlobalValue *, 8> &Used,
|
SmallPtrSet<GlobalValue *, 8> &Used,
|
||||||
const InputFile::Symbol &Sym, SymbolResolution Res,
|
const InputFile::Symbol &Sym, SymbolResolution Res,
|
||||||
size_t Partition);
|
unsigned Partition);
|
||||||
|
|
||||||
Error addRegularLTO(std::unique_ptr<InputFile> Input,
|
Error addRegularLTO(std::unique_ptr<InputFile> Input,
|
||||||
ArrayRef<SymbolResolution> Res);
|
ArrayRef<SymbolResolution> Res);
|
||||||
|
@ -39,12 +39,11 @@ Error backend(Config &C, AddStreamFn AddStream,
|
|||||||
std::unique_ptr<Module> M);
|
std::unique_ptr<Module> M);
|
||||||
|
|
||||||
/// Runs a ThinLTO backend.
|
/// Runs a ThinLTO backend.
|
||||||
Error thinBackend(Config &C, size_t Task, AddStreamFn AddStream, Module &M,
|
Error thinBackend(Config &C, unsigned Task, AddStreamFn AddStream, Module &M,
|
||||||
ModuleSummaryIndex &CombinedIndex,
|
ModuleSummaryIndex &CombinedIndex,
|
||||||
const FunctionImporter::ImportMapTy &ImportList,
|
const FunctionImporter::ImportMapTy &ImportList,
|
||||||
const GVSummaryMapTy &DefinedGlobals,
|
const GVSummaryMapTy &DefinedGlobals,
|
||||||
MapVector<StringRef, MemoryBufferRef> &ModuleMap);
|
MapVector<StringRef, MemoryBufferRef> &ModuleMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ LTO::LTO(Config Conf, ThinBackend Backend,
|
|||||||
void LTO::addSymbolToGlobalRes(IRObjectFile *Obj,
|
void LTO::addSymbolToGlobalRes(IRObjectFile *Obj,
|
||||||
SmallPtrSet<GlobalValue *, 8> &Used,
|
SmallPtrSet<GlobalValue *, 8> &Used,
|
||||||
const InputFile::Symbol &Sym,
|
const InputFile::Symbol &Sym,
|
||||||
SymbolResolution Res, size_t Partition) {
|
SymbolResolution Res, unsigned Partition) {
|
||||||
GlobalValue *GV = Obj->getSymbolGV(Sym.I->getRawDataRefImpl());
|
GlobalValue *GV = Obj->getSymbolGV(Sym.I->getRawDataRefImpl());
|
||||||
|
|
||||||
auto &GlobalRes = GlobalResolutions[Sym.getName()];
|
auto &GlobalRes = GlobalResolutions[Sym.getName()];
|
||||||
@ -345,7 +345,7 @@ Error LTO::addThinLTO(std::unique_ptr<InputFile> Input,
|
|||||||
return Error();
|
return Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t LTO::getMaxTasks() const {
|
unsigned LTO::getMaxTasks() const {
|
||||||
CalledGetMaxTasks = true;
|
CalledGetMaxTasks = true;
|
||||||
return RegularLTO.ParallelCodeGenParallelismLevel + ThinLTO.ModuleMap.size();
|
return RegularLTO.ParallelCodeGenParallelismLevel + ThinLTO.ModuleMap.size();
|
||||||
}
|
}
|
||||||
@ -408,7 +408,7 @@ public:
|
|||||||
ModuleToDefinedGVSummaries(ModuleToDefinedGVSummaries) {}
|
ModuleToDefinedGVSummaries(ModuleToDefinedGVSummaries) {}
|
||||||
|
|
||||||
virtual ~ThinBackendProc() {}
|
virtual ~ThinBackendProc() {}
|
||||||
virtual Error start(size_t Task, MemoryBufferRef MBRef,
|
virtual Error start(unsigned Task, MemoryBufferRef MBRef,
|
||||||
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
||||||
MapVector<StringRef, MemoryBufferRef> &ModuleMap) = 0;
|
MapVector<StringRef, MemoryBufferRef> &ModuleMap) = 0;
|
||||||
virtual Error wait() = 0;
|
virtual Error wait() = 0;
|
||||||
@ -430,7 +430,7 @@ public:
|
|||||||
BackendThreadPool(ThinLTOParallelismLevel) {}
|
BackendThreadPool(ThinLTOParallelismLevel) {}
|
||||||
|
|
||||||
Error
|
Error
|
||||||
runThinLTOBackendThread(AddStreamFn AddStream, size_t Task,
|
runThinLTOBackendThread(AddStreamFn AddStream, unsigned Task,
|
||||||
MemoryBufferRef MBRef,
|
MemoryBufferRef MBRef,
|
||||||
ModuleSummaryIndex &CombinedIndex,
|
ModuleSummaryIndex &CombinedIndex,
|
||||||
const FunctionImporter::ImportMapTy &ImportList,
|
const FunctionImporter::ImportMapTy &ImportList,
|
||||||
@ -446,7 +446,7 @@ public:
|
|||||||
ImportList, DefinedGlobals, ModuleMap);
|
ImportList, DefinedGlobals, ModuleMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error start(size_t Task, MemoryBufferRef MBRef,
|
Error start(unsigned Task, MemoryBufferRef MBRef,
|
||||||
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
||||||
MapVector<StringRef, MemoryBufferRef> &ModuleMap) override {
|
MapVector<StringRef, MemoryBufferRef> &ModuleMap) override {
|
||||||
StringRef ModulePath = MBRef.getBufferIdentifier();
|
StringRef ModulePath = MBRef.getBufferIdentifier();
|
||||||
@ -529,7 +529,7 @@ public:
|
|||||||
return NewPath.str();
|
return NewPath.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
Error start(size_t Task, MemoryBufferRef MBRef,
|
Error start(unsigned Task, MemoryBufferRef MBRef,
|
||||||
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
||||||
MapVector<StringRef, MemoryBufferRef> &ModuleMap) override {
|
MapVector<StringRef, MemoryBufferRef> &ModuleMap) override {
|
||||||
StringRef ModulePath = MBRef.getBufferIdentifier();
|
StringRef ModulePath = MBRef.getBufferIdentifier();
|
||||||
@ -629,8 +629,8 @@ Error LTO::runThinLTO(AddStreamFn AddStream) {
|
|||||||
// ParallelCodeGenParallelismLevel, as tasks 0 through
|
// ParallelCodeGenParallelismLevel, as tasks 0 through
|
||||||
// ParallelCodeGenParallelismLevel-1 are reserved for parallel code generation
|
// ParallelCodeGenParallelismLevel-1 are reserved for parallel code generation
|
||||||
// partitions.
|
// partitions.
|
||||||
size_t Task = RegularLTO.ParallelCodeGenParallelismLevel;
|
unsigned Task = RegularLTO.ParallelCodeGenParallelismLevel;
|
||||||
size_t Partition = 1;
|
unsigned Partition = 1;
|
||||||
|
|
||||||
for (auto &Mod : ThinLTO.ModuleMap) {
|
for (auto &Mod : ThinLTO.ModuleMap) {
|
||||||
if (Error E = BackendProc->start(Task, Mod.second, ImportLists,
|
if (Error E = BackendProc->start(Task, Mod.second, ImportLists,
|
||||||
|
@ -46,7 +46,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
|
|||||||
auto setHook = [&](std::string PathSuffix, ModuleHookFn &Hook) {
|
auto setHook = [&](std::string PathSuffix, ModuleHookFn &Hook) {
|
||||||
// Keep track of the hook provided by the linker, which also needs to run.
|
// Keep track of the hook provided by the linker, which also needs to run.
|
||||||
ModuleHookFn LinkerHook = Hook;
|
ModuleHookFn LinkerHook = Hook;
|
||||||
Hook = [=](size_t Task, Module &M) {
|
Hook = [=](unsigned Task, Module &M) {
|
||||||
// If the linker's hook returned false, we need to pass that result
|
// If the linker's hook returned false, we need to pass that result
|
||||||
// through.
|
// through.
|
||||||
if (LinkerHook && !LinkerHook(Task, M))
|
if (LinkerHook && !LinkerHook(Task, M))
|
||||||
@ -115,7 +115,8 @@ createTargetMachine(Config &C, StringRef TheTriple, const Target *TheTarget) {
|
|||||||
C.CodeModel, C.CGOptLevel));
|
C.CodeModel, C.CGOptLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool opt(Config &C, TargetMachine *TM, size_t Task, Module &M, bool IsThinLto) {
|
bool opt(Config &C, TargetMachine *TM, unsigned Task, Module &M,
|
||||||
|
bool IsThinLto) {
|
||||||
M.setDataLayout(TM->createDataLayout());
|
M.setDataLayout(TM->createDataLayout());
|
||||||
|
|
||||||
legacy::PassManager passes;
|
legacy::PassManager passes;
|
||||||
@ -143,7 +144,7 @@ bool opt(Config &C, TargetMachine *TM, size_t Task, Module &M, bool IsThinLto) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void codegen(Config &C, TargetMachine *TM, AddStreamFn AddStream, size_t Task,
|
void codegen(Config &C, TargetMachine *TM, AddStreamFn AddStream, unsigned Task,
|
||||||
Module &M) {
|
Module &M) {
|
||||||
if (C.PreCodeGenModuleHook && !C.PreCodeGenModuleHook(Task, M))
|
if (C.PreCodeGenModuleHook && !C.PreCodeGenModuleHook(Task, M))
|
||||||
return;
|
return;
|
||||||
@ -234,8 +235,8 @@ Error lto::backend(Config &C, AddStreamFn AddStream,
|
|||||||
return Error();
|
return Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
Error lto::thinBackend(Config &C, size_t Task, AddStreamFn AddStream, Module &M,
|
Error lto::thinBackend(Config &C, unsigned Task, AddStreamFn AddStream,
|
||||||
ModuleSummaryIndex &CombinedIndex,
|
Module &M, ModuleSummaryIndex &CombinedIndex,
|
||||||
const FunctionImporter::ImportMapTy &ImportList,
|
const FunctionImporter::ImportMapTy &ImportList,
|
||||||
const GVSummaryMapTy &DefinedGlobals,
|
const GVSummaryMapTy &DefinedGlobals,
|
||||||
MapVector<StringRef, MemoryBufferRef> &ModuleMap) {
|
MapVector<StringRef, MemoryBufferRef> &ModuleMap) {
|
||||||
|
Loading…
Reference in New Issue
Block a user