<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-07-14 16:17 GMT-07:00 Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5"><br>
> On 2015-Jul-14, at 16:04, Alex L <<a href="mailto:arphaman@gmail.com">arphaman@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> This patch serializes the references to the named LLVM alloca instructions from the stack objects in the machine frame info. This commit adds a field 'Name' to the struct 'yaml::MachineStackObject'. This new field is used to store the name of the alloca instruction when the alloca is present and when it has a name.<br>
><br>
> Cheers,<br>
> Alex<br>
</div></div>> <0001-MIR-Serialization-Serialize-references-from-stack-ob.patch><br>
<br>
> From eb929476f0efa98aef6a28c220371ef4b071c24a Mon Sep 17 00:00:00 2001<br>
> From: Alex Lorenz <<a href="mailto:arphaman@gmail.com">arphaman@gmail.com</a>><br>
> Date: Wed, 8 Jul 2015 11:52:02 -0700<br>
> Subject: [PATCH] MIR Serialization: Serialize references from stack objects to<br>
>  named allocas.<br>
><br>
> ---<br>
>  include/llvm/CodeGen/MIRYamlMapping.h              |  5 +++-<br>
>  lib/CodeGen/MIRParser/MIRParser.cpp                | 23 ++++++++++++-----<br>
>  lib/CodeGen/MIRPrinter.cpp                         |  6 +++++<br>
>  test/CodeGen/MIR/X86/stack-object-invalid-name.mir | 30 ++++++++++++++++++++++<br>
>  test/CodeGen/MIR/X86/stack-objects.mir             |  8 +++---<br>
>  .../MIR/X86/variable-sized-stack-objects.mir       |  4 +--<br>
>  6 files changed, 63 insertions(+), 13 deletions(-)<br>
>  create mode 100644 test/CodeGen/MIR/X86/stack-object-invalid-name.mir<br>
><br>
> diff --git a/lib/CodeGen/MIRPrinter.cpp b/lib/CodeGen/MIRPrinter.cpp<br>
> index d5cf924..3b8fc27 100644<br>
> --- a/lib/CodeGen/MIRPrinter.cpp<br>
> +++ b/lib/CodeGen/MIRPrinter.cpp<br>
> @@ -19,6 +19,7 @@<br>
>  #include "llvm/CodeGen/MachineRegisterInfo.h"<br>
>  #include "llvm/CodeGen/MIRYamlMapping.h"<br>
>  #include "llvm/IR/BasicBlock.h"<br>
> +#include "llvm/IR/Instructions.h"<br>
>  #include "llvm/IR/Module.h"<br>
>  #include "llvm/IR/ModuleSlotTracker.h"<br>
>  #include "llvm/Support/MemoryBuffer.h"<br>
> @@ -199,6 +200,11 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF,<br>
><br>
>      yaml::MachineStackObject YamlObject;<br>
>      YamlObject.ID = ID++;<br>
> +    if (const auto *Alloca = MFI.getObjectAllocation(I))<br>
> +      YamlObject.Name.Value =<br>
> +          Alloca->hasName() ? Alloca->getName() : "<unnamed alloca>";<br>
> +    else<br>
> +      YamlObject.Name.Value = "";<br>
<br>
Is it necessary to manually set `YamlObject.Name.Value` to an empty<br>
string here?  Isn't that handled by the default initializer?</blockquote><div><br></div><div>No, it's redundant. I removed this empty string initialization in the commit.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="line-height:normal"> </span></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Otherwise, LGTM.<br></blockquote><div><br></div><div>Thanks, this got committed in r242339.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
>      YamlObject.Type = MFI.isSpillSlotObjectIndex(I)<br>
>                            ? yaml::MachineStackObject::SpillSlot<br>
>                            : MFI.isVariableSizedObjectIndex(I)<br>
<br>
</blockquote></div><br></div></div>