llvm
Intel staging area for llvm.org contribution. Home for Intel LLVM-based projects.
Top Related Projects
Empowering everyone to build reliable and efficient software.
The Swift Programming Language
Emscripten: An LLVM-to-WebAssembly Compiler
Quick Overview
The intel/llvm repository is a fork of the LLVM compiler infrastructure project, which is a collection of modular and reusable compiler and toolchain components. This fork is maintained by Intel and focuses on optimizing LLVM for Intel hardware and architectures.
Pros
- Hardware Optimization: The intel/llvm repository is optimized for Intel hardware, providing improved performance and efficiency on Intel-based systems.
- Continuous Improvement: Intel actively maintains and updates the repository, ensuring that it stays up-to-date with the latest LLVM releases and improvements.
- Collaboration: The project encourages collaboration and contributions from the community, allowing for the incorporation of a wider range of features and bug fixes.
- Compatibility: The intel/llvm repository maintains compatibility with the upstream LLVM project, allowing users to leverage the vast ecosystem of LLVM-based tools and libraries.
Cons
- Limited Scope: The intel/llvm repository is primarily focused on Intel hardware optimization, which may not be as beneficial for users with non-Intel systems.
- Potential Divergence: As the repository is a fork of the main LLVM project, there is a risk of it diverging from the upstream project, which could lead to compatibility issues or the need for additional maintenance.
- Reduced Contribution Diversity: The focus on Intel hardware optimization may limit the diversity of contributions and features compared to the broader LLVM community.
- Potential Vendor Lock-in: Users who rely heavily on the intel/llvm repository may become more dependent on Intel hardware and software, potentially limiting their flexibility in the future.
Code Examples
N/A (This is not a code library)
Getting Started
N/A (This is not a code library)
Competitor Comparisons
Empowering everyone to build reliable and efficient software.
Pros of Rust
- Memory safety without garbage collection
- Modern language features like pattern matching and zero-cost abstractions
- Strong community support and growing ecosystem
Cons of Rust
- Steeper learning curve, especially for developers new to systems programming
- Longer compile times compared to LLVM-based languages
- Less mature tooling and IDE support in some areas
Code Comparison
Rust example:
fn main() {
let numbers = vec![1, 2, 3, 4, 5];
let sum: i32 = numbers.iter().sum();
println!("Sum: {}", sum);
}
LLVM (C++) example:
#include <iostream>
#include <vector>
#include <numeric>
int main() {
std::vector<int> numbers = {1, 2, 3, 4, 5};
int sum = std::accumulate(numbers.begin(), numbers.end(), 0);
std::cout << "Sum: " << sum << std::endl;
return 0;
}
Summary
Rust offers modern language features and memory safety guarantees, making it attractive for systems programming. However, it has a steeper learning curve and longer compile times compared to LLVM-based languages. LLVM provides a robust compiler infrastructure used by many languages, offering more flexibility but with potentially less built-in safety features. The choice between Rust and LLVM depends on project requirements, team expertise, and performance needs.
The Swift Programming Language
Pros of Swift
- Designed specifically for Apple platforms, offering seamless integration with iOS, macOS, and other Apple ecosystems
- Includes modern language features like optionals, generics, and protocol-oriented programming
- Faster development cycle for Apple-centric applications
Cons of Swift
- Limited cross-platform support compared to LLVM's broader reach
- Smaller community and ecosystem outside of Apple development
- Steeper learning curve for developers not familiar with Apple's development paradigms
Code Comparison
Swift:
func greet(person: String) -> String {
return "Hello, \(person)!"
}
print(greet(person: "World"))
LLVM (C++):
#include <iostream>
#include <string>
std::string greet(const std::string& person) {
return "Hello, " + person + "!";
}
int main() {
std::cout << greet("World") << std::endl;
return 0;
}
The Swift code is more concise and uses string interpolation, while the LLVM (C++) code requires more boilerplate and explicit string concatenation. Swift's syntax is generally more readable and expressive, especially for beginners, while LLVM's C++ offers more low-level control and broader platform support.
Pros of GCC
- Longer history and wider platform support
- Stronger focus on free software principles
- More extensive optimization capabilities for certain architectures
Cons of GCC
- Slower compilation times compared to LLVM
- Less modular architecture, making it harder to integrate into other tools
- More challenging to extend or modify due to its monolithic design
Code Comparison
GCC example (C++):
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
LLVM example (LLVM IR):
@.str = private unnamed_addr constant [14 x i8] c"Hello, World!\0A\00"
define i32 @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0))
ret i32 0
}
declare i32 @puts(i8*)
While both compilers can handle high-level languages like C++, LLVM's intermediate representation (IR) provides a more flexible and language-agnostic approach to compilation. GCC, on the other hand, focuses on direct compilation from source to machine code, which can be more efficient for specific use cases but less adaptable to new languages or targets.
Emscripten: An LLVM-to-WebAssembly Compiler
Pros of Emscripten
- Specialized for compiling C/C++ to WebAssembly, making it easier to port existing codebases to the web
- Provides a complete toolchain with built-in optimizations for web-specific use cases
- Includes a robust JavaScript API for seamless integration with web technologies
Cons of Emscripten
- More limited in scope compared to LLVM's broader compiler infrastructure
- May have a steeper learning curve for developers not familiar with web technologies
- Potentially slower compilation times for large projects due to additional web-specific optimizations
Code Comparison
LLVM (C++):
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
LLVMContext Context;
std::unique_ptr<Module> M = std::make_unique<Module>("my_module", Context);
Emscripten (C++):
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE
extern "C" int my_function(int x, int y) {
return x + y;
}
Summary
LLVM provides a more comprehensive compiler infrastructure suitable for various targets, while Emscripten focuses specifically on compiling C/C++ to WebAssembly. Emscripten offers web-specific optimizations and integration, making it ideal for web-based projects, but may be less flexible for other use cases compared to LLVM.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
This is the Intel staging area for llvm.org contributions and the home for Intel LLVM-based projects:
For general contribution process see CONTRIBUTING.md
oneAPI DPC++ compiler
The DPC++ is a LLVM-based compiler project that implements compiler and runtime support for the SYCL* language. The project is hosted in the sycl branch and is synced with the tip of the LLVM upstream main branch on a regular basis (revisions delay is usually not more than 1-2 weeks). DPC++ compiler takes everything from LLVM upstream as is, however some modules of LLVM might be not included in the default project build configuration. Additional modules can be enabled by modifying build framework settings.
The DPC++ goal is to support the latest SYCL* standard and work on that is in progress. DPC++ also implements a number of extensions to the SYCL* standard, which can be found in the sycl/doc/extensions directory.
The main purpose of this project is open source collaboration on the DPC++ compiler implementation in LLVM across a variety of architectures, prototyping compiler and runtime library solutions, designing future extensions, and conducting experiments. As the implementation becomes more mature, we try to upstream as much DPC++ support to LLVM main branch as possible. See SYCL upstreaming working group notes for more details.
Note that this project can be used as a technical foundation for some proprietary compiler products, which may leverage implementations from this open source project. One of the examples is Intel(R) oneAPI DPC++ Compiler Features parity between this project and downstream projects is not guaranteed.
Project documentation is available at: DPC++ Documentation.
How to use DPC++
Dockerfiles
See available Dockerfiles to create containers with pre-built/pre-installed DPC++ compiler at: Containers
Releases
Daily builds of the sycl branch on Linux are available at releases. A few times a year, we publish Release Notes to highlight all important changes made in the project: features implemented and issues addressed. The corresponding builds can be found using search in daily releases. None of the branches in the project are stable or rigorously tested for production quality control, so the quality of these releases is expected to be similar to the daily releases.
Build from sources
See Get Started Guide.
Report a problem
Submit an issue or initiate a discussion.
How to contribute to DPC++
This project welcomes contributions from the community. Please refer to CONTRIBUTING for general guidelines around contributing to this project. You can then see ContributeToDPCPP for DPC++ specific guidelines.
Late-outline OpenMP* and OpenMP* Offload
See openmp branch.
License
See LICENSE for details.
*Other names and brands may be claimed as the property of others.
Top Related Projects
Empowering everyone to build reliable and efficient software.
The Swift Programming Language
Emscripten: An LLVM-to-WebAssembly Compiler
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot