aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-09-22 13:33:00 +0200
committerRon Evans <[email protected]>2022-10-19 22:23:19 +0200
commit62df1d7490ccf495dc08837ec72ee1d6042bc374 (patch)
tree379a9e4e5f46dc8293beeb3ba1f386f08bdf53c9 /transform
parent229746b71ef8c6ab095f0e97aa722959c6f07268 (diff)
downloadtinygo-62df1d7490ccf495dc08837ec72ee1d6042bc374.tar.gz
tinygo-62df1d7490ccf495dc08837ec72ee1d6042bc374.zip
all: remove pointer ElementType calls
This is needed for opaque pointers, which are enabled by default in LLVM 15.
Diffstat (limited to 'transform')
-rw-r--r--transform/allocs.go2
-rw-r--r--transform/gc.go4
-rw-r--r--transform/interface-lowering.go2
-rw-r--r--transform/llvm.go2
-rw-r--r--transform/wasm-abi.go2
5 files changed, 6 insertions, 6 deletions
diff --git a/transform/allocs.go b/transform/allocs.go
index af7c70b28..5be7df2d3 100644
--- a/transform/allocs.go
+++ b/transform/allocs.go
@@ -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)
diff --git a/transform/gc.go b/transform/gc.go
index 514fb1bf3..e2d23987f 100644
--- a/transform/gc.go
+++ b/transform/gc.go
@@ -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.
diff --git a/transform/interface-lowering.go b/transform/interface-lowering.go
index f28443dc2..9e2ffa90a 100644
--- a/transform/interface-lowering.go
+++ b/transform/interface-lowering.go
@@ -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)
diff --git a/transform/llvm.go b/transform/llvm.go
index 17968f8a9..7042b32d0 100644
--- a/transform/llvm.go
+++ b/transform/llvm.go
@@ -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),
diff --git a/transform/wasm-abi.go b/transform/wasm-abi.go
index 064e38f4b..83a16d85f 100644
--- a/transform/wasm-abi.go
+++ b/transform/wasm-abi.go
@@ -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