mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
* Passes return true if they change something, not if they fail
* Convert opt to use Pass's and convert optimizations to pass structure git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@870 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
05e5e070ee
commit
6db0f4795c
@ -39,17 +39,17 @@ enum Opts {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
enum Opts OptID;
|
enum Opts OptID;
|
||||||
bool (*OptPtr)(Module *C);
|
Pass *ThePass;
|
||||||
} OptTable[] = {
|
} OptTable[] = {
|
||||||
{ dce , DoDeadCodeElimination },
|
{ dce , new opt::DeadCodeElimination() },
|
||||||
{ constprop, DoConstantPropogation },
|
{ constprop, new opt::ConstantPropogation() },
|
||||||
{ inlining , DoMethodInlining },
|
{ inlining , new opt::MethodInlining() },
|
||||||
{ strip , DoSymbolStripping },
|
{ strip , new opt::SymbolStripping() },
|
||||||
{ mstrip , DoFullSymbolStripping },
|
{ mstrip , new opt::FullSymbolStripping() },
|
||||||
{ indvars , DoInductionVariableCannonicalize },
|
{ indvars , new opt::InductionVariableCannonicalize() },
|
||||||
{ sccp , DoSCCP },
|
{ sccp , new opt::SCCPPass() },
|
||||||
{ adce , DoADCE },
|
{ adce , new opt::AgressiveDCE() },
|
||||||
{ raise , DoRaiseRepresentation },
|
{ raise , new opt::RaiseRepresentation() },
|
||||||
};
|
};
|
||||||
|
|
||||||
cl::String InputFilename ("", "Load <arg> file to optimize", cl::NoFlags, "-");
|
cl::String InputFilename ("", "Load <arg> file to optimize", cl::NoFlags, "-");
|
||||||
@ -86,7 +86,7 @@ int main(int argc, char **argv) {
|
|||||||
unsigned j;
|
unsigned j;
|
||||||
for (j = 0; j < sizeof(OptTable)/sizeof(OptTable[0]); ++j) {
|
for (j = 0; j < sizeof(OptTable)/sizeof(OptTable[0]); ++j) {
|
||||||
if (Opt == OptTable[j].OptID) {
|
if (Opt == OptTable[j].OptID) {
|
||||||
if (OptTable[j].OptPtr(C) && !Quiet)
|
if (OptTable[j].ThePass->run(C) && !Quiet)
|
||||||
cerr << OptimizationList.getArgName(Opt)
|
cerr << OptimizationList.getArgName(Opt)
|
||||||
<< " pass made modifications!\n";
|
<< " pass made modifications!\n";
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user