{"id":48310058,"url":"https://github.com/ahueck/irprinter","last_synced_at":"2026-04-05T00:15:53.520Z","repository":{"id":53716925,"uuid":"148608159","full_name":"ahueck/irprinter","owner":"ahueck","description":"Explore the generated LLVM IR of a translation unit","archived":false,"fork":false,"pushed_at":"2026-02-01T16:26:35.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-01T21:14:26.598Z","etag":null,"topics":["c","cpp","llvm","llvm-clang","llvm-ir"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahueck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-09-13T08:37:57.000Z","updated_at":"2025-02-09T00:35:36.000Z","dependencies_parsed_at":"2022-09-23T13:23:14.214Z","dependency_job_id":null,"html_url":"https://github.com/ahueck/irprinter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ahueck/irprinter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahueck%2Firprinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahueck%2Firprinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahueck%2Firprinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahueck%2Firprinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahueck","download_url":"https://codeload.github.com/ahueck/irprinter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahueck%2Firprinter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31419642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","llvm","llvm-clang","llvm-ir"],"created_at":"2026-04-05T00:15:50.799Z","updated_at":"2026-04-05T00:15:53.103Z","avatar_url":"https://github.com/ahueck.png","language":"C++","readme":"# irprinter \u0026middot; ![License](https://img.shields.io/github/license/ahueck/irprinter)\n\n*irprinter* is a command-line tool for exploring LLVM Intermediate Representation (IR) code. \nIt allows users to print IR code for specific functions, which is particularly useful when dumping the entire translation unit would result in excessive output.\n\n\n## Features\n* Print LLVM IR code for a translation unit (C/C++) to the console.\n* Modify and add compiler flags (e.g., replace -g with -O2) and regenerate the (modified) IR.\n* Regex matching of (demangled) function names, with options to print:\n  1. Function signatures only.\n  2. Functions including their bodies.\n* Dump the entire IR code of the translation unit.\n\n## Usage\nSee [main.cpp](src/main.cpp) for all possible command-line arguments.\n\n### Example of using *irprinter*\nAssume *test.c* contains the code:\n\n  ```c\n  int foo () {\n      return 2; \n  }\n  int main() {\n      int val;\n      val = foo();    \n      return 0;\n  }\n  ```\n#### Using irprinter on test.c\nIn this example we\n  1) load `test.c` with standard Clang flags,\n  2) list all functions in `test.c`,\n  3) print the body of main,\n  4) optimize the code with `-O3`, and finally,\n  5) print the body of main again.\n\n```console\nahueck@sys:~/irprint/install$ ./bin/irprinter ../test.c --\nir-printer\u003e l\nMatch 1 [foo]:\n; Function Attrs: noinline nounwind optnone uwtable\ndefine i32 @foo() #0 \n\nMatch 2 [main]:\n; Function Attrs: noinline nounwind optnone uwtable\ndefine i32 @main() #0 \n\nir-printer\u003e p main\nMatch 1 [main]:\n; Function Attrs: noinline nounwind optnone uwtable\ndefine i32 @main() #0 {\n  %1 = alloca i32, align 4\n  %2 = alloca i32, align 4\n  store i32 0, i32* %1, align 4\n  %3 = call i32 @foo()\n  store i32 %3, i32* %2, align 4\n  ret i32 0\n}\n\nir-printer\u003e f -O3\nSet flag to -O3. Re-generating module...\nir-printer\u003e p main\nMatch 1 [main]:\n; Function Attrs: norecurse nounwind readnone uwtable\ndefine i32 @main() local_unnamed_addr #1 {\n  ret i32 0\n}\n\n```\n\n## How to build\n###### Requirements\n- CMake \u003e= 3.20\n- Clang/LLVM 12, 14, 18 (CMake needs to find the installation, see\n  the [LLVM CMake documentation](https://llvm.org/docs/CMake.html) or the [CI workflow](.github/workflows/basic-ci.yml))\n- C++17 compiler\n\n###### Build steps\nIn the root project folder, execute the following commands (see also [CI workflow](.github/workflows/basic-ci.yml))\n\n  ```\n  cmake -B build -DCMAKE_INSTALL_PREFIX=*your path*\n  cmake --build build --target install --parallel\n  ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahueck%2Firprinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahueck%2Firprinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahueck%2Firprinter/lists"}