Skip to content

Commit 3b50c76

Browse files
committed
Add getters for call site attributes
This is needed to read the 'align' return value attribute from a @runtime.alloc call.
1 parent 697964f commit 3b50c76

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ir.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,17 @@ func (v Value) InstructionCallConv() CallConv {
12431243
func (v Value) AddCallSiteAttribute(i int, a Attribute) {
12441244
C.LLVMAddCallSiteAttribute(v.C, C.LLVMAttributeIndex(i), a.C)
12451245
}
1246+
func (v Value) GetCallSiteEnumAttribute(i int, kind uint) (a Attribute) {
1247+
a.C = C.LLVMGetCallSiteEnumAttribute(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
1248+
return
1249+
}
1250+
func (v Value) GetCallSiteStringAttribute(i int, kind string) (a Attribute) {
1251+
ckind := C.CString(kind)
1252+
defer C.free(unsafe.Pointer(ckind))
1253+
a.C = C.LLVMGetCallSiteStringAttribute(v.C, C.LLVMAttributeIndex(i),
1254+
ckind, C.unsigned(len(kind)))
1255+
return
1256+
}
12461257
func (v Value) SetInstrParamAlignment(i int, align int) {
12471258
C.LLVMSetInstrParamAlignment(v.C, C.unsigned(i), C.unsigned(align))
12481259
}

0 commit comments

Comments
 (0)