Coder Social home page Coder Social logo

gen-ir's Introduction


Gen IR ๐Ÿงžโ€โ™‚๏ธ

Generate LLVM IR from an Xcode Build Log

This tool was heavily inspired by: https://blog.digitalrickshaw.com/2016/03/14/dumping-the-swift-ast-for-an-ios-project-part-2.html โค๏ธ

Prerequisites

To build the tool, you'll need Xcode 14 and macOS 12.5 or greater.

To install and run the tool, you'll need Homebrew, Xcode, and macOS 12 or greater.

Install

# If you don't have brew installed, install it: https://brew.sh/

# Add the brew tap to your local machine
brew tap NinjaLikesCheez/tap

# Install the tool
brew install gen-ir

๐ŸŽ‰ Done!

All installed! You can now use gen-ir on your system - be sure to run gen-ir --help to check the available commands and options.

Usage

โš ๏ธ Before you use

It's important to know that gen-ir requires that a full build log is provided.

This means a clean, fresh build of a project.

The compiler will not make a call for an object that doesn't need to be rebuilt, and we will not be able to parse what doesn't exist. Ensure you do a clean before your build otherwise gen-ir may miss some modules.

gen-ir takes a Xcode build log by two means, a path to a file or stdin:

# Path to build log (you can export from inside of Xcode too)
xcodebuild clean && \
xcodebuild build -project TestProject.xcodeproj -scheme TestProject -configuration Debug > build_log.txt

gen-ir build_log.txt ir_files/

# Stdin (you may need to redirect stderr to stdout here, Xcode is weird about writing to it sometimes)
xcodebuild clean && \
xcodebuild build -project TestProject.xcodeproj -scheme TestProject -configuration Debug | gen-ir - ir_files/

Building

gen-ir is implemented as a Swift Package, so you can either open Package.swift in Xcode, or build via the command line:

# Debug output: ./.build/debug/gen-ir
swift build

# Release output: ./.build/release/gen-ir
swift build -c release

gen-ir's People

Contributors

ninjalikescheez avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.