├── .gitattributes ├── .gitignore ├── BUILD.md ├── README.md ├── RESOURCES.md ├── bin ├── llvm │ └── build.bat ├── pelook.exe ├── updatemds.bat └── vswhere.exe ├── docs ├── 2002-08-09-LLVMCompilationStrategy.pdf ├── 2002-08-09-LLVMCompilationStrategy.txt ├── 2002-12-LattnerMSThesis.pdf ├── 2002-12-LattnerMSThesis.txt ├── 2015_1405.4565.pdf ├── 2015_1405.4565.txt ├── 2016_VMIL_Efficient_Execution_of_LLVM_IR_on_Truffle.pdf ├── 2016_VMIL_Efficient_Execution_of_LLVM_IR_on_Truffle.txt ├── 2018_LLVM_Documentation_Release_8.pdf ├── 2018_LLVM_Documentation_Release_8.txt ├── 2018_Rigger_Safe_and_Efficient_Execution_of LLVM_based_Languages.pdf ├── 2018_Rigger_Safe_and_Efficient_Execution_of LLVM_based_Languages.txt ├── 2021_PLDI_Alive2.pdf ├── 2021_PLDI_Alive2.txt ├── 2024_First_Steps_towards_Deductive_Verification_of_LLVM_IR.pdf ├── 2024_First_Steps_towards_Deductive_Verification_of_LLVM_IR.txt ├── TutorialLLVMBackendCpu0.pdf ├── TutorialLLVMBackendCpu0.txt └── images │ └── llvm.png ├── examples ├── JITTutorial1 │ ├── 00download.txt │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── Makefile │ ├── build.bat │ ├── build.sh │ └── src │ │ └── tut1.cpp ├── JITTutorial1_main │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── Makefile │ ├── build.bat │ └── src │ │ ├── main.cpp │ │ ├── tut1.cpp │ │ └── tut1.h ├── JITTutorial2 │ ├── 00download.txt │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── Makefile │ ├── build.bat │ └── src │ │ └── tut2.cpp ├── JITTutorial2_main │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── Makefile │ ├── build.bat │ └── src │ │ ├── main.cpp │ │ ├── tut2.cpp │ │ ├── tut2.h │ │ ├── utils.cpp │ │ └── utils.h ├── Makefile.inc ├── README.md ├── hello │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── Makefile │ ├── build.bat │ └── src │ │ └── main │ │ ├── c │ │ └── hello.c │ │ └── cpp │ │ └── hello.cpp └── llvm-hello │ ├── .gitignore │ ├── 00download.txt │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── Makefile │ ├── build.bat │ └── src │ └── main │ └── cpp │ └── main.cpp ├── llvm-essentials ├── 1_2_Getting_familiar_with_LLVM_IR │ ├── Makefile │ ├── build.bat │ └── src │ │ └── add.c ├── 3_2_Getting_address_of_element │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── toy.cpp ├── 3_3_Reading_from_memory │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── toy.cpp ├── 3_4_Writing_to_memory │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── toy.cpp ├── 3_5_Inserting_a_scalar_into_a_vector │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── toy.cpp ├── 3_6_Extracting_a_scalar_from_a_vector │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── toy.cpp ├── 5_1_Loop_processing │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── toy.cpp ├── 5_2_Scalar_evolution │ ├── CMakeLists.txt │ ├── build.bat │ └── src │ │ └── scalevl.cpp ├── Makefile.inc └── README.md ├── setenv.bat └── setenv.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | # (see https://github.com/github-linguist/linguist/blob/master/lib/linguist/languages.yml) 7 | *.ada text linguist-language=Ada 8 | *.adb text linguist-language=Ada 9 | *.adc text linguist-language=Ada 10 | *.ads text linguist-language=Ada 11 | *.awk text linguist-language=Awk 12 | *.c text linguist-language=C 13 | *.cabal text linguist-language=Cabal Config 14 | *.cbl text linguist-language=COBOL 15 | *.cob text linguist-language=COBOL 16 | *.cpp text linguist-language=C++ 17 | *.cpy text linguist-language=COBOL 18 | *.cs text linguist-language=CSharp 19 | *.daml text linguist-language=Haskell 20 | *.dart text linguist-language=Dart 21 | *.erl text linguist-language=Erlang 22 | *.es text linguist-language=JavaScript 23 | *.flix text linguist-language=Flix 24 | *.go text linguist-language=Go 25 | *.h text linguist-language=C 26 | *.hpp text linguist-language=C++ 27 | *.hs text linguist-language=Haskell 28 | *.hsc text linguist-language=Haskell 29 | *.inc text linguist-language=Makefile 30 | *.ini text linguist-language=INI 31 | *.java text linguist-language=Java 32 | *.js text linguist-language=JavaScript 33 | *.json text linguist-language=JSON 34 | *.jsx text linguist-language=JavaScript 35 | *.kt text linguist-language=Kotlin 36 | *.kts text linguist-language=Kotlin 37 | *.md text linguist-documentation=true 38 | *.mod test linguist-language=Modula-2 39 | *.properties text linguist-language=INI 40 | *.py text linguist-language=Python 41 | *.rs text linguist-language=Rust 42 | *.sbt text linguist-language=Scala 43 | *.sc text linguist-language=Scala 44 | *.scala text linguist-language=Scala 45 | *.txt text linguist-language=Text 46 | *.xml text linguist-language=XML 47 | *.xslt text linguist-language=XSLT 48 | *.wxi text linguist-language=XML 49 | *.wxl text linguist-language=XML 50 | *.wxs text linguist-language=XML 51 | *.yaml text linguist-language=MiniYAML 52 | *.zig text linguist-language=Zig 53 | 54 | # Declare files that will always have CRLF line endings on checkout. 55 | *.bat eol=crlf linguist-detectable=false 56 | *.cmd eol=crlf linguist-detectable=false 57 | *.ps1 eol=crlf linguist-detectable=false 58 | *.sln text eol=crlf linguist-detectable=false 59 | 60 | # https://github.com/github/linguist/blob/master/lib/linguist/languages.yml 61 | Makefile text eol=crlf linguist-detectable=false 62 | Makefile.inc text eol=crlf linguist-detectable=false 63 | 64 | # Declare files that will always have LF line endings on checkout. 65 | *.sh eol=lf linguist-detectable=false 66 | 67 | # Denote all files that are truly binary and should not be modified. 68 | *.bmp binary 69 | *.class binary 70 | *.dat binary 71 | *.dll binary 72 | *.gif binary 73 | *.ico binary 74 | *.jar binary 75 | *.jpg binary 76 | *.m4a binary 77 | *.pdf binary 78 | *.png binary 79 | *.rtf binary 80 | *.zip binary 81 | 82 | # Project specific attributes 83 | # https://aldomann.com/post/override-github-linguist-with-gitattributes-files/ 84 | bin/* linguist-vendored 85 | docs/* linguist-documentation 86 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.aux 3 | *.bak 4 | *.cfg 5 | *.config 6 | *.csv 7 | *.dot 8 | *.exe 9 | *.hprof 10 | *.iml 11 | *.log 12 | *.o 13 | *.obj 14 | *.orig 15 | *.pyc 16 | *.rej 17 | *.swn 18 | *.swo 19 | *.swp 20 | *.zip 21 | .DS_Store 22 | .checkstyle 23 | .classpath 24 | .externalToolBuilders 25 | .factorypath 26 | .idea 27 | .metadata/ 28 | .project 29 | .settings/ 30 | build/ 31 | clibraries/ 32 | llvm-*.src/ 33 | svmbuild/ 34 | test-suite-*.src/ 35 | core.* 36 | env 37 | bench-results.json 38 | hs_err_pid*.log 39 | jmh_result.json 40 | *.src.tar.xz 41 | workingsets.xml 42 | 43 | # llvm-examples project 44 | *_LOCAL/ 45 | .settings/ 46 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | # Building LLVM on Windows [↩](README.md#top) 2 | 3 |
![]() |
6 | This document presents our build from the LLVM source distribution on a Windows machine. 7 | | 8 |
22 | > curl -sL -o llvm-15.0.7.src.tar.xz https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.7/llvm-15.0.7.src.tar.xz 23 | > tar xzvf llvm-15.0.7.src.tar.xz 24 | > cp bin\llvm\build.bat llvm-15.0.7.src 25 | > cd llvm-15.0.7.src 26 |27 | 28 | > **:mag_right:** In our case we successively worked with versions `8.0.1`, `9.0.1`, `10.0.1`, `11.0.1`, `11.1.0`, `12.0.1`, `13.0.1`, `14.0.6`, `15.0.6` of the [LLVM] source distribution and today we build our binaries from directory `L:\llvm-15.0.7.src\`. 29 | 30 | Command [**`build.bat -verbose compile`**](bin/llvm/build.bat) [2](#footnote_02) generates the additional binaries (both **`.exe`** and **`.lib`** files) into directory **`build\Release\`** (resp. **`build\Debug\`**). Be patient, build time is about 55 minutes on an Intel i7-4th with 16 GB of memory. 31 | 32 |
33 | > cd 34 | L:\llvm-15.0.7.src 35 | 36 | > build -verbose compile 37 | Toolset: MSVC/MSBuild, Project: LLVM 38 | ********************************************************************** 39 | ** Visual Studio 2019 Developer Command Prompt v16.11.11 40 | ** Copyright (c) 2019 Microsoft Corporation 41 | ********************************************************************** 42 | [vcvarsall.bat] Environment initialized for: 'x64' 43 | INCLUDE="..." 44 | LIB="..." 45 | Configuration: Debug, Platform: x64 46 | [build] Current directory is: L:\llvm-15.0.7.src\build 47 | [...] 48 | 49 | > dir build\Release\bin\ll?.exe | findstr /b [0-9] 50 | 07.12.2022 08:07 72 299 520 llc.exe 51 | 07.12.2022 08:08 23 104 512 lli.exe 52 |53 | 54 | > **:mag_right:** Command [**`build -verbose run`**](bin/llvm/build.bat) also execute **`lli.exe -version`** at the end of the build process : 55 | >
56 | > [...] 57 | > Generate LLVM executables (LLVM.sln) 58 | > Execute build\Release\bin\lli.exe --version 59 | > LLVM (http://llvm.org/): 60 | > LLVM version 15.0.7 61 | > Optimized build. 62 | > Default target: x86_64-pc-windows-msvc 63 | > Host CPU: haswell 64 |65 | 66 | Command [**`build.bat -verbose install`**](bin/llvm/build.bat) copies the generated binaries to the [LLVM] installation directory (in our case **`C:\opt\LLVM-15.0.7\`**). 67 | 68 |
69 | > build -verbose install 70 | Do really want to copy files from 'build\' to 'c:\opt\LLVM-15.0.7\' (Y/N)? y 71 | Copy files from directory build\Release\bin to C:\opt\LLVM-15.0.7\bin\ 72 | Copy files from directory build\Release\lib to C:\opt\LLVM-15.0.7\lib\ 73 | Copy files from directory build\lib\cmake to C:\opt\LLVM-15.0.7\lib\cmake\ 74 | Copy files from directory include to C:\opt\LLVM-15.0.7\include\ 75 |76 | 77 | > **:mag_right:** Before installation our [LLVM] installation directory contains 18 `llvm-*.exe` executables: 78 | >
79 | > > where /r c:\opt\LLVM-15.0.7 llvm*.exe | wc -l 80 | > 18 81 | >82 | > and after installation it contains 78 `llvm-*.exe` executables: 83 | >
84 | > > where /r c:\opt\LLVM-15.0.7 llvm*.exe | wc -l 85 | > 78 86 | >87 | 88 | We list below several executables in the [LLVM] installation directory; e.g. commands like [**`clang.exe`**][llvm_clang], [**`lld.exe`**][llvm_lld] and [**`lldb.exe`**][llvm_lldb] belong to the orginal distribution while commands like [**`llc.exe`**][llvm_llc], [**`lli.exe`**][llvm_lli] and [**`opt.exe`**][llvm_opt] were build/added from the [LLVM] source distribution. 89 | 90 |
91 | > where /t clang llc lld lldb lli opt 92 | 111801856 30.11.2022 10:46:14 C:\opt\LLVM-15.0.7\bin\clang.exe 93 | 72299520 07.12.2022 01:34:48 C:\opt\LLVM-15.0.7\bin\llc.exe 94 | 82472960 30.11.2022 10:48:04 C:\opt\LLVM-15.0.7\bin\lld.exe 95 | 215552 30.11.2022 10:50:04 C:\opt\LLVM-15.0.7\bin\lldb.exe 96 | 23104512 07.12.2022 01:35:01 C:\opt\LLVM-15.0.7\bin\lli.exe 97 | 77778432 07.12.2022 01:43:52 C:\opt\LLVM-15.0.7\bin\opt.exe 98 |99 | 100 | ## Footnotes [**▴**](#top) 101 | 102 | [1] ***Cmake modules*** [↩](#anchor_01) 103 | 104 |
105 | In order to successfully generate the LLVM distribution from the sources we need to copy some missing CMake files to directory L:\llvm-X.Y.Z.src\cmake\modules\
:
106 |
LLVM version | CMake files |
---|---|
15 | ExtendPath.cmake FindPrefixFromConfig.cmake |
16 | CMakePolicy.cmake ExtendPath.cmake FindPrefixFromConfig.cmake GNUInstallPackageDir.cmake |
116 | We need to comment out the lines marked with #ME#
in file CMakeLists.txt
in order to build a LLVM distribution in our Windows environment :
117 |
118 | if (LLVM_INCLUDE_BENCHMARKS) 119 | ... 120 | # Since LLVM requires C++11 it is safe to assume that std::regex is available. 121 | set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE) 122 | #ME# add_subdirectory(${LLVM_THIRD_PARTY_DIR}/benchmark 123 | #ME# ${CMAKE_CURRENT_BINARY_DIR}/third-party/benchmark) 124 | #ME# add_subdirectory(benchmarks) 125 | endif() 126 |127 | 128 | 129 | *** 130 | 131 | *[mics](https://lampwww.epfl.ch/~michelou/)/August 2024* [**▲**](#top) 132 | 133 | 134 | 135 | 136 | [batch_file]: https://en.wikibooks.org/wiki/Windows_Batch_Scripting 137 | [llvm]: https://llvm.org/ 138 | [llvm_as]: https://llvm.org/docs/CommandGuide/llvm-as.html 139 | [llvm_clang]: https://releases.llvm.org/14.0.0/tools/clang/docs/ClangCommandLineReference.html 140 | [llvm_dis]: https://llvm.org/docs/CommandGuide/llvm-dis.html 141 | [llvm_downloads]: https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.7 142 | [llvm_llc]: https://llvm.org/docs/CommandGuide/llc.html 143 | [llvm_lld]: https://lld.llvm.org/ 144 | [llvm_lldb]: https://lldb.llvm.org/ 145 | [llvm_lli]: https://llvm.org/docs/CommandGuide/lli.html 146 | [llvm_opt]: https://llvm.org/docs/CommandGuide/opt.html 147 | [llvm_tools]: https://llvm.org/docs/CommandGuide/ 148 | [mx_cli]: https://github.com/graalvm/mx 149 | [oracle_graal]: https://github.com/oracle/graal 150 | [travis_yml]: https://github.com/oracle/graal/blob/master/.travis.yml 151 | -------------------------------------------------------------------------------- /RESOURCES.md: -------------------------------------------------------------------------------- 1 | # LLVM Resources [↩](README.md#top) 2 | 3 |
![]() |
6 | This document gathers LLVM related resources that caught our attention. 7 | | 8 |