Skip to content

Commit 0157b3d

Browse files
committed
Extend README
1 parent 2c3a082 commit 0157b3d

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

README.md

+58-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,68 @@
11
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
22
[![Swift CI](https://github.com/mrLSD/llvm-api-swift/actions/workflows/swift.yaml/badge.svg)](https://github.com/mrLSD/llvm-api-swift/actions/workflows/swift.yaml)
33

4-
# `llvm-api-swift`
4+
<center>
5+
<h1>mrLSD<code>/llvm-api-swift</code></h1>
6+
</center>
57

68
`llvm-api-swift` is a library representing Swift LLVM API, a pure Swift interface to the [LLVM API](https://llvm.org/docs/) and its associated libraries.
79
It provides native, easy-to-use components to create compilers codegen backend. It contains LLVM bindings,
810
components and toolset for efficiently use LLVM as compilers backend implementation on Swift.
911

12+
## Overview
13+
14+
The `llvm-api-swift` provides a robust and comprehensive interface to the LLVM Compiler Infrastructure,
15+
leveraging the `LLVM-C API` to offer a blend of safety, flexibility, and extendability. This library
16+
is designed to serve as a powerful tool for developers looking to create backends for compilers, enabling
17+
them to harness the full potential of **LLVM** in a secure and user-friendly manner.
18+
19+
## Safety
20+
21+
Safety is a paramount concern in the design of this library. By building on the `LLVM-C API`, we ensure that
22+
interactions
23+
with the **LLVM** infrastructure are conducted in a type-safe and memory-safe manner. The library employs Swift’s
24+
stringent
25+
safety guarantees to prevent common issues such as null pointer dereferencing, buffer overflows, and memory leaks. This
26+
commitment to safety allows developers to focus on the functionality of their compiler backends without worrying about
27+
underlying security vulnerabilities.
28+
29+
## Flexibility
30+
31+
Flexibility is another core attribute of the `llvm-api-swift`. The library provides a rich set of APIs that cover a wide
32+
range of LLVM’s capabilities, from module management and inline assembly to debugging metadata and function iteration.
33+
Developers can easily access and manipulate **LLVM** constructs, enabling the creation of highly customized and
34+
optimized
35+
compiler backends. The library’s design ensures that it can adapt to various use cases and requirements, making it an
36+
ideal choice for a diverse set of compiler development projects based on Swift.
37+
38+
## Extendability
39+
40+
The 'llvm-api-swift' is built with extendability in mind. It is designed to be easily extendable, allowing developers to
41+
add
42+
new functionalities and support for additional **LLVM** features as needed. The modular structure of the library
43+
facilitates
44+
the incorporation of new components, ensuring that it can grow and evolve alongside the **LLVM** ecosystem. This
45+
extendability ensures that the library remains relevant and useful as **LLVM** continues to advance and expand its
46+
capabilities.
47+
48+
## Why LLVM?
49+
50+
**LLVM** (Low-Level Virtual Machine) is a powerful and versatile compiler infrastructure that provides a collection of
51+
modular and reusable compiler and toolchain technologies. It is widely used in the development of modern compilers,
52+
providing a framework for optimizing intermediate representations and generating machine code for various target
53+
architectures. LLVM’s ability to support multiple languages and platforms, coupled with its extensive optimization
54+
capabilities, makes it an essential tool for compiler developers. By leveraging **LLVM**, developers can create highly
55+
efficient and portable compilers that meet the demands of today’s diverse computing environments.
56+
57+
## Design
58+
59+
The `llvm-api-awift` library adheres to the structure of the `LLVM C API`, ensuring easy navigation through the extensive LLVM
60+
functions. Logical elements are grouped into modules, providing a clear organizational structure. Within these modules,
61+
Rust structures are introduced to wrap LLVM types, implementing corresponding functions for the wrapped LLVM types. This
62+
approach enhances flexibility and usability while maintaining the original LLVM code structure. The design avoids
63+
unnecessary complexity in the code and documentation, remaining fully aligned with the `LLVM API`. This alignment allows
64+
developers to easily navigate the `llvm-api-swift` library using existing LLVM-C documentation.
65+
1066
### Compatibility with LLVM-C API
1167

1268
When creating the library, we were guided by **full compatibility** with [LLVM-C API](https://llvm.org/doxygen/group__LLVMC.html).
@@ -15,8 +71,7 @@ And filling the components also with the appropriate `LLVM-C API`.
1571
When implementing Swift types, we were guided by the approach of abstracting away from C types, completely transforming them into Swift types.
1672
At the same time adhering to the principles of a safety and reliability implementation - without explicit memory management, means of safe techniques, functions provided by Swift.
1773

18-
19-
### Requirements
74+
## Requirements
2075

2176
- Supported OS: MacOS 12.0 or above
2277

0 commit comments

Comments
 (0)