llvm.org GIT mirror llvm / 35300ff
SelectionDAGBuilder: move constant initialization out of loop No semantic change intended. Reviewers: resistor Differential Revision: http://reviews.llvm.org/D6834 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225278 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 5 years ago
1 changed file(s) with 21 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
12371237 unsigned NumValues = ValueVTs.size();
12381238 if (NumValues) {
12391239 SDValue RetOp = getValue(I.getOperand(0));
1240 for (unsigned j = 0, f = NumValues; j != f; ++j) {
1240
1241 const Function *F = I.getParent()->getParent();
1242
1243 ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
1244 if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
1245 Attribute::SExt))
1246 ExtendKind = ISD::SIGN_EXTEND;
1247 else if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
1248 Attribute::ZExt))
1249 ExtendKind = ISD::ZERO_EXTEND;
1250
1251 LLVMContext &Context = F->getContext();
1252 bool RetInReg = F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
1253 Attribute::InReg);
1254
1255 for (unsigned j = 0; j != NumValues; ++j) {
12411256 EVT VT = ValueVTs[j];
12421257
1243 ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
1244
1245 const Function *F = I.getParent()->getParent();
1246 if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
1247 Attribute::SExt))
1248 ExtendKind = ISD::SIGN_EXTEND;
1249 else if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
1250 Attribute::ZExt))
1251 ExtendKind = ISD::ZERO_EXTEND;
1252
12531258 if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
1254 VT = TLI.getTypeForExtArgOrReturn(*DAG.getContext(), VT, ExtendKind);
1255
1256 unsigned NumParts = TLI.getNumRegisters(*DAG.getContext(), VT);
1257 MVT PartVT = TLI.getRegisterType(*DAG.getContext(), VT);
1259 VT = TLI.getTypeForExtArgOrReturn(Context, VT, ExtendKind);
1260
1261 unsigned NumParts = TLI.getNumRegisters(Context, VT);
1262 MVT PartVT = TLI.getRegisterType(Context, VT);
12581263 SmallVector Parts(NumParts);
12591264 getCopyToParts(DAG, getCurSDLoc(),
12601265 SDValue(RetOp.getNode(), RetOp.getResNo() + j),
12621267
12631268 // 'inreg' on function refers to return value
12641269 ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
1265 if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex,
1266 Attribute::InReg))
1270 if (RetInReg)
12671271 Flags.setInReg();
12681272
12691273 // Propagate extension type if any