On Tue, Nov 27, 2012 at 8:58 AM, Krzysztof Parzyszek <span dir="ltr"><<a href="mailto:kparzysz@codeaurora.org" target="_blank">kparzysz@codeaurora.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 11/27/2012 8:03 AM, Hal Finkel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
This still leaves the question of exactly how to attach metadata to loops, etc.<br>
</blockquote>
<br></div>
In one implementation, the loops had a fixed structure: guard branch, preheader, header and loop body, optional epilog.  The structure was clearly identified by various means (flags, bits, etc.).  No optimization in the optimizer (roughly a counterpart of the LLVM's bitcode optimizer) was allowed to alter it.  For example, CFG simplification could change branches all it wanted, *except* the branches that were a part of the loop structure.  A "continue" inside of a loop would not create a nested loop, etc.  This worked like a dream (hence my limited appreciation for SimplifyCFG...).<br>

<br>
In that implementation, the metadata was placed in the loop header, or the loop preheader, depending on what information it was.  Since any code that would try to move things around in a loop would have to know what it's doing (i.e. would have to be aware of the loop structure and what the rules were), there was no risk that the metadata would become accidentally separated from the loop.<br>
</blockquote><div><br></div><div>Here is an analogy for your consideration. "Where do I put the propeller?"</div><div><br></div><div>LLVM (the optimizer/codegen) is like a car design. It's got a good engine, frame, and other parts. It's got an active community of people around refining the design and using it for many purposes. It's a good car for these people.</div>
<div><br></div><div>OpenMP and similar pragmas are like a helicopter design. A few people have decided that they wish to design helicopters. It's a lot of work to design a complete helicopter, and a helicopter needs some of the same things a car needs, so their plan is to take this popular car design and attach a propeller and other things that they'll need. They're really excited about this because it will free them from worrying about the boring parts so that they can focus on the cool parts like propeller blades and flight control surfaces. However, there are a few minor issues. We just need somewhere to attach a propeller. And we'll need to make the transmission design modular so that we can do some custom things there. And possibly a few other minor tweaks that will come up as we go forward. It shouldn't be much.</div>
<div><br></div><div>Then they encounter some friction. Most of the people around primarily care about cars. Some of them think that helicopters sound cool, and are eager to help figure out how to attach a propeller mount to the car roof, however they find that the frame of the car isn't prepared to handle that kind of load. A redesign of the frame, or somehow making the frame modular, is not something that can be trivially dropped in. The car people find themselves pushing back. Then the helicopter people point out that in other helicopter designs, most of the important parts were designed specifically for a helicopter's needs, and that that is widely considered the best design methodology for helicopters, and so why can't we do that here?</div>
<div><br></div><div>You want a no-compromise helicopter, and you are talking about starting from a car conversion kit helicopter. Quite possibly you can meet your goals with this approach, and you may save a fair amount of work, however you'll also end up making compromises and doing extra work that you wouldn't have otherwise needed. Which approach is best depends on many factors.</div>
<div><br></div><div>Dan</div><div><br></div></div>