diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h index a7d7db834b50e6..279c2300565eae 100644 --- a/llvm/include/llvm/MC/MCAsmBackend.h +++ b/llvm/include/llvm/MC/MCAsmBackend.h @@ -46,6 +46,9 @@ class MCAsmBackend { const support::endianness Endian; + /// Give the target a chance to manipulate state related to instruction + /// alignment (e.g. padding for optimization) before and after actually + /// emitting the instruction. virtual void alignBranchesBegin(MCObjectStreamer &OS, const MCInst &Inst) {} virtual void alignBranchesEnd(MCObjectStreamer &OS, const MCInst &Inst) {} diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h index 5e3d5b783365f9..892b65c43cf7f8 100644 --- a/llvm/include/llvm/MC/MCFragment.h +++ b/llvm/include/llvm/MC/MCFragment.h @@ -565,15 +565,18 @@ class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> { } }; +/// Represents required padding such that a particular other set of fragments +/// does not cross a particular power-of-two boundary. The other fragments must +/// follow this one within the same section. class MCBoundaryAlignFragment : public MCFragment { private: - /// The size of the MCBoundaryAlignFragment. - /// Note: The size is lazily set during relaxation, and is not meaningful - /// before that. + /// The size of the fragment. The size is lazily set during relaxation, and + /// is not meaningful before that. uint64_t Size = 0; /// The alignment requirement of the branch to be aligned. Align AlignBoundary; - /// Flag to indicate whether the branch is fused. + /// Flag to indicate whether the branch is fused. Use in determining the + /// region of fragments being aligned. bool Fused : 1; /// Flag to indicate whether NOPs should be emitted. bool EmitNops : 1; @@ -586,21 +589,16 @@ class MCBoundaryAlignFragment : public MCFragment { /// \name Accessors /// @{ - - Align getAlignment() const { return AlignBoundary; } - uint64_t getSize() const { return Size; } + void setSize(uint64_t Value) { Size = Value; } - bool canEmitNops() const { return EmitNops; } - + Align getAlignment() const { return AlignBoundary; } + bool isFused() const { return Fused; } - void setFused(bool Value) { Fused = Value; } + bool canEmitNops() const { return EmitNops; } void setEmitNops(bool Value) { EmitNops = Value; } - - void setSize(uint64_t Value) { Size = Value; } - /// @} //