<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 7, 2010, at 6:27 PM, Lang Hames wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>The design I have in mind is this: We add a method to TargetRegisterInfo which returns a PBQPProblemBuilder for the target architectures. I implement a base PBQPProblemBuilder by simply lifting the current construction process out of the PBQP allocator and into its own class. Anyone (such as yourself, Carlos) who wants to represent more esoteric constraints in their architecture just extends this class, calls the base class to handle all the basic constraints, then performs their own pass over the function to add in their constraints:</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">struct MyTargetPBQPProblemBuilder : public PBQPProblemBuilder {</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  PBQP::Graph* buildProblemFor(MachineFunction *mf) {</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    PBQP::Graph* g = PBQPProblemBuilder::buildProblemFor(mf);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    // Add additional constraints for my architecture here.</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    return g;</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  }</font></div><div><font class="Apple-style-span" face="'courier new', monospace">}</font></div><div><br></div><div>Any thoughts or comments? I think this should be a very straightforward extension.</div></span></blockquote><br></div><div>If a target requires PBQP to work properly, it is going to be registering a new default register allocator constructor.</div><div><br></div><div>It might as well register a function that allocates AND configures PBQP properly then. There is no need for a target hook.</div><div><br></div><div><br></div></body></html>