- 
                Notifications
    You must be signed in to change notification settings 
- Fork 482
Ssa transform #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ssa transform #713
Conversation
| Hi! We have used it (for example in constant propagation), and it really gives instesting results 😄 Thanks to you and Niko Schmidt for the job! | 
2482b3f    to
    328c6f1      
    Compare
  
    | Hi! We are happy to hear this :) Go for it! | 
328c6f1    to
    b79ef9f      
    Compare
  
    b79ef9f    to
    ab6f9fc      
    Compare
  
    ab6f9fc    to
    be76045      
    Compare
  
    | PR seems ready to me | 
be76045    to
    5c708f8      
    Compare
  
    | Rebase done | 
        
          
                miasm2/analysis/ssa.py
              
                Outdated
          
        
      | Handling of | ||
| - variable generation | ||
| - variable renaming | ||
| - conversion of an DiGraphIR block into SSA | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now an "IRCFG" ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
        
          
                miasm2/analysis/ssa.py
              
                Outdated
          
        
      | def __init__(self, ircfg): | ||
| """ | ||
| Initialises generic class for SSA | ||
| :param ircfg: instance of DiGrpahIR | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| self.ssa_to_location = {} | ||
|  | ||
| # Don't SSA architecture's instruction pointer | ||
| self.immutable_ids = set([self.ircfg.IRDst]) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand, the architecture's instruction pointer (PC / RIP / ...) will be SSA. Is it wanted? If so, the comment is maybe misleading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reflected the comment
        
          
                miasm2/analysis/ssa.py
              
                Outdated
          
        
      | # Don't SSA architecture's instruction pointer | ||
| self.immutable_ids = set([self.ircfg.IRDst]) | ||
|  | ||
| @classmethod | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could even be a staticmethod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this code and used native expr function
| return expr | ||
|  | ||
|  | ||
| class SSAPath(SSABlock): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is SSAPath inheriting from SSABlock and not from SSA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you inherit reassemble_expr. Understanding a path as a sequence of block, this makes sense. A similar function on CFG-level would work differently since it has to consider all the different branches/phi nodes.
| Thanks for the PR and for the work on re-integration to the current codebase! | 
4f80bfd    to
    afb5d04      
    Compare
  
            
          
                miasm2/analysis/ssa.py
              
                Outdated
          
        
      |  | ||
| def __init__(self, ircfg): | ||
| """ | ||
| Initialises SSA class for directed acyclic graphs | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A last question for @mrphrazer
The acyclic here seems strange to me here.
I think it's possible to have cylces in even in ssa form, passing through a phi operator.
Did I miss something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, the implemention works as it is also for cycles. The comment is a relic from a project where I had to enforce acylcic graphs via loop unrolling.
Joint work with Niko Schmidt
afb5d04    to
    953676d      
    Compare
  
    | Thanks again @mrphrazer for this contribution, and @serpilliere for refactoring it. We were using it internally for some time now, and it's quite a nice tool! | 
No description provided.