
This commit switches from the previous behavior of compiling the whole program at once, to compiling every package in parallel and linking the LLVM bitcode files together for further whole-program optimization. This is a small performance win, but it has several advantages in the future: - There are many more things that can be done per package in parallel, avoiding the bottleneck at the end of the compiler phase. This should speed up the compiler futher. - This change is a necessary step towards a non-LTO build mode for fast incremental builds that only rebuild the changed package, when compiler speed is more important than binary size. - This change refactors the compiler in such a way that it will be easier to inspect the IR for one package only. Inspecting this IR will be very helpful for compiler developers.
51 строка
1,6 КиБ
LLVM
51 строка
1,6 КиБ
LLVM
; ModuleID = 'pointer.go'
|
|
source_filename = "pointer.go"
|
|
target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
|
|
target triple = "i686--linux"
|
|
|
|
declare noalias nonnull i8* @runtime.alloc(i32, i8*, i8*)
|
|
|
|
define hidden void @main.init(i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
ret void
|
|
}
|
|
|
|
define hidden [0 x i32] @main.pointerDerefZero([0 x i32]* %x, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
ret [0 x i32] zeroinitializer
|
|
}
|
|
|
|
define hidden i32* @main.pointerCastFromUnsafe(i8* %x, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
%0 = bitcast i8* %x to i32*
|
|
ret i32* %0
|
|
}
|
|
|
|
define hidden i8* @main.pointerCastToUnsafe(i32* dereferenceable_or_null(4) %x, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
%0 = bitcast i32* %x to i8*
|
|
ret i8* %0
|
|
}
|
|
|
|
define hidden i8* @main.pointerCastToUnsafeNoop(i8* dereferenceable_or_null(1) %x, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
ret i8* %x
|
|
}
|
|
|
|
define hidden i8* @main.pointerUnsafeGEPFixedOffset(i8* dereferenceable_or_null(1) %ptr, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
%0 = getelementptr inbounds i8, i8* %ptr, i32 10
|
|
ret i8* %0
|
|
}
|
|
|
|
define hidden i8* @main.pointerUnsafeGEPByteOffset(i8* dereferenceable_or_null(1) %ptr, i32 %offset, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
%0 = getelementptr inbounds i8, i8* %ptr, i32 %offset
|
|
ret i8* %0
|
|
}
|
|
|
|
define hidden i32* @main.pointerUnsafeGEPIntOffset(i32* dereferenceable_or_null(4) %ptr, i32 %offset, i8* %context, i8* %parentHandle) unnamed_addr {
|
|
entry:
|
|
%0 = getelementptr i32, i32* %ptr, i32 %offset
|
|
ret i32* %0
|
|
}
|