[llvm] 8b725f0 - Comment and adjust style in the newly introduced MCBoundaryAlignFragment infrastructure. More to follow.
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 12:04:15 PST 2019
Author: Philip Reames
Date: 2019-12-20T12:04:07-08:00
New Revision: 8b725f0459eee468ed7f9935fba3278fcb4997b1
URL: https://github.com/llvm/llvm-project/commit/8b725f0459eee468ed7f9935fba3278fcb4997b1
DIFF: https://github.com/llvm/llvm-project/commit/8b725f0459eee468ed7f9935fba3278fcb4997b1.diff
LOG: Comment and adjust style in the newly introduced MCBoundaryAlignFragment infrastructure. More to follow.
Added:
Modified:
llvm/include/llvm/MC/MCAsmBackend.h
llvm/include/llvm/MC/MCFragment.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index a7d7db834b50..279c2300565e 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 5e3d5b783365..892b65c43cf7 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; }
-
/// @}
//
More information about the llvm-commits
mailing list