Skip to content

Hello all llvm developers and fresher. This repository will just give a keen idea of what is LLVM and its uses along with buildin process of it.

Notifications You must be signed in to change notification settings

aabhinavg/Build-LLVM-From-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Build-LLVM-From-Scratch

  • Hello all llvm developers and fresher who want to learn LLVM.
  • This repository will just give a keen idea of what is LLVM and its uses along with buildin process of it.

About LLVM

  • LLVM abbrevation is Low Level Virtual Machine.LLVM is a framework which is used to developed new language and improve existing one.
  • It consist of tools which is helping industry in language creation,creating a compiler, transferring the output code to multiple platforms and architectures along with generation of architecture-specific optimizations.
  • LLVM also consist of libraries, and header files which are used in process of converting binaries in to intermediate representations and converts it into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer. It also contains basic regression tests.
  • The main advatnage of the LLVM project is that it provide a SSA-based (static single assignment) compilation strategy.

Building LLVM And Clang

  • In Unix/Linux System

  • Steps Required

    • Go to the directory where you want your llvm project to be their.

    • Clone the repository by using command

    • git clone https://github.com/llvm/llvm-project.git (if git is not their install it by giving command sudo apt-get install git).

    • cd llvm-project

    • mkdir build

    • cd build

    • cmake ../llvm -G -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGET_TO_BUILD="x86".

    • make -j8

      Note this will build both llvm and clang both in debug mode. To build in release mode just change flag DCMAKE_BUILD_TYPE=Release clang will be install in /path/to/llvm-project/build/bin

  • In Windows

    • Requirements
      • Hardware

        • Any system that can adequately run Visual Studio 2017 is fine. The LLVM source tree and object files, libraries and executables will consume approximately 3GB.
      • Software

      • Steps Required

        • Get the Source Code
          • With the distributed files:
          • cd
          • gunzip --stdout llvm-VERSION.tar.gz | tar -xvf - (or use WinZip)
          • cd llvm
          • With git access:
          • Use CMAKE for Upto Date
            • Use CMake to generate up-to-date project files:
            • Once CMake is installed then the simplest way is to just start the CMake GUI, select the directory where you have LLVM extracted to, and the default options should all be fine. One option you may really want to change, regardless of anything else, might be the CMAKE_INSTALL_PREFIX setting to select a directory to INSTALL to once compiling is complete, although installation is not mandatory for using LLVM. Another important option is LLVM_TARGETS_TO_BUILD, which controls the LLVM target architectures that are included on the build.
            • If CMake complains that it cannot find the compiler, make sure that you have the Visual Studio C++ Tools installed, not just Visual Studio itself (trying to create a C++ project in Visual Studio will generally download the C++ tools if they haven’t already been). See the LLVM CMake guide for detailed information about how to configure the LLVM build.
            • CMake generates project files for all build types. To select a specific build type, use the Configuration manager from the VS IDE or the /property:Configuration command line option when using MSBuild.
            • By default, the Visual Studio project files generated by CMake use the 32-bit toolset. If you are developing on a 64-bit version of Windows and want to use the 64-bit toolset, pass the -Thost=x64 flag when generating the Visual Studio solution. This requires CMake 3.8.0 or later.

About

Hello all llvm developers and fresher. This repository will just give a keen idea of what is LLVM and its uses along with buildin process of it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages