draperlaboratory / fracture

an architecture-independent decompiler to LLVM IR
Other
385 stars 47 forks source link

Auto-detect subtargets #13

Open skintigh opened 10 years ago

skintigh commented 10 years ago

When hitting an unknown instruction, it is often the case that a subtarget has not been specified in the LLVM Engine. I would like to add a feature that attempts to automatically detect the subtarget when this happens. The pseudo-algorithm would be like this:

Hit unknown instruction at location X
  foreach Subtarget in Target
    Set engine to turn on subtarget features
    if (decode X is successful)
      add Subtarget to list of successful subtargets
    endif
  endfor
  if(length of successful subtargets list is 0)
    print "Warning: Added subtarget feature name to support instruction at location X"
    return new subtarget to calling function
  else 
    print each subtarget and it's instruction decoding, then give the user a choice. 
  endif