MCPcopy
hub / github.com/tinygo-org/tinygo / stripPointerCasts

Function stripPointerCasts

transform/llvm.go:82–96  ·  view source on GitHub ↗

stripPointerCasts strips instruction pointer casts (getelementptr and bitcast) and returns the original value without the casts.

(value llvm.Value)

Source from the content-addressed store, hash-verified

80// stripPointerCasts strips instruction pointer casts (getelementptr and
81// bitcast) and returns the original value without the casts.
82func stripPointerCasts(value llvm.Value) llvm.Value {
83 if !value.IsAConstantExpr().IsNil() {
84 switch value.Opcode() {
85 case llvm.GetElementPtr, llvm.BitCast:
86 return stripPointerCasts(value.Operand(0))
87 }
88 }
89 if !value.IsAInstruction().IsNil() {
90 switch value.InstructionOpcode() {
91 case llvm.GetElementPtr, llvm.BitCast:
92 return stripPointerCasts(value.Operand(0))
93 }
94 }
95 return value
96}

Callers 5

MakeGCStackSlotsFunction · 0.85
runMethod · 0.85
addTypeMethodsMethod · 0.85
extractMethodSigsMethod · 0.85
filterMethodSetMethod · 0.85

Calls 1

IsNilMethod · 0.80

Tested by

no test coverage detected