File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 1
1
import cllvm
2
2
3
+ /// A `Switch` represents a `switch` instruction. A `switch` instruction
4
+ /// defines a jump table of values and destination basic blocks to pass the flow
5
+ /// of control to if a condition value matches. If no match is made, control
6
+ /// flow passes to the default basic block.
3
7
public struct Switch : IRValue {
4
- internal let llvm : LLVMValueRef
5
-
6
- public func addCase( _ value: IRValue , _ block: BasicBlock ) {
7
- LLVMAddCase ( llvm, value. asLLVM ( ) , block. asLLVM ( ) )
8
- }
9
-
10
- public func asLLVM( ) -> LLVMValueRef {
11
- return llvm
12
- }
8
+ internal let llvm : LLVMValueRef
9
+
10
+ /// Inserts a case with the given value and destination basic block in the
11
+ /// jump table of this `switch` instruction.
12
+ ///
13
+ /// - parameter value: The value that acts as the selector for this case.
14
+ /// - parameter block: The destination block for the flow of control if this
15
+ /// case is matched.
16
+ public func addCase( _ value: IRValue , _ block: BasicBlock ) {
17
+ LLVMAddCase ( llvm, value. asLLVM ( ) , block. asLLVM ( ) )
18
+ }
19
+
20
+ /// Retrieves the underlying LLVM value object.
21
+ public func asLLVM( ) -> LLVMValueRef {
22
+ return llvm
23
+ }
13
24
}
You can’t perform that action at this time.
0 commit comments