diff options
Diffstat (limited to 'tools/llc/llc.cpp')
-rw-r--r-- | tools/llc/llc.cpp | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index c4370d9..a331296 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -14,31 +14,25 @@ #include "llvm/Module.h" #include "llvm/Method.h" #include "llvm/Bytecode/Reader.h" -#include "llvm/Bytecode/Writer.h" #include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/Sparc.h" #include "llvm/Support/CommandLine.h" -cl::String InputFilename ("", "Input filename", cl::NoFlags, ""); +cl::String InputFilename ("", "Input filename", cl::NoFlags, "-"); cl::String OutputFilename("o", "Output filename", cl::NoFlags, ""); -static bool CompileModule(Module *module, TargetMachine &Target) { +static bool CompileModule(Module *M, TargetMachine &Target) { bool failed = false; - for (Module::MethodListType::const_iterator - methodIter = module->getMethodList().begin(); - methodIter != module->getMethodList().end(); - ++methodIter) - { - Method* method = *methodIter; + for (Module::const_iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) { + Method * method = *MI; - if (SelectInstructionsForMethod(method, Target)) - { - failed = true; - cerr << "Instruction selection failed for method " - << method->getName() << "\n\n"; - } + if (SelectInstructionsForMethod(method, Target)) { + failed = true; + cerr << "Instruction selection failed for method " + << method->getName() << "\n\n"; } + } return failed; } @@ -54,24 +48,17 @@ int main(int argc, char** argv) { cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n"); UltraSparc Target; - Module *module = ParseBytecodeFile(InputFilename.getValue()); + Module *module = ParseBytecodeFile(InputFilename); if (module == 0) { cerr << "bytecode didn't read correctly.\n"; return 1; } - bool failure = CompileModule(module, Target); - - if (failure) { - cerr << "Error compiling " - << InputFilename.getValue() << "!\n"; - delete module; - return 1; - } - - // Okay, we're done now... write out result... - // WriteBytecodeToFile(module, - // OutputFilename.getValue()); + if (CompileModule(module, Target)) { + cerr << "Error compiling " << InputFilename << "!\n"; + delete module; + return 1; + } // Clean up and exit delete module; |