[PATCH] D15188: [llgo] Roll gofrontend forward

Andrew Wilkins via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 05:07:06 PST 2016


axw added a comment.

@pcc Thanks, PTAL.


================
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
+}
+
----------------
pcc wrote:
> 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.
Yep, thanks, I'm storing functions and descriptors, so reverted the hash/equal calls.

================
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/
 
----------------
pcc wrote:
> 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.
config.guess was relocated to cmake/config.guess, so I'll change it to copy from there.
config.sub was removed, so adding it as llgo/autoconf/config.sub.


http://reviews.llvm.org/D15188





More information about the llvm-commits mailing list