Skip to content

Commit

Permalink
Make each target map all inline assembly memory constraints to Inline…
Browse files Browse the repository at this point in the history
…Asm::Constraint_m. NFC.

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

llvm-svn: 232373
  • Loading branch information
dsandersllvm committed Mar 16, 2015
1 parent ace93f3 commit bf5b80f
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/include/llvm/Target/TargetLowering.h
Expand Up @@ -2627,9 +2627,9 @@ class TargetLowering : public TargetLoweringBase {

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
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.h
Expand Up @@ -473,6 +473,12 @@ class AArch64TargetLowering : public TargetLowering {
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,
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/ARM/ARMISelLowering.h
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/Hexagon/HexagonISelLowering.h
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/MSP430/MSP430ISelLowering.h
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/Mips/MipsISelLowering.h
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/NVPTX/NVPTXISelLowering.h
Expand Up @@ -497,6 +497,12 @@ class NVPTXTargetLowering : public TargetLowering {
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
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/PowerPC/PPCISelLowering.h
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/Sparc/SparcISelLowering.h
Expand Up @@ -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; }

Expand Down
7 changes: 7 additions & 0 deletions llvm/lib/Target/SystemZ/SystemZISelLowering.h
Expand Up @@ -233,6 +233,13 @@ class SystemZTargetLowering : public TargetLowering {
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;
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/X86/X86ISelLowering.h
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/XCore/XCoreISelLowering.h
Expand Up @@ -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;
Expand Down

0 comments on commit bf5b80f

Please sign in to comment.