# Using Numba to compile a Python algorithm into target assembly

**URL:** <https://numba.discourse.group/t/using-numba-to-compile-a-python-algorithm-into-target-assembly/2000>\
**Category:** Numba\
**Created:** [June 23, 2023, 9:42am UTC](https://numba.discourse.group/t/using-numba-to-compile-a-python-algorithm-into-target-assembly/2000 "2023-06-23T09:42:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![guilherme](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/guilherme/32/111_2.png) [@guilherme](https://numba.discourse.group/u/guilherme)\
**Post date:** [June 26, 2023, 3:18pm UTC](https://numba.discourse.group/t/using-numba-to-compile-a-python-algorithm-into-target-assembly/2000/2 "2023-06-26T15:18:36Z")

</div>

Hi @thk123,

I maintain a tool called RBC that does something along the lines of what you described. It also ships with a partial [implementation](https://github.com/xnd-project/rbc/blob/main/rbc/nrt.py) of the Numba Runtime written in LLVM IR.

> [@thk123](#):
>
> Docs say the Ahead of Time compilation is deprecated - what is planned to replace it?

AOT will be replaced by [PIXIE](https://numba.discourse.group/t/proposal-development-focus-for-2023h1/1773#a-jit-friendly-shared-library-format-4)

> What is the motivation for some of the Numba runtime being generated through LLVM IR, rather than simply including them in nrt.cpp (e.g. `NRT_MemInfo_data_fast`)?

I **guess** it is because LLVM can inline this function.

> Is there a way to get the full LLVM IR for a function and everything it calls (currently using the command line --dump-llvm and then splitting the output into each module).

Programatically, yes!

```python
from numba import njit

@njit('int32(int32)')
def incr(a):
    return a + 1

print(incr.inspect_llvm(incr.signatures[0]))

```

---

_[View the full topic](https://numba.discourse.group/t/using-numba-to-compile-a-python-algorithm-into-target-assembly/2000)._
