[LLVMdev] JIT machine code deletion
Chris Lattner
sabre at nondot.org
Sun May 14 13:08:35 PDT 2006
On Sun, 14 May 2006, Ralph Corderoy wrote:
>> PPC should be 4 bytes in the normal case. It is up to the backend to
>> implement this API correctly... if it doesn't, that's a bug: please
>> report it!
>
> No, EmitBranchToAt() always emits 16 bytes.
>
> AtI[0] = BUILD_LIS(12, Addr >> 16); // lis r12, hi16(address)
> AtI[1] = BUILD_ORI(12, 12, Addr); // ori r12, r12, low16(address)
> AtI[2] = BUILD_MTCTR(12); // mtctr r12
> AtI[3] = BUILD_BCTR(isCall); // bctr/bctrl
>
> but I understand now how startFunctionStub() is given StubSize and on
> PowerPC it's 16 so there's no problem.
Ah, that's silly. If the source and target are within range (as they
should almost always be), a simple unconditional branch should be used.
Patches welcome :)
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list