Skip to content
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

Add llvm-extract support for the LLVM graph creation API #173

Open
ChrisCummins opened this issue Jul 8, 2021 · 0 comments
Open

Add llvm-extract support for the LLVM graph creation API #173

ChrisCummins opened this issue Jul 8, 2021 · 0 comments
Labels
Datasets Graph and text datasets Enhancement New feature or request

Comments

@ChrisCummins
Copy link
Owner

ChrisCummins commented Jul 8, 2021

🚀 Feature

This feature request is to make it easy to construct ProGraML from subsets of LLVM-IRs by integrating with llvm-extract.

Motivation

For some use cases, we may want to construct a partial graph of a program. E.g. to construct the graph for a single function. This is easy to do using llvm-extract, but is not part of the ProGraML API. Lets say we have a program with two functions 'A' and 'B'. First compile the program down to LLVM-IR:

$ echo 'int A() { return 5; } int B() { return 10; }' | clang -xc - -emit-llvm -c -S -o ir.ll

Then use llvm-extract tool to pull out only the function you want. We can then use the normal ProGraML llvm2graph tool to generate the graph of just this function (and its transitive deps):

$ llvm-extract --func=A ir.ll -S | llvm2graph

Pitch

Add a set of arguments to the LLVM creation ops that automatically invoke llvm-extract to pull out the required program fragment. E.g.

G = programl.from_llvm_ir(my_program, function="A")
@ChrisCummins ChrisCummins added the Enhancement New feature or request label Jul 8, 2021
@ChrisCummins ChrisCummins added the Datasets Graph and text datasets label Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datasets Graph and text datasets Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant