Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.20)
PROJECT(irprinter)
PROJECT(irprinter
VERSION 0.3
)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Alexander Hück
Copyright (c) 2018-2025 Alexander Hück

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# irprinter
# irprinter · ![License](https://img.shields.io/github/license/ahueck/irprinter)

*irprinter* is a small commandline-based tool developed to explore LLVM IR code.
The tool can print IR code of only specific functions, when dumping of the whole translation unit would produce too much output.
*irprinter* is a command-line tool for exploring LLVM Intermediate Representation (IR) code.
It allows users to print IR code for specific functions, which is particularly useful when dumping the entire translation unit would result in excessive output.


## Main features
Print LLVM IR code of a translation unit (C/C++) to a console.
- Ability to modify and add compiler flags (e.g., replace `-g` with `-O2`) and re-generate the (modified) IR
- Regex matching of (demangled) function names, with the ability to print
1) Function signatures only, and,
2) Functions including body
- Dump whole IR code of the TU
## Features
* Print LLVM IR code for a translation unit (C/C++) to the console.
* Modify and add compiler flags (e.g., replace -g with -O2) and regenerate the (modified) IR.
* Regex matching of (demangled) function names, with options to print:
1. Function signatures only.
2. Functions including their bodies.
* Dump the entire IR code of the translation unit.

## Usage
See [main.cpp](src/main.cpp) for all possible commandline arguments.
See [main.cpp](src/main.cpp) for all possible command-line arguments.

### Example of using *irprinter*
Assume *test.c* contains the code:
Expand Down Expand Up @@ -72,13 +72,13 @@ define i32 @main() local_unnamed_addr #1 {

## How to build
###### Requirements
- cmake >= 3.14
- Clang/LLVM 10.0 (cmake needs to find the installation, see
the [LLVM cmake documentation](https://llvm.org/docs/CMake.html#id14))
- C++ compiler with support for the C++17 standard, e.g., Clang 10
- CMake >= 3.20
- Clang/LLVM 12, 14, 18 (CMake needs to find the installation, see
the [LLVM CMake documentation](https://llvm.org/docs/CMake.html) or the [CI workflow](.github/workflows/basic-ci.yml))
- C++17 compiler

###### Build steps
In the root project folder, execute the following commands
In the root project folder, execute the following commands (see also [CI workflow](.github/workflows/basic-ci.yml))

```
cmake -B build -DCMAKE_INSTALL_PREFIX=*your path*
Expand Down