Skip to content

w32zhong/mlir-study

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

A stripped LLVM project, commit: b76089c7f3d6593d2e2c83db7dbf4965b656bd8c (this commit is selected to align Modular code).

Download

wget https://github.com/llvm/llvm-project/archive/{}.tar.gz
tar xzf b76089c7f3d6593d2e2c83db7dbf4965b656bd8c.tar.gz -C llvm-project --strip-components=1

Build

cmake -S ./llvm-project/llvm -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra;mlir" \
    -DLLVM_BUILD_EXAMPLES=ON \
    -DLLVM_TARGETS_TO_BUILD="Native;NVPTX"

ninja -C build -j 12
./build/bin/clang++ -g \
    -o build/toyc.bin \
    llvm-project/mlir/examples/toy/Ch1/toyc.cpp \
    llvm-project/mlir/examples/toy/Ch1/parser/AST.cpp \
    -I llvm-project/mlir/examples/toy/Ch1/include \
    $(build/bin/llvm-config --cxxflags --ldflags --libs core support native --system-libs)

./build/toyc.bin llvm-project/mlir/test/Examples/Toy/Ch1/ast.toy -emit=ast

lldb usage example:

./build/bin/lldb ./build/toyc.bin
(lldb) b Parser.h:42
(lldb) r llvm-project/mlir/test/Examples/Toy/Ch1/ast.toy -emit=ast
(lldb) f # frame
(lldb) expr auto t = lexer.getNextToken(); t;
(lldb) p lexer.curTok
(lldb) c # continue

About

Studying MLIR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published