From 8ff70c2635bfd4e02c0140a5dc9ca909fffba35a Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Wed, 4 Jul 2007 21:55:50 +0000 Subject: [PATCH] Pretty straightforward replacement of "bytecode" by "bitcode" performed on tools/ first, in order not to cause lethal damage git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37877 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/BugDriver.cpp | 10 ++-- tools/bugpoint/BugDriver.h | 22 ++++---- tools/bugpoint/CrashDebugger.cpp | 10 ++-- tools/bugpoint/ExecutionDriver.cpp | 68 +++++++++++------------ tools/bugpoint/ExtractFunction.cpp | 4 +- tools/bugpoint/Miscompilation.cpp | 50 ++++++++--------- tools/bugpoint/OptimizerDriver.cpp | 36 ++++++------ tools/bugpoint/ToolRunner.cpp | 40 ++++++------- tools/bugpoint/ToolRunner.h | 32 +++++------ tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 24 ++++---- 10 files changed, 148 insertions(+), 148 deletions(-) diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index 7ce1e689431..e8c47a569ba 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -69,7 +69,7 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, run_find_bugs(find_bugs), Timeout(timeout), MemoryLimit(memlimit) {} -/// ParseInputFile - Given a bytecode or assembly input filename, parse and +/// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// Module *llvm::ParseInputFile(const std::string &Filename) { @@ -88,8 +88,8 @@ Module *llvm::ParseInputFile(const std::string &Filename) { } // This method takes the specified list of LLVM input files, attempts to load -// them, either as assembly or bytecode, then link them together. It returns -// true on failure (if, for example, an input bytecode file could not be +// them, either as assembly or bitcode, then link them together. It returns +// true on failure (if, for example, an input bitcode file could not be // parsed), and false on success. // bool BugDriver::addSources(const std::vector &Filenames) { @@ -153,7 +153,7 @@ bool BugDriver::run() { // determine what the problem is. Does the optimization series crash the // compiler, or does it produce illegal code? We make the top-level // decision by trying to run all of the passes on the the input program, - // which should generate a bytecode file. If it does generate a bytecode + // which should generate a bitcode file. If it does generate a bitcode // file, then we know the compiler didn't crash, so try to diagnose a // miscompilation. if (!PassesToRun.empty()) { @@ -162,7 +162,7 @@ bool BugDriver::run() { return debugOptimizerCrash(); } - // Set up the execution environment, selecting a method to run LLVM bytecode. + // Set up the execution environment, selecting a method to run LLVM bitcode. if (initializeExecutionEnvironment()) return true; // Test to see if we have a code generator crash. diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h index ef8118c58f9..4652e37ba2f 100644 --- a/tools/bugpoint/BugDriver.h +++ b/tools/bugpoint/BugDriver.h @@ -107,9 +107,9 @@ public: const std::string &ReferenceOutput); /// compileSharedObject - This method creates a SharedObject from a given - /// BytecodeFile for debugging a code generator. + /// BitcodeFile for debugging a code generator. /// - std::string compileSharedObject(const std::string &BytecodeFile); + std::string compileSharedObject(const std::string &BitcodeFile); /// debugCodeGenerator - This method narrows down a module to a function or /// set of functions, using the CBE as a ``safe'' code generator for other @@ -167,7 +167,7 @@ public: /// generator (e.g., llc crashes), this will throw an exception. /// std::string executeProgram(std::string RequestedOutputFilename = "", - std::string Bytecode = "", + std::string Bitcode = "", const std::string &SharedObjects = "", AbstractInterpreter *AI = 0, bool *ProgramExitedNonzero = 0); @@ -191,14 +191,14 @@ public: /// is different, true is returned. If there is a problem with the code /// generator (e.g., llc crashes), this will throw an exception. /// - bool diffProgram(const std::string &BytecodeFile = "", + bool diffProgram(const std::string &BitcodeFile = "", const std::string &SharedObj = "", - bool RemoveBytecode = false); + bool RemoveBitcode = false); - /// EmitProgressBytecode - This function is used to output the current Program + /// EmitProgressBitcode - This function is used to output the current Program /// to a file named "bugpoint-ID.bc". /// - void EmitProgressBytecode(const std::string &ID, bool NoFlyer = false); + void EmitProgressBitcode(const std::string &ID, bool NoFlyer = false); /// deleteInstructionFromProgram - This method clones the current Program and /// deletes the specified instruction from the cloned module. It then runs a @@ -236,10 +236,10 @@ public: Module *runPassesOn(Module *M, const std::vector &Passes, bool AutoDebugCrashes = false); - /// runPasses - Run the specified passes on Program, outputting a bytecode + /// runPasses - Run the specified passes on Program, outputting a bitcode /// file and writting the filename into OutputFile if successful. If the /// optimizations fail for some reason (optimizer crashes), return true, - /// otherwise return false. If DeleteOutput is set to true, the bytecode is + /// otherwise return false. If DeleteOutput is set to true, the bitcode is /// deleted on success, and the filename string is undefined. This prints to /// cout a single line message indicating whether compilation was successful /// or failed, unless Quiet is set. @@ -258,7 +258,7 @@ public: bool runManyPasses(const std::vector &AllPasses); /// writeProgramToFile - This writes the current "Program" to the named - /// bytecode file. If an error occurs, true is returned. + /// bitcode file. If an error occurs, true is returned. /// bool writeProgramToFile(const std::string &Filename, Module *M = 0) const; @@ -282,7 +282,7 @@ private: bool initializeExecutionEnvironment(); }; -/// ParseInputFile - Given a bytecode or assembly input filename, parse and +/// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// Module *ParseInputFile(const std::string &InputFilename); diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 723134856dd..dac85386620 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -70,7 +70,7 @@ ReducePassList::doTest(std::vector &Prefix, BD.Program = ParseInputFile(PrefixOutput.toString()); if (BD.Program == 0) { - std::cerr << BD.getToolName() << ": Error reading bytecode file '" + std::cerr << BD.getToolName() << ": Error reading bitcode file '" << PrefixOutput << "'!\n"; exit(1); } @@ -396,7 +396,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs); if (GVs.size() < OldSize) - BD.EmitProgressBytecode("reduced-global-variables"); + BD.EmitProgressBitcode("reduced-global-variables"); } } } @@ -417,7 +417,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { ReduceCrashingFunctions(BD, TestFn).reduceList(Functions); if (Functions.size() < OldSize) - BD.EmitProgressBytecode("reduced-function"); + BD.EmitProgressBitcode("reduced-function"); } // Attempt to delete entire basic blocks at a time to speed up @@ -508,7 +508,7 @@ ExitLoops: } } - BD.EmitProgressBytecode("reduced-simplified"); + BD.EmitProgressBitcode("reduced-simplified"); return false; } @@ -532,7 +532,7 @@ bool BugDriver::debugOptimizerCrash(const std::string &ID) { << (PassesToRun.size() == 1 ? ": " : "es: ") << getPassesString(PassesToRun) << '\n'; - EmitProgressBytecode(ID); + EmitProgressBitcode(ID); return DebugACrash(*this, TestForOptimizerCrash); } diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 9a670c950c0..395ac2f6a14 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This file contains code used to execute the program utilizing one of the -// various ways of running LLVM bytecode. +// various ways of running LLVM bitcode. // //===----------------------------------------------------------------------===// @@ -181,25 +181,25 @@ bool BugDriver::initializeExecutionEnvironment() { /// generation crash testing. /// void BugDriver::compileProgram(Module *M) { - // Emit the program to a bytecode file... - sys::Path BytecodeFile ("bugpoint-test-program.bc"); + // Emit the program to a bitcode file... + sys::Path BitcodeFile ("bugpoint-test-program.bc"); std::string ErrMsg; - if (BytecodeFile.makeUnique(true,&ErrMsg)) { + if (BitcodeFile.makeUnique(true,&ErrMsg)) { std::cerr << ToolName << ": Error making unique filename: " << ErrMsg << "\n"; exit(1); } - if (writeProgramToFile(BytecodeFile.toString(), M)) { - std::cerr << ToolName << ": Error emitting bytecode to file '" - << BytecodeFile << "'!\n"; + if (writeProgramToFile(BitcodeFile.toString(), M)) { + std::cerr << ToolName << ": Error emitting bitcode to file '" + << BitcodeFile << "'!\n"; exit(1); } - // Remove the temporary bytecode file when we are done. - FileRemover BytecodeFileRemover(BytecodeFile); + // Remove the temporary bitcode file when we are done. + FileRemover BitcodeFileRemover(BitcodeFile); // Actually compile the program! - Interpreter->compileProgram(BytecodeFile.toString()); + Interpreter->compileProgram(BitcodeFile.toString()); } @@ -208,35 +208,35 @@ void BugDriver::compileProgram(Module *M) { /// filename may be optionally specified. /// std::string BugDriver::executeProgram(std::string OutputFile, - std::string BytecodeFile, + std::string BitcodeFile, const std::string &SharedObj, AbstractInterpreter *AI, bool *ProgramExitedNonzero) { if (AI == 0) AI = Interpreter; assert(AI && "Interpreter should have been created already!"); - bool CreatedBytecode = false; + bool CreatedBitcode = false; std::string ErrMsg; - if (BytecodeFile.empty()) { - // Emit the program to a bytecode file... + if (BitcodeFile.empty()) { + // Emit the program to a bitcode file... sys::Path uniqueFilename("bugpoint-test-program.bc"); if (uniqueFilename.makeUnique(true, &ErrMsg)) { std::cerr << ToolName << ": Error making unique filename: " << ErrMsg << "!\n"; exit(1); } - BytecodeFile = uniqueFilename.toString(); + BitcodeFile = uniqueFilename.toString(); - if (writeProgramToFile(BytecodeFile, Program)) { - std::cerr << ToolName << ": Error emitting bytecode to file '" - << BytecodeFile << "'!\n"; + if (writeProgramToFile(BitcodeFile, Program)) { + std::cerr << ToolName << ": Error emitting bitcode to file '" + << BitcodeFile << "'!\n"; exit(1); } - CreatedBytecode = true; + CreatedBitcode = true; } - // Remove the temporary bytecode file when we are done. - sys::Path BytecodePath (BytecodeFile); - FileRemover BytecodeFileRemover(BytecodePath, CreatedBytecode); + // Remove the temporary bitcode file when we are done. + sys::Path BitcodePath (BitcodeFile); + FileRemover BitcodeFileRemover(BitcodePath, CreatedBitcode); if (OutputFile.empty()) OutputFile = "bugpoint-execution-output"; @@ -261,11 +261,11 @@ std::string BugDriver::executeProgram(std::string OutputFile, int RetVal = 0; if (InterpreterSel == RunLLC || InterpreterSel == RunCBE || InterpreterSel == CBE_bug || InterpreterSel == LLC_Safe) - RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile, + RetVal = AI->ExecuteProgram(BitcodeFile, InputArgv, InputFile, OutputFile, AdditionalLinkerArgs, SharedObjs, Timeout, MemoryLimit); else - RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile, + RetVal = AI->ExecuteProgram(BitcodeFile, InputArgv, InputFile, OutputFile, std::vector(), SharedObjs, Timeout, MemoryLimit); @@ -311,12 +311,12 @@ std::string BugDriver::executeProgramWithCBE(std::string OutputFile) { return outFN; } -std::string BugDriver::compileSharedObject(const std::string &BytecodeFile) { +std::string BugDriver::compileSharedObject(const std::string &BitcodeFile) { assert(Interpreter && "Interpreter should have been created already!"); sys::Path OutputFile; // Using CBE - GCC::FileType FT = cbe->OutputCode(BytecodeFile, OutputFile); + GCC::FileType FT = cbe->OutputCode(BitcodeFile, OutputFile); std::string SharedObjectFile; if (gcc->MakeSharedObject(OutputFile.toString(), FT, @@ -360,20 +360,20 @@ bool BugDriver::createReferenceFile(Module *M, const std::string &Filename) { /// is different, true is returned. If there is a problem with the code /// generator (e.g., llc crashes), this will throw an exception. /// -bool BugDriver::diffProgram(const std::string &BytecodeFile, +bool BugDriver::diffProgram(const std::string &BitcodeFile, const std::string &SharedObject, - bool RemoveBytecode) { + bool RemoveBitcode) { bool ProgramExitedNonzero; // Execute the program, generating an output file... - sys::Path Output(executeProgram("", BytecodeFile, SharedObject, 0, + sys::Path Output(executeProgram("", BitcodeFile, SharedObject, 0, &ProgramExitedNonzero)); // If we're checking the program exit code, assume anything nonzero is bad. if (CheckProgramExitCode && ProgramExitedNonzero) { Output.eraseFromDisk(); - if (RemoveBytecode) - sys::Path(BytecodeFile).eraseFromDisk(); + if (RemoveBitcode) + sys::Path(BitcodeFile).eraseFromDisk(); return true; } @@ -392,9 +392,9 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile, // Remove the generated output. Output.eraseFromDisk(); - // Remove the bytecode file if we are supposed to. - if (RemoveBytecode) - sys::Path(BytecodeFile).eraseFromDisk(); + // Remove the bitcode file if we are supposed to. + if (RemoveBitcode) + sys::Path(BitcodeFile).eraseFromDisk(); return FilesDifferent; } diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 85da9294285..31f7fa4ca7d 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -139,7 +139,7 @@ Module *BugDriver::ExtractLoop(Module *M) { if (NewM == 0) { Module *Old = swapProgramIn(M); std::cout << "*** Loop extraction failed: "; - EmitProgressBytecode("loopextraction", true); + EmitProgressBitcode("loopextraction", true); std::cout << "*** Sorry. :( Please report a bug!\n"; swapProgramIn(Old); return 0; @@ -361,7 +361,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const if (Ret == 0) { std::cout << "*** Basic Block extraction failed, please report a bug!\n"; M = swapProgramIn(M); - EmitProgressBytecode("basicblockextractfail", true); + EmitProgressBitcode("basicblockextractfail", true); swapProgramIn(M); } return Ret; diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 534aa28533e..925a7a85ee9 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -59,17 +59,17 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, std::cout << "Checking to see if '" << getPassesString(Suffix) << "' compile correctly: "; - std::string BytecodeResult; - if (BD.runPasses(Suffix, BytecodeResult, false/*delete*/, true/*quiet*/)) { + std::string BitcodeResult; + if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) { std::cerr << " Error running this sequence of passes" << " on the input program!\n"; BD.setPassesToRun(Suffix); - BD.EmitProgressBytecode("pass-error", false); + BD.EmitProgressBitcode("pass-error", false); exit(BD.debugOptimizerCrash()); } // Check to see if the finished program matches the reference output... - if (BD.diffProgram(BytecodeResult, "", true /*delete bytecode*/)) { + if (BD.diffProgram(BitcodeResult, "", true /*delete bitcode*/)) { std::cout << " nope.\n"; if (Suffix.empty()) { std::cerr << BD.getToolName() << ": I'm confused: the test fails when " @@ -90,21 +90,21 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, // If it is not broken with the kept passes, it's possible that the prefix // passes must be run before the kept passes to break it. If the program // WORKS after the prefix passes, but then fails if running the prefix AND - // kept passes, we can update our bytecode file to include the result of the + // kept passes, we can update our bitcode file to include the result of the // prefix passes, then discard the prefix passes. // - if (BD.runPasses(Prefix, BytecodeResult, false/*delete*/, true/*quiet*/)) { + if (BD.runPasses(Prefix, BitcodeResult, false/*delete*/, true/*quiet*/)) { std::cerr << " Error running this sequence of passes" << " on the input program!\n"; BD.setPassesToRun(Prefix); - BD.EmitProgressBytecode("pass-error", false); + BD.EmitProgressBitcode("pass-error", false); exit(BD.debugOptimizerCrash()); } // If the prefix maintains the predicate by itself, only keep the prefix! - if (BD.diffProgram(BytecodeResult)) { + if (BD.diffProgram(BitcodeResult)) { std::cout << " nope.\n"; - sys::Path(BytecodeResult).eraseFromDisk(); + sys::Path(BitcodeResult).eraseFromDisk(); return KeepPrefix; } std::cout << " yup.\n"; // No miscompilation! @@ -112,13 +112,13 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, // Ok, so now we know that the prefix passes work, try running the suffix // passes on the result of the prefix passes. // - Module *PrefixOutput = ParseInputFile(BytecodeResult); + Module *PrefixOutput = ParseInputFile(BitcodeResult); if (PrefixOutput == 0) { - std::cerr << BD.getToolName() << ": Error reading bytecode file '" - << BytecodeResult << "'!\n"; + std::cerr << BD.getToolName() << ": Error reading bitcode file '" + << BitcodeResult << "'!\n"; exit(1); } - sys::Path(BytecodeResult).eraseFromDisk(); // No longer need the file on disk + sys::Path(BitcodeResult).eraseFromDisk(); // No longer need the file on disk // Don't check if there are no passes in the suffix. if (Suffix.empty()) @@ -129,16 +129,16 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, << getPassesString(Prefix) << "' passes: "; Module *OriginalInput = BD.swapProgramIn(PrefixOutput); - if (BD.runPasses(Suffix, BytecodeResult, false/*delete*/, true/*quiet*/)) { + if (BD.runPasses(Suffix, BitcodeResult, false/*delete*/, true/*quiet*/)) { std::cerr << " Error running this sequence of passes" << " on the input program!\n"; BD.setPassesToRun(Suffix); - BD.EmitProgressBytecode("pass-error", false); + BD.EmitProgressBitcode("pass-error", false); exit(BD.debugOptimizerCrash()); } // Run the result... - if (BD.diffProgram(BytecodeResult, "", true/*delete bytecode*/)) { + if (BD.diffProgram(BitcodeResult, "", true/*delete bitcode*/)) { std::cout << " nope.\n"; delete OriginalInput; // We pruned down the original input... return KeepSuffix; @@ -601,25 +601,25 @@ bool BugDriver::debugMiscompilation() { std::cout << "\n*** Found miscompiling pass" << (getPassesToRun().size() == 1 ? "" : "es") << ": " << getPassesString(getPassesToRun()) << '\n'; - EmitProgressBytecode("passinput"); + EmitProgressBitcode("passinput"); std::vector MiscompiledFunctions = DebugAMiscompilation(*this, TestOptimizer); - // Output a bunch of bytecode files for the user... - std::cout << "Outputting reduced bytecode files which expose the problem:\n"; + // Output a bunch of bitcode files for the user... + std::cout << "Outputting reduced bitcode files which expose the problem:\n"; Module *ToNotOptimize = CloneModule(getProgram()); Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize, MiscompiledFunctions); std::cout << " Non-optimized portion: "; ToNotOptimize = swapProgramIn(ToNotOptimize); - EmitProgressBytecode("tonotoptimize", true); + EmitProgressBitcode("tonotoptimize", true); setNewProgram(ToNotOptimize); // Delete hacked module. std::cout << " Portion that is input to optimizer: "; ToOptimize = swapProgramIn(ToOptimize); - EmitProgressBytecode("tooptimize"); + EmitProgressBitcode("tooptimize"); setNewProgram(ToOptimize); // Delete hacked module. return false; @@ -795,7 +795,7 @@ static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe) { exit(1); } if (BD.writeProgramToFile(TestModuleBC.toString(), Test)) { - std::cerr << "Error writing bytecode to `" << TestModuleBC << "'\nExiting."; + std::cerr << "Error writing bitcode to `" << TestModuleBC << "'\nExiting."; exit(1); } delete Test; @@ -809,7 +809,7 @@ static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe) { } if (BD.writeProgramToFile(SafeModuleBC.toString(), Safe)) { - std::cerr << "Error writing bytecode to `" << SafeModuleBC << "'\nExiting."; + std::cerr << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting."; exit(1); } std::string SharedObject = BD.compileSharedObject(SafeModuleBC.toString()); @@ -865,7 +865,7 @@ bool BugDriver::debugCodeGenerator() { } if (writeProgramToFile(TestModuleBC.toString(), ToCodeGen)) { - std::cerr << "Error writing bytecode to `" << TestModuleBC << "'\nExiting."; + std::cerr << "Error writing bitcode to `" << TestModuleBC << "'\nExiting."; exit(1); } delete ToCodeGen; @@ -879,7 +879,7 @@ bool BugDriver::debugCodeGenerator() { } if (writeProgramToFile(SafeModuleBC.toString(), ToNotCodeGen)) { - std::cerr << "Error writing bytecode to `" << SafeModuleBC << "'\nExiting."; + std::cerr << "Error writing bitcode to `" << SafeModuleBC << "'\nExiting."; exit(1); } std::string SharedObject = compileSharedObject(SafeModuleBC.toString()); diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 047901fd9f6..a3ce42ec71c 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -47,7 +47,7 @@ namespace { cl::desc("Run optimizations through valgrind")); } -/// writeProgramToFile - This writes the current "Program" to the named bytecode +/// writeProgramToFile - This writes the current "Program" to the named bitcode /// file. If an error occurs, true is returned. /// bool BugDriver::writeProgramToFile(const std::string &Filename, @@ -62,11 +62,11 @@ bool BugDriver::writeProgramToFile(const std::string &Filename, } -/// EmitProgressBytecode - This function is used to output the current Program +/// EmitProgressBitcode - This function is used to output the current Program /// to a file named "bugpoint-ID.bc". /// -void BugDriver::EmitProgressBytecode(const std::string &ID, bool NoFlyer) { - // Output the input to the current pass to a bytecode file, emit a message +void BugDriver::EmitProgressBitcode(const std::string &ID, bool NoFlyer) { + // Output the input to the current pass to a bitcode file, emit a message // telling the user how to reproduce it: opt -foo blah.bc // std::string Filename = "bugpoint-" + ID + ".bc"; @@ -75,7 +75,7 @@ void BugDriver::EmitProgressBytecode(const std::string &ID, bool NoFlyer) { return; } - cout << "Emitted bytecode to '" << Filename << "'\n"; + cout << "Emitted bitcode to '" << Filename << "'\n"; if (NoFlyer || PassesToRun.empty()) return; cout << "\n*** You can reproduce the problem with: "; cout << "opt " << Filename << " "; @@ -88,7 +88,7 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { std::ios::binary; std::ofstream OutFile(ChildOutput.c_str(), io_mode); if (!OutFile.good()) { - cerr << "Error opening bytecode file: " << ChildOutput << "\n"; + cerr << "Error opening bitcode file: " << ChildOutput << "\n"; return 1; } @@ -105,7 +105,7 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { // Check that the module is well formed on completion of optimization PM.add(createVerifierPass()); - // Write bytecode out to disk as the last step... + // Write bitcode out to disk as the last step... PM.add(CreateBitcodeWriterPass(OutFile)); // Run all queued passes. @@ -114,10 +114,10 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { return 0; } -/// runPasses - Run the specified passes on Program, outputting a bytecode file +/// runPasses - Run the specified passes on Program, outputting a bitcode file /// and writing the filename into OutputFile if successful. If the /// optimizations fail for some reason (optimizer crashes), return true, -/// otherwise return false. If DeleteOutput is set to true, the bytecode is +/// otherwise return false. If DeleteOutput is set to true, the bitcode is /// deleted on success, and the filename string is undefined. This prints to /// cout a single line message indicating whether compilation was successful or /// failed. @@ -147,7 +147,7 @@ bool BugDriver::runPasses(const std::vector &Passes, std::ios::binary; std::ofstream InFile(inputFilename.c_str(), io_mode); if (!InFile.good()) { - cerr << "Error opening bytecode file: " << inputFilename << "\n"; + cerr << "Error opening bitcode file: " << inputFilename << "\n"; return(1); } WriteBitcodeToFile(Program, InFile); @@ -192,7 +192,7 @@ bool BugDriver::runPasses(const std::vector &Passes, int result = sys::Program::ExecuteAndWait(prog, args, 0, 0, Timeout, MemoryLimit, &ErrMsg); - // If we are supposed to delete the bytecode file or if the passes crashed, + // If we are supposed to delete the bitcode file or if the passes crashed, // remove it now. This may fail if the file was never created, but that's ok. if (DeleteOutput || result != 0) sys::Path(OutputFilename).eraseFromDisk(); @@ -227,13 +227,13 @@ Module *BugDriver::runPassesOn(Module *M, const std::vector &Passes, bool AutoDebugCrashes) { Module *OldProgram = swapProgramIn(M); - std::string BytecodeResult; - if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/)) { + std::string BitcodeResult; + if (runPasses(Passes, BitcodeResult, false/*delete*/, true/*quiet*/)) { if (AutoDebugCrashes) { cerr << " Error running this sequence of passes" << " on the input program!\n"; delete OldProgram; - EmitProgressBytecode("pass-error", false); + EmitProgressBitcode("pass-error", false); exit(debugOptimizerCrash()); } swapProgramIn(OldProgram); @@ -243,12 +243,12 @@ Module *BugDriver::runPassesOn(Module *M, // Restore the current program. swapProgramIn(OldProgram); - Module *Ret = ParseInputFile(BytecodeResult); + Module *Ret = ParseInputFile(BitcodeResult); if (Ret == 0) { - cerr << getToolName() << ": Error reading bytecode file '" - << BytecodeResult << "'!\n"; + cerr << getToolName() << ": Error reading bitcode file '" + << BitcodeResult << "'!\n"; exit(1); } - sys::Path(BytecodeResult).eraseFromDisk(); // No longer need the file on disk + sys::Path(BitcodeResult).eraseFromDisk(); // No longer need the file on disk return Ret; } diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 163c36acb05..ac9a493cbff 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -108,7 +108,7 @@ namespace { if (Args) { ToolArgs = *Args; } } - virtual int ExecuteProgram(const std::string &Bytecode, + virtual int ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -120,7 +120,7 @@ namespace { }; } -int LLI::ExecuteProgram(const std::string &Bytecode, +int LLI::ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -143,7 +143,7 @@ int LLI::ExecuteProgram(const std::string &Bytecode, for (unsigned i = 0, e = ToolArgs.size(); i != e; ++i) LLIArgs.push_back(ToolArgs[i].c_str()); - LLIArgs.push_back(Bytecode.c_str()); + LLIArgs.push_back(Bitcode.c_str()); // Add optional parameters to the running program from Argv for (unsigned i=0, e = Args.size(); i != e; ++i) LLIArgs.push_back(Args[i].c_str()); @@ -177,9 +177,9 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const std::string &ProgPath, //===----------------------------------------------------------------------===// // LLC Implementation of AbstractIntepreter interface // -GCC::FileType LLC::OutputCode(const std::string &Bytecode, +GCC::FileType LLC::OutputCode(const std::string &Bitcode, sys::Path &OutputAsmFile) { - sys::Path uniqueFile(Bytecode+".llc.s"); + sys::Path uniqueFile(Bitcode+".llc.s"); std::string ErrMsg; if (uniqueFile.makeUnique(true, &ErrMsg)) { std::cerr << "Error making unique filename: " << ErrMsg << "\n"; @@ -196,7 +196,7 @@ GCC::FileType LLC::OutputCode(const std::string &Bytecode, LLCArgs.push_back ("-o"); LLCArgs.push_back (OutputAsmFile.c_str()); // Output to the Asm file LLCArgs.push_back ("-f"); // Overwrite as necessary... - LLCArgs.push_back (Bytecode.c_str()); // This is the input bytecode + LLCArgs.push_back (Bitcode.c_str()); // This is the input bitcode LLCArgs.push_back (0); std::cout << "" << std::flush; @@ -212,13 +212,13 @@ GCC::FileType LLC::OutputCode(const std::string &Bytecode, return GCC::AsmFile; } -void LLC::compileProgram(const std::string &Bytecode) { +void LLC::compileProgram(const std::string &Bitcode) { sys::Path OutputAsmFile; - OutputCode(Bytecode, OutputAsmFile); + OutputCode(Bitcode, OutputAsmFile); OutputAsmFile.eraseFromDisk(); } -int LLC::ExecuteProgram(const std::string &Bytecode, +int LLC::ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -228,7 +228,7 @@ int LLC::ExecuteProgram(const std::string &Bytecode, unsigned MemoryLimit) { sys::Path OutputAsmFile; - OutputCode(Bytecode, OutputAsmFile); + OutputCode(Bitcode, OutputAsmFile); FileRemover OutFileRemover(OutputAsmFile); std::vector GCCArgs(ArgsForGCC); @@ -274,7 +274,7 @@ namespace { if (Args) { ToolArgs = *Args; } } - virtual int ExecuteProgram(const std::string &Bytecode, + virtual int ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -287,7 +287,7 @@ namespace { }; } -int JIT::ExecuteProgram(const std::string &Bytecode, +int JIT::ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -310,7 +310,7 @@ int JIT::ExecuteProgram(const std::string &Bytecode, JITArgs.push_back("-load"); JITArgs.push_back(SharedLibs[i].c_str()); } - JITArgs.push_back(Bytecode.c_str()); + JITArgs.push_back(Bitcode.c_str()); // Add optional parameters to the running program from Argv for (unsigned i=0, e = Args.size(); i != e; ++i) JITArgs.push_back(Args[i].c_str()); @@ -342,9 +342,9 @@ AbstractInterpreter *AbstractInterpreter::createJIT(const std::string &ProgPath, return 0; } -GCC::FileType CBE::OutputCode(const std::string &Bytecode, +GCC::FileType CBE::OutputCode(const std::string &Bitcode, sys::Path &OutputCFile) { - sys::Path uniqueFile(Bytecode+".cbe.c"); + sys::Path uniqueFile(Bitcode+".cbe.c"); std::string ErrMsg; if (uniqueFile.makeUnique(true, &ErrMsg)) { std::cerr << "Error making unique filename: " << ErrMsg << "\n"; @@ -362,7 +362,7 @@ GCC::FileType CBE::OutputCode(const std::string &Bytecode, LLCArgs.push_back (OutputCFile.c_str()); // Output to the C file LLCArgs.push_back ("-march=c"); // Output C language LLCArgs.push_back ("-f"); // Overwrite as necessary... - LLCArgs.push_back (Bytecode.c_str()); // This is the input bytecode + LLCArgs.push_back (Bitcode.c_str()); // This is the input bitcode LLCArgs.push_back (0); std::cout << "" << std::flush; @@ -377,13 +377,13 @@ GCC::FileType CBE::OutputCode(const std::string &Bytecode, return GCC::CFile; } -void CBE::compileProgram(const std::string &Bytecode) { +void CBE::compileProgram(const std::string &Bitcode) { sys::Path OutputCFile; - OutputCode(Bytecode, OutputCFile); + OutputCode(Bitcode, OutputCFile); OutputCFile.eraseFromDisk(); } -int CBE::ExecuteProgram(const std::string &Bytecode, +int CBE::ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -392,7 +392,7 @@ int CBE::ExecuteProgram(const std::string &Bytecode, unsigned Timeout, unsigned MemoryLimit) { sys::Path OutputCFile; - OutputCode(Bytecode, OutputCFile); + OutputCode(Bitcode, OutputCFile); FileRemover CFileRemove(OutputCFile); diff --git a/tools/bugpoint/ToolRunner.h b/tools/bugpoint/ToolRunner.h index a4dc9150ca0..5cdd304f02e 100644 --- a/tools/bugpoint/ToolRunner.h +++ b/tools/bugpoint/ToolRunner.h @@ -80,7 +80,7 @@ public: //===---------------------------------------------------------------------===// /// AbstractInterpreter Class - Subclasses of this class are used to execute -/// LLVM bytecode in a variety of ways. This abstract interface hides this +/// LLVM bitcode in a variety of ways. This abstract interface hides this /// complexity behind a simple interface. /// class AbstractInterpreter { @@ -101,25 +101,25 @@ public: virtual ~AbstractInterpreter() {} - /// compileProgram - Compile the specified program from bytecode to executable + /// compileProgram - Compile the specified program from bitcode to executable /// code. This does not produce any output, it is only used when debugging /// the code generator. If the code generator fails, an exception should be /// thrown, otherwise, this function will just return. - virtual void compileProgram(const std::string &Bytecode) {} + virtual void compileProgram(const std::string &Bitcode) {} - /// OutputCode - Compile the specified program from bytecode to code + /// OutputCode - Compile the specified program from bitcode to code /// understood by the GCC driver (either C or asm). If the code generator /// fails, an exception should be thrown, otherwise, this function returns the /// type of code emitted. - virtual GCC::FileType OutputCode(const std::string &Bytecode, + virtual GCC::FileType OutputCode(const std::string &Bitcode, sys::Path &OutFile) { throw std::string("OutputCode not supported by this AbstractInterpreter!"); } - /// ExecuteProgram - Run the specified bytecode file, emitting output to the + /// ExecuteProgram - Run the specified bitcode file, emitting output to the /// specified filename. This returns the exit code of the program. /// - virtual int ExecuteProgram(const std::string &Bytecode, + virtual int ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -146,13 +146,13 @@ public: } ~CBE() { delete gcc; } - /// compileProgram - Compile the specified program from bytecode to executable + /// compileProgram - Compile the specified program from bitcode to executable /// code. This does not produce any output, it is only used when debugging /// the code generator. If the code generator fails, an exception should be /// thrown, otherwise, this function will just return. - virtual void compileProgram(const std::string &Bytecode); + virtual void compileProgram(const std::string &Bitcode); - virtual int ExecuteProgram(const std::string &Bytecode, + virtual int ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -163,11 +163,11 @@ public: unsigned Timeout = 0, unsigned MemoryLimit = 0); - /// OutputCode - Compile the specified program from bytecode to code + /// OutputCode - Compile the specified program from bitcode to code /// understood by the GCC driver (either C or asm). If the code generator /// fails, an exception should be thrown, otherwise, this function returns the /// type of code emitted. - virtual GCC::FileType OutputCode(const std::string &Bytecode, + virtual GCC::FileType OutputCode(const std::string &Bitcode, sys::Path &OutFile); }; @@ -187,13 +187,13 @@ public: } ~LLC() { delete gcc; } - /// compileProgram - Compile the specified program from bytecode to executable + /// compileProgram - Compile the specified program from bitcode to executable /// code. This does not produce any output, it is only used when debugging /// the code generator. If the code generator fails, an exception should be /// thrown, otherwise, this function will just return. - virtual void compileProgram(const std::string &Bytecode); + virtual void compileProgram(const std::string &Bitcode); - virtual int ExecuteProgram(const std::string &Bytecode, + virtual int ExecuteProgram(const std::string &Bitcode, const std::vector &Args, const std::string &InputFile, const std::string &OutputFile, @@ -204,7 +204,7 @@ public: unsigned Timeout = 0, unsigned MemoryLimit = 0); - virtual GCC::FileType OutputCode(const std::string &Bytecode, + virtual GCC::FileType OutputCode(const std::string &Bitcode, sys::Path &OutFile); }; diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index 1c96a2b3a8e..126a2edc402 100644 --- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -1,4 +1,4 @@ -//===-- llvm-bcanalyzer.cpp - Byte Code Analyzer --------------------------===// +//===-- llvm-bcanalyzer.cpp - Bitcode Analyzer --------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,22 +8,22 @@ //===----------------------------------------------------------------------===// // // This tool may be invoked in the following manner: -// llvm-bcanalyzer [options] - Read LLVM bytecode from stdin -// llvm-bcanalyzer [options] x.bc - Read LLVM bytecode from the x.bc file +// llvm-bcanalyzer [options] - Read LLVM bitcode from stdin +// llvm-bcanalyzer [options] x.bc - Read LLVM bitcode from the x.bc file // // Options: // --help - Output information about command line switches -// --dump - Dump low-level bytecode structure in readable format +// --dump - Dump low-level bitcode structure in readable format // -// This tool provides analytical information about a bytecode file. It is -// intended as an aid to developers of bytecode reading and writing software. It -// produces on std::out a summary of the bytecode file that shows various +// This tool provides analytical information about a bitcode file. It is +// intended as an aid to developers of bitcode reading and writing software. It +// produces on std::out a summary of the bitcode file that shows various // statistics about the contents of the file. By default this information is -// detailed and contains information about individual bytecode blocks and the +// detailed and contains information about individual bitcode blocks and the // functions in the module. -// The tool is also able to print a bytecode file in a straight forward text +// The tool is also able to print a bitcode file in a straight forward text // format that shows the containment and relationships of the information in -// the bytecode file (-dump option). +// the bitcode file (-dump option). // //===----------------------------------------------------------------------===// @@ -41,12 +41,12 @@ using namespace llvm; static cl::opt - InputFilename(cl::Positional, cl::desc(""), cl::init("-")); + InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt OutputFilename("-o", cl::init("-"), cl::desc("")); -static cl::opt Dump("dump", cl::desc("Dump low level bytecode trace")); +static cl::opt Dump("dump", cl::desc("Dump low level bitcode trace")); //===----------------------------------------------------------------------===// // Bitcode specific analysis. -- 2.34.1