summaryrefslogtreecommitdiffstats
path: root/llgo/irgen/compiler.go
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-04-05 23:31:49 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-04-05 23:31:49 +0000
commitcac325993ad8872dc9bea68195c6618283171c5b (patch)
treed68519655208ccf81fc39df371938649193bc9d2 /llgo/irgen/compiler.go
parent93c73ebcbd73f5436d13ffc41f49a86fc062deb8 (diff)
downloadbcm5719-llvm-cac325993ad8872dc9bea68195c6618283171c5b.tar.gz
bcm5719-llvm-cac325993ad8872dc9bea68195c6618283171c5b.zip
Roll gofrontend to 07baa07598ea; roll libffi to r219477.
Incorporates https://codereview.appspot.com/198770044, which causes us to start using the static chain register for closures instead of __go_{get,set}_closure. Differential Revision: http://reviews.llvm.org/D8829 llvm-svn: 234135
Diffstat (limited to 'llgo/irgen/compiler.go')
-rw-r--r--llgo/irgen/compiler.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/llgo/irgen/compiler.go b/llgo/irgen/compiler.go
index 830c1bd57ce..8f4e65f1aa6 100644
--- a/llgo/irgen/compiler.go
+++ b/llgo/irgen/compiler.go
@@ -341,7 +341,8 @@ func (c *compiler) buildPackageInitData(mainPkg *ssa.Package) gccgoimporter.Init
}
func (c *compiler) createInitMainFunction(mainPkg *ssa.Package) {
- ftyp := llvm.FunctionType(llvm.VoidType(), nil, false)
+ int8ptr := llvm.PointerType(c.types.ctx.Int8Type(), 0)
+ ftyp := llvm.FunctionType(llvm.VoidType(), []llvm.Type{int8ptr}, false)
initMain := llvm.AddFunction(c.module.Module, "__go_init_main", ftyp)
c.addCommonFunctionAttrs(initMain)
entry := llvm.AddBasicBlock(initMain, "entry")
@@ -350,10 +351,12 @@ func (c *compiler) createInitMainFunction(mainPkg *ssa.Package) {
defer builder.Dispose()
builder.SetInsertPointAtEnd(entry)
+ args := []llvm.Value{llvm.Undef(int8ptr)}
+
if !c.GccgoABI {
initfn := c.module.Module.NamedFunction("main..import")
if !initfn.IsNil() {
- builder.CreateCall(initfn, nil, "")
+ builder.CreateCall(initfn, args, "")
}
builder.CreateRetVoid()
return
@@ -366,7 +369,7 @@ func (c *compiler) createInitMainFunction(mainPkg *ssa.Package) {
if initfn.IsNil() {
initfn = llvm.AddFunction(c.module.Module, init.InitFunc, ftyp)
}
- builder.CreateCall(initfn, nil, "")
+ builder.CreateCall(initfn, args, "")
}
builder.CreateRetVoid()
OpenPOWER on IntegriCloud