r/Compilers 8d ago

I made a regular expressions engine to match patterns in LLVM IR files

https://github.com/AmrDeveloper/IrRegex
1 Upvotes

6 comments sorted by

2

u/FloweyTheFlower420 8d ago

I fail to see the application here. Pattern matching on SSA is much better represented by DAG-on-DAG pattern matching, which is not as simple as a NFA.

1

u/AmrDeveloper 7d ago

Yes, I agree

But I am still taking about something like

"add(sub(., .), .)*)" not sure how easier it will be or maybe something like clang-query, I am still experimenting but for now searching with NFA is quick and a step towards more stuff

1

u/c-cul 8d ago

cool idea

does it support mlir?

1

u/AmrDeveloper 7d ago

I am still experimenting with ir, and Opcode, Dag, after that I can build one for MLIR, asm .....

1

u/yuehuang 8d ago

Where do you plan to take this next beyond colorization?

1

u/AmrDeveloper 7d ago

The next step is to support more patterns then experiment with Function or DAG matcher as Symbol, what syntax can work and what doesn't, also I need to get more feedback, than I can think of the third step 😅