diff options
author | Duncan Sands <baldrick@free.fr> | 2008-03-21 09:14:45 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-03-21 09:14:45 +0000 |
commit | 276dcbdc8db6614cfd5004dc7dc35e437ddf9c58 (patch) | |
tree | c67b0aefb431dbe28d54f7a2d912ab1359863d0a /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 1d57a752a23c28ddbdde623c3a4676d0a2b62a08 (diff) |
Introduce a new node for holding call argument
flags. This is needed by the new legalize types
infrastructure which wants to expand the 64 bit
constants previously used to hold the flags on
32 bit machines. There are two functional changes:
(1) in LowerArguments, if a parameter has the zext
attribute set then that is marked in the flags;
before it was being ignored; (2) PPC had some bogus
code for handling two word arguments when using the
ELF 32 ABI, which was hard to convert because of
the bogusness. As suggested by the original author
(Nicolas Geoffray), I've disabled it for the moment.
Tested with "make check" and the Ada ACATS testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3cd731073c..9331e8b7ee 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -355,6 +355,9 @@ static void AddNodeIDNode(FoldingSetNodeID &ID, SDNode *N) { // Handle SDNode leafs with special info. switch (N->getOpcode()) { default: break; // Normal nodes don't need extra info. + case ISD::ARG_FLAGS: + ID.AddInteger(cast<ARG_FLAGSSDNode>(N)->getArgFlags().getRawBits()); + break; case ISD::TargetConstant: case ISD::Constant: ID.Add(cast<ConstantSDNode>(N)->getAPIntValue()); @@ -923,6 +926,19 @@ SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) { return SDOperand(N, 0); } +SDOperand SelectionDAG::getArgFlags(ISD::ArgFlagsTy Flags) { + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::ARG_FLAGS, getVTList(MVT::Other), 0, 0); + ID.AddInteger(Flags.getRawBits()); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + return SDOperand(E, 0); + SDNode *N = new ARG_FLAGSSDNode(Flags); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getValueType(MVT::ValueType VT) { if (!MVT::isExtendedVT(VT) && (unsigned)VT >= ValueTypeNodes.size()) ValueTypeNodes.resize(VT+1); @@ -3584,6 +3600,7 @@ void MemOperandSDNode::ANCHOR() {} void RegisterSDNode::ANCHOR() {} void ExternalSymbolSDNode::ANCHOR() {} void CondCodeSDNode::ANCHOR() {} +void ARG_FLAGSSDNode::ANCHOR() {} void VTSDNode::ANCHOR() {} void LoadSDNode::ANCHOR() {} void StoreSDNode::ANCHOR() {} @@ -3831,6 +3848,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::STRING: return "String"; case ISD::BasicBlock: return "BasicBlock"; + case ISD::ARG_FLAGS: return "ArgFlags"; case ISD::VALUETYPE: return "ValueType"; case ISD::Register: return "Register"; @@ -4043,6 +4061,30 @@ const char *SDNode::getIndexedModeName(ISD::MemIndexedMode AM) { } } +std::string ISD::ArgFlagsTy::getArgFlagsString() { + std::string S = "< "; + + if (isZExt()) + S += "zext "; + if (isSExt()) + S += "sext "; + if (isInReg()) + S += "inreg "; + if (isSRet()) + S += "sret "; + if (isByVal()) + S += "byval "; + if (isNest()) + S += "nest "; + if (getByValAlign()) + S += "byval-align:" + utostr(getByValAlign()) + " "; + if (getOrigAlign()) + S += "orig-align:" + utostr(getOrigAlign()) + " "; + if (getByValSize()) + S += "byval-size:" + utostr(getByValSize()) + " "; + return S + ">"; +} + void SDNode::dump() const { dump(0); } void SDNode::dump(const SelectionDAG *G) const { cerr << (void*)this << ": "; @@ -4138,6 +4180,8 @@ void SDNode::dump(const SelectionDAG *G) const { cerr << "<" << M->MO.getValue() << ":" << M->MO.getOffset() << ">"; else cerr << "<null:" << M->MO.getOffset() << ">"; + } else if (const ARG_FLAGSSDNode *N = dyn_cast<ARG_FLAGSSDNode>(this)) { + cerr << N->getArgFlags().getArgFlagsString(); } else if (const VTSDNode *N = dyn_cast<VTSDNode>(this)) { cerr << ":" << MVT::getValueTypeString(N->getVT()); } else if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(this)) { |