mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Add calls to NormalizeMethod() and to ScheduleInstructionsWithSSA().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@404 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
59e3b8220a
commit
14335835f1
@ -14,47 +14,75 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Method.h"
|
#include "llvm/Method.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
|
#include "llvm/Optimizations/Normalize.h"
|
||||||
#include "llvm/CodeGen/InstrSelection.h"
|
#include "llvm/CodeGen/InstrSelection.h"
|
||||||
|
#include "llvm/CodeGen/InstrScheduling.h"
|
||||||
#include "llvm/CodeGen/Sparc.h"
|
#include "llvm/CodeGen/Sparc.h"
|
||||||
#include "llvm/Support/CommandLine.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, "");
|
cl::String OutputFilename("o", "Output filename", cl::NoFlags, "");
|
||||||
|
|
||||||
static bool CompileModule(Module *M, TargetMachine &Target) {
|
|
||||||
|
void
|
||||||
|
NormalizeMethod(Method* method)
|
||||||
|
{
|
||||||
|
NormalizePhiConstantArgs(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
CompileModule(Module *M, TargetMachine &target)
|
||||||
|
{
|
||||||
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 * method = *MI;
|
{
|
||||||
|
Method* method = *MI;
|
||||||
|
|
||||||
if (SelectInstructionsForMethod(method, Target)) {
|
NormalizeMethod(method);
|
||||||
failed = true;
|
|
||||||
cerr << "Instruction selection failed for method "
|
failed = SelectInstructionsForMethod(method, target);
|
||||||
<< method->getName() << "\n\n";
|
if (failed)
|
||||||
|
{
|
||||||
|
cerr << "Instruction selection failed for method "
|
||||||
|
<< method->getName() << "\n\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
failed = ScheduleInstructionsWithSSA(method, target);
|
||||||
|
if (failed)
|
||||||
|
{
|
||||||
|
cerr << "Instruction scheduling before allocation failed for method "
|
||||||
|
<< method->getName() << "\n\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return failed;
|
return failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Function main()
|
// Function main()
|
||||||
//
|
//
|
||||||
// Entry point for the driver.
|
// 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");
|
||||||
UltraSparc Target;
|
UltraSparc target;
|
||||||
|
|
||||||
Module *module = ParseBytecodeFile(InputFilename);
|
Module *module = ParseBytecodeFile(InputFilename);
|
||||||
if (module == 0) {
|
if (module == 0) {
|
||||||
cerr << "bytecode didn't read correctly.\n";
|
cerr << "bytecode didn't read correctly.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompileModule(module, Target)) {
|
if (CompileModule(module, target)) {
|
||||||
cerr << "Error compiling " << InputFilename << "!\n";
|
cerr << "Error compiling " << InputFilename << "!\n";
|
||||||
delete module;
|
delete module;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user