all: remove pointer ElementType calls

This is needed for opaque pointers, which are enabled by default in
LLVM 15.
This commit is contained in:
Ayke van Laethem
2022-09-22 13:33:00 +02:00
committed by Ron Evans
parent 229746b71e
commit 62df1d7490
17 changed files with 82 additions and 93 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ func OptimizeAllocs(mod llvm.Module, printAllocs *regexp.Regexp, logger func(tok
alloca.SetAlignment(alignment)
// Zero the allocation inside the block where the value was originally allocated.
zero := llvm.ConstNull(alloca.Type().ElementType())
zero := llvm.ConstNull(alloca.AllocatedType())
builder.SetInsertPointBefore(bitcast)
store := builder.CreateStore(zero, alloca)
store.SetAlignment(alignment)
+2 -2
View File
@@ -18,7 +18,7 @@ func MakeGCStackSlots(mod llvm.Module) bool {
stackChainStart := mod.NamedGlobal("runtime.stackChainStart")
if !stackChainStart.IsNil() {
stackChainStart.SetLinkage(llvm.InternalLinkage)
stackChainStart.SetInitializer(llvm.ConstNull(stackChainStart.Type().ElementType()))
stackChainStart.SetInitializer(llvm.ConstNull(stackChainStart.GlobalValueType()))
stackChainStart.SetGlobalConstant(true)
}
return false
@@ -96,7 +96,7 @@ func MakeGCStackSlots(mod llvm.Module) bool {
return false
}
stackChainStart.SetLinkage(llvm.InternalLinkage)
stackChainStartType := stackChainStart.Type().ElementType()
stackChainStartType := stackChainStart.GlobalValueType()
stackChainStart.SetInitializer(llvm.ConstNull(stackChainStartType))
// Iterate until runtime.trackPointer has no uses left.
+1 -1
View File
@@ -423,7 +423,7 @@ func (p *lowerInterfacesPass) defineInterfaceImplementsFunc(fn llvm.Value, itf *
func (p *lowerInterfacesPass) defineInterfaceMethodFunc(fn llvm.Value, itf *interfaceInfo, signature *signatureInfo) {
context := fn.LastParam()
actualType := llvm.PrevParam(context)
returnType := fn.Type().ElementType().ReturnType()
returnType := fn.GlobalValueType().ReturnType()
context.SetName("context")
actualType.SetName("actualType")
fn.SetLinkage(llvm.InternalLinkage)
+1 -1
View File
@@ -66,7 +66,7 @@ func getGlobalBytes(global llvm.Value, builder llvm.Builder) []byte {
// function used for creating reflection sidetables, for example.
func replaceGlobalIntWithArray(mod llvm.Module, name string, buf interface{}) llvm.Value {
oldGlobal := mod.NamedGlobal(name)
globalType, global := makeGlobalArray(mod, buf, name+".tmp", oldGlobal.Type().ElementType())
globalType, global := makeGlobalArray(mod, buf, name+".tmp", oldGlobal.GlobalValueType())
gep := llvm.ConstGEP(globalType, global, []llvm.Value{
llvm.ConstInt(mod.Context().Int32Type(), 0, false),
llvm.ConstInt(mod.Context().Int32Type(), 0, false),
+1 -1
View File
@@ -50,7 +50,7 @@ func ExternalInt64AsPtr(mod llvm.Module, config *compileopts.Config) error {
paramTypes := []llvm.Type{}
// Check return type for 64-bit integer.
fnType := fn.Type().ElementType()
fnType := fn.GlobalValueType()
returnType := fnType.ReturnType()
if returnType == int64Type {
hasInt64 = true