Page MenuHomePhabricator

[NFC] Make the describeLoadedValue() hook return machine operand objects

Authored by dstenb on Sep 6 2019, 12:56 AM.



This changes the ParamLoadedValue pair which the describeLoadedValue()
hook returns so that MachineOperand objects are returned instead of

When describing call site values we may need to describe operands which
are not part of the instruction. One such example is zero-materializing
XORs on x86, which I have implemented support for in a child revision.
Instead of having to return a pointer to an operand stored somewhere
outside the instruction, start returning objects directly instead, as
that simplifies the code.

The MachineOperand class only holds POD members, and on x86-64 it is 32
bytes large. That combined with copy elision means that the overhead of
returning a machine operand object from the hook does not become very

I benchmarked this on a 8-thread i7-8650U machine with 32 GB RAM. The
benchmark consisted of building a clang 8.0 binary configured with:

-DCMAKE_CXX_FLAGS="-Xclang -femit-debug-entry-values -stdlib=libc++"

The average wall clock time increased by 4 seconds, from 62:05 to
62:09, which is an 0.1% increase.

Diff Detail


Event Timeline

dstenb created this revision.Sep 6 2019, 12:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2019, 12:56 AM

Thanks for this! This looks good.

vsk accepted this revision.Sep 6 2019, 9:01 AM

Lgtm as well, thanks.

This revision is now accepted and ready to land.Sep 6 2019, 9:01 AM
This revision was automatically updated to reflect the committed changes.