<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 18, 2018, at 10:28 PM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com" class="">chandlerc@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">> Then I propose we restructure the type system to allow CallInst and InvokeInst to easily share logic:<br class="">> - Create `CallBase` which is an *abstract* class derived from Instruction that provides all of the common call logic<br class="">> - Make `CallInst` derive from this<br class="">> - Make `InvokeInst` derive from this, extend it for EH aspects and successors<br class="">> - Remove `CallSite` and all accompanying code, rewriting it to use `CallBase`.<br class="">><span class="Apple-converted-space"> </span><br class="">> The end result will, IMO, be a much simpler IR type system and implementation. The code interacting with instructions should also be much more consistent and clear w/o the awkward CallSite "abstraction”.<br class=""><br class="">+1, this seems like a great direction.  Random question, which we might have talked about but I forgot: can we just eliminate CallBase and InvokeInst entirely?  Why not make “isTerminator()” for calls return true if the call has a normal/unwind destination set?<br class=""></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Eventually, this might make sense, but I'm not currently certain.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I think storing stuff like successors is useful to model as a separate type to start. Once we get there, I think it'll be easier to see if the tradeoff isn't actually worth it and we can just make this a a property of calls.</div></div></blockquote><br class=""></div><div>I agree that this isn’t the right first step, just wondering about the end game on this.  It seems reasonable to go this way (depending on how “indirect branches” and up going) because various aspects of a call (including its operand count) are fixed at creation time.  “terminator or not” seems like something that would/should similarly be fixed at construction time.</div><div><br class=""></div><div>-Chris</div><div><br class=""></div></body></html>