Fare9 / KUNAI-static-analyzer

Tool aimed to provide a binary analysis of different file formats through the use of an Intermmediate Representation.
https://fare9.github.io/KUNAI-static-analyzer/
MIT License
136 stars 17 forks source link

Check algorithm of SSA Generation #65

Closed Fare9 closed 1 year ago

Fare9 commented 1 year ago

The algorithm of SSA Generation created the terminal instructions after generating all the basic blocks, probably it is possible to follow the next code: https://github.com/J-MR-T/blc/blob/50da676f8c3fa965d5c877534cb068bdfc95dcf2/src/mlir.cpp#L163-L187 generate the terminal instructions in the moment they are found and later apply the generation of basic block parameters.

Fare9 commented 1 year ago

In some of the presented test, current algorithm crash, for what I see in the given URL it's possible to obtain a reference to the list of arguments from each jump, so it would be possible to apply the algorithm from the SSA paper without the Phi nodes.

Fare9 commented 1 year ago

For the moment the next commit fix part of the issue, and include the code from the link: https://github.com/Fare9/KUNAI-static-analyzer/commit/297d8fb702bb5884fd9ea4d98e2c340cea5da911

Fare9 commented 1 year ago

Algorithm has been changed, and tested with different cases, now it should be working.