[LLVMdev] How to implement register allocation constraints to guide allocator dispatching different registers for certain instruction?

Tim Northover t.p.northover at gmail.com
Wed Feb 19 03:27:26 PST 2014

Hi Kevin,

> I suppose to add some extra rules on register allocator to avoid it
> allocating register causing any unpredictable behavior, but I don't have
> experience to this part. Can anybody tell me how to implement this or have
> better ideas to solve this problem? Thanks in advance.

I think this is what the "@earlyclobber" constraint is for: if you
mark the status output register as @earlyclobber then LLVM will think
it gets written early on during the instruction (i.e. before the CPU
would get a chance to read the other two) and make sure it gets
allocated to a different register.



More information about the llvm-dev mailing list