minor cleanups to LSBaseSDNode.

llvm-svn: 47469
This commit is contained in:
Chris Lattner 2008-02-22 01:54:35 +00:00
parent 271aef2b03
commit 160742ff57
1 changed files with 17 additions and 18 deletions

View File

@ -1615,29 +1615,17 @@ public:
const Value *SV, int SVO, unsigned Align, bool Vol)
: SDNode(NodeTy, VTs),
AddrMode(AM), MemoryVT(VT),
SrcValue(SV), SVOffset(SVO), Alignment(Align), IsVolatile(Vol)
{
SrcValue(SV), SVOffset(SVO), Alignment(Align), IsVolatile(Vol) {
for (unsigned i = 0; i != NumOperands; ++i)
Ops[i] = Operands[i];
InitOperands(Ops, 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 SDOperand getChain() const {
return getOperand(0);
}
const SDOperand getBasePtr() const {
const SDOperand &getChain() const { return getOperand(0); }
const SDOperand &getBasePtr() const {
return getOperand(getOpcode() == ISD::LOAD ? 1 : 2);
}
const SDOperand getOffset() const {
return getOperand(getOpcode() == ISD::LOAD ? 2 : 3);
}
const SDOperand getValue() const {
assert(getOpcode() == ISD::STORE);
return getOperand(1);
}
const Value *getSrcValue() const { return SrcValue; }
int getSrcValueOffset() const { return SVOffset; }
@ -1679,10 +1667,15 @@ protected:
const Value *SV, int O=0, unsigned Align=0, bool Vol=false)
: LSBaseSDNode(ISD::LOAD, ChainPtrOff, 3,
VTs, AM, LVT, SV, O, Align, Vol),
ExtType(ETy) { }
ExtType(ETy) {
assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
"Only indexed loads and stores have a non-undef offset operand");
}
public:
ISD::LoadExtType getExtensionType() const { return ExtType; }
const SDOperand &getBasePtr() const { return getOperand(1); }
const SDOperand &getOffset() const { return getOperand(2); }
static bool classof(const LoadSDNode *) { return true; }
static bool classof(const SDNode *N) {
@ -1704,10 +1697,16 @@ protected:
const Value *SV, int O=0, unsigned Align=0, bool Vol=false)
: LSBaseSDNode(ISD::STORE, ChainValuePtrOff, 4,
VTs, AM, SVT, SV, O, Align, Vol),
IsTruncStore(isTrunc) { }
IsTruncStore(isTrunc) {
assert((getOffset().getOpcode() == ISD::UNDEF || isIndexed()) &&
"Only indexed loads and stores have a non-undef offset operand");
}
public:
bool isTruncatingStore() const { return IsTruncStore; }
const SDOperand &getValue() const { return getOperand(1); }
const SDOperand &getBasePtr() const { return getOperand(2); }
const SDOperand &getOffset() const { return getOperand(3); }
static bool classof(const StoreSDNode *) { return true; }
static bool classof(const SDNode *N) {