Make each target map all inline assembly memory constraints to InlineAsm::Constraint_...
authorDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 16 Mar 2015 13:13:41 +0000 (13:13 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 16 Mar 2015 13:13:41 +0000 (13:13 +0000)
Summary:
This is instead of doing this in target independent code and is the last
non-functional change before targets begin to distinguish between
different memory constraints when selecting code for the ISD::INLINEASM
node.

Next, each target will individually move away from the idea that all
memory constraints behave like 'm'.

Subscribers: jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D8173

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232373 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/llvm/Target/TargetLowering.h
lib/Target/AArch64/AArch64ISelLowering.h
lib/Target/ARM/ARMISelLowering.h
lib/Target/Hexagon/HexagonISelLowering.h
lib/Target/MSP430/MSP430ISelLowering.h
lib/Target/Mips/MipsISelLowering.h
lib/Target/NVPTX/NVPTXISelLowering.h
lib/Target/PowerPC/PPCISelLowering.h
lib/Target/Sparc/SparcISelLowering.h
lib/Target/SystemZ/SystemZISelLowering.h
lib/Target/X86/X86ISelLowering.h
lib/Target/XCore/XCoreISelLowering.h

index 4e08cc961be6a17adeb1479db32763a1910ee8e7..55386d1bca20fc09de98e4143ee1819cc55e4e51 100644 (file)
@@ -2627,9 +2627,9 @@ public:
 
   virtual unsigned
   getInlineAsmMemConstraint(const std::string &ConstraintCode) const {
-    // FIXME: This currently maps all constraints to the the same code.
-    //        This will be corrected once all targets are updated.
-    return InlineAsm::Constraint_m;
+    if (ConstraintCode == "m")
+      return InlineAsm::Constraint_m;
+    return InlineAsm::Constraint_Unknown;
   }
 
   /// Try to replace an X constraint, which matches anything, with another that
index b3b9986a319681d70689d5ae15fc0bfaafafdcad..4d5b619e752eff73319e75e28b46564522c82466 100644 (file)
@@ -473,6 +473,12 @@ private:
                                     std::vector<SDValue> &Ops,
                                     SelectionDAG &DAG) const override;
 
+  unsigned getInlineAsmMemConstraint(
+      const std::string &ConstraintCode) const override {
+    // FIXME: Map different constraints differently.
+    return InlineAsm::Constraint_m;
+  }
+
   bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override;
   bool mayBeEmittedAsTailCall(CallInst *CI) const override;
   bool getIndexedAddressParts(SDNode *Op, SDValue &Base, SDValue &Offset,
index f769b3d6219b7aed88cce7033c842ddfe64d3291..a364933b38a78002ad7234bdc15d2ce79da53d37 100644 (file)
@@ -348,6 +348,12 @@ namespace llvm {
                                       std::vector<SDValue> &Ops,
                                       SelectionDAG &DAG) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     const ARMSubtarget* getSubtarget() const {
       return Subtarget;
     }
index 620c73695ac507cb9bde0cb56863028811721eaa..7b772f07eb059c66019579f7ce51811fa92b2022 100644 (file)
@@ -183,6 +183,12 @@ bool isPositiveHalfWord(SDNode *N);
                                  const std::string &Constraint,
                                  MVT VT) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     // Intrinsics
     SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
     /// isLegalAddressingMode - Return true if the addressing mode represented
index 9266c3b19df292296584eda2ce007eb497dcb921..68868b6470c98c531f6aaea987299a32d6f104c8 100644 (file)
@@ -102,6 +102,12 @@ namespace llvm {
                                  const std::string &Constraint,
                                  MVT VT) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     /// isTruncateFree - Return true if it's free to truncate a value of type
     /// Ty1 to type Ty2. e.g. On msp430 it's free to truncate a i16 value in
     /// register R15W to i8 by referencing its sub-register R15B.
index 9f86a43ae2516791448c407e78d3e226c1241f8f..748b1ad45bfe58968ab1983bd4878eaf4c1096b0 100644 (file)
@@ -503,6 +503,12 @@ namespace llvm {
                                       std::vector<SDValue> &Ops,
                                       SelectionDAG &DAG) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const override;
 
     bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
index 1b4da2ce7fc719ecde8b0eebc8ccf29ce0608a34..8594364d290bf6993c6219adf489e907bb84caf0 100644 (file)
@@ -497,6 +497,12 @@ public:
                                     std::vector<SDValue> &Ops,
                                     SelectionDAG &DAG) const override;
 
+  unsigned getInlineAsmMemConstraint(
+      const std::string &ConstraintCode) const override {
+    // FIXME: Map different constraints differently.
+    return InlineAsm::Constraint_m;
+  }
+
   const NVPTXTargetMachine *nvTM;
 
   // PTX always uses 32-bit shift amounts
index ac090acdf88ddfcd9f941e5640ee9839974d84b2..497b62ebfca57aac8d7faccb4f432c46710d452f 100644 (file)
@@ -519,6 +519,12 @@ namespace llvm {
                                       std::vector<SDValue> &Ops,
                                       SelectionDAG &DAG) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     /// isLegalAddressingMode - Return true if the addressing mode represented
     /// by AM is legal for this target, for a load/store of the specified type.
     bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const override;
index 87153261e1e1b92e6829ba87b5655608875db947..c08e6fb7562c08b7513b60623ecd8e05b019fa9a 100644 (file)
@@ -85,6 +85,12 @@ namespace llvm {
                                  const std::string &Constraint,
                                  MVT VT) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
     MVT getScalarShiftAmountTy(EVT LHSTy) const override { return MVT::i32; }
 
index a2b10b0ac74f16356390b0e8ee2430385cdf4443..123c1df2ed0c0424aaca0eabddd24b809dfbffb9 100644 (file)
@@ -233,6 +233,13 @@ public:
                                     std::string &Constraint,
                                     std::vector<SDValue> &Ops,
                                     SelectionDAG &DAG) const override;
+
+  unsigned getInlineAsmMemConstraint(
+      const std::string &ConstraintCode) const override {
+    // FIXME: Map different constraints differently.
+    return InlineAsm::Constraint_m;
+  }
+
   MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
                                                  MachineBasicBlock *BB) const
     override;
index f913daabbaea78e483da98c5ef67fd0f8e2020de..dd20ec23976c15552939fa84960919f78c25c24a 100644 (file)
@@ -695,6 +695,12 @@ namespace llvm {
                                       std::vector<SDValue> &Ops,
                                       SelectionDAG &DAG) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     /// Given a physical register constraint
     /// (e.g. {edx}), return the register number and the register class for the
     /// register.  This should only be used for C_Register constraints.  On
index 213ae4af2fbda4eb3c9168525550184be3ff5e77..b20fc014ccdfffd7d747fe0e9d6a30c5febc57a6 100644 (file)
@@ -177,6 +177,12 @@ namespace llvm {
                                  const std::string &Constraint,
                                  MVT VT) const override;
 
+    unsigned getInlineAsmMemConstraint(
+        const std::string &ConstraintCode) const override {
+      // FIXME: Map different constraints differently.
+      return InlineAsm::Constraint_m;
+    }
+
     // Expand specifics
     SDValue TryExpandADDWithMul(SDNode *Op, SelectionDAG &DAG) const;
     SDValue ExpandADDSUB(SDNode *Op, SelectionDAG &DAG) const;