search for: co_yield

Displaying 3 results from an estimated 3 matches for "co_yield".

2016 Jun 09
6
Fwd: [RFC] LLVM Coroutines
...desire to support C++ Coroutines [1], the llvm representation is language neutral and can be used to support coroutines in other languages as well. Clang + llvm coroutines allows you to take this code: generator<int> range(int from, int to) { for(int i = from; i < to; ++n) co_yield i; } int main() { int sum = 0; for (auto v: range(1,100)) sum += v; return sum; } And translate it down to this: define i32 @main() #5 { entry: ret i32 4950 } I prototyped llvm changes to support this proposal and extended clang coroutine implementation [2]...
2016 Jun 14
2
Calling a null pointer. How undefined it is?
Hi all: This question is related to a state machine generated by LLVM for a coroutine. I stripped all coroutine related details to get to the essence of the question. Let's say I have a state machine that looks like this: struct State { FnPtr Fn; State() : Fn(&SomeFunction) {} void Go() { (*Fn)(); } void Stop() { Fn = nullptr; } bool IsDone() { return Fn ==
2016 Jul 21
2
RFC: LLVM Coroutine Representation, Round 2
...is language neutral and can be used >> to support coroutines in other languages as well. >> >> Clang + llvm coroutines allows you to take this code: >> >> generator<int> range(int from, int to) { >> for(int i = from; i < to; ++n) >> co_yield i; >> } >> int main() { >> int sum = 0; >> for (auto v: range(1,100)) >> sum += v; >> return sum; >> } >> >> And translate it down to this: >> >> define i32 @main() #5 { >> entry: >> r...