provides simple methods for reading files and standard input into a memory
buffer. In addition to basic access to the characters in the file, this
interface guarantees you can read one character past the end of the file,
-and that this character will read as ’\0’.
+and that this character will read as ‘\0’.
-
The ’\0’ guarantee is needed to support an optimization – it’s intended to
+
The ‘\0’ guarantee is needed to support an optimization – it’s intended to
be more efficient for clients which are reading all the data to stop
-reading when they encounter a ’\0’ than to continually check the file
+reading when they encounter a ‘\0’ than to continually check the file
position to see if it has reached the end of the file.
Retrieves a pointer to the function compiled by this JIT.
+- parameter name: The name of the function you wish to look up.
+- returns: A pointer to the result of compiling the specified function.
+- note: You will have to unsafeBitCast this pointer to
+ the appropriate @convention(c) function type to be
+ able to run it from Swift.
provides simple methods for reading files and standard input into a memory
buffer. In addition to basic access to the characters in the file, this
interface guarantees you can read one character past the end of the file,
-and that this character will read as ’\0’.
+and that this character will read as ‘\0’.
-
The ’\0’ guarantee is needed to support an optimization – it’s intended to
+
The ‘\0’ guarantee is needed to support an optimization – it’s intended to
be more efficient for clients which are reading all the data to stop
-reading when they encounter a ’\0’ than to continually check the file
+reading when they encounter a ‘\0’ than to continually check the file
position to see if it has reached the end of the file.
@@ -316,6 +348,18 @@
Declaration
Creates a MemoryBuffer that points to a specified
UnsafeBufferPointer.
+
+
parameters:
+
+
+
buffer: The underlying buffer that contains the data.
+
name: The name for the new memory buffer.
+
requiresNullTerminator: Whether or not the MemoryBuffer should
+ append a null terminator. Defaults to
+ false
+
+
+
Declaration
@@ -392,6 +436,15 @@
Parameters
Creates a MemoryBuffer by copying the data within a specified
UnsafeBufferPointer.
+
+
parameters:
+
+
+
buffer: The underlying buffer that contains the data.
This calling convention attempts to make code in the caller as efficient
+as possible under the assumption that the call is not commonly executed.
+As such, these calls often preserve all registers so that the call does
+not break any live ranges in the caller side.
A Constant represents a value initialized to a constant. Constant values
+may be manipulated with standard Swift arithmetic operations and used with
+standard IR Builder instructions like any other operand. The difference
+being any instructions acting solely on constants and any arithmetic
+performed on constants is evaluated at compile-time only.
+
+
Constants keep track of the values they represent at the type level to
+disallow mixed-type arithmetic. Use the cast family of operations to
+safely convert constants to other representations.
A Constant represents a value initialized to a constant. Constant values
+may be manipulated with standard Swift arithmetic operations and used with
+standard IR Builder instructions like any other operand. The difference
+being any instructions acting solely on constants and any arithmetic
+performed on constants is evaluated at compile-time only.
+
+
Constants keep track of the values they represent at the type level to
+disallow mixed-type arithmetic. Use the cast family of operations to
+safely convert constants to other representations.
provides simple methods for reading files and standard input into a memory
buffer. In addition to basic access to the characters in the file, this
interface guarantees you can read one character past the end of the file,
-and that this character will read as ’\0’.
+and that this character will read as ‘\0’.
-
The ’\0’ guarantee is needed to support an optimization – it’s intended to
+
The ‘\0’ guarantee is needed to support an optimization – it’s intended to
be more efficient for clients which are reading all the data to stop
-reading when they encounter a ’\0’ than to continually check the file
+reading when they encounter a ‘\0’ than to continually check the file
position to see if it has reached the end of the file.
Retrieves a pointer to the function compiled by this JIT.
+- parameter name: The name of the function you wish to look up.
+- returns: A pointer to the result of compiling the specified function.
+- note: You will have to unsafeBitCast this pointer to
+ the appropriate @convention(c) function type to be
+ able to run it from Swift.
provides simple methods for reading files and standard input into a memory
buffer. In addition to basic access to the characters in the file, this
interface guarantees you can read one character past the end of the file,
-and that this character will read as ’\0’.
+and that this character will read as ‘\0’.
-
The ’\0’ guarantee is needed to support an optimization – it’s intended to
+
The ‘\0’ guarantee is needed to support an optimization – it’s intended to
be more efficient for clients which are reading all the data to stop
-reading when they encounter a ’\0’ than to continually check the file
+reading when they encounter a ‘\0’ than to continually check the file
position to see if it has reached the end of the file.
@@ -316,6 +348,18 @@
Declaration
Creates a MemoryBuffer that points to a specified
UnsafeBufferPointer.
+
+
parameters:
+
+
+
buffer: The underlying buffer that contains the data.
+
name: The name for the new memory buffer.
+
requiresNullTerminator: Whether or not the MemoryBuffer should
+ append a null terminator. Defaults to
+ false
+
+
+
Declaration
@@ -392,6 +436,15 @@
Parameters
Creates a MemoryBuffer by copying the data within a specified
UnsafeBufferPointer.
+
+
parameters:
+
+
+
buffer: The underlying buffer that contains the data.
This calling convention attempts to make code in the caller as efficient
+as possible under the assumption that the call is not commonly executed.
+As such, these calls often preserve all registers so that the call does
+not break any live ranges in the caller side.
A Constant represents a value initialized to a constant. Constant values
+may be manipulated with standard Swift arithmetic operations and used with
+standard IR Builder instructions like any other operand. The difference
+being any instructions acting solely on constants and any arithmetic
+performed on constants is evaluated at compile-time only.
+
+
Constants keep track of the values they represent at the type level to
+disallow mixed-type arithmetic. Use the cast family of operations to
+safely convert constants to other representations.
A Constant represents a value initialized to a constant. Constant values
+may be manipulated with standard Swift arithmetic operations and used with
+standard IR Builder instructions like any other operand. The difference
+being any instructions acting solely on constants and any arithmetic
+performed on constants is evaluated at compile-time only.
+
+
Constants keep track of the values they represent at the type level to
+disallow mixed-type arithmetic. Use the cast family of operations to
+safely convert constants to other representations.
Once you do that, you can add LLVMSwift as a dependency for your own Swift
compiler projects!
+
Installation without Swift Package Manager
+
+
We really recommend using SwiftPM with LLVMSwift, but if your project is
+structured in such a way that makes using SwiftPM impractical or impossible,
+you can still use LLVMSwift by passing the -DNO_SWIFTPM to swift when
+compiling.
+
+
+
Xcode:
+
+
+
Add this repository as a git submodule
+
Add the files in Sources/ to your Xcode project.
+
Under Other Swift Flags, add -DNO_SWIFTPM.
+
Under Library Search Paths add the output of llvm-config --libdir
+
Under Header Search Paths add the output of llvm-config --includedir
+
Under Link Target with Libraries drag in
+/path/to/your/llvm/lib/libLLVM.dylib
+
+
This project is used by Trill for
all its code generation.
Once you do that, you can add LLVMSwift as a dependency for your own Swift
compiler projects!
+
Installation without Swift Package Manager
+
+
We really recommend using SwiftPM with LLVMSwift, but if your project is
+structured in such a way that makes using SwiftPM impractical or impossible,
+you can still use LLVMSwift by passing the -DNO_SWIFTPM to swift when
+compiling.
+
+
+
Xcode:
+
+
+
Add this repository as a git submodule
+
Add the files in Sources/ to your Xcode project.
+
Under Other Swift Flags, add -DNO_SWIFTPM.
+
Under Library Search Paths add the output of llvm-config --libdir
+
Under Header Search Paths add the output of llvm-config --includedir
+
Under Link Target with Libraries drag in
+/path/to/your/llvm/lib/libLLVM.dylib
+
+
This project is used by Trill for
all its code generation.