[PATCH] Add NaCl target for Mips. Forbid indexed loads and stores if the target is NaCl.

Mark Seaborn mseaborn at chromium.org
Tue Feb 4 13:55:11 PST 2014



================
Comment at: lib/Target/Mips/MipsInstrInfo.td:190
@@ -189,1 +189,3 @@
 def IsBE           :  Predicate<"!Subtarget.isLittle()">;
+def IsNaCl       :    Predicate<"Subtarget.isTargetNaCl()">;
+def IsNotNaCl    :    Predicate<"!Subtarget.isTargetNaCl()">;
----------------
Nit: You don't actually use this yet, so you could leave it out

================
Comment at: lib/Target/Mips/MipsInstrFPU.td:393
@@ -392,3 +392,3 @@
 // Indexed loads and stores.
-let Predicates = [HasFPIdx, HasStdEnc] in {
+let Predicates = [HasFPIdx, HasStdEnc, IsNotNaCl] in {
   def LWXC1 : MMRel, LWXC1_FT<"lwxc1", FGR32Opnd, II_LWXC1, load>, LWXC1_FM<0>;
----------------
It might be worth commenting why these instructions are disallowed under NaCl -- either in the code or at least in the commit message -- because I don't actually know why they are.

Are these inherently dangerous, or is it just that they haven't been added to the MIPS validator's whitelist yet?

================
Comment at: lib/Target/Mips/MipsSubtarget.h:212
@@ +211,3 @@
+  bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
+  bool isNotTargetNaCl() const { return !TargetTriple.isOSNaCl(); }
+
----------------
This one isn't used.


http://llvm-reviews.chandlerc.com/D2690



More information about the llvm-commits mailing list