1 //===------------------------------------------------------------------------===
4 // This is the llc compiler driver.
6 //===------------------------------------------------------------------------===
8 #include "llvm/Bytecode/Reader.h"
9 #include "llvm/Optimizations/Normalize.h"
10 #include "llvm/CodeGen/Sparc.h"
11 #include "llvm/Support/CommandLine.h"
12 #include "llvm/Module.h"
13 #include "llvm/Method.h"
15 cl::String InputFilename ("", "Input filename", cl::NoFlags, "-");
16 cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
18 static void NormalizeMethod(Method* method) {
19 NormalizePhiConstantArgs(method);
23 static bool CompileModule(Module *M, TargetMachine &Target) {
24 for (Module::const_iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) {
27 NormalizeMethod(Meth);
29 if (Target.compileMethod(Meth)) return true;
37 //---------------------------------------------------------------------------
40 // Entry point for the llc compiler.
41 //---------------------------------------------------------------------------
43 int main(int argc, char** argv) {
44 cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n");
47 Module *module = ParseBytecodeFile(InputFilename);
49 cerr << "bytecode didn't read correctly.\n";
53 if (CompileModule(module, Target)) {
54 cerr << "Error compiling " << InputFilename << "!\n";