forked from OSchip/llvm-project
Add DebugLoc-aware constructors for SDNode derived
classes (those that reasonably have a DebugLoc associated with them). llvm-svn: 63236
This commit is contained in:
parent
7a1b4538a0
commit
666bf20441
|
@ -1519,6 +1519,10 @@ public:
|
||||||
: SDNode(Opc, VTs) {
|
: SDNode(Opc, VTs) {
|
||||||
InitOperands(&Op, X);
|
InitOperands(&Op, X);
|
||||||
}
|
}
|
||||||
|
UnarySDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, SDValue X)
|
||||||
|
: SDNode(Opc, dl, VTs) {
|
||||||
|
InitOperands(&Op, X);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// BinarySDNode - This class is used for two-operand SDNodes. This is solely
|
/// BinarySDNode - This class is used for two-operand SDNodes. This is solely
|
||||||
|
@ -1530,6 +1534,10 @@ public:
|
||||||
: SDNode(Opc, VTs) {
|
: SDNode(Opc, VTs) {
|
||||||
InitOperands(Ops, X, Y);
|
InitOperands(Ops, X, Y);
|
||||||
}
|
}
|
||||||
|
BinarySDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, SDValue X, SDValue Y)
|
||||||
|
: SDNode(Opc, dl, VTs) {
|
||||||
|
InitOperands(Ops, X, Y);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// TernarySDNode - This class is used for three-operand SDNodes. This is solely
|
/// TernarySDNode - This class is used for three-operand SDNodes. This is solely
|
||||||
|
@ -1542,6 +1550,11 @@ public:
|
||||||
: SDNode(Opc, VTs) {
|
: SDNode(Opc, VTs) {
|
||||||
InitOperands(Ops, X, Y, Z);
|
InitOperands(Ops, X, Y, Z);
|
||||||
}
|
}
|
||||||
|
TernarySDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, SDValue X, SDValue Y,
|
||||||
|
SDValue Z)
|
||||||
|
: SDNode(Opc, dl, VTs) {
|
||||||
|
InitOperands(Ops, X, Y, Z);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1591,6 +1604,14 @@ public:
|
||||||
MVT MemoryVT, const Value *srcValue, int SVOff,
|
MVT MemoryVT, const Value *srcValue, int SVOff,
|
||||||
unsigned alignment, bool isvolatile);
|
unsigned alignment, bool isvolatile);
|
||||||
|
|
||||||
|
MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, MVT MemoryVT,
|
||||||
|
const Value *srcValue, int SVOff,
|
||||||
|
unsigned alignment, bool isvolatile);
|
||||||
|
|
||||||
|
MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops,
|
||||||
|
unsigned NumOps, MVT MemoryVT, const Value *srcValue, int SVOff,
|
||||||
|
unsigned alignment, bool isvolatile);
|
||||||
|
|
||||||
/// Returns alignment and volatility of the memory access
|
/// Returns alignment and volatility of the memory access
|
||||||
unsigned getAlignment() const { return (1u << (Flags >> 1)) >> 1; }
|
unsigned getAlignment() const { return (1u << (Flags >> 1)) >> 1; }
|
||||||
bool isVolatile() const { return Flags & 1; }
|
bool isVolatile() const { return Flags & 1; }
|
||||||
|
@ -1669,6 +1690,21 @@ public:
|
||||||
Align, /*isVolatile=*/true) {
|
Align, /*isVolatile=*/true) {
|
||||||
InitOperands(Ops, Chain, Ptr, Val);
|
InitOperands(Ops, Chain, Ptr, Val);
|
||||||
}
|
}
|
||||||
|
AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, MVT MemVT,
|
||||||
|
SDValue Chain, SDValue Ptr,
|
||||||
|
SDValue Cmp, SDValue Swp, const Value* SrcVal,
|
||||||
|
unsigned Align=0)
|
||||||
|
: MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0,
|
||||||
|
Align, /*isVolatile=*/true) {
|
||||||
|
InitOperands(Ops, Chain, Ptr, Cmp, Swp);
|
||||||
|
}
|
||||||
|
AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, MVT MemVT,
|
||||||
|
SDValue Chain, SDValue Ptr,
|
||||||
|
SDValue Val, const Value* SrcVal, unsigned Align=0)
|
||||||
|
: MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0,
|
||||||
|
Align, /*isVolatile=*/true) {
|
||||||
|
InitOperands(Ops, Chain, Ptr, Val);
|
||||||
|
}
|
||||||
|
|
||||||
const SDValue &getBasePtr() const { return getOperand(1); }
|
const SDValue &getBasePtr() const { return getOperand(1); }
|
||||||
const SDValue &getVal() const { return getOperand(2); }
|
const SDValue &getVal() const { return getOperand(2); }
|
||||||
|
@ -1710,6 +1746,13 @@ public:
|
||||||
: MemSDNode(Opc, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol),
|
: MemSDNode(Opc, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol),
|
||||||
ReadMem(ReadMem), WriteMem(WriteMem) {
|
ReadMem(ReadMem), WriteMem(WriteMem) {
|
||||||
}
|
}
|
||||||
|
MemIntrinsicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs,
|
||||||
|
const SDValue *Ops, unsigned NumOps,
|
||||||
|
MVT MemoryVT, const Value *srcValue, int SVO,
|
||||||
|
unsigned Align, bool Vol, bool ReadMem, bool WriteMem)
|
||||||
|
: MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol),
|
||||||
|
ReadMem(ReadMem), WriteMem(WriteMem) {
|
||||||
|
}
|
||||||
|
|
||||||
bool readMem() const { return ReadMem; }
|
bool readMem() const { return ReadMem; }
|
||||||
bool writeMem() const { return WriteMem; }
|
bool writeMem() const { return WriteMem; }
|
||||||
|
@ -1928,6 +1971,9 @@ protected:
|
||||||
explicit BasicBlockSDNode(MachineBasicBlock *mbb)
|
explicit BasicBlockSDNode(MachineBasicBlock *mbb)
|
||||||
: SDNode(ISD::BasicBlock, getSDVTList(MVT::Other)), MBB(mbb) {
|
: SDNode(ISD::BasicBlock, getSDVTList(MVT::Other)), MBB(mbb) {
|
||||||
}
|
}
|
||||||
|
explicit BasicBlockSDNode(MachineBasicBlock *mbb, DebugLoc dl)
|
||||||
|
: SDNode(ISD::BasicBlock, dl, getSDVTList(MVT::Other)), MBB(mbb) {
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MachineBasicBlock *getBasicBlock() const { return MBB; }
|
MachineBasicBlock *getBasicBlock() const { return MBB; }
|
||||||
|
@ -2037,6 +2083,10 @@ protected:
|
||||||
: SDNode(NodeTy, getSDVTList(MVT::Other)), LabelID(id) {
|
: SDNode(NodeTy, getSDVTList(MVT::Other)), LabelID(id) {
|
||||||
InitOperands(&Chain, ch);
|
InitOperands(&Chain, ch);
|
||||||
}
|
}
|
||||||
|
LabelSDNode(unsigned NodeTy, DebugLoc dl, SDValue ch, unsigned id)
|
||||||
|
: SDNode(NodeTy, dl, getSDVTList(MVT::Other)), LabelID(id) {
|
||||||
|
InitOperands(&Chain, ch);
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
unsigned getLabelID() const { return LabelID; }
|
unsigned getLabelID() const { return LabelID; }
|
||||||
|
|
||||||
|
@ -2055,6 +2105,10 @@ protected:
|
||||||
: SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
|
: SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
|
||||||
getSDVTList(VT)), Symbol(Sym) {
|
getSDVTList(VT)), Symbol(Sym) {
|
||||||
}
|
}
|
||||||
|
ExternalSymbolSDNode(bool isTarget, DebugLoc dl, const char *Sym, MVT VT)
|
||||||
|
: SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, dl,
|
||||||
|
getSDVTList(VT)), Symbol(Sym) {
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const char *getSymbol() const { return Symbol; }
|
const char *getSymbol() const { return Symbol; }
|
||||||
|
@ -2221,6 +2275,12 @@ protected:
|
||||||
: SDNode(ISD::CALL, VTs, Operands, numOperands),
|
: SDNode(ISD::CALL, VTs, Operands, numOperands),
|
||||||
CallingConv(cc), IsVarArg(isvararg), IsTailCall(istailcall),
|
CallingConv(cc), IsVarArg(isvararg), IsTailCall(istailcall),
|
||||||
Inreg(isinreg) {}
|
Inreg(isinreg) {}
|
||||||
|
CallSDNode(unsigned cc, DebugLoc dl, bool isvararg, bool istailcall,
|
||||||
|
bool isinreg, SDVTList VTs, const SDValue *Operands,
|
||||||
|
unsigned numOperands)
|
||||||
|
: SDNode(ISD::CALL, dl, VTs, Operands, numOperands),
|
||||||
|
CallingConv(cc), IsVarArg(isvararg), IsTailCall(istailcall),
|
||||||
|
Inreg(isinreg) {}
|
||||||
public:
|
public:
|
||||||
unsigned getCallingConv() const { return CallingConv; }
|
unsigned getCallingConv() const { return CallingConv; }
|
||||||
unsigned isVarArg() const { return IsVarArg; }
|
unsigned isVarArg() const { return IsVarArg; }
|
||||||
|
@ -2295,6 +2355,16 @@ public:
|
||||||
assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
|
assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
|
||||||
"Only indexed loads and stores have a non-undef offset operand");
|
"Only indexed loads and stores have a non-undef offset operand");
|
||||||
}
|
}
|
||||||
|
LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands,
|
||||||
|
unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM,
|
||||||
|
MVT VT, const Value *SV, int SVO, unsigned Align, bool Vol)
|
||||||
|
: MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol) {
|
||||||
|
SubclassData = AM;
|
||||||
|
InitOperands(Ops, Operands, numOperands);
|
||||||
|
assert(Align != 0 && "Loads and stores should have non-zero aligment");
|
||||||
|
assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
|
||||||
|
"Only indexed loads and stores have a non-undef offset operand");
|
||||||
|
}
|
||||||
|
|
||||||
const SDValue &getOffset() const {
|
const SDValue &getOffset() const {
|
||||||
return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
|
return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
|
||||||
|
@ -2331,6 +2401,13 @@ protected:
|
||||||
VTs, AM, LVT, SV, O, Align, Vol) {
|
VTs, AM, LVT, SV, O, Align, Vol) {
|
||||||
SubclassData |= (unsigned short)ETy << 3;
|
SubclassData |= (unsigned short)ETy << 3;
|
||||||
}
|
}
|
||||||
|
LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs,
|
||||||
|
ISD::MemIndexedMode AM, ISD::LoadExtType ETy, MVT LVT,
|
||||||
|
const Value *SV, int O=0, unsigned Align=0, bool Vol=false)
|
||||||
|
: LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3,
|
||||||
|
VTs, AM, LVT, SV, O, Align, Vol) {
|
||||||
|
SubclassData |= (unsigned short)ETy << 3;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// getExtensionType - Return whether this is a plain node,
|
/// getExtensionType - Return whether this is a plain node,
|
||||||
|
@ -2360,6 +2437,13 @@ protected:
|
||||||
VTs, AM, SVT, SV, O, Align, Vol) {
|
VTs, AM, SVT, SV, O, Align, Vol) {
|
||||||
SubclassData |= (unsigned short)isTrunc << 3;
|
SubclassData |= (unsigned short)isTrunc << 3;
|
||||||
}
|
}
|
||||||
|
StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs,
|
||||||
|
ISD::MemIndexedMode AM, bool isTrunc, MVT SVT,
|
||||||
|
const Value *SV, int O=0, unsigned Align=0, bool Vol=false)
|
||||||
|
: LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4,
|
||||||
|
VTs, AM, SVT, SV, O, Align, Vol) {
|
||||||
|
SubclassData |= (unsigned short)isTrunc << 3;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// isTruncatingStore - Return true if the op does a truncation before store.
|
/// isTruncatingStore - Return true if the op does a truncation before store.
|
||||||
|
|
|
@ -4766,6 +4766,29 @@ MemSDNode::MemSDNode(unsigned Opc, SDVTList VTs, const SDValue *Ops,
|
||||||
assert(isVolatile() == vol && "Volatile representation error!");
|
assert(isVolatile() == vol && "Volatile representation error!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, MVT memvt,
|
||||||
|
const Value *srcValue, int SVO,
|
||||||
|
unsigned alignment, bool vol)
|
||||||
|
: SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO),
|
||||||
|
Flags(encodeMemSDNodeFlags(vol, alignment)) {
|
||||||
|
|
||||||
|
assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!");
|
||||||
|
assert(getAlignment() == alignment && "Alignment representation error!");
|
||||||
|
assert(isVolatile() == vol && "Volatile representation error!");
|
||||||
|
}
|
||||||
|
|
||||||
|
MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs,
|
||||||
|
const SDValue *Ops,
|
||||||
|
unsigned NumOps, MVT memvt, const Value *srcValue,
|
||||||
|
int SVO, unsigned alignment, bool vol)
|
||||||
|
: SDNode(Opc, dl, VTs, Ops, NumOps),
|
||||||
|
MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO),
|
||||||
|
Flags(vol | ((Log2_32(alignment) + 1) << 1)) {
|
||||||
|
assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!");
|
||||||
|
assert(getAlignment() == alignment && "Alignment representation error!");
|
||||||
|
assert(isVolatile() == vol && "Volatile representation error!");
|
||||||
|
}
|
||||||
|
|
||||||
/// getMemOperand - Return a MachineMemOperand object describing the memory
|
/// getMemOperand - Return a MachineMemOperand object describing the memory
|
||||||
/// reference performed by this memory reference.
|
/// reference performed by this memory reference.
|
||||||
MachineMemOperand MemSDNode::getMemOperand() const {
|
MachineMemOperand MemSDNode::getMemOperand() const {
|
||||||
|
|
Loading…
Reference in New Issue