TargetMachine
public class TargetMachine
A TargetMachine object represents an object that encapsulates information
about a particular machine (i.e. CPU type) associated with a target
environment.
-
The target information associated with this target machine.
Declaration
Swift
public let target: Target -
The data layout semantics associated with this target machine.
Declaration
Swift
public let dataLayout: TargetData -
The target triple for this target machine.
Declaration
Swift
public let triple: Triple -
The CPU associated with this target machine.
Declaration
Swift
public var cpu: String { get } -
The feature string associated with this target machine.
Declaration
Swift
public var features: String { get } -
Creates a Target Machine with information about its target environment.
Declaration
Swift
public init(triple: Triple = .default, cpu: String = "", features: String = "", optLevel: CodeGenOptLevel = .default, relocations: RelocationModel = .default, codeModel: CodeModel = .default) throwsParameters
tripleAn optional target triple to target. If this is not provided the target triple of the host machine will be assumed.
cpuAn optional CPU type to target. If this is not provided the host CPU will be inferred.
featuresAn optional string containing the features a particular target provides.
optLevelThe optimization level for generated code. If no value is provided, the default level of optimization is assumed.
relocationsThe relocation model of the target environment. If no mode is provided, the default model for the target architecture is assumed.
codeModelThe kind of code to produce for this target. If no model is provided, the default model for the target architecture is assumed.
-
Emits an LLVM Bitcode, ASM, or object file for the given module to the provided filename.
Failure during any part of the compilation process or the process of writing the results to disk will result in a
TargetMachineErrorbeing thrown describing the error in detail.Declaration
Swift
public func emitToFile(module: Module, type: CodegenFileType, path: String) throwsParameters
moduleThe module whose contents will be codegened.
typeThe type of codegen to perform on the given module.
pathThe path to write the resulting file.
-
Emits an LLVM Bitcode, ASM, or object file for the given module to a new
MemoryBuffercontaining the contents.Failure during any part of the compilation process or the process of writing the results to disk will result in a
TargetMachineErrorbeing thrown describing the error in detail.Declaration
Swift
public func emitToMemoryBuffer(module: Module, type: CodegenFileType) throws -> MemoryBufferParameters
moduleThe module whose contents will be codegened.
typeThe type of codegen to perform on the given module.
TargetMachine Class Reference