[PATCH] D15188: [llgo] Roll gofrontend forward

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 7 19:33:02 PST 2016


pcc added inline comments.

================
Comment at: irgen/typemap.go:1492-1506
@@ +1491,17 @@
+
+func (tm *TypeMap) callHashDescriptor(builder llvm.Builder, descriptor, ptr, size llvm.Value) llvm.Value {
+	hashFn := builder.CreateLoad(builder.CreateStructGEP(descriptor, 0, ""), "")
+	hashFn = builder.CreateBitCast(hashFn, tm.ptrHashFnNestType, "")
+	hashcall := builder.CreateCall(hashFn, []llvm.Value{descriptor, ptr, size}, "")
+	hashcall.AddInstrAttribute(1, llvm.NestAttribute)
+	return hashcall
+}
+
+func (tm *TypeMap) callEqualDescriptor(builder llvm.Builder, descriptor, ptr1, ptr2, size llvm.Value) llvm.Value {
+	equalFn := builder.CreateLoad(builder.CreateStructGEP(descriptor, 0, ""), "")
+	equalFn = builder.CreateBitCast(equalFn, tm.ptrEqualFnNestType, "")
+	equalcall := builder.CreateCall(equalFn, []llvm.Value{descriptor, ptr1, ptr2, size}, "")
+	equalcall.AddInstrAttribute(1, llvm.NestAttribute)
+	return equalcall
+}
+
----------------
I don't think you need to be able to call arbitrary closures in the algorithm implementations. Since the identity of the element type is statically known, you can just call the function directly. The only place where you should need to deal with closure descriptors is when building the type descriptor struct.

================
Comment at: update_third_party.sh:74-76
@@ -61,5 +73,5 @@
 
 # Note: this expects the llgo source tree to be located at llvm/tools/llgo.
 cp ../../autoconf/config.guess third_party/gofrontend/
 cp ../../autoconf/config.sub third_party/gofrontend/
 
----------------
Will this work now that autoconf support is removed from LLVM? We might need to make our own copies of the files in the llgo repo.


http://reviews.llvm.org/D15188





More information about the llvm-commits mailing list