Skip to content

Commit

Permalink
Add getters for call site attributes
Browse files Browse the repository at this point in the history
This is needed to read the 'align' return value attribute from a
@runtime.alloc call.
  • Loading branch information
aykevl committed Jun 27, 2024
1 parent 697964f commit 3b50c76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ir.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,17 @@ func (v Value) InstructionCallConv() CallConv {
func (v Value) AddCallSiteAttribute(i int, a Attribute) {
C.LLVMAddCallSiteAttribute(v.C, C.LLVMAttributeIndex(i), a.C)
}
func (v Value) GetCallSiteEnumAttribute(i int, kind uint) (a Attribute) {
a.C = C.LLVMGetCallSiteEnumAttribute(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
return
}
func (v Value) GetCallSiteStringAttribute(i int, kind string) (a Attribute) {
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
a.C = C.LLVMGetCallSiteStringAttribute(v.C, C.LLVMAttributeIndex(i),
ckind, C.unsigned(len(kind)))
return
}
func (v Value) SetInstrParamAlignment(i int, align int) {
C.LLVMSetInstrParamAlignment(v.C, C.unsigned(i), C.unsigned(align))
}
Expand Down

0 comments on commit 3b50c76

Please sign in to comment.