⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loopinv.dcf

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 DCF
字号:
// loop invariant code motionclass Program {  int gl;  int ai[1];  boolean foo(int inp) {    gl = gl + 1;    inp = inp + 1;    return (inp < 14);  }  void main() {    int a,b,c,d,e,f;    gl = 0;    ai[0] = -1;    callout("printf","A? ");    a = callout("readint");    callout("printf","B? ");    b = callout("readint");    callout("printf","C? ");    c = callout("readint");    while (foo((a+b)+gl)) { // the a+b should be moved      f = f + 1; // should not be moved      c = a + b; // may be moved;      d = gl + b; // should not be moved      e = f + b;  // should not be moved    }    while (f < 0) {      d = -1;    // should be moved but not executed since f < 0 is false.      f = ai[0]; // bounds check can be moved, but not the failure jump    }    callout("printf", "a: %d  ", a);    callout("printf", "b: %d  ", b);    callout("printf", "c: %d  ", c);    callout("printf", "d: %d  ", d);    callout("printf", "e: %d  ", e);    callout("printf", "f: %d  ", f);    callout("printf", "gl: %d\n", gl);        }}          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -