main | develop |
---|---|
void
- Integer types
i1
i8
i16
i32
i64
- Floating-point types
float
double
ptr
- Array types
- Function types
label
- Integer constants
- Floating-point constants
null
- Array constants
poison
- Terminators
br
ret
- Binary operators
- Integer
- Arithmetic
add
sub
mul
sdiv
udiv
srem
urem
and
or
xor
shl
lshr
ashr
- Relational
icmp
- Arithmetic
- Floating-point
- Arithmetic
fadd
fsub
fmul
fdiv
frem
- Relational
fcmp
- Arithmetic
- Integer
- Unary operators
- Floating-point
- Arithmetic
fneg
- Arithmetic
- Floating-point
- Casting operators
- Integer
trunc
sext
zext
- Floating-point
fptrunc
fpext
- Integer to floating-point
sitofp
uitofp
- Floating-point to integer
fptosi
fptoui
ptrtoint
inttoptr
bitcast
- Integer
- Memory management
alloca
load
store
getelemenetptr
select
call
phi
riscv64
AlgebraicSimplification
BasicBlockMerging
BranchSimplification
ConstantFolding
DeadCodeElimination
FunctionInlining
JumpThreading
Mem2Reg
PoisonPropagation
UnreachableBlockElimination
ConstantPropagation
ConstantReuse
DeadCodeElimination
IdentityMoveElimination
ZeroRegisterReplacement
RedundantLabelElimination
riscv64
RISCVFallthrough
NaiveAllocator
LinearScanAllocator
example.ll |
define i32 @add(i32 %0, i32 %1) {
2:
%3 = add i32 %0, %1
ret i32 %3
} |
mini-llc --target=riscv64 -o example.s example.ll
Linux | macOS | Windows |
---|---|---|
✓ | ✗ | ✗ |
GCC | Clang |
---|---|
≥ 14 | ≥ 18 |
CMake |
---|
≥ 3.20 |
git clone --depth=1 --recurse-submodules --shallow-submodules <repo-url>
sudo apt-get update
sudo apt-get -y install g++-14 cmake ninja-build
cd <repo-dir>
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_BUILD_TYPE=Release -DMINI_LLVM_TESTS=ON -G Ninja ..
cmake --build .
./tools/mini-llc/mini-llc --help
cd <repo-dir>/build
ctest .
sudo apt-get update
sudo apt-get -y install gcc-14-riscv64-linux-gnu qemu-user
sudo mkdir -p /usr/gnemul
sudo ln -s /usr/riscv64-linux-gnu /usr/gnemul/qemu-riscv64
cd <repo-dir>/tests/tools/mini-llc
export TARGET="riscv64"
export MINI_LLC_COMMAND="../../../build/tools/mini-llc/mini-llc"
export LINKER_COMMAND="riscv64-linux-gnu-gcc-14"
export EMULATOR_COMMAND="qemu-riscv64"
export DIFF_COMMAND="diff"
export MINI_LLC_TIMEOUT=10
export LINKER_TIMEOUT=10
export EMULATOR_TIMEOUT=10
./test-all.sh
cd <repo-dir>/build
cmake --install .
mini-llvm is licensed under the MIT license.