[PATCH] D35479: [CodeGen][mips] Support `long_call/far/near` attributes

Simon Dardis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 10:25:40 PDT 2017


sdardis added a comment.

Some comments on the documentation.



================
Comment at: include/clang/Basic/AttrDocs.td:1336
+if code compiled using ``-mlong-calls`` switch, it forces compiler to use
+the ``jal`` instruction to call the function.
+  }];
----------------
rjmccall wrote:
> I suggest the following wording:
> 
> Clang supports the ``__attribute__((long_call))``, ``__attribute__((far))``, and
> ``__attribute__((near))`` attributes on MIPS targets.  These attributes may only be
> added to function declarations and change the code generated by the compiler when
> directly calling the function.  The ``near`` attribute allows calls to the function to
> be made using the ``jal`` instruction, which requires the function to be defined in the
> same 256MB segment as the caller.  The ``long_call`` and ``far`` attributes are
> synonyms and require the use of a different call sequence that works regardless of
> the distance between the functions.
> 
> These attributes take priority over command line switches such as ``-mlong-calls``.
> requires the function to be defined

I'd change the "defined" to be "located".

> in the same 256MB segment as the caller.

I'd change this to: "in the same naturally aligned 256MB segment as the caller."

This also needs a note saying that it has no effect for code compiled with -fpic.


Repository:
  rL LLVM

https://reviews.llvm.org/D35479





More information about the cfe-commits mailing list