[PATCH] D34393: Adding code padding for performance stability - infrastructure

Omer Paparo Bivas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 08:37:05 PDT 2017


opaparo added a comment.

> Should we expose this to the .s?
> 
> That would make it easy to test codegen because you would just need to
>  check for things like .pad_bb_begin.
> 
> It would make it easier to test the layout as you could use a simple .s
>  file for that.
> 
> Cheers,
> Rafael

Hi Rafael,

Unfortunately it cannot be exposed to the .s. I'll explain:
When generating an object file, MCObjectStreamer (or more specifically, one of its descendants) is used as the MCStreamer by MCAsmPrinter. All the decisions regarding the places to insert padding and the final size of the padding are made in the MCAsmBackend, which is a member of MCObjectStreamer (via the MCAssembler). Some of those decisions (the decisions regarding the final size of the padding) rely on the final layout of the code (as manifested by MCAsmLayout). On the other hand, when generating a .s file, MCAsmStreamer is used as the MCStreamer by MCAsmPrinter. Unlike MCObjectStreamer, this streamer does not require a MCAsmBackend. In addition, .s files don't have a layout, so there's no MCAsmLayout either, which, as I stated, is needed for the decision making. All in all, we can't mimic the padding behavior when generating a .s file.

Hope that explains it.

Thanks,
Omer


Repository:
  rL LLVM

https://reviews.llvm.org/D34393





More information about the llvm-commits mailing list