[LLVMdev] Complex regalloc contraints

Lang Hames lhames at gmail.com
Wed Sep 8 17:16:48 PDT 2010


Hi Jakob,

That's a good point. I'll factor out the problem builder in the next couple
of days and drop a mail to the list explaining how to write extensions.

Cheers,
Lang.

On Thu, Sep 9, 2010 at 12:21 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:

>
> On Sep 7, 2010, at 6:27 PM, Lang Hames wrote:
>
> 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:
>
> struct MyTargetPBQPProblemBuilder : public PBQPProblemBuilder {
>   PBQP::Graph* buildProblemFor(MachineFunction *mf) {
>     PBQP::Graph* g = PBQPProblemBuilder::buildProblemFor(mf);
>     // Add additional constraints for my architecture here.
>     return g;
>   }
> }
>
> Any thoughts or comments? I think this should be a very straightforward
> extension.
>
>
> If a target requires PBQP to work properly, it is going to be registering a
> new default register allocator constructor.
>
> It might as well register a function that allocates AND configures PBQP
> properly then. There is no need for a target hook.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100909/560327b3/attachment.html>


More information about the llvm-dev mailing list