[LLVMdev] RE : RE : RE : Detect if a basicblock is part of a loop

Rinaldini Julien julien.rinaldini at heig-vd.ch
Fri Apr 27 06:24:06 PDT 2012


It try to put all basicblock in a switch in a loop, like that for example:

int main() {
    if(something)
         somethingelse:
    else
          another;
}

become:

int main() {
    while(true) {
        switch(var) {
            case 0:
                 if(something)
                    var+=1;
                 else:
                     var+=2;
                  break;
              case1:
                    somethingelse;
                    var = MAX;
                    break;
               case2:
                     another;
                      var = MAX;
               case MAX:
                      exit();
           }
      }
}

But I'm trying that before any attempt of code flattening, just to see if I can detect loop...

Cheers
________________________________________
De : 陳韋任 [chenwj at iis.sinica.edu.tw]
Date d'envoi : vendredi 27 avril 2012 15:05
À : Rinaldini Julien
Cc: llvmdev at cs.uiuc.edu
Objet : Re: [LLVMdev] RE :  RE :  Detect if a basicblock is part of a loop

> Yes it's my own lib... It contains some obfuscation's passes. The one I'm trying to make now is making code flattening!
                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^
  What's the flattening effect? Maybe try NOT to flat it first?

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj




More information about the llvm-dev mailing list