mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d1c881a8d4
commit
f976c856fc
@ -1,10 +1,10 @@
|
||||
//===-- TargetLowering.cpp - Implement the TargetLowering class -----------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This implements the TargetLowering class.
|
||||
@ -76,7 +76,7 @@ void TargetLowering::computeRegisterProperties() {
|
||||
// Everything defaults to one.
|
||||
for (unsigned i = 0; i != MVT::LAST_VALUETYPE; ++i)
|
||||
NumElementsForVT[i] = 1;
|
||||
|
||||
|
||||
// Find the largest integer register class.
|
||||
unsigned LargestIntReg = MVT::i128;
|
||||
for (; RegClassForVT[LargestIntReg] == 0; --LargestIntReg)
|
||||
@ -101,7 +101,7 @@ void TargetLowering::computeRegisterProperties() {
|
||||
TransformToType, ValueTypeActions);
|
||||
else
|
||||
TransformToType[(MVT::ValueType)IntReg] = (MVT::ValueType)IntReg;
|
||||
|
||||
|
||||
// If the target does not have native support for F32, promote it to F64.
|
||||
if (!hasNativeSupportFor(MVT::f32))
|
||||
SetValueTypeAction(MVT::f32, Promote, *this,
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Intercept.cpp - System function interception routines -------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// If a function call occurs to an external function, the JIT is designed to use
|
||||
@ -50,7 +50,7 @@ static void runAtExitHandlers() {
|
||||
#if defined(__linux__)
|
||||
#if defined(HAVE_SYS_STAT_H)
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#endif
|
||||
void *FunctionPointers[] = {
|
||||
(void *) stat,
|
||||
(void *) fstat,
|
||||
@ -84,9 +84,9 @@ static int jit_atexit(void (*Fn)(void)) {
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
/// getPointerToNamedFunction - This method returns the address of the specified
|
||||
/// function by using the dynamic loader interface. As such it is only useful
|
||||
/// function by using the dynamic loader interface. As such it is only useful
|
||||
/// for resolving library symbols, not code generated symbols.
|
||||
///
|
||||
void *JIT::getPointerToNamedFunction(const std::string &Name) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- JIT.cpp - LLVM Just in Time Compiler ------------------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This tool implements a just-in-time compiler for LLVM, allowing direct
|
||||
@ -35,7 +35,7 @@ JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji)
|
||||
|
||||
// Initialize MCE
|
||||
MCE = createEmitter(*this);
|
||||
|
||||
|
||||
// Add target data
|
||||
PM.add(new TargetData(TM.getTargetData()));
|
||||
|
||||
@ -77,7 +77,7 @@ GenericValue JIT::runFunction(Function *F,
|
||||
if (RetTy == Type::IntTy || RetTy == Type::UIntTy || RetTy == Type::VoidTy) {
|
||||
switch (ArgValues.size()) {
|
||||
case 3:
|
||||
if ((FTy->getParamType(0) == Type::IntTy ||
|
||||
if ((FTy->getParamType(0) == Type::IntTy ||
|
||||
FTy->getParamType(0) == Type::UIntTy) &&
|
||||
isa<PointerType>(FTy->getParamType(1)) &&
|
||||
isa<PointerType>(FTy->getParamType(2))) {
|
||||
@ -92,7 +92,7 @@ GenericValue JIT::runFunction(Function *F,
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((FTy->getParamType(0) == Type::IntTy ||
|
||||
if ((FTy->getParamType(0) == Type::IntTy ||
|
||||
FTy->getParamType(0) == Type::UIntTy) &&
|
||||
isa<PointerType>(FTy->getParamType(1))) {
|
||||
int (*PF)(int, char **) = (int(*)(int, char **))FPtr;
|
||||
@ -105,7 +105,7 @@ GenericValue JIT::runFunction(Function *F,
|
||||
break;
|
||||
case 1:
|
||||
if (FTy->getNumParams() == 1 &&
|
||||
(FTy->getParamType(0) == Type::IntTy ||
|
||||
(FTy->getParamType(0) == Type::IntTy ||
|
||||
FTy->getParamType(0) == Type::UIntTy)) {
|
||||
GenericValue rv;
|
||||
int (*PF)(int) = (int(*)(int))FPtr;
|
||||
@ -239,7 +239,7 @@ void *JIT::getPointerToFunction(Function *F) {
|
||||
return Addr; // Check if function already code gen'd
|
||||
|
||||
// Make sure we read in the function if it exists in this Module
|
||||
if (F->hasNotBeenReadFromBytecode())
|
||||
if (F->hasNotBeenReadFromBytecode())
|
||||
try {
|
||||
MP->materializeFunction(F);
|
||||
} catch ( std::string& errmsg ) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- JIT.h - Class definition for the JIT --------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the top-level JIT data structure.
|
||||
@ -30,7 +30,7 @@ class MachineCodeEmitter;
|
||||
class JIT : public ExecutionEngine {
|
||||
TargetMachine &TM; // The current target we are compiling to
|
||||
TargetJITInfo &TJI; // The JITInfo for the target we are compiling to
|
||||
|
||||
|
||||
FunctionPassManager PM; // Passes to compile a function
|
||||
MachineCodeEmitter *MCE; // MCE object
|
||||
|
||||
@ -67,7 +67,7 @@ public:
|
||||
|
||||
// CompilationCallback - Invoked the first time that a call site is found,
|
||||
// which causes lazy compilation of the target function.
|
||||
//
|
||||
//
|
||||
static void CompilationCallback();
|
||||
|
||||
/// getPointerToFunction - This returns the address of the specified function,
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- JITEmitter.cpp - Write machine code to executable memory ----------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines a MachineCodeEmitter object that is used by the JIT to
|
||||
@ -54,7 +54,7 @@ namespace {
|
||||
public:
|
||||
JITMemoryManager();
|
||||
~JITMemoryManager();
|
||||
|
||||
|
||||
inline unsigned char *allocateStub(unsigned StubSize);
|
||||
inline unsigned char *allocateConstant(unsigned ConstantSize,
|
||||
unsigned Alignment);
|
||||
@ -190,7 +190,7 @@ void *JITResolver::getFunctionStub(Function *F) {
|
||||
void *Actual = (void*)LazyResolverFn;
|
||||
if (F->isExternal() && F->hasExternalLinkage())
|
||||
Actual = TheJIT->getPointerToFunction(F);
|
||||
|
||||
|
||||
// Otherwise, codegen a new stub. For now, the stub will call the lazy
|
||||
// resolver function.
|
||||
Stub = TheJIT->getJITInfo().emitFunctionStub(Actual, MCE);
|
||||
@ -230,7 +230,7 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
|
||||
/// it if necessary, then returns the resultant function pointer.
|
||||
void *JITResolver::JITCompilerFn(void *Stub) {
|
||||
JITResolver &JR = getJITResolver();
|
||||
|
||||
|
||||
// The address given to us for the stub may not be exactly right, it might be
|
||||
// a little bit after the stub. As such, use upper_bound to find it.
|
||||
std::map<void*, Function*>::iterator I =
|
||||
@ -373,7 +373,7 @@ void JITEmitter::finishFunction(MachineFunction &F) {
|
||||
void *ResultPtr;
|
||||
if (MR.isString()) {
|
||||
ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString());
|
||||
|
||||
|
||||
// If the target REALLY wants a stub for this function, emit it now.
|
||||
if (!MR.doesntNeedFunctionStub())
|
||||
ResultPtr = getJITResolver(this).getExternalFunctionStub(ResultPtr);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TargetSelect.cpp - Target Chooser Code ----------------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This just asks the TargetMachineRegistry for the appropriate JIT to use, and
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- lib/Linker/LinkArchives.cpp - Link LLVM objects and libraries ------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains routines to handle linking together LLVM bytecode files,
|
||||
@ -26,7 +26,7 @@ using namespace llvm;
|
||||
/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
|
||||
/// name of each externally-visible symbol defined in M.
|
||||
///
|
||||
static void
|
||||
static void
|
||||
GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||
@ -60,7 +60,7 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||
Function *Main = M->getMainFunction();
|
||||
if (Main == 0 || Main->isExternal())
|
||||
UndefinedSymbols.insert("main");
|
||||
|
||||
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||
if (I->hasName()) {
|
||||
if (I->isExternal())
|
||||
@ -76,7 +76,7 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||
else if (!I->hasInternalLinkage())
|
||||
DefinedSymbols.insert(I->getName());
|
||||
}
|
||||
|
||||
|
||||
// Prune out any defined symbols from the undefined symbols set...
|
||||
for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
|
||||
I != UndefinedSymbols.end(); )
|
||||
@ -95,7 +95,7 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||
/// Return Value:
|
||||
/// TRUE - An error occurred.
|
||||
/// FALSE - No errors.
|
||||
bool
|
||||
bool
|
||||
Linker::LinkInArchive(const sys::Path &Filename) {
|
||||
|
||||
// Make sure this is an archive file we're dealing with
|
||||
@ -110,9 +110,9 @@ Linker::LinkInArchive(const sys::Path &Filename) {
|
||||
// no reason to link in any archive files.
|
||||
std::set<std::string> UndefinedSymbols;
|
||||
GetAllUndefinedSymbols(Composite, UndefinedSymbols);
|
||||
|
||||
|
||||
if (UndefinedSymbols.empty()) {
|
||||
verbose("No symbols undefined, skipping library '" +
|
||||
verbose("No symbols undefined, skipping library '" +
|
||||
Filename.toString() + "'");
|
||||
return false; // No need to link anything in!
|
||||
}
|
||||
@ -124,7 +124,7 @@ Linker::LinkInArchive(const sys::Path &Filename) {
|
||||
Archive* arch = AutoArch.get();
|
||||
|
||||
if (!arch)
|
||||
return error("Cannot read archive '" + Filename.toString() +
|
||||
return error("Cannot read archive '" + Filename.toString() +
|
||||
"': " + ErrMsg);
|
||||
|
||||
// Save a set of symbols that are not defined by the archive. Since we're
|
||||
@ -133,13 +133,13 @@ Linker::LinkInArchive(const sys::Path &Filename) {
|
||||
std::set<std::string> NotDefinedByArchive;
|
||||
|
||||
// While we are linking in object files, loop.
|
||||
while (true) {
|
||||
while (true) {
|
||||
|
||||
// Find the modules we need to link into the target module
|
||||
std::set<ModuleProvider*> Modules;
|
||||
arch->findModulesDefiningSymbols(UndefinedSymbols, Modules);
|
||||
|
||||
// If we didn't find any more modules to link this time, we are done
|
||||
// If we didn't find any more modules to link this time, we are done
|
||||
// searching this archive.
|
||||
if (Modules.empty())
|
||||
break;
|
||||
@ -162,7 +162,7 @@ Linker::LinkInArchive(const sys::Path &Filename) {
|
||||
|
||||
// Link it in
|
||||
if (LinkInModule(aModule))
|
||||
return error("Cannot link in module '" +
|
||||
return error("Cannot link in module '" +
|
||||
aModule->getModuleIdentifier() + "': " + Error);
|
||||
}
|
||||
|
||||
@ -171,17 +171,17 @@ Linker::LinkInArchive(const sys::Path &Filename) {
|
||||
GetAllUndefinedSymbols(Composite, UndefinedSymbols);
|
||||
|
||||
// At this point we have two sets of undefined symbols: UndefinedSymbols
|
||||
// which holds the undefined symbols from all the modules, and
|
||||
// which holds the undefined symbols from all the modules, and
|
||||
// NotDefinedByArchive which holds symbols we know the archive doesn't
|
||||
// define. There's no point searching for symbols that we won't find in the
|
||||
// archive so we subtract these sets.
|
||||
set_subtract(UndefinedSymbols, NotDefinedByArchive);
|
||||
|
||||
|
||||
// If there's no symbols left, no point in continuing to search the
|
||||
// archive.
|
||||
if (UndefinedSymbols.empty())
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- lib/Linker/LinkItems.cpp - Link LLVM objects and libraries ---------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains routines to handle linking together LLVM bytecode files,
|
||||
@ -21,7 +21,7 @@ using namespace llvm;
|
||||
bool
|
||||
Linker::LinkInItems(const ItemList& Items) {
|
||||
// For each linkage item ...
|
||||
for (ItemList::const_iterator I = Items.begin(), E = Items.end();
|
||||
for (ItemList::const_iterator I = Items.begin(), E = Items.end();
|
||||
I != E; ++I) {
|
||||
if (I->second) {
|
||||
// Link in the library suggested.
|
||||
@ -38,7 +38,7 @@ Linker::LinkInItems(const ItemList& Items) {
|
||||
// that module should also be aggregated with duplicates eliminated. This is
|
||||
// now the time to process the dependent libraries to resolve any remaining
|
||||
// symbols.
|
||||
for (Module::lib_iterator I = Composite->lib_begin(),
|
||||
for (Module::lib_iterator I = Composite->lib_begin(),
|
||||
E = Composite->lib_end(); I != E; ++I)
|
||||
if(LinkInLibrary(*I))
|
||||
return true;
|
||||
@ -95,9 +95,9 @@ bool Linker::LinkInLibraries(const std::vector<std::string> &Libraries) {
|
||||
// now the time to process the dependent libraries to resolve any remaining
|
||||
// symbols.
|
||||
const Module::LibraryListType& DepLibs = Composite->getLibraries();
|
||||
for (Module::LibraryListType::const_iterator I = DepLibs.begin(),
|
||||
E = DepLibs.end(); I != E; ++I)
|
||||
if (LinkInLibrary(*I))
|
||||
for (Module::LibraryListType::const_iterator I = DepLibs.begin(),
|
||||
E = DepLibs.end(); I != E; ++I)
|
||||
if (LinkInLibrary(*I))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -130,7 +130,7 @@ bool Linker::LinkInFile(const sys::Path &File) {
|
||||
verbose("Linking bytecode file '" + File.toString() + "'");
|
||||
|
||||
std::auto_ptr<Module> M(LoadObject(File));
|
||||
if (M.get() == 0)
|
||||
if (M.get() == 0)
|
||||
return error("Cannot load file '" + File.toString() + "'" + Error);
|
||||
if (LinkInModule(M.get()))
|
||||
return error("Cannot link file '" + File.toString() + "'" + Error);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- lib/Linker/LinkModules.cpp - Module Linker Implementation ----------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the LLVM module linker.
|
||||
@ -98,11 +98,11 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
|
||||
const Type *SrcTyT = SrcTy.get();
|
||||
const Type *DestTyT = DestTy.get();
|
||||
if (DestTyT == SrcTyT) return false; // If already equal, noop
|
||||
|
||||
|
||||
// If we found our opaque type, resolve it now!
|
||||
if (isa<OpaqueType>(DestTyT) || isa<OpaqueType>(SrcTyT))
|
||||
return ResolveTypes(DestTyT, SrcTyT, DestST, Name);
|
||||
|
||||
|
||||
// Two types cannot be resolved together if they are of different primitive
|
||||
// type. For example, we cannot resolve an int to a float.
|
||||
if (DestTyT->getTypeID() != SrcTyT->getTypeID()) return true;
|
||||
@ -123,7 +123,7 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
|
||||
return false;
|
||||
}
|
||||
case Type::StructTyID: {
|
||||
if (getST(DestTy)->getNumContainedTypes() !=
|
||||
if (getST(DestTy)->getNumContainedTypes() !=
|
||||
getST(SrcTy)->getNumContainedTypes()) return 1;
|
||||
for (unsigned i = 0, e = getST(DestTy)->getNumContainedTypes(); i != e; ++i)
|
||||
if (RecursiveResolveTypesI(getST(DestTy)->getContainedType(i),
|
||||
@ -159,7 +159,7 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
|
||||
return Result;
|
||||
}
|
||||
default: assert(0 && "Unexpected type!"); return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool RecursiveResolveTypes(const PATypeHolder &DestTy,
|
||||
@ -229,7 +229,7 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) {
|
||||
if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
|
||||
// We are making progress!
|
||||
DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
|
||||
|
||||
|
||||
// Go back to the main loop, perhaps we can resolve directly by name
|
||||
// now...
|
||||
break;
|
||||
@ -407,7 +407,7 @@ static bool GetLinkageResult(GlobalValue *Dest, GlobalValue *Src,
|
||||
} else {
|
||||
assert(Dest->hasExternalLinkage() && Src->hasExternalLinkage() &&
|
||||
"Unexpected linkage type!");
|
||||
return Error(Err, "Linking globals named '" + Src->getName() +
|
||||
return Error(Err, "Linking globals named '" + Src->getName() +
|
||||
"': symbol multiply defined!");
|
||||
}
|
||||
return false;
|
||||
@ -423,7 +423,7 @@ static bool LinkGlobals(Module *Dest, Module *Src,
|
||||
// We will need a module level symbol table if the src module has a module
|
||||
// level symbol table...
|
||||
SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable();
|
||||
|
||||
|
||||
// Loop over all of the globals in the src module, mapping them over as we go
|
||||
for (Module::global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I) {
|
||||
GlobalVariable *SGV = I;
|
||||
@ -541,11 +541,11 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src,
|
||||
Constant *SInit =
|
||||
cast<Constant>(RemapOperand(SGV->getInitializer(), ValueMap));
|
||||
|
||||
GlobalVariable *DGV = cast<GlobalVariable>(ValueMap[SGV]);
|
||||
GlobalVariable *DGV = cast<GlobalVariable>(ValueMap[SGV]);
|
||||
if (DGV->hasInitializer()) {
|
||||
if (SGV->hasExternalLinkage()) {
|
||||
if (DGV->getInitializer() != SInit)
|
||||
return Error(Err, "Global Variable Collision on '" +
|
||||
return Error(Err, "Global Variable Collision on '" +
|
||||
ToStr(SGV->getType(), Src) +"':%"+SGV->getName()+
|
||||
" - Global variables have different initializers");
|
||||
} else if (DGV->hasLinkOnceLinkage() || DGV->hasWeakLinkage()) {
|
||||
@ -577,7 +577,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
||||
std::map<std::string, GlobalValue*> &GlobalsByName,
|
||||
std::string *Err) {
|
||||
SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable();
|
||||
|
||||
|
||||
// Loop over all of the functions in the src module, mapping them over as we
|
||||
// go
|
||||
for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {
|
||||
@ -637,8 +637,8 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
||||
"' have different linkage specifiers!");
|
||||
} else if (SF->hasExternalLinkage()) {
|
||||
// The function is defined in both modules!!
|
||||
return Error(Err, "Function '" +
|
||||
ToStr(SF->getFunctionType(), Src) + "':\"" +
|
||||
return Error(Err, "Function '" +
|
||||
ToStr(SF->getFunctionType(), Src) + "':\"" +
|
||||
SF->getName() + "\" - Function is already defined!");
|
||||
} else {
|
||||
assert(0 && "Unknown linkage configuration found!");
|
||||
@ -718,7 +718,7 @@ static bool LinkAppendingVars(Module *M,
|
||||
std::multimap<std::string, GlobalVariable *> &AppendingVars,
|
||||
std::string *ErrorMsg) {
|
||||
if (AppendingVars.empty()) return false; // Nothing to do.
|
||||
|
||||
|
||||
// Loop over the multimap of appending vars, processing any variables with the
|
||||
// same name, forming a new appending global variable with both of the
|
||||
// initializers merged together, then rewrite references to the old variables
|
||||
@ -735,7 +735,7 @@ static bool LinkAppendingVars(Module *M,
|
||||
GlobalVariable *G1 = First->second, *G2 = Second->second;
|
||||
const ArrayType *T1 = cast<ArrayType>(G1->getType()->getElementType());
|
||||
const ArrayType *T2 = cast<ArrayType>(G2->getType()->getElementType());
|
||||
|
||||
|
||||
// Check to see that they two arrays agree on type...
|
||||
if (T1->getElementType() != T2->getElementType())
|
||||
return Error(ErrorMsg,
|
||||
@ -803,7 +803,7 @@ static bool LinkAppendingVars(Module *M,
|
||||
// error occurs, true is returned and ErrorMsg (if not null) is set to indicate
|
||||
// the problem. Upon failure, the Dest module could be in a modified state, and
|
||||
// shouldn't be relied on to be consistent.
|
||||
bool
|
||||
bool
|
||||
Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
|
||||
assert(Dest != 0 && "Invalid Destination module");
|
||||
assert(Src != 0 && "Invalid Source Module");
|
||||
@ -824,7 +824,7 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
|
||||
if (!Src->getTargetTriple().empty() &&
|
||||
Dest->getTargetTriple() != Src->getTargetTriple())
|
||||
std::cerr << "WARNING: Linking two modules of different target triples!\n";
|
||||
|
||||
|
||||
// Update the destination module's dependent libraries list with the libraries
|
||||
// from the source module. There's no opportunity for duplicates here as the
|
||||
// Module ensures that duplicate insertions are discarded.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- lib/Linker/Linker.cpp - Basic Linker functionality ----------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains basic Linker functionality that all usages will need.
|
||||
@ -42,7 +42,7 @@ Linker::~Linker() {
|
||||
delete Composite;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
Linker::error(const std::string& message) {
|
||||
Error = message;
|
||||
if (!(Flags&QuietErrors)) {
|
||||
@ -99,23 +99,23 @@ Linker::releaseModule() {
|
||||
}
|
||||
|
||||
// LoadObject - Read in and parse the bytecode file named by FN and return the
|
||||
// module it contains (wrapped in an auto_ptr), or auto_ptr<Module>() and set
|
||||
// module it contains (wrapped in an auto_ptr), or auto_ptr<Module>() and set
|
||||
// Error if an error occurs.
|
||||
std::auto_ptr<Module>
|
||||
std::auto_ptr<Module>
|
||||
Linker::LoadObject(const sys::Path &FN) {
|
||||
std::string ParseErrorMessage;
|
||||
Module *Result = ParseBytecodeFile(FN.toString(), &ParseErrorMessage);
|
||||
if (Result)
|
||||
if (Result)
|
||||
return std::auto_ptr<Module>(Result);
|
||||
Error = "Bytecode file '" + FN.toString() + "' could not be loaded";
|
||||
if (ParseErrorMessage.size())
|
||||
if (ParseErrorMessage.size())
|
||||
Error += ": " + ParseErrorMessage;
|
||||
return std::auto_ptr<Module>();
|
||||
}
|
||||
|
||||
// IsLibrary - Determine if "Name" is a library in "Directory". Return
|
||||
// IsLibrary - Determine if "Name" is a library in "Directory". Return
|
||||
// a non-empty sys::Path if its found, an empty one otherwise.
|
||||
static inline sys::Path IsLibrary(const std::string& Name,
|
||||
static inline sys::Path IsLibrary(const std::string& Name,
|
||||
const sys::Path& Directory) {
|
||||
|
||||
assert(Directory.isDirectory() && "Need to specify a directory");
|
||||
@ -145,15 +145,15 @@ static inline sys::Path IsLibrary(const std::string& Name,
|
||||
/// FindLib - Try to convert Filename into the name of a file that we can open,
|
||||
/// if it does not already name a file we can open, by first trying to open
|
||||
/// Filename, then libFilename.[suffix] for each of a set of several common
|
||||
/// library suffixes, in each of the directories in LibPaths. Returns an empty
|
||||
/// library suffixes, in each of the directories in LibPaths. Returns an empty
|
||||
/// Path if no matching file can be found.
|
||||
///
|
||||
sys::Path
|
||||
Linker::FindLib(const std::string &Filename)
|
||||
sys::Path
|
||||
Linker::FindLib(const std::string &Filename)
|
||||
{
|
||||
// Determine if the pathname can be found as it stands.
|
||||
sys::Path FilePath(Filename);
|
||||
if (FilePath.readable() &&
|
||||
if (FilePath.readable() &&
|
||||
(FilePath.isArchive() || FilePath.isDynamicLibrary()))
|
||||
return FilePath;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Annotation.cpp - Implement the Annotation Classes -----------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the AnnotationManager class.
|
||||
@ -67,7 +67,7 @@ AnnotationID AnnotationManager::getID(const std::string &Name, Factory Fact,
|
||||
void *Data) {
|
||||
AnnotationID Result(getID(Name));
|
||||
registerAnnotationFactory(Result, Fact, Data);
|
||||
return Result;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// getName - This function is especially slow, but that's okay because it should
|
||||
@ -82,7 +82,7 @@ const std::string &AnnotationManager::getName(AnnotationID ID) { // ID -> Name
|
||||
}
|
||||
|
||||
// registerAnnotationFactory - This method is used to register a callback
|
||||
// function used to create an annotation on demand if it is needed by the
|
||||
// function used to create an annotation on demand if it is needed by the
|
||||
// Annotable::findOrCreateAnnotation method.
|
||||
//
|
||||
void AnnotationManager::registerAnnotationFactory(AnnotationID ID, AnnFactory F,
|
||||
@ -96,7 +96,7 @@ void AnnotationManager::registerAnnotationFactory(AnnotationID ID, AnnFactory F,
|
||||
// createAnnotation - Create an annotation of the specified ID for the
|
||||
// specified object, using a register annotation creation function.
|
||||
//
|
||||
Annotation *AnnotationManager::createAnnotation(AnnotationID ID,
|
||||
Annotation *AnnotationManager::createAnnotation(AnnotationID ID,
|
||||
const Annotable *Obj) {
|
||||
FactMapType::iterator I = getFactMap().find(ID.ID);
|
||||
if (I == getFactMap().end()) return 0;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- CommandLine.cpp - Command line parser implementation --------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class implements a command line argument processor that is useful when
|
||||
@ -68,7 +68,7 @@ static std::vector<Option*> &getPositionalOpts() {
|
||||
|
||||
static void AddArgument(const char *ArgName, Option *Opt) {
|
||||
if (getOption(ArgName)) {
|
||||
std::cerr << ProgramName << ": CommandLine Error: Argument '"
|
||||
std::cerr << ProgramName << ": CommandLine Error: Argument '"
|
||||
<< ArgName << "' defined more than once!\n";
|
||||
} else {
|
||||
// Add argument to the argument map!
|
||||
@ -78,7 +78,7 @@ static void AddArgument(const char *ArgName, Option *Opt) {
|
||||
|
||||
// RemoveArgument - It's possible that the argument is no longer in the map if
|
||||
// options have already been processed and the map has been deleted!
|
||||
//
|
||||
//
|
||||
static void RemoveArgument(const char *ArgName, Option *Opt) {
|
||||
if(getOpts().empty()) return;
|
||||
|
||||
@ -107,15 +107,15 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName,
|
||||
break;
|
||||
case ValueDisallowed:
|
||||
if (*Value != 0)
|
||||
return Handler->error(" does not allow a value! '" +
|
||||
return Handler->error(" does not allow a value! '" +
|
||||
std::string(Value) + "' specified.");
|
||||
break;
|
||||
case ValueOptional:
|
||||
case ValueOptional:
|
||||
break;
|
||||
default:
|
||||
std::cerr << ProgramName
|
||||
<< ": Bad ValueMask flag! CommandLine usage error:"
|
||||
<< Handler->getValueExpectedFlag() << "\n";
|
||||
default:
|
||||
std::cerr << ProgramName
|
||||
<< ": Bad ValueMask flag! CommandLine usage error:"
|
||||
<< Handler->getValueExpectedFlag() << "\n";
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
@ -124,7 +124,7 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName,
|
||||
return Handler->addOccurrence(i, ArgName, Value);
|
||||
}
|
||||
|
||||
static bool ProvidePositionalOption(Option *Handler, const std::string &Arg,
|
||||
static bool ProvidePositionalOption(Option *Handler, const std::string &Arg,
|
||||
int i) {
|
||||
int Dummy = i;
|
||||
return ProvideOption(Handler, Handler->ArgStr, Arg.c_str(), 0, 0, Dummy);
|
||||
@ -147,7 +147,7 @@ static inline bool isPrefixedOrGrouping(const Option *O) {
|
||||
//
|
||||
static Option *getOptionPred(std::string Name, unsigned &Length,
|
||||
bool (*Pred)(const Option*)) {
|
||||
|
||||
|
||||
Option *Op = getOption(Name);
|
||||
if (Op && Pred(Op)) {
|
||||
Length = Name.length();
|
||||
@ -236,7 +236,7 @@ void cl::ParseEnvironmentOptions(const char *progName, const char *envVar,
|
||||
// Check args.
|
||||
assert(progName && "Program name not specified");
|
||||
assert(envVar && "Environment variable name missing");
|
||||
|
||||
|
||||
// Get the environment variable they want us to parse options out of.
|
||||
const char *envValue = getenv (envVar);
|
||||
if (!envValue)
|
||||
@ -265,7 +265,7 @@ void cl::ParseEnvironmentOptions(const char *progName, const char *envVar,
|
||||
/// that as well.
|
||||
static Option *LookupOption(const char *&Arg, const char *&Value) {
|
||||
while (*Arg == '-') ++Arg; // Eat leading dashes
|
||||
|
||||
|
||||
const char *ArgEnd = Arg;
|
||||
while (*ArgEnd && *ArgEnd != '=')
|
||||
++ArgEnd; // Scan till end of argument name...
|
||||
@ -273,7 +273,7 @@ static Option *LookupOption(const char *&Arg, const char *&Value) {
|
||||
Value = ArgEnd;
|
||||
if (*Value) // If we have an equals sign...
|
||||
++Value; // Advance to value...
|
||||
|
||||
|
||||
if (*Arg == 0) return 0;
|
||||
|
||||
// Look up the option.
|
||||
@ -366,7 +366,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
// All of the positional arguments have been fulfulled, give the rest to
|
||||
// the consume after option... if it's specified...
|
||||
//
|
||||
if (PositionalVals.size() >= NumPositionalRequired &&
|
||||
if (PositionalVals.size() >= NumPositionalRequired &&
|
||||
ConsumeAfterOpt != 0) {
|
||||
for (++i; i < argc; ++i)
|
||||
PositionalVals.push_back(std::make_pair(argv[i],i));
|
||||
@ -402,7 +402,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
if (RealName.size() > 1) {
|
||||
unsigned Length = 0;
|
||||
Option *PGOpt = getOptionPred(RealName, Length, isPrefixedOrGrouping);
|
||||
|
||||
|
||||
// If the option is a prefixed option, then the value is simply the
|
||||
// rest of the name... so fall through to later processing, by
|
||||
// setting up the argument name flags and value fields.
|
||||
@ -415,13 +415,13 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
} else if (PGOpt) {
|
||||
// This must be a grouped option... handle them now.
|
||||
assert(isGrouping(PGOpt) && "Broken getOptionPred!");
|
||||
|
||||
|
||||
do {
|
||||
// Move current arg name out of RealName into RealArgName...
|
||||
std::string RealArgName(RealName.begin(),
|
||||
RealName.begin() + Length);
|
||||
RealName.erase(RealName.begin(), RealName.begin() + Length);
|
||||
|
||||
|
||||
// Because ValueRequired is an invalid flag for grouped arguments,
|
||||
// we don't need to pass argc/argv in...
|
||||
//
|
||||
@ -430,11 +430,11 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
int Dummy;
|
||||
ErrorParsing |= ProvideOption(PGOpt, RealArgName.c_str(),
|
||||
"", 0, 0, Dummy);
|
||||
|
||||
|
||||
// Get the next grouping option...
|
||||
PGOpt = getOptionPred(RealName, Length, isGrouping);
|
||||
} while (PGOpt && Length != RealName.size());
|
||||
|
||||
|
||||
Handler = PGOpt; // Ate all of the options.
|
||||
}
|
||||
}
|
||||
@ -473,13 +473,13 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
// active one...
|
||||
if (Handler->getFormattingFlag() == cl::Positional)
|
||||
ActivePositionalArg = Handler;
|
||||
else
|
||||
else
|
||||
ErrorParsing |= ProvideOption(Handler, ArgName, Value, argc, argv, i);
|
||||
}
|
||||
|
||||
// Check and handle positional arguments now...
|
||||
if (NumPositionalRequired > PositionalVals.size()) {
|
||||
std::cerr << ProgramName
|
||||
std::cerr << ProgramName
|
||||
<< ": Not enough positional command line arguments specified!\n"
|
||||
<< "Must specify at least " << NumPositionalRequired
|
||||
<< " positional arguments: See: " << argv[0] << " --help\n";
|
||||
@ -491,7 +491,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
unsigned ValNo = 0, NumVals = PositionalVals.size();
|
||||
for (unsigned i = 0, e = PositionalOpts.size(); i != e; ++i) {
|
||||
if (RequiresValue(PositionalOpts[i])) {
|
||||
ProvidePositionalOption(PositionalOpts[i], PositionalVals[ValNo].first,
|
||||
ProvidePositionalOption(PositionalOpts[i], PositionalVals[ValNo].first,
|
||||
PositionalVals[ValNo].second);
|
||||
ValNo++;
|
||||
--NumPositionalRequired; // We fulfilled our duty...
|
||||
@ -542,7 +542,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
PositionalVals[ValNo].second);
|
||||
ValNo++;
|
||||
}
|
||||
|
||||
|
||||
// Handle over all of the rest of the arguments to the
|
||||
// cl::ConsumeAfter command line option...
|
||||
for (; ValNo != PositionalVals.size(); ++ValNo)
|
||||
@ -552,7 +552,7 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
}
|
||||
|
||||
// Loop over args and make sure all required args are specified!
|
||||
for (std::map<std::string, Option*>::iterator I = Opts.begin(),
|
||||
for (std::map<std::string, Option*>::iterator I = Opts.begin(),
|
||||
E = Opts.end(); I != E; ++I) {
|
||||
switch (I->second->getNumOccurrencesFlag()) {
|
||||
case Required:
|
||||
@ -688,7 +688,7 @@ unsigned basic_parser_impl::getOptionWidth(const Option &O) const {
|
||||
return Len + 6;
|
||||
}
|
||||
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// to-be-maintained width is specified.
|
||||
//
|
||||
void basic_parser_impl::printOptionInfo(const Option &O,
|
||||
@ -709,7 +709,7 @@ void basic_parser_impl::printOptionInfo(const Option &O,
|
||||
//
|
||||
bool parser<bool>::parse(Option &O, const char *ArgName,
|
||||
const std::string &Arg, bool &Value) {
|
||||
if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
|
||||
if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
|
||||
Arg == "1") {
|
||||
Value = true;
|
||||
} else if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") {
|
||||
@ -727,7 +727,7 @@ bool parser<int>::parse(Option &O, const char *ArgName,
|
||||
const std::string &Arg, int &Value) {
|
||||
char *End;
|
||||
Value = (int)strtol(Arg.c_str(), &End, 0);
|
||||
if (*End != 0)
|
||||
if (*End != 0)
|
||||
return O.error(": '" + Arg + "' value invalid for integer argument!");
|
||||
return false;
|
||||
}
|
||||
@ -753,7 +753,7 @@ static bool parseDouble(Option &O, const std::string &Arg, double &Value) {
|
||||
const char *ArgStart = Arg.c_str();
|
||||
char *End;
|
||||
Value = strtod(ArgStart, &End);
|
||||
if (*End != 0)
|
||||
if (*End != 0)
|
||||
return O.error(": '" +Arg+ "' value invalid for floating point argument!");
|
||||
return false;
|
||||
}
|
||||
@ -808,7 +808,7 @@ unsigned generic_parser_base::getOptionWidth(const Option &O) const {
|
||||
}
|
||||
}
|
||||
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// printOptionInfo - Print out information about this option. The
|
||||
// to-be-maintained width is specified.
|
||||
//
|
||||
void generic_parser_base::printOptionInfo(const Option &O,
|
||||
@ -825,7 +825,7 @@ void generic_parser_base::printOptionInfo(const Option &O,
|
||||
}
|
||||
} else {
|
||||
if (O.HelpStr[0])
|
||||
std::cerr << " " << O.HelpStr << "\n";
|
||||
std::cerr << " " << O.HelpStr << "\n";
|
||||
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
|
||||
unsigned L = std::strlen(getOption(i));
|
||||
std::cerr << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ')
|
||||
@ -867,7 +867,7 @@ public:
|
||||
copy(getOpts().begin(), getOpts().end(), std::back_inserter(Options));
|
||||
|
||||
// Eliminate Hidden or ReallyHidden arguments, depending on ShowHidden
|
||||
Options.erase(std::remove_if(Options.begin(), Options.end(),
|
||||
Options.erase(std::remove_if(Options.begin(), Options.end(),
|
||||
std::ptr_fun(ShowHidden ? isReallyHidden : isHidden)),
|
||||
Options.end());
|
||||
|
||||
@ -928,7 +928,7 @@ class VersionPrinter {
|
||||
public:
|
||||
void operator=(bool OptionWasSpecified) {
|
||||
if (OptionWasSpecified) {
|
||||
std::cerr << "Low Level Virtual Machine (" << PACKAGE_NAME << ") "
|
||||
std::cerr << "Low Level Virtual Machine (" << PACKAGE_NAME << ") "
|
||||
<< PACKAGE_VERSION << " (see http://llvm.cs.uiuc.edu/)\n";
|
||||
getOpts().clear(); // Don't bother making option dtors remove from map.
|
||||
exit(1);
|
||||
@ -943,7 +943,7 @@ public:
|
||||
HelpPrinter NormalPrinter(false);
|
||||
HelpPrinter HiddenPrinter(true);
|
||||
|
||||
cl::opt<HelpPrinter, true, parser<bool> >
|
||||
cl::opt<HelpPrinter, true, parser<bool> >
|
||||
HOp("help", cl::desc("display available options (--help-hidden for more)"),
|
||||
cl::location(NormalPrinter), cl::ValueDisallowed);
|
||||
|
||||
@ -954,7 +954,7 @@ HHOp("help-hidden", cl::desc("display all available options"),
|
||||
// Define the --version option that prints out the LLVM version for the tool
|
||||
VersionPrinter VersionPrinterInstance;
|
||||
cl::opt<VersionPrinter, true, parser<bool> >
|
||||
VersOp("version", cl::desc("display the version"),
|
||||
VersOp("version", cl::desc("display the version"),
|
||||
cl::location(VersionPrinterInstance), cl::ValueDisallowed);
|
||||
|
||||
|
||||
@ -962,10 +962,10 @@ VersOp("version", cl::desc("display the version"),
|
||||
|
||||
// Utility function for printing the help message.
|
||||
void cl::PrintHelpMessage() {
|
||||
// This looks weird, but it actually prints the help message. The
|
||||
// This looks weird, but it actually prints the help message. The
|
||||
// NormalPrinter variable is a HelpPrinter and the help gets printed when
|
||||
// its operator= is invoked. That's because the "normal" usages of the
|
||||
// help printer is to be assigned true/false depending on whether the
|
||||
// help printer is to be assigned true/false depending on whether the
|
||||
// --help option was given or not. Since we're circumventing that we have
|
||||
// to make it look like --help was given, so we assign true.
|
||||
NormalPrinter = true;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- lib/Support/Compressor.cpp -------------------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the llvm::Compressor class, an abstraction for memory
|
||||
@ -26,7 +26,7 @@ enum CompressionTypes {
|
||||
COMP_TYPE_BZIP2 = '2',
|
||||
};
|
||||
|
||||
static int getdata(char*& buffer, size_t &size,
|
||||
static int getdata(char*& buffer, size_t &size,
|
||||
llvm::Compressor::OutputDataCallback* cb, void* context) {
|
||||
buffer = 0;
|
||||
size = 0;
|
||||
@ -36,7 +36,7 @@ static int getdata(char*& buffer, size_t &size,
|
||||
return result;
|
||||
}
|
||||
|
||||
static int getdata_uns(char*& buffer, unsigned &size,
|
||||
static int getdata_uns(char*& buffer, unsigned &size,
|
||||
llvm::Compressor::OutputDataCallback* cb, void* context) {
|
||||
size_t SizeOut;
|
||||
int Res = getdata(buffer, SizeOut, cb, context);
|
||||
@ -45,7 +45,7 @@ static int getdata_uns(char*& buffer, unsigned &size,
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== NULLCOMP - a compression like set of routines that just copies data
|
||||
//=== NULLCOMP - a compression like set of routines that just copies data
|
||||
//=== without doing any compression. This is provided so that if the
|
||||
//=== configured environment doesn't have a compression library the
|
||||
//=== program can still work, albeit using more data/memory.
|
||||
@ -121,26 +121,26 @@ namespace {
|
||||
|
||||
/// This structure is only used when a bytecode file is compressed.
|
||||
/// As bytecode is being decompressed, the memory buffer might need
|
||||
/// to be reallocated. The buffer allocation is handled in a callback
|
||||
/// to be reallocated. The buffer allocation is handled in a callback
|
||||
/// and this structure is needed to retain information across calls
|
||||
/// to the callback.
|
||||
/// @brief An internal buffer object used for handling decompression
|
||||
struct BufferContext {
|
||||
char* buff;
|
||||
size_t size;
|
||||
BufferContext(size_t compressedSize) {
|
||||
BufferContext(size_t compressedSize) {
|
||||
// Null to indicate malloc of a new block
|
||||
buff = 0;
|
||||
buff = 0;
|
||||
|
||||
// Compute the initial length of the uncompression buffer. Note that this
|
||||
// is twice the length of the compressed buffer and will be doubled again
|
||||
// in the callback for an initial allocation of 4x compressedSize. This
|
||||
// calculation is based on the typical compression ratio of bzip2 on LLVM
|
||||
// bytecode files which typically ranges in the 50%-75% range. Since we
|
||||
// typically get at least 50%, doubling is insufficient. By using a 4x
|
||||
// in the callback for an initial allocation of 4x compressedSize. This
|
||||
// calculation is based on the typical compression ratio of bzip2 on LLVM
|
||||
// bytecode files which typically ranges in the 50%-75% range. Since we
|
||||
// typically get at least 50%, doubling is insufficient. By using a 4x
|
||||
// multiplier on the first allocation, we minimize the impact of having to
|
||||
// copy the buffer on reallocation.
|
||||
size = compressedSize*2;
|
||||
size = compressedSize*2;
|
||||
}
|
||||
|
||||
/// trimTo - Reduce the size of the buffer down to the specified amount. This
|
||||
@ -154,7 +154,7 @@ struct BufferContext {
|
||||
|
||||
/// This function handles allocation of the buffer used for decompression of
|
||||
/// compressed bytecode files. It is called by Compressor::decompress which is
|
||||
/// called by BytecodeReader::ParseBytecode.
|
||||
/// called by BytecodeReader::ParseBytecode.
|
||||
static size_t callback(char*&buff, size_t &sz, void* ctxt){
|
||||
// Case the context variable to our BufferContext
|
||||
BufferContext* bc = reinterpret_cast<BufferContext*>(ctxt);
|
||||
@ -168,9 +168,9 @@ struct BufferContext {
|
||||
// Figure out what to return to the Compressor. If this is the first call,
|
||||
// then bc->buff will be null. In this case we want to return the entire
|
||||
// buffer because there was no previous allocation. Otherwise, when the
|
||||
// buffer is reallocated, we save the new base pointer in the
|
||||
// BufferContext.buff field but return the address of only the extension,
|
||||
// mid-way through the buffer (since its size was doubled). Furthermore,
|
||||
// buffer is reallocated, we save the new base pointer in the
|
||||
// BufferContext.buff field but return the address of only the extension,
|
||||
// mid-way through the buffer (since its size was doubled). Furthermore,
|
||||
// the sz result must be 1/2 the total size of the buffer.
|
||||
if (bc->buff == 0 ) {
|
||||
buff = bc->buff = new_buff;
|
||||
@ -189,18 +189,18 @@ struct BufferContext {
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
} // end anonymous namespace
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// This structure retains the context when compressing the bytecode file. The
|
||||
// WriteCompressedData function below uses it to keep track of the previously
|
||||
// filled chunk of memory (which it writes) and how many bytes have been
|
||||
// filled chunk of memory (which it writes) and how many bytes have been
|
||||
// written.
|
||||
struct WriterContext {
|
||||
// Initialize the context
|
||||
WriterContext(std::ostream*OS, size_t CS)
|
||||
WriterContext(std::ostream*OS, size_t CS)
|
||||
: chunk(0), sz(0), written(0), compSize(CS), Out(OS) {}
|
||||
|
||||
// Make sure we clean up memory
|
||||
@ -219,10 +219,10 @@ struct WriterContext {
|
||||
sz = 0;
|
||||
}
|
||||
|
||||
// This function is a callback used by the Compressor::compress function to
|
||||
// This function is a callback used by the Compressor::compress function to
|
||||
// allocate memory for the compression buffer. This function fulfills that
|
||||
// responsibility but also writes the previous (now filled) buffer out to the
|
||||
// stream.
|
||||
// stream.
|
||||
static size_t callback(char*& buffer, size_t &size, void* context) {
|
||||
// Cast the context to the structure it must point to.
|
||||
WriterContext* ctxt = reinterpret_cast<WriterContext*>(context);
|
||||
@ -259,7 +259,7 @@ struct WriterContext {
|
||||
} // end anonymous namespace
|
||||
|
||||
// Compress in one of three ways
|
||||
size_t Compressor::compress(const char* in, size_t size,
|
||||
size_t Compressor::compress(const char* in, size_t size,
|
||||
OutputDataCallback* cb, void* context) {
|
||||
assert(in && "Can't compress null buffer");
|
||||
assert(size && "Can't compress empty buffer");
|
||||
@ -355,7 +355,7 @@ size_t Compressor::compressToNewBuffer(const char* in, size_t size, char*&out) {
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
size_t
|
||||
Compressor::compressToStream(const char*in, size_t size, std::ostream& out) {
|
||||
// Set up the context and writer
|
||||
WriterContext ctxt(&out, size / 2);
|
||||
@ -460,7 +460,7 @@ size_t Compressor::decompress(const char *in, size_t size,
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
size_t
|
||||
Compressor::decompressToNewBuffer(const char* in, size_t size, char*&out) {
|
||||
BufferContext bc(size);
|
||||
size_t result = decompress(in,size,BufferContext::callback,(void*)&bc);
|
||||
@ -468,7 +468,7 @@ Compressor::decompressToNewBuffer(const char* in, size_t size, char*&out) {
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t
|
||||
size_t
|
||||
Compressor::decompressToStream(const char*in, size_t size, std::ostream& out){
|
||||
// Set up the context and writer
|
||||
WriterContext ctxt(&out,size / 2);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Debug.cpp - An easy way to add debug output to your code ----------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements a handle way of adding debugging information to your
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- Support/FileUtilities.cpp - File System Utilities ------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements a family of utility functions which are useful for doing
|
||||
@ -24,7 +24,7 @@ using namespace llvm;
|
||||
static bool isNumberChar(char C) {
|
||||
switch (C) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '.': case '+': case '-':
|
||||
case 'e':
|
||||
case 'E': return true;
|
||||
@ -47,7 +47,7 @@ static bool CompareNumbers(char *&F1P, char *&F2P, char *F1End, char *F2End,
|
||||
double AbsTolerance, double RelTolerance,
|
||||
std::string *ErrorMsg) {
|
||||
char *F1NumEnd, *F2NumEnd;
|
||||
double V1 = 0.0, V2 = 0.0;
|
||||
double V1 = 0.0, V2 = 0.0;
|
||||
|
||||
// If one of the positions is at a space and the other isn't, chomp up 'til
|
||||
// the end of the space.
|
||||
@ -142,7 +142,7 @@ int llvm::DiffFilesWithTolerance(const sys::Path &FileA,
|
||||
return 1;
|
||||
|
||||
// Now its safe to mmap the files into memory becasue both files
|
||||
// have a non-zero size.
|
||||
// have a non-zero size.
|
||||
sys::MappedFile F1(FileA);
|
||||
sys::MappedFile F2(FileB);
|
||||
F1.map();
|
||||
@ -171,7 +171,7 @@ int llvm::DiffFilesWithTolerance(const sys::Path &FileA,
|
||||
// If the files need padding, do so now.
|
||||
PadFileIfNeeded(File1Start, File1End, F1P);
|
||||
PadFileIfNeeded(File2Start, File2End, F2P);
|
||||
|
||||
|
||||
bool CompareFailed = false;
|
||||
while (1) {
|
||||
// Scan for the end of file or next difference.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- IsInf.cpp - Platform-independent wrapper around C99 isinf() -------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Config/config.h"
|
||||
@ -26,7 +26,7 @@ static int isinf(double x) { return !finite(x) && x==x; }
|
||||
#define isinf(X) (!_finite(X))
|
||||
#elif defined(_AIX) && defined(__GNUC__)
|
||||
// GCC's fixincludes seems to be removing the isinf() declaration from the
|
||||
// system header /usr/include/math.h
|
||||
// system header /usr/include/math.h
|
||||
# include <math.h>
|
||||
static int isinf(double x) { return !finite(x) && x==x; }
|
||||
#else
|
||||
|
@ -1,13 +1,13 @@
|
||||
//===-- IsNAN.cpp ---------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Platform-independent wrapper around C99 isnan().
|
||||
// Platform-independent wrapper around C99 isnan().
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- PluginLoader.cpp - Implement -load command line option ------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the -load <plugin> command line option handler.
|
||||
|
@ -1,12 +1,12 @@
|
||||
//===-- SlowOperationInformer.cpp - Keep the user informed ----------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
// This file implements the SlowOperationInformer class for the LLVM debugger.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Statistic.cpp - Easy way to expose stats information --------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the 'Statistic' class, which is designed to be an easy
|
||||
@ -78,9 +78,9 @@ void StatisticBase::destroy() const {
|
||||
// Figure out how long the biggest Value and Name fields are...
|
||||
unsigned MaxNameLen = 0, MaxValLen = 0;
|
||||
for (unsigned i = 0, e = AccumStats->size(); i != e; ++i) {
|
||||
MaxValLen = std::max(MaxValLen,
|
||||
MaxValLen = std::max(MaxValLen,
|
||||
(unsigned)(*AccumStats)[i].Value.length());
|
||||
MaxNameLen = std::max(MaxNameLen,
|
||||
MaxNameLen = std::max(MaxNameLen,
|
||||
(unsigned)std::strlen((*AccumStats)[i].Name));
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- StringExtras.cpp - Implement the StringExtras header --------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the StringExtras.h header
|
||||
@ -35,9 +35,9 @@ std::string llvm::getToken(std::string &Source, const char *Delimiters) {
|
||||
|
||||
// Create the return token.
|
||||
std::string Result = std::string(Source.begin()+Start, Source.begin()+End);
|
||||
|
||||
|
||||
// Erase the token that we read in.
|
||||
Source.erase(Source.begin(), Source.begin()+End);
|
||||
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- SystemUtils.cpp - Utilities for low-level system tasks -------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains functions used to do a variety of low-level, often
|
||||
@ -42,14 +42,14 @@ bool llvm::CheckBytecodeOutputToConsole(std::ostream* stream_to_check,
|
||||
#undef FindExecutable // needed on windows :(
|
||||
sys::Path llvm::FindExecutable(const std::string &ExeName,
|
||||
const std::string &ProgramPath) {
|
||||
// First check the directory that the calling program is in. We can do this
|
||||
// First check the directory that the calling program is in. We can do this
|
||||
// if ProgramPath contains at least one / character, indicating that it is a
|
||||
// relative path to bugpoint itself.
|
||||
sys::Path Result ( ProgramPath );
|
||||
Result.elideFile();
|
||||
if (!Result.isEmpty()) {
|
||||
Result.appendFile(ExeName);
|
||||
if (Result.executable())
|
||||
if (Result.executable())
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Timer.cpp - Interval Timing Support -------------------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Interval Timing implementation.
|
||||
@ -238,7 +238,7 @@ void Timer::print(const Timer &Total, std::ostream &OS) {
|
||||
if (Total.getProcessTime())
|
||||
printVal(getProcessTime(), Total.getProcessTime(), OS);
|
||||
printVal(Elapsed, Total.Elapsed, OS);
|
||||
|
||||
|
||||
OS << " ";
|
||||
|
||||
if (Total.MemUsed) {
|
||||
@ -294,10 +294,10 @@ void TimerGroup::removeTimer() {
|
||||
{ // Scope to contain Total timer... don't allow total timer to drop us to
|
||||
// zero timers...
|
||||
Timer Total("TOTAL");
|
||||
|
||||
|
||||
for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i)
|
||||
Total.sum(TimersToPrint[i]);
|
||||
|
||||
|
||||
// Print out timing header...
|
||||
*OutStream << "===" << std::string(73, '-') << "===\n"
|
||||
<< std::string(Padding, ' ') << Name << "\n"
|
||||
@ -329,11 +329,11 @@ void TimerGroup::removeTimer() {
|
||||
if (Total.getPeakMem())
|
||||
*OutStream << " -PeakMem-";
|
||||
*OutStream << " --- Name ---\n";
|
||||
|
||||
|
||||
// Loop through all of the timing data, printing it out...
|
||||
for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i)
|
||||
TimersToPrint[i].print(Total, *OutStream);
|
||||
|
||||
|
||||
Total.print(Total, *OutStream);
|
||||
*OutStream << std::endl; // Flush output
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- ToolRunner.cpp ----------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the interfaces described in the ToolRunner.h file.
|
||||
@ -36,8 +36,8 @@ static int RunProgramWithTimeout(const sys::Path &ProgramPath,
|
||||
redirects[0] = &StdInFile;
|
||||
redirects[1] = &StdOutFile;
|
||||
redirects[2] = &StdErrFile;
|
||||
|
||||
return
|
||||
|
||||
return
|
||||
sys::Program::ExecuteAndWait(ProgramPath, Args, 0, redirects, NumSeconds);
|
||||
}
|
||||
|
||||
@ -82,12 +82,12 @@ namespace {
|
||||
ToolArgs.clear ();
|
||||
if (Args) { ToolArgs = *Args; }
|
||||
}
|
||||
|
||||
|
||||
virtual int ExecuteProgram(const std::string &Bytecode,
|
||||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(),
|
||||
unsigned Timeout = 0);
|
||||
};
|
||||
@ -124,7 +124,7 @@ int LLI::ExecuteProgram(const std::string &Bytecode,
|
||||
std::cerr << "\n";
|
||||
);
|
||||
return RunProgramWithTimeout(sys::Path(LLIPath), &LLIArgs[0],
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
Timeout);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ void LLC::OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile) {
|
||||
std::cerr << " " << LLCArgs[i];
|
||||
std::cerr << "\n";
|
||||
);
|
||||
if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
|
||||
if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
|
||||
sys::Path(), sys::Path(), sys::Path()))
|
||||
ProcessFailure(sys::Path(LLCPath), &LLCArgs[0]);
|
||||
}
|
||||
@ -228,12 +228,12 @@ namespace {
|
||||
ToolArgs.clear ();
|
||||
if (Args) { ToolArgs = *Args; }
|
||||
}
|
||||
|
||||
|
||||
virtual int ExecuteProgram(const std::string &Bytecode,
|
||||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(), unsigned Timeout =0);
|
||||
};
|
||||
}
|
||||
@ -271,7 +271,7 @@ int JIT::ExecuteProgram(const std::string &Bytecode,
|
||||
);
|
||||
DEBUG(std::cerr << "\nSending output to " << OutputFile << "\n");
|
||||
return RunProgramWithTimeout(sys::Path(LLIPath), &JITArgs[0],
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
Timeout);
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ void CBE::OutputC(const std::string &Bytecode, sys::Path& OutputCFile) {
|
||||
std::cerr << " " << LLCArgs[i];
|
||||
std::cerr << "\n";
|
||||
);
|
||||
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
|
||||
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
|
||||
sys::Path()))
|
||||
ProcessFailure(LLCPath, &LLCArgs[0]);
|
||||
}
|
||||
@ -335,7 +335,7 @@ int CBE::ExecuteProgram(const std::string &Bytecode,
|
||||
|
||||
FileRemover CFileRemove(OutputCFile);
|
||||
|
||||
return gcc->ExecuteProgram(OutputCFile.toString(), Args, GCC::CFile,
|
||||
return gcc->ExecuteProgram(OutputCFile.toString(), Args, GCC::CFile,
|
||||
InputFile, OutputFile, SharedLibs, Timeout);
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ CBE *AbstractInterpreter::createCBE(const std::string &ProgramPath,
|
||||
const std::vector<std::string> *Args) {
|
||||
sys::Path LLCPath = FindExecutable("llc", ProgramPath);
|
||||
if (LLCPath.isEmpty()) {
|
||||
Message =
|
||||
Message =
|
||||
"Cannot find `llc' in executable directory or PATH!\n";
|
||||
return 0;
|
||||
}
|
||||
@ -377,7 +377,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
||||
// Specify the shared libraries to link in...
|
||||
for (unsigned i = 0, e = SharedLibs.size(); i != e; ++i)
|
||||
GCCArgs.push_back(SharedLibs[i].c_str());
|
||||
|
||||
|
||||
// Specify -x explicitly in case the extension is wonky
|
||||
GCCArgs.push_back("-x");
|
||||
if (fileType == CFile) {
|
||||
@ -423,7 +423,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
||||
|
||||
FileRemover OutputBinaryRemover(OutputBinary);
|
||||
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
Timeout);
|
||||
}
|
||||
|
||||
@ -458,9 +458,9 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
||||
"-O2", // Optimize the program a bit...
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
std::cout << "<gcc>" << std::flush;
|
||||
if (RunProgramWithTimeout(GCCPath, GCCArgs, sys::Path(), sys::Path(),
|
||||
if (RunProgramWithTimeout(GCCPath, GCCArgs, sys::Path(), sys::Path(),
|
||||
sys::Path())) {
|
||||
ProcessFailure(GCCPath, GCCArgs);
|
||||
return 1;
|
||||
|
@ -17,16 +17,16 @@
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product
|
||||
2. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
3. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
4. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
4. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
@ -85,7 +85,7 @@ extern "C" {
|
||||
#define BZ_OUTBUFF_FULL (-8)
|
||||
#define BZ_CONFIG_ERROR (-9)
|
||||
|
||||
typedef
|
||||
typedef
|
||||
struct {
|
||||
char *next_in;
|
||||
unsigned int avail_in;
|
||||
@ -102,7 +102,7 @@ typedef
|
||||
void *(*bzalloc)(void *,int,int);
|
||||
void (*bzfree)(void *,void *);
|
||||
void *opaque;
|
||||
}
|
||||
}
|
||||
bz_stream;
|
||||
|
||||
|
||||
@ -135,34 +135,34 @@ typedef
|
||||
|
||||
/*-- Core (low-level) library functions --*/
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
|
||||
bz_stream* strm,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
|
||||
bz_stream* strm,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
|
||||
bz_stream* strm,
|
||||
int action
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
|
||||
bz_stream* strm,
|
||||
int action
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
|
||||
bz_stream* strm
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
|
||||
bz_stream* strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
||||
bz_stream *strm,
|
||||
int verbosity,
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
||||
bz_stream *strm,
|
||||
int verbosity,
|
||||
int small
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
||||
bz_stream* strm
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
||||
bz_stream* strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
||||
bz_stream *strm
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
||||
bz_stream *strm
|
||||
);
|
||||
|
||||
|
||||
@ -174,64 +174,64 @@ BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
||||
|
||||
typedef void BZFILE;
|
||||
|
||||
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
|
||||
int* bzerror,
|
||||
FILE* f,
|
||||
int verbosity,
|
||||
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
|
||||
int* bzerror,
|
||||
FILE* f,
|
||||
int verbosity,
|
||||
int small,
|
||||
void* unused,
|
||||
int nUnused
|
||||
void* unused,
|
||||
int nUnused
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
|
||||
int* bzerror,
|
||||
BZFILE* b
|
||||
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
|
||||
int* bzerror,
|
||||
BZFILE* b
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void** unused,
|
||||
int* nUnused
|
||||
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void** unused,
|
||||
int* nUnused
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzRead) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
BZ_EXTERN int BZ_API(BZ2_bzRead) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
|
||||
int* bzerror,
|
||||
FILE* f,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
|
||||
int* bzerror,
|
||||
FILE* f,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in,
|
||||
unsigned int* nbytes_out
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in,
|
||||
unsigned int* nbytes_out
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in_lo32,
|
||||
unsigned int* nbytes_in_hi32,
|
||||
unsigned int* nbytes_out_lo32,
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in_lo32,
|
||||
unsigned int* nbytes_in_hi32,
|
||||
unsigned int* nbytes_out_lo32,
|
||||
unsigned int* nbytes_out_hi32
|
||||
);
|
||||
#endif
|
||||
@ -239,23 +239,23 @@ BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
||||
|
||||
/*-- Utility functions --*/
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
|
||||
char* dest,
|
||||
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
|
||||
char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
char* source,
|
||||
unsigned int sourceLen,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
|
||||
char* dest,
|
||||
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
|
||||
char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
char* source,
|
||||
unsigned int sourceLen,
|
||||
int small,
|
||||
int verbosity
|
||||
int small,
|
||||
int verbosity
|
||||
);
|
||||
|
||||
|
||||
@ -283,17 +283,17 @@ BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
|
||||
int fd,
|
||||
const char *mode
|
||||
);
|
||||
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzread) (
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzwrite) (
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzflush) (
|
||||
@ -305,7 +305,7 @@ BZ_EXTERN void BZ_API(BZ2_bzclose) (
|
||||
);
|
||||
|
||||
BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
|
||||
BZFILE *b,
|
||||
BZFILE *b,
|
||||
int *errnum
|
||||
);
|
||||
#endif
|
||||
|
@ -17,16 +17,16 @@
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product
|
||||
2. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
3. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
4. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
4. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
@ -91,7 +91,7 @@ typedef unsigned short UInt16;
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __inline__ /* */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
extern void BZ2_bz__AssertH__fail ( int errcode );
|
||||
@ -143,7 +143,7 @@ extern void bz_internal_error ( int errcode );
|
||||
#define BZ_HDR_Z 0x5a /* 'Z' */
|
||||
#define BZ_HDR_h 0x68 /* 'h' */
|
||||
#define BZ_HDR_0 0x30 /* '0' */
|
||||
|
||||
|
||||
/*-- Constants for the back end. --*/
|
||||
|
||||
#define BZ_MAX_ALPHA_SIZE 258
|
||||
@ -303,19 +303,19 @@ typedef
|
||||
|
||||
/*-- externs for compression. --*/
|
||||
|
||||
extern void
|
||||
extern void
|
||||
BZ2_blockSort ( EState* );
|
||||
|
||||
extern void
|
||||
extern void
|
||||
BZ2_compressBlock ( EState*, Bool );
|
||||
|
||||
extern void
|
||||
extern void
|
||||
BZ2_bsInitWrite ( EState* );
|
||||
|
||||
extern void
|
||||
extern void
|
||||
BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
|
||||
|
||||
extern void
|
||||
extern void
|
||||
BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
|
||||
|
||||
|
||||
@ -459,7 +459,7 @@ typedef
|
||||
Int32 save_N;
|
||||
Int32 save_curr;
|
||||
Int32 save_zt;
|
||||
Int32 save_zn;
|
||||
Int32 save_zn;
|
||||
Int32 save_zvec;
|
||||
Int32 save_zj;
|
||||
Int32 save_gSel;
|
||||
@ -509,13 +509,13 @@ typedef
|
||||
|
||||
/*-- externs for decompression. --*/
|
||||
|
||||
extern Int32
|
||||
extern Int32
|
||||
BZ2_indexIntoF ( Int32, Int32* );
|
||||
|
||||
extern Int32
|
||||
extern Int32
|
||||
BZ2_decompress ( DState* );
|
||||
|
||||
extern void
|
||||
extern void
|
||||
BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
|
||||
Int32, Int32, Int32 );
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- DynamicLibrary.cpp - Runtime link/load libraries --------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file implements the operating system DynamicLibrary concept.
|
||||
@ -33,7 +33,7 @@ using namespace llvm::sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static bool did_initialize_ltdl = false;
|
||||
@ -55,7 +55,7 @@ DynamicLibrary::DynamicLibrary() : handle(0) {
|
||||
|
||||
if (a_handle == 0)
|
||||
throw std::string("Can't open program as dynamic library");
|
||||
|
||||
|
||||
handle = a_handle;
|
||||
OpenedHandles.push_back(a_handle);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- MappedFile.cpp - MappedFile Support ----------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the mapped file concept.
|
||||
@ -19,7 +19,7 @@ using namespace sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- Memory.cpp - Memory Handling Support ---------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines some helpful functions for allocating memory and dealing
|
||||
@ -20,7 +20,7 @@ using namespace sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Path.cpp - Implement OS Path Concept --------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file implements the operating system Path concept.
|
||||
@ -20,7 +20,7 @@ using namespace sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Path
|
||||
@ -33,7 +33,7 @@ Path::GetLLVMConfigDir() {
|
||||
return GetLLVMDefaultConfigDir();
|
||||
}
|
||||
|
||||
LLVMFileType
|
||||
LLVMFileType
|
||||
sys::IdentifyFileType(const char*magic, unsigned length) {
|
||||
assert(magic && "Invalid magic number string");
|
||||
assert(length >=4 && "Invalid magic number length");
|
||||
@ -69,7 +69,7 @@ Path::isArchive() const {
|
||||
|
||||
bool
|
||||
Path::isDynamicLibrary() const {
|
||||
if (readable())
|
||||
if (readable())
|
||||
return hasMagicNumber("\177ELF");
|
||||
return false;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Process.cpp - Implement OS Process Concept --------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file implements the operating system Process concept.
|
||||
@ -19,7 +19,7 @@ using namespace sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- Program.cpp - Implement OS Program Concept --------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header file implements the operating system Program concept.
|
||||
@ -19,7 +19,7 @@ using namespace sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- Signals.cpp - Signal Handling support --------------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines some helpful functions for dealing with the possibility of
|
||||
@ -20,7 +20,7 @@ using namespace sys;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only TRULY operating system
|
||||
//=== independent code.
|
||||
//=== independent code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TimeValue.cpp - Implement OS TimeValue Concept ----------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the operating system TimeValue concept.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- Unix/SUS/Process.cpp - Linux Process Implementation ---- -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides the Linux specific implementation of the Process class.
|
||||
@ -14,14 +14,14 @@
|
||||
#include <unistd.h>
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//=== WARNING: Implementation here must contain only code specific to the
|
||||
//=== WARNING: Implementation here must contain only code specific to the
|
||||
//=== SUS (Single Unix Specification).
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace llvm {
|
||||
using namespace sys;
|
||||
|
||||
unsigned
|
||||
unsigned
|
||||
Process::GetPageSize() {
|
||||
static const long page_size = sysconf(_SC_PAGE_SIZE);
|
||||
return static_cast<unsigned>(page_size);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- llvm/System/Unix/Unix.h - Common Unix Include File -------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines things specific to Unix implementations.
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ASSERT_H
|
||||
#include <assert.h>
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- Win32/Win32.h - Common Win32 Include File ----------------*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// This file was developed by Reid Spencer and is distributed under the
|
||||
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines things specific to Unix implementations.
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===- MRegisterInfo.cpp - Target Register Information Implementation -----===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the MRegisterInfo interface.
|
||||
@ -38,6 +38,6 @@ std::vector<bool> MRegisterInfo::getAllocatableSet(MachineFunction &MF) const {
|
||||
Allocatable[*I] = true;
|
||||
}
|
||||
return Allocatable;
|
||||
}
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TargetData.cpp - Data size & alignment routines --------------------==//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines target properties related to datatype size/offset/alignment
|
||||
@ -43,7 +43,7 @@ StructLayout::StructLayout(const StructType *ST, const TargetData &TD) {
|
||||
StructSize = 0;
|
||||
|
||||
// Loop over each of the elements, placing them in memory...
|
||||
for (StructType::element_iterator TI = ST->element_begin(),
|
||||
for (StructType::element_iterator TI = ST->element_begin(),
|
||||
TE = ST->element_end(); TI != TE; ++TI) {
|
||||
const Type *Ty = *TI;
|
||||
unsigned char A;
|
||||
@ -95,7 +95,7 @@ unsigned StructLayout::getElementContainingOffset(uint64_t Offset) const {
|
||||
TargetData::TargetData(const std::string &TargetName,
|
||||
bool isLittleEndian, unsigned char PtrSize,
|
||||
unsigned char PtrAl, unsigned char DoubleAl,
|
||||
unsigned char FloatAl, unsigned char LongAl,
|
||||
unsigned char FloatAl, unsigned char LongAl,
|
||||
unsigned char IntAl, unsigned char ShortAl,
|
||||
unsigned char ByteAl, unsigned char BoolAl) {
|
||||
|
||||
@ -205,7 +205,7 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
|
||||
Size = Layout->StructSize; Alignment = Layout->StructAlignment;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
assert(0 && "Bad type for getTypeInfo!!!");
|
||||
return;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TargetFrameInfo.cpp - Implement machine frame interface -*- C++ -*-===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Implements the layout of a stack frame on the target machine.
|
||||
@ -22,7 +22,7 @@ using namespace llvm;
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
// This method adjusts a stack offset to meet alignment rules of target.
|
||||
int
|
||||
int
|
||||
TargetFrameInfo::adjustAlignment(int unalignedOffset, bool growUp,
|
||||
unsigned align) const {
|
||||
abort();
|
||||
@ -33,7 +33,7 @@ TargetFrameInfo::adjustAlignment(int unalignedOffset, bool growUp,
|
||||
// function. The frame contents are obtained from the MachineFunction object
|
||||
// for the given function. The rest must be implemented by the
|
||||
// machine-specific subclass.
|
||||
//
|
||||
//
|
||||
int
|
||||
TargetFrameInfo::getIncomingArgOffset(MachineFunction& mcInfo, unsigned argNum)
|
||||
const {
|
||||
@ -55,7 +55,7 @@ TargetFrameInfo::getFirstAutomaticVarOffset(MachineFunction& mcInfo,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
TargetFrameInfo::getRegSpillAreaOffset(MachineFunction& mcInfo, bool& growUp)
|
||||
const {
|
||||
abort();
|
||||
@ -68,7 +68,7 @@ TargetFrameInfo::getTmpAreaOffset(MachineFunction& mcInfo, bool& growUp) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
TargetFrameInfo::getDynamicAreaOffset(MachineFunction& mcInfo, bool& growUp)
|
||||
const {
|
||||
abort();
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TargetInstrInfo.cpp - Target Instruction Information --------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the TargetInstrInfo class.
|
||||
@ -20,7 +20,7 @@ using namespace llvm;
|
||||
namespace llvm {
|
||||
// External object describing the machine instructions Initialized only when
|
||||
// the TargetMachine class is created and reset when that class is destroyed.
|
||||
//
|
||||
//
|
||||
// FIXME: UGLY SPARCV9 HACK!
|
||||
const TargetInstrDescriptor* TargetInstrDescriptors = 0;
|
||||
}
|
||||
@ -49,13 +49,13 @@ bool TargetInstrInfo::constantFitsInImmedField(MachineOpCode opCode,
|
||||
// NEED TO HANDLE UNSIGNED VALUES SINCE THEY MAY BECOME MUCH
|
||||
// SMALLER AFTER CASTING TO SIGN-EXTENDED int, short, or char.
|
||||
// See CreateUIntSetInstruction in SparcInstrInfo.cpp.
|
||||
|
||||
|
||||
// Now check if the constant fits
|
||||
if (intValue <= (int64_t) maxImmedValue &&
|
||||
intValue >= -((int64_t) maxImmedValue+1))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TargetMachine.cpp - General Target Information ---------------------==//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file describes the general parts of a Target machine.
|
||||
@ -32,7 +32,7 @@ namespace {
|
||||
cl::desc("Print generated machine code"),
|
||||
cl::location(PrintMachineCode), cl::init(false));
|
||||
|
||||
cl::opt<bool, true>
|
||||
cl::opt<bool, true>
|
||||
DisableFPElim("disable-fp-elim",
|
||||
cl::desc("Disable frame pointer elimination optimization"),
|
||||
cl::location(NoFramePointerElim),
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- TargetMachineRegistry.cpp - Target Auto Registration Impl ---------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file exposes the RegisterTarget class, which TargetMachine
|
||||
@ -62,7 +62,7 @@ TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M,
|
||||
return 0;
|
||||
} else if (UsableTargets.size() == 1)
|
||||
return UsableTargets.back().second;
|
||||
|
||||
|
||||
// Otherwise, take the best target, but make sure we don't have to equally
|
||||
// good best targets.
|
||||
std::sort(UsableTargets.begin(), UsableTargets.end());
|
||||
@ -91,7 +91,7 @@ TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) {
|
||||
return 0;
|
||||
} else if (UsableTargets.size() == 1)
|
||||
return UsableTargets.back().second;
|
||||
|
||||
|
||||
// Otherwise, take the best target. If there is a tie, just pick one.
|
||||
unsigned MaxQual = UsableTargets.front().first;
|
||||
const Entry *MaxQualTarget = UsableTargets.front().second;
|
||||
@ -101,7 +101,7 @@ TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) {
|
||||
MaxQual = UsableTargets[i].first;
|
||||
MaxQualTarget = UsableTargets[i].second;
|
||||
}
|
||||
|
||||
|
||||
return MaxQualTarget;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- SchedInfo.cpp - Generic code to support target schedulers ----------==//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the generic part of a Scheduler description for a
|
||||
@ -21,7 +21,7 @@ using namespace llvm;
|
||||
|
||||
resourceId_t llvm::CPUResource::nextId = 0;
|
||||
static std::vector<CPUResource*> *CPUResourceMap = 0;
|
||||
|
||||
|
||||
CPUResource::CPUResource(const std::string& resourceName, int maxUsers)
|
||||
: rname(resourceName), rid(nextId++), maxNumUsers(maxUsers) {
|
||||
if(!CPUResourceMap)
|
||||
@ -45,8 +45,8 @@ inline static bool
|
||||
RUConflict(const std::vector<resourceId_t>& fromRVec,
|
||||
const std::vector<resourceId_t>& toRVec)
|
||||
{
|
||||
|
||||
unsigned fN = fromRVec.size(), tN = toRVec.size();
|
||||
|
||||
unsigned fN = fromRVec.size(), tN = toRVec.size();
|
||||
unsigned fi = 0, ti = 0;
|
||||
|
||||
while (fi < fN && ti < tN) {
|
||||
@ -62,14 +62,14 @@ RUConflict(const std::vector<resourceId_t>& fromRVec,
|
||||
|
||||
|
||||
static CycleCount_t
|
||||
ComputeMinGap(const InstrRUsage &fromRU,
|
||||
ComputeMinGap(const InstrRUsage &fromRU,
|
||||
const InstrRUsage &toRU)
|
||||
{
|
||||
CycleCount_t minGap = 0;
|
||||
|
||||
|
||||
if (fromRU.numBubbles > 0)
|
||||
minGap = fromRU.numBubbles;
|
||||
|
||||
|
||||
if (minGap < fromRU.numCycles) {
|
||||
// only need to check from cycle `minGap' onwards
|
||||
for (CycleCount_t gap=minGap; gap <= fromRU.numCycles-1; gap++) {
|
||||
@ -85,7 +85,7 @@ ComputeMinGap(const InstrRUsage &fromRU,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return minGap;
|
||||
}
|
||||
|
||||
@ -114,11 +114,11 @@ TargetSchedInfo::initializeResources()
|
||||
{
|
||||
assert(MAX_NUM_SLOTS >= (int)getMaxNumIssueTotal()
|
||||
&& "Insufficient slots for static data! Increase MAX_NUM_SLOTS");
|
||||
|
||||
|
||||
// First, compute common resource usage info for each class because
|
||||
// most instructions will probably behave the same as their class.
|
||||
// Cannot allocate a vector of InstrRUsage so new each one.
|
||||
//
|
||||
//
|
||||
std::vector<InstrRUsage> instrRUForClasses;
|
||||
instrRUForClasses.resize(numSchedClasses);
|
||||
for (InstrSchedClass sc = 0; sc < numSchedClasses; sc++) {
|
||||
@ -126,7 +126,7 @@ TargetSchedInfo::initializeResources()
|
||||
instrRUForClasses[sc].setMaxSlots(getMaxNumIssueTotal());
|
||||
instrRUForClasses[sc].setTo(classRUsages[sc]);
|
||||
}
|
||||
|
||||
|
||||
computeInstrResources(instrRUForClasses);
|
||||
computeIssueGaps(instrRUForClasses);
|
||||
}
|
||||
@ -138,21 +138,21 @@ TargetSchedInfo::computeInstrResources(const std::vector<InstrRUsage>&
|
||||
{
|
||||
int numOpCodes = mii->getNumOpcodes();
|
||||
instrRUsages.resize(numOpCodes);
|
||||
|
||||
|
||||
// First get the resource usage information from the class resource usages.
|
||||
for (MachineOpCode op = 0; op < numOpCodes; ++op) {
|
||||
InstrSchedClass sc = getSchedClass(op);
|
||||
assert(sc < numSchedClasses);
|
||||
instrRUsages[op] = instrRUForClasses[sc];
|
||||
}
|
||||
|
||||
|
||||
// Now, modify the resource usages as specified in the deltas.
|
||||
for (unsigned i = 0; i < numUsageDeltas; ++i) {
|
||||
MachineOpCode op = usageDeltas[i].opCode;
|
||||
assert(op < numOpCodes);
|
||||
instrRUsages[op].addUsageDelta(usageDeltas[i]);
|
||||
}
|
||||
|
||||
|
||||
// Then modify the issue restrictions as specified in the deltas.
|
||||
for (unsigned i = 0; i < numIssueDeltas; ++i) {
|
||||
MachineOpCode op = issueDeltas[i].opCode;
|
||||
@ -173,14 +173,14 @@ TargetSchedInfo::computeIssueGaps(const std::vector<InstrRUsage>&
|
||||
// First, compute issue gaps between pairs of classes based on common
|
||||
// resources usages for each class, because most instruction pairs will
|
||||
// usually behave the same as their class.
|
||||
//
|
||||
//
|
||||
int* classPairGaps =
|
||||
static_cast<int*>(alloca(sizeof(int) * numSchedClasses * numSchedClasses));
|
||||
for (InstrSchedClass fromSC=0; fromSC < numSchedClasses; fromSC++)
|
||||
for (InstrSchedClass toSC=0; toSC < numSchedClasses; toSC++) {
|
||||
int classPairGap = ComputeMinGap(instrRUForClasses[fromSC],
|
||||
instrRUForClasses[toSC]);
|
||||
classPairGaps[fromSC*numSchedClasses + toSC] = classPairGap;
|
||||
classPairGaps[fromSC*numSchedClasses + toSC] = classPairGap;
|
||||
}
|
||||
|
||||
// Now, for each pair of instructions, use the class pair gap if both
|
||||
@ -191,7 +191,7 @@ TargetSchedInfo::computeIssueGaps(const std::vector<InstrRUsage>&
|
||||
|
||||
for (MachineOpCode fromOp=0; fromOp < numOpCodes; fromOp++)
|
||||
for (MachineOpCode toOp=0; toOp < numOpCodes; toOp++) {
|
||||
int instrPairGap =
|
||||
int instrPairGap =
|
||||
(instrRUsages[fromOp].sameAsClass && instrRUsages[toOp].sameAsClass)
|
||||
? classPairGaps[getSchedClass(fromOp)*numSchedClasses + getSchedClass(toOp)]
|
||||
: ComputeMinGap(instrRUsages[fromOp], instrRUsages[toOp]);
|
||||
@ -208,23 +208,23 @@ TargetSchedInfo::computeIssueGaps(const std::vector<InstrRUsage>&
|
||||
void InstrRUsage::setTo(const InstrClassRUsage& classRU) {
|
||||
sameAsClass = true;
|
||||
isSingleIssue = classRU.isSingleIssue;
|
||||
breaksGroup = classRU.breaksGroup;
|
||||
breaksGroup = classRU.breaksGroup;
|
||||
numBubbles = classRU.numBubbles;
|
||||
|
||||
|
||||
for (unsigned i=0; i < classRU.numSlots; i++) {
|
||||
unsigned slot = classRU.feasibleSlots[i];
|
||||
assert(slot < feasibleSlots.size() && "Invalid slot specified!");
|
||||
this->feasibleSlots[slot] = true;
|
||||
}
|
||||
|
||||
|
||||
numCycles = classRU.totCycles;
|
||||
resourcesByCycle.resize(this->numCycles);
|
||||
|
||||
|
||||
for (unsigned i=0; i < classRU.numRUEntries; i++)
|
||||
for (unsigned c=classRU.V[i].startCycle, NC = c + classRU.V[i].numCycles;
|
||||
c < NC; c++)
|
||||
this->resourcesByCycle[c].push_back(classRU.V[i].resourceId);
|
||||
|
||||
|
||||
// Sort each resource usage vector by resourceId_t to speed up conflict
|
||||
// checking
|
||||
for (unsigned i=0; i < this->resourcesByCycle.size(); i++)
|
||||
@ -234,11 +234,11 @@ void InstrRUsage::setTo(const InstrClassRUsage& classRU) {
|
||||
// Add the extra resource usage requirements specified in the delta.
|
||||
// Note that a negative value of `numCycles' means one entry for that
|
||||
// resource should be deleted for each cycle.
|
||||
//
|
||||
//
|
||||
void InstrRUsage::addUsageDelta(const InstrRUsageDelta &delta) {
|
||||
int NC = delta.numCycles;
|
||||
sameAsClass = false;
|
||||
|
||||
|
||||
// resize the resources vector if more cycles are specified
|
||||
unsigned maxCycles = this->numCycles;
|
||||
maxCycles = std::max(maxCycles, delta.startCycle + abs(NC) - 1);
|
||||
@ -246,7 +246,7 @@ void InstrRUsage::addUsageDelta(const InstrRUsageDelta &delta) {
|
||||
this->resourcesByCycle.resize(maxCycles);
|
||||
this->numCycles = maxCycles;
|
||||
}
|
||||
|
||||
|
||||
if (NC >= 0)
|
||||
for (unsigned c=delta.startCycle, last=c+NC-1; c <= last; c++)
|
||||
this->resourcesByCycle[c].push_back(delta.resourceId);
|
||||
|
@ -1,10 +1,10 @@
|
||||
//===-- ToolRunner.cpp ----------------------------------------------------===//
|
||||
//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file was developed by the LLVM research group and is distributed under
|
||||
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the interfaces described in the ToolRunner.h file.
|
||||
@ -36,8 +36,8 @@ static int RunProgramWithTimeout(const sys::Path &ProgramPath,
|
||||
redirects[0] = &StdInFile;
|
||||
redirects[1] = &StdOutFile;
|
||||
redirects[2] = &StdErrFile;
|
||||
|
||||
return
|
||||
|
||||
return
|
||||
sys::Program::ExecuteAndWait(ProgramPath, Args, 0, redirects, NumSeconds);
|
||||
}
|
||||
|
||||
@ -82,12 +82,12 @@ namespace {
|
||||
ToolArgs.clear ();
|
||||
if (Args) { ToolArgs = *Args; }
|
||||
}
|
||||
|
||||
|
||||
virtual int ExecuteProgram(const std::string &Bytecode,
|
||||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(),
|
||||
unsigned Timeout = 0);
|
||||
};
|
||||
@ -124,7 +124,7 @@ int LLI::ExecuteProgram(const std::string &Bytecode,
|
||||
std::cerr << "\n";
|
||||
);
|
||||
return RunProgramWithTimeout(sys::Path(LLIPath), &LLIArgs[0],
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
Timeout);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ void LLC::OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile) {
|
||||
std::cerr << " " << LLCArgs[i];
|
||||
std::cerr << "\n";
|
||||
);
|
||||
if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
|
||||
if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
|
||||
sys::Path(), sys::Path(), sys::Path()))
|
||||
ProcessFailure(sys::Path(LLCPath), &LLCArgs[0]);
|
||||
}
|
||||
@ -228,12 +228,12 @@ namespace {
|
||||
ToolArgs.clear ();
|
||||
if (Args) { ToolArgs = *Args; }
|
||||
}
|
||||
|
||||
|
||||
virtual int ExecuteProgram(const std::string &Bytecode,
|
||||
const std::vector<std::string> &Args,
|
||||
const std::string &InputFile,
|
||||
const std::string &OutputFile,
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
const std::vector<std::string> &SharedLibs =
|
||||
std::vector<std::string>(), unsigned Timeout =0);
|
||||
};
|
||||
}
|
||||
@ -271,7 +271,7 @@ int JIT::ExecuteProgram(const std::string &Bytecode,
|
||||
);
|
||||
DEBUG(std::cerr << "\nSending output to " << OutputFile << "\n");
|
||||
return RunProgramWithTimeout(sys::Path(LLIPath), &JITArgs[0],
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
Timeout);
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ void CBE::OutputC(const std::string &Bytecode, sys::Path& OutputCFile) {
|
||||
std::cerr << " " << LLCArgs[i];
|
||||
std::cerr << "\n";
|
||||
);
|
||||
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
|
||||
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
|
||||
sys::Path()))
|
||||
ProcessFailure(LLCPath, &LLCArgs[0]);
|
||||
}
|
||||
@ -335,7 +335,7 @@ int CBE::ExecuteProgram(const std::string &Bytecode,
|
||||
|
||||
FileRemover CFileRemove(OutputCFile);
|
||||
|
||||
return gcc->ExecuteProgram(OutputCFile.toString(), Args, GCC::CFile,
|
||||
return gcc->ExecuteProgram(OutputCFile.toString(), Args, GCC::CFile,
|
||||
InputFile, OutputFile, SharedLibs, Timeout);
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ CBE *AbstractInterpreter::createCBE(const std::string &ProgramPath,
|
||||
const std::vector<std::string> *Args) {
|
||||
sys::Path LLCPath = FindExecutable("llc", ProgramPath);
|
||||
if (LLCPath.isEmpty()) {
|
||||
Message =
|
||||
Message =
|
||||
"Cannot find `llc' in executable directory or PATH!\n";
|
||||
return 0;
|
||||
}
|
||||
@ -377,7 +377,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
||||
// Specify the shared libraries to link in...
|
||||
for (unsigned i = 0, e = SharedLibs.size(); i != e; ++i)
|
||||
GCCArgs.push_back(SharedLibs[i].c_str());
|
||||
|
||||
|
||||
// Specify -x explicitly in case the extension is wonky
|
||||
GCCArgs.push_back("-x");
|
||||
if (fileType == CFile) {
|
||||
@ -423,7 +423,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
||||
|
||||
FileRemover OutputBinaryRemover(OutputBinary);
|
||||
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||
Timeout);
|
||||
}
|
||||
|
||||
@ -458,9 +458,9 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
||||
"-O2", // Optimize the program a bit...
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
std::cout << "<gcc>" << std::flush;
|
||||
if (RunProgramWithTimeout(GCCPath, GCCArgs, sys::Path(), sys::Path(),
|
||||
if (RunProgramWithTimeout(GCCPath, GCCArgs, sys::Path(), sys::Path(),
|
||||
sys::Path())) {
|
||||
ProcessFailure(GCCPath, GCCArgs);
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user