[llvm-dev] What does a dead register mean?

Bhatu via llvm-dev
Wed, 07 Feb 2018 08:47:48 -0000

Thank you for the explanation!

On Tue, Feb 6, 2018 at 7:40 PM, Krzysztof Parzyszek via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> You are right about your interpretation of "dead". The case here
is that
> RSP is a reserved register and so its liveness isn't really tracked.
The
> "implicit-def dead" is an idiom used to mean that the register
(reserved or
> not) is clobbered. The other implicit uses/defs can come from instruction
> definitions to indicate that this instruction uses and/or modifies a given
> register (regardless of its explicit operands), but for reserved registers
> there doesn't need to be any continuity between the defs and the uses.
>
> -Krzysztof
>
>
> On 2/5/2018 11:14 PM, Bhatu via llvm-dev wrote:
>
>> Hi,
>>
>> My understanding of a "dead" register is a def that is never
used.
>> However,
>> when I dump the MI after reg alloc on a simple program I see the
>> following sequence:
>>
>> ADJCALLSTACKDOWN64 0, 0, 0, *implicit-def dead %rsp*, implicit-def dead
>> %eflags, implicit-def dead %ssp, implicit %rsp, implicit %ssp
>> CALL64pcrel32 @foo, <regmask %bh %bl %bp %bpl %bx %ebp %ebx %rbp
%rbx
>> %r12 %r13 %r14 %r15 %r12b %r13b %r14b %r15b %r12d %r13d %r14d %r15d
%r12w
>> %r13w %r14w %r15w>, *implicit %rsp*, implicit %ssp, implicit-def
%rsp,
>> implicit-def %ssp
>> ADJCALLSTACKUP64 0, 0, implicit-def dead %rsp, implicit-def dead
%eflags,
>> implicit-def dead %ssp, implicit %rsp, implicit %ssp
>> RET 0
>>
>>
>> The ADJCALLSTACKDOWN64 has implicit-def dead %rsp. However the next
>> instruction,
>> CALL64pcrel32 has an implicit use of %rsp. This would be a use of %rsp
as
>> defined
>> in ADJCALLSTACKDOWN64 making that non-dead.
>>
>> So I guess my understanding of dead is incorrect. Could you please
>> explain what dead means?
>>
>>
>> For reference:
>> Source file(a.c):
>> void foo(void);
>> void boo(){ foo(); }
>>
>> Commands:
>> clang -S -emit-llvm -Xclang -disable-O0-optnone a.c
>> llc -print-after="stack-slot-coloring" a.ll
>>
>> --
>> Regards
>> Bhatu
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by The Linux Foundation
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>



--
Regards
Bhatu
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180207/ca34f9d7/attachment.html>