[llvm-dev] [RFC] Working around a PS2 hardware errata
Cameron McInally via llvm-dev
llvm-dev at lists.llvm.org
Tue Nov 6 15:34:42 PST 2018
First off, awesome project! I love it. Comments inline...
On Tue, Nov 6, 2018 at 5:59 PM Dan Ravensloft via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> The MIPS R5900 core that powers the PlayStation 2's CPU has a hardware bug
> that affects very short loops of 6 or less instructions where the processor
> may fail to branch under "special conditions" (don't you love vague
> hardware manuals?)
>
> The obvious solution is to pad the loop with NOPs so that it is bigger
> than 6 instructions long.
>
> However, I have a few questions to ask about this.
>
> First, where would I go about adding a pass that detects and works around
> this hardware bug? Presumably it would have to go as a pass after
> instruction selection, but I'm unfamiliar with LLVM internals in this case.
>
Check out a similar pass in the X86
backend: llvm/lib/Target/X86/X86PadShortFunction.cpp
You'll likely need to use MachineLoopInfo to find the loops.
-Cameron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181106/68e616c8/attachment.html>
More information about the llvm-dev
mailing list