@@ -398,7 +398,7 @@ extension Module {
398
398
var global = addGlobal ( name, type:
399
399
ArrayType ( elementType: IntType . int8, count: length + 1 ) )
400
400
401
- global. alignment = 1
401
+ global. alignment = Alignment ( 1 )
402
402
global. initializer = value
403
403
404
404
return global
@@ -1247,14 +1247,14 @@ public class IRBuilder {
1247
1247
///
1248
1248
/// - returns: A value representing `void`.
1249
1249
public func buildAlloca( type: IRType , count: IRValue ? = nil ,
1250
- alignment: Int = 0 , name: String = " " ) -> IRValue {
1250
+ alignment: Alignment = . zero , name: String = " " ) -> IRValue {
1251
1251
let allocaInst : LLVMValueRef
1252
1252
if let count = count {
1253
1253
allocaInst = LLVMBuildArrayAlloca ( llvm, type. asLLVM ( ) , count. asLLVM ( ) , name)
1254
1254
} else {
1255
1255
allocaInst = LLVMBuildAlloca ( llvm, type. asLLVM ( ) , name) !
1256
1256
}
1257
- LLVMSetAlignment ( allocaInst, UInt32 ( alignment) )
1257
+ LLVMSetAlignment ( allocaInst, alignment. rawValue )
1258
1258
return allocaInst
1259
1259
}
1260
1260
@@ -1270,11 +1270,11 @@ public class IRBuilder {
1270
1270
///
1271
1271
/// - returns: A value representing `void`.
1272
1272
@discardableResult
1273
- public func buildStore( _ val: IRValue , to ptr: IRValue , ordering: AtomicOrdering = . notAtomic, volatile: Bool = false , alignment: Int = 0 ) -> IRValue {
1273
+ public func buildStore( _ val: IRValue , to ptr: IRValue , ordering: AtomicOrdering = . notAtomic, volatile: Bool = false , alignment: Alignment = . zero ) -> IRValue {
1274
1274
let storeInst = LLVMBuildStore ( llvm, val. asLLVM ( ) , ptr. asLLVM ( ) ) !
1275
1275
LLVMSetOrdering ( storeInst, ordering. llvm)
1276
1276
LLVMSetVolatile ( storeInst, volatile. llvm)
1277
- LLVMSetAlignment ( storeInst, UInt32 ( alignment) )
1277
+ LLVMSetAlignment ( storeInst, alignment. rawValue )
1278
1278
return storeInst
1279
1279
}
1280
1280
@@ -1290,11 +1290,11 @@ public class IRBuilder {
1290
1290
///
1291
1291
/// - returns: A value representing the result of a load from the given
1292
1292
/// pointer value.
1293
- public func buildLoad( _ ptr: IRValue , ordering: AtomicOrdering = . notAtomic, volatile: Bool = false , alignment: Int = 0 , name: String = " " ) -> IRValue {
1293
+ public func buildLoad( _ ptr: IRValue , ordering: AtomicOrdering = . notAtomic, volatile: Bool = false , alignment: Alignment = . zero , name: String = " " ) -> IRValue {
1294
1294
let loadInst = LLVMBuildLoad ( llvm, ptr. asLLVM ( ) , name) !
1295
1295
LLVMSetOrdering ( loadInst, ordering. llvm)
1296
1296
LLVMSetVolatile ( loadInst, volatile. llvm)
1297
- LLVMSetAlignment ( loadInst, UInt32 ( alignment) )
1297
+ LLVMSetAlignment ( loadInst, alignment. rawValue )
1298
1298
return loadInst
1299
1299
}
1300
1300
0 commit comments