XCore target: Fix eliminateFrameIndex() to handle large frames

Richard Osborne richard at xmos.com
Mon Nov 11 05:53:28 PST 2013


On 07/11/13 21:27, Robert Lytton wrote:
> Hi,
>
> Here is a patch that allows the XCore target to handle large frames.
>
>     Large frame offsets are loaded from the ConstantPool.
>     Where possible, offsets are encoded using the smaller MKMSK 
> instruction.
>     Large frame offsets can only be used when there is a frame-pointer.
>
> At present, functions must be compiled using '-fno-omit-frame-pointer'.
> A follow up patch will add heuristics to automatically 
> -disable-fp-elim as necessary.
>
> Robert
>

+  if (Value && !(Value & (Value+1))) {
+    // Value = 2^N - 1, where N != 0.
+    int N = 1;
+    while (Value >>= 1)
+      ++N;

You can use the functions in MathExtras.h to simplify this:
if (isMask_32(Value)) {
   int N = Log2_32(Value) + 1

Looks good to me otherwise.

-- 
Richard Osborne | XMOS
http://www.xmos.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131111/1b8bfdf0/attachment.html>


More information about the llvm-commits mailing list