func (c *Compiler) emitChanSend(frame *Frame, instr *ssa.Send) {
	ch := c.getValue(frame, instr.Chan)
	chanValue := c.getValue(frame, instr.X)

	// store value-to-send
	valueType := c.getLLVMType(instr.X.Type())
	valueAlloca, valueAllocaCast, valueAllocaSize := c.createTemporaryAlloca(valueType, "chan.value")
	c.builder.CreateStore(chanValue, valueAlloca)

	// Do the send.
	coroutine := c.createRuntimeCall("getCoroutine", nil, "")
	valueSize := llvm.ConstInt(c.uintptrType, c.targetData.TypeAllocSize(chanValue.Type()), false)
	c.createRuntimeCall("chanSend", []llvm.Value{coroutine, ch, valueAllocaCast, valueSize}, "")

	// End the lifetime of the alloca.
	// This also works around a bug in CoroSplit, at least in LLVM 8:
	// https://bugs.llvm.org/show_bug.cgi?id=41742
	c.emitLifetimeEnd(valueAllocaCast, valueAllocaSize)
}
// emitChanSend emits a pseudo chan send operation. It is lowered to the actual
// channel send operation during goroutine lowering.
emitChanSend emits a pseudo chan send operation. It is lowered to the actual
channel send operation during goroutine lowering.
// emitChanSend emits a pseudo chan send operation . It is lowered to the actual // channel send operation during goroutine lowering .
func (c *Compiler) emitChanSend(frame *Frame, instr *ssa.Send) {
	ch := c.getValue(frame, instr.Chan)
	chanValue := c.getValue(frame, instr.X)
	valueType := c.getLLVMType(instr.X.Type())
	valueAlloca, valueAllocaCast, valueAllocaSize := c.createTemporaryAlloca(valueType, "chan.value")
	c.builder.CreateStore(chanValue, valueAlloca)
	coroutine := c.createRuntimeCall("getCoroutine", nil, "")
	valueSize := llvm.ConstInt(c.uintptrType, c.targetData.TypeAllocSize(chanValue.Type()), false)
	c.createRuntimeCall("chanSend", []llvm.Value{coroutine, ch, valueAllocaCast, valueSize}, "")
	c.emitLifetimeEnd(valueAllocaCast, valueAllocaSize)
}
func ( c * Compiler ) emitChanSend ( frame * Frame , instr * ssa . Send ) { ch := c . getValue ( frame , instr . Chan ) chanValue := c . getValue ( frame , instr . X ) valueType := c . getLLVMType ( instr . X . Type ( ) ) valueAlloca , valueAllocaCast , valueAllocaSize := c . createTemporaryAlloca ( valueType , " " ) c . builder . CreateStore ( chanValue , valueAlloca ) coroutine := c . createRuntimeCall ( " " , nil , " " ) valueSize := llvm . ConstInt ( c . uintptrType , c . targetData . TypeAllocSize ( chanValue . Type ( ) ) , false ) c . createRuntimeCall ( " " , [ ] llvm . Value { coroutine , ch , valueAllocaCast , valueSize } , " " ) c . emitLifetimeEnd ( valueAllocaCast , valueAllocaSize ) }
emitChanSend emits a pseudo chan send operation.
emitChanSend emits a pseudo chan send operation .
// store value-to-send // Do the send. // End the lifetime of the alloca. // This also works around a bug in CoroSplit, at least in LLVM 8: // https://bugs.llvm.org/show_bug.cgi?id=41742