mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
all: replace llvm.Const* calls with builder.Create* calls
A number of llvm.Const* functions (in particular extractvalue and insertvalue) were removed in LLVM 15, so we have to use a builder instead. This builder will create the same constant values, it simply uses a different API.
This commit is contained in:
committed by
Ron Evans
parent
f57cffce2d
commit
09ec846c9f
@@ -154,7 +154,7 @@ func (p *lowerInterfacesPass) run() error {
|
||||
if initializer.IsNil() {
|
||||
continue
|
||||
}
|
||||
methodSet := llvm.ConstExtractValue(initializer, []uint32{2})
|
||||
methodSet := p.builder.CreateExtractValue(initializer, 2, "")
|
||||
p.addTypeMethods(t, methodSet)
|
||||
}
|
||||
}
|
||||
@@ -288,9 +288,9 @@ func (p *lowerInterfacesPass) run() error {
|
||||
zeroUintptr := llvm.ConstNull(p.uintptrType)
|
||||
for _, t := range p.types {
|
||||
initializer := t.typecode.Initializer()
|
||||
methodSet := llvm.ConstExtractValue(initializer, []uint32{2})
|
||||
initializer = llvm.ConstInsertValue(initializer, llvm.ConstNull(methodSet.Type()), []uint32{2})
|
||||
initializer = llvm.ConstInsertValue(initializer, zeroUintptr, []uint32{4})
|
||||
methodSet := p.builder.CreateExtractValue(initializer, 2, "")
|
||||
initializer = p.builder.CreateInsertValue(initializer, llvm.ConstNull(methodSet.Type()), 2, "")
|
||||
initializer = p.builder.CreateInsertValue(initializer, zeroUintptr, 4, "")
|
||||
t.typecode.SetInitializer(initializer)
|
||||
}
|
||||
|
||||
@@ -311,10 +311,10 @@ func (p *lowerInterfacesPass) addTypeMethods(t *typeInfo, methodSet llvm.Value)
|
||||
t.methodSet = methodSet
|
||||
set := methodSet.Initializer() // get value from global
|
||||
for i := 0; i < set.Type().ArrayLength(); i++ {
|
||||
methodData := llvm.ConstExtractValue(set, []uint32{uint32(i)})
|
||||
signatureGlobal := llvm.ConstExtractValue(methodData, []uint32{0})
|
||||
methodData := p.builder.CreateExtractValue(set, i, "")
|
||||
signatureGlobal := p.builder.CreateExtractValue(methodData, 0, "")
|
||||
signatureName := signatureGlobal.Name()
|
||||
function := llvm.ConstExtractValue(methodData, []uint32{1}).Operand(0)
|
||||
function := p.builder.CreateExtractValue(methodData, 1, "").Operand(0)
|
||||
signature := p.getSignature(signatureName)
|
||||
method := &methodInfo{
|
||||
function: function,
|
||||
|
||||
Reference in New Issue
Block a user