[llvm-dev] returning from LowerOperation()
Hal Finkel via llvm-dev
llvm-dev at lists.llvm.org
Mon Jan 23 12:59:08 PST 2017
On 01/23/2017 02:41 PM, Matt Arsenault via llvm-dev wrote:
>
>> On Jan 23, 2017, at 12:36, Friedman, Eli via llvm-dev
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>> On 1/23/2017 5:21 AM, Jonas Paulsson wrote:
>>> Hi Eli,
>>>
>>> I would like to clarify generally what the difference is between
>>> returning SDValue() and Op (input argument unchanged) from
>>> LowerOperation()?
>>>
>>> My understanding is that returning SDValue() means that Target gives
>>> up, and the common code is supposed to handle it. Returning Op, the
>>> unchanged argument, means that the Target is happy with the node as
>>> it is, and the common code can move on to something else.
>>
>> This is right.
>
> This sounds backwards. Returning SDValue() means the node should be
> treated as legal. Returning the original operation should hit the
> expand path.
No, I think that was correct. The code in
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp reads:
switch (Action) {
case TargetLowering::Legal:
return;
case TargetLowering::Custom: {
// FIXME: The handling for custom lowering with multiple results is
// a complete mess.
if (SDValue Res = TLI.LowerOperation(SDValue(Node, 0), DAG)) {
if (!(Res.getNode() != Node || Res.getResNo() != 0))
return;
...
ReplaceNode(Node, ResultVals.data());
return;
}
LLVM_FALLTHROUGH;
}
case TargetLowering::Expand:
if (ExpandNode(Node))
return;
So, if you return an SDValue() then it will Expand. If you return the
original node, that is equivalent to Legal. Otherwise, you're requesting
a replacement. The logic for loads/stores and vectors is handled
separately (but is similar).
-Hal
>
> -Matt
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170123/b262e158/attachment.html>
More information about the llvm-dev
mailing list