[PATCH] D56638: [llgo]: Somewhat revive it and make it buildable with current trunk.

Kristina Brooks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 12 08:18:05 PST 2019


kristina created this revision.
kristina added a reviewer: pcc.

Make llgo buildable with current LLVM.

Some caveats:

- No `compiler-rt` support for now (That may be fixed soon, depending on other factors).
- No test coverage either as I'm not familiar with LLGO test structure enough.


Repository:
  rL LLVM

https://reviews.llvm.org/D56638

Files:
  cmd/gllgo/gllgo.go
  irgen/runtime.go


Index: irgen/runtime.go
===================================================================
--- irgen/runtime.go
+++ irgen/runtime.go
@@ -518,7 +518,6 @@
 			llvm.PointerType(llvm.Int8Type(), 0),
 			llvm.Int8Type(),
 			tm.target.IntPtrType(),
-			llvm.Int32Type(),
 			llvm.Int1Type(),
 		},
 		false,
@@ -531,8 +530,7 @@
 		[]llvm.Type{
 			llvm.PointerType(llvm.Int8Type(), 0),
 			llvm.PointerType(llvm.Int8Type(), 0),
-			tm.target.IntPtrType(),
-			llvm.Int32Type(),
+			llvm.Int64Type(),
 			llvm.Int1Type(),
 		},
 		false,
@@ -590,9 +588,8 @@
 	ptr = fr.builder.CreateBitCast(ptr, llvm.PointerType(llvm.Int8Type(), 0), "")
 	fill := llvm.ConstNull(llvm.Int8Type())
 	size = fr.createZExtOrTrunc(size, fr.target.IntPtrType(), "")
-	align := llvm.ConstInt(llvm.Int32Type(), 1, false)
 	isvolatile := llvm.ConstNull(llvm.Int1Type())
-	fr.builder.CreateCall(memset, []llvm.Value{ptr, fill, size, align, isvolatile}, "")
+	fr.builder.CreateCall(memset, []llvm.Value{ptr, fill, size, isvolatile}, "")
 }
 
 func (fr *frame) memcpy(dest llvm.Value, src llvm.Value, size llvm.Value) {
@@ -600,9 +597,8 @@
 	dest = fr.builder.CreateBitCast(dest, llvm.PointerType(llvm.Int8Type(), 0), "")
 	src = fr.builder.CreateBitCast(src, llvm.PointerType(llvm.Int8Type(), 0), "")
 	size = fr.createZExtOrTrunc(size, fr.target.IntPtrType(), "")
-	align := llvm.ConstInt(llvm.Int32Type(), 1, false)
 	isvolatile := llvm.ConstNull(llvm.Int1Type())
-	fr.builder.CreateCall(memcpy, []llvm.Value{dest, src, size, align, isvolatile}, "")
+	fr.builder.CreateCall(memcpy, []llvm.Value{dest, src, size, isvolatile}, "")
 }
 
 func (fr *frame) returnAddress(level uint64) llvm.Value {
Index: cmd/gllgo/gllgo.go
===================================================================
--- cmd/gllgo/gllgo.go
+++ cmd/gllgo/gllgo.go
@@ -118,7 +118,7 @@
 	case san.thread:
 		mpm.AddThreadSanitizerPass()
 	case san.memory:
-		mpm.AddMemorySanitizerPass()
+		mpm.AddMemorySanitizerLegacyPassPass()
 	case san.dataflow:
 		blacklist := san.blacklist
 		if blacklist == "" {
@@ -198,6 +198,7 @@
 	staticLibgo     bool
 	staticLink      bool
 	triple          string
+	splitStack      bool
 }
 
 func getInstPrefix() (string, error) {
@@ -344,6 +345,12 @@
 			opts.plugins = append(opts.plugins, args[1])
 			consumedArgs = 2
 
+		case args[0] == "-fno-split-stack":
+			opts.splitStack = false
+
+		case args[0] == "-fsplit-stack":
+			opts.splitStack = true		
+
 		case args[0] == "-fno-toplevel-reorder":
 			// This is a GCC-specific code generation option. Ignore.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56638.181444.patch
Type: text/x-patch
Size: 2538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190112/35d5daad/attachment.bin>


More information about the llvm-commits mailing list