Minor changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@622 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2001-09-18 13:10:45 +00:00
parent 9bf654646e
commit 805eb96727

View File

@ -1,13 +1,13 @@
//===-- llc.cpp - Implement the LLVM Compiler -----------------------------===// //===-- llc.cpp - Implement the LLVM Compiler ----------------------------===//
// //
// This is the llc compiler driver. // This is the llc compiler driver.
// //
//===----------------------------------------------------------------------===// //===---------------------------------------------------------------------===//
#include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/Reader.h"
#include "llvm/Optimizations/Normalize.h" #include "llvm/Optimizations/Normalize.h"
#include "llvm/Target/Sparc.h" #include "llvm/Target/Sparc.h"
#include "llvm/Target/Machine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Method.h" #include "llvm/Method.h"
@ -15,39 +15,50 @@
cl::String InputFilename ("", "Input filename", cl::NoFlags, "-"); cl::String InputFilename ("", "Input filename", cl::NoFlags, "-");
cl::String OutputFilename("o", "Output filename", cl::NoFlags, ""); cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
static void NormalizeMethod(Method* method) {
//-------------------------- Internal Functions -----------------------------//
static void
NormalizeMethod(Method* method)
{
NormalizePhiConstantArgs(method); NormalizePhiConstantArgs(method);
} }
//===----------------------------------------------------------------------===//
//===---------------------------------------------------------------------===//
// Function main() // Function main()
//===----------------------------------------------------------------------===//
// //
// Entry point for the llc compiler. // Entry point for the llc compiler.
// //===---------------------------------------------------------------------===//
int main(int argc, char** argv) {
int
main(int argc, char** argv)
{
cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n"); cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n");
TargetMachine *Target = allocateSparcTargetMachine(); TargetMachine *Target = allocateSparcTargetMachine();
Module *M = ParseBytecodeFile(InputFilename); Module *M = ParseBytecodeFile(InputFilename);
if (M == 0) { if (M == 0)
cerr << "bytecode didn't read correctly.\n"; {
delete Target; cerr << "bytecode didn't read correctly.\n";
return 1; delete Target;
} return 1;
}
bool Failed = false; bool Failed = false;
for (Module::const_iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) { for (Module::const_iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI)
Method *Meth = *MI; {
Method *Meth = *MI;
NormalizeMethod(Meth); NormalizeMethod(Meth);
if (Target->compileMethod(Meth)) { if (Target->compileMethod(Meth))
cerr << "Error compiling " << InputFilename << "!\n"; {
Failed = true; cerr << "Error compiling " << InputFilename << "!\n";
break; Failed = true;
break;
}
} }
}
// Clean up and exit // Clean up and exit
delete M; delete M;
@ -55,3 +66,4 @@ int main(int argc, char** argv) {
return Failed; return Failed;
} }