[mips] Reserve address spaces 1-255 for software use.
[oota-llvm.git] / lib / Target / Mips / MipsISelLowering.h
index 1ec0d2c618f144f5f19a31e5b28e2e9ff7dfb44c..b0204ca516d53de6e94e21aceb64756710a0069b 100644 (file)
@@ -269,6 +269,14 @@ namespace llvm {
     unsigned getRegisterByName(const char* RegName, EVT VT,
                                SelectionDAG &DAG) const override;
 
+    /// Returns true if a cast between SrcAS and DestAS is a noop.
+    bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
+      // Mips doesn't have any special address spaces so we just reserve
+      // the first 256 for software use (e.g. OpenCL) and treat casts
+      // between them as noops.
+      return SrcAS < 256 && DestAS < 256;
+    }
+
   protected:
     SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;