@@ -398,7 +398,7 @@ extension Module {
398398 var global = addGlobal ( name, type:
399399 ArrayType ( elementType: IntType . int8, count: length + 1 ) )
400400
401- global. alignment = 1
401+ global. alignment = Alignment ( 1 )
402402 global. initializer = value
403403
404404 return global
@@ -1247,14 +1247,14 @@ public class IRBuilder {
12471247 ///
12481248 /// - returns: A value representing `void`.
12491249 public func buildAlloca( type: IRType , count: IRValue ? = nil ,
1250- alignment: Int = 0 , name: String = " " ) -> IRValue {
1250+ alignment: Alignment = . zero , name: String = " " ) -> IRValue {
12511251 let allocaInst : LLVMValueRef
12521252 if let count = count {
12531253 allocaInst = LLVMBuildArrayAlloca ( llvm, type. asLLVM ( ) , count. asLLVM ( ) , name)
12541254 } else {
12551255 allocaInst = LLVMBuildAlloca ( llvm, type. asLLVM ( ) , name) !
12561256 }
1257- LLVMSetAlignment ( allocaInst, UInt32 ( alignment) )
1257+ LLVMSetAlignment ( allocaInst, alignment. rawValue )
12581258 return allocaInst
12591259 }
12601260
@@ -1270,11 +1270,11 @@ public class IRBuilder {
12701270 ///
12711271 /// - returns: A value representing `void`.
12721272 @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 {
12741274 let storeInst = LLVMBuildStore ( llvm, val. asLLVM ( ) , ptr. asLLVM ( ) ) !
12751275 LLVMSetOrdering ( storeInst, ordering. llvm)
12761276 LLVMSetVolatile ( storeInst, volatile. llvm)
1277- LLVMSetAlignment ( storeInst, UInt32 ( alignment) )
1277+ LLVMSetAlignment ( storeInst, alignment. rawValue )
12781278 return storeInst
12791279 }
12801280
@@ -1290,11 +1290,11 @@ public class IRBuilder {
12901290 ///
12911291 /// - returns: A value representing the result of a load from the given
12921292 /// 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 {
12941294 let loadInst = LLVMBuildLoad ( llvm, ptr. asLLVM ( ) , name) !
12951295 LLVMSetOrdering ( loadInst, ordering. llvm)
12961296 LLVMSetVolatile ( loadInst, volatile. llvm)
1297- LLVMSetAlignment ( loadInst, UInt32 ( alignment) )
1297+ LLVMSetAlignment ( loadInst, alignment. rawValue )
12981298 return loadInst
12991299 }
13001300
0 commit comments