|
1 | 1 | import cllvm
|
2 | 2 |
|
3 |
| -public enum Attribute { |
4 |
| - case zExt, sExt, noReturn, inReg, structRet, noUnwind, noAlias |
5 |
| - case byVal, nest, readOnly, noInline, alwaysInline, optimizeForSize |
6 |
| - case stackProtect, stackProtectReq, alignment, noCapture, noRedZone |
7 |
| - case noImplicitFloat, naked, inlineHint, stackAlignment, returnsTwice |
8 |
| - case uwTable, nonLazyBind |
9 |
| - |
10 |
| - /* FIXME: These attributes are currently not included in the C API as |
11 |
| - a temporary measure until the API/ABI impact to the C API is understood |
12 |
| - and the path forward agreed upon. |
13 |
| - case sanitizeAddress, stackProtectStrong, cold, optimizeNone, inAlloca |
14 |
| - case nonNull, jumpTable, convergent, safeStack, swiftSelf, swiftError |
15 |
| - */ |
16 |
| - |
17 |
| - private static let mapping: [Attribute: LLVMAttribute] = [ |
18 |
| - .zExt: LLVMZExtAttribute, .sExt: LLVMSExtAttribute, .noReturn: LLVMNoReturnAttribute, |
19 |
| - .inReg: LLVMInRegAttribute, .structRet: LLVMStructRetAttribute, .noUnwind: LLVMNoUnwindAttribute, |
20 |
| - .noAlias: LLVMNoAliasAttribute, .byVal: LLVMByValAttribute, .nest: LLVMNestAttribute, |
21 |
| - .readOnly: LLVMReadOnlyAttribute, .noInline: LLVMNoInlineAttribute, .alwaysInline: LLVMAlwaysInlineAttribute, |
22 |
| - .optimizeForSize: LLVMOptimizeForSizeAttribute, .stackProtect: LLVMStackProtectAttribute, |
23 |
| - .stackProtectReq: LLVMStackProtectReqAttribute, .alignment: LLVMAlignment, |
24 |
| - .noCapture: LLVMNoCaptureAttribute, .noRedZone: LLVMNoRedZoneAttribute, |
25 |
| - .noImplicitFloat: LLVMNoImplicitFloatAttribute, .naked: LLVMNakedAttribute, |
26 |
| - .inlineHint: LLVMInlineHintAttribute, .stackAlignment: LLVMStackAlignment, |
27 |
| - .returnsTwice: LLVMReturnsTwice, .uwTable: LLVMUWTable, .nonLazyBind: LLVMNonLazyBind |
28 |
| - ] |
29 |
| - |
30 |
| - public func asLLVM() -> LLVMAttribute { |
31 |
| - return Attribute.mapping[self]! |
32 |
| - } |
33 |
| -} |
34 |
| - |
35 | 3 | public class Function: IRValue {
|
36 | 4 | internal let llvm: LLVMValueRef
|
37 | 5 | internal init(llvm: LLVMValueRef) {
|
@@ -106,14 +74,6 @@ public class Function: IRValue {
|
106 | 74 | public struct Parameter: IRValue {
|
107 | 75 | internal let llvm: LLVMValueRef
|
108 | 76 |
|
109 |
| - func addAttribute(_ attr: Attribute) { |
110 |
| - LLVMAddAttribute(asLLVM(), attr.asLLVM()) |
111 |
| - } |
112 |
| - |
113 |
| - func removeAttribute(_ attr: Attribute) { |
114 |
| - LLVMRemoveAttribute(asLLVM(), attr.asLLVM()) |
115 |
| - } |
116 |
| - |
117 | 77 | public func next() -> Parameter? {
|
118 | 78 | guard let param = LLVMGetNextParam(llvm) else { return nil }
|
119 | 79 | return Parameter(llvm: param)
|
|
0 commit comments