Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1,982 Lines • ▼ Show 20 Lines | ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, | ||||
} | } | ||||
if (!MemOpChains.empty()) | if (!MemOpChains.empty()) | ||||
Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, MemOpChains); | Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, MemOpChains); | ||||
// Build a sequence of copy-to-reg nodes chained together with token chain | // Build a sequence of copy-to-reg nodes chained together with token chain | ||||
// and flag operands which copy the outgoing args into the appropriate regs. | // and flag operands which copy the outgoing args into the appropriate regs. | ||||
SDValue InFlag; | SDValue InFlag; | ||||
// Tail call byval lowering might overwrite argument registers so in case of | |||||
// tail call optimization the copies to registers are lowered later. | |||||
if (!isTailCall) | |||||
for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { | for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { | ||||
Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, | Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, | ||||
RegsToPass[i].second, InFlag); | RegsToPass[i].second, InFlag); | ||||
InFlag = Chain.getValue(1); | InFlag = Chain.getValue(1); | ||||
} | } | ||||
// For tail calls lower the arguments to the 'real' stack slot. | |||||
if (isTailCall) { | |||||
// Force all the incoming stack arguments to be loaded from the stack | |||||
// before any new outgoing arguments are stored to the stack, because the | |||||
// outgoing stack slots may alias the incoming argument stack slots, and | |||||
// the alias isn't otherwise explicit. This is slightly more conservative | |||||
// than necessary, because it means that each store effectively depends | |||||
// on every argument instead of just those arguments it would clobber. | |||||
// Do not flag preceding copytoreg stuff together with the following stuff. | |||||
InFlag = SDValue(); | |||||
for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { | |||||
Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, | |||||
RegsToPass[i].second, InFlag); | |||||
InFlag = Chain.getValue(1); | |||||
} | |||||
InFlag = SDValue(); | |||||
} | |||||
// If the callee is a GlobalAddress/ExternalSymbol node (quite common, every | // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every | ||||
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol | // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol | ||||
// node so that legalize doesn't hack it. | // node so that legalize doesn't hack it. | ||||
bool isDirect = false; | bool isDirect = false; | ||||
const TargetMachine &TM = getTargetMachine(); | const TargetMachine &TM = getTargetMachine(); | ||||
const Module *Mod = MF.getFunction().getParent(); | const Module *Mod = MF.getFunction().getParent(); | ||||
const GlobalValue *GV = nullptr; | const GlobalValue *GV = nullptr; | ||||
▲ Show 20 Lines • Show All 13,324 Lines • Show Last 20 Lines |