[PATCH] [mips] Add the following MIPS options that control gp-relative addressing of small data items: -mgpopt, -mlocal-sdata, -mextern-sdata.

Daniel Sanders daniel.sanders at imgtec.com
Fri Oct 10 02:13:08 PDT 2014


Thanks. There's just one thing to clarify.

================
Comment at: lib/Target/Mips/MipsTargetObjectFile.cpp:53
@@ +52,3 @@
+bool MipsTargetObjectFile::IsInSmallSection(uint64_t Size) const {
+  return (Size > 0
+          && Size <= TM->getSubtarget<MipsSubtarget>()
----------------
sstankovic wrote:
> dsanders wrote:
> > Could you explain why zero-sized objects are excluded?
> I don't know the reason for it. I followed gcc - there is a comment in file gcc/config/mips/mips.c, in function mips_in_small_data_p:
> 
>   /* We have traditionally not treated zero-sized objects as small data,
>      so this is now effectively part of the ABI.  */
>   return size > 0 && size <= mips_small_data_threshold;
Thanks. We should comment that it's important for the ABI so that future readers don't try to remove it.

================
Comment at: lib/Target/Mips/MipsTargetObjectFile.cpp:65
@@ -51,1 +64,3 @@
+  // definitions.
   if (GV->isDeclaration() || GV->hasAvailableExternallyLinkage())
+    return IsGlobalInSmallSectionImpl(GV, TM);
----------------
sstankovic wrote:
> dsanders wrote:
> > Are static globals allowed in the small section?
> Do you mean globals defined in the same file? If so, they are.
I mean globals defined in the same file that aren't available/visible to other objects.

http://reviews.llvm.org/D4903






More information about the llvm-commits mailing list