Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/MC/MCFragment.h
Show All 10 Lines | |||||
#include "llvm/ADT/ArrayRef.h" | #include "llvm/ADT/ArrayRef.h" | ||||
#include "llvm/ADT/SmallString.h" | #include "llvm/ADT/SmallString.h" | ||||
#include "llvm/ADT/SmallVector.h" | #include "llvm/ADT/SmallVector.h" | ||||
#include "llvm/ADT/StringRef.h" | #include "llvm/ADT/StringRef.h" | ||||
#include "llvm/ADT/ilist_node.h" | #include "llvm/ADT/ilist_node.h" | ||||
#include "llvm/MC/MCFixup.h" | #include "llvm/MC/MCFixup.h" | ||||
#include "llvm/MC/MCInst.h" | #include "llvm/MC/MCInst.h" | ||||
#include "llvm/Support/Alignment.h" | |||||
#include "llvm/Support/Casting.h" | #include "llvm/Support/Casting.h" | ||||
#include "llvm/Support/SMLoc.h" | #include "llvm/Support/SMLoc.h" | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <utility> | #include <utility> | ||||
namespace llvm { | namespace llvm { | ||||
class MCSection; | class MCSection; | ||||
Show All 9 Lines | enum FragmentType : uint8_t { | ||||
FT_Data, | FT_Data, | ||||
FT_CompactEncodedInst, | FT_CompactEncodedInst, | ||||
FT_Fill, | FT_Fill, | ||||
FT_Relaxable, | FT_Relaxable, | ||||
FT_Org, | FT_Org, | ||||
FT_Dwarf, | FT_Dwarf, | ||||
FT_DwarfFrame, | FT_DwarfFrame, | ||||
FT_LEB, | FT_LEB, | ||||
FT_BoundaryAlign, | |||||
FT_SymbolId, | FT_SymbolId, | ||||
FT_CVInlineLines, | FT_CVInlineLines, | ||||
FT_CVDefRange, | FT_CVDefRange, | ||||
FT_Dummy | FT_Dummy | ||||
}; | }; | ||||
private: | private: | ||||
FragmentType Kind; | FragmentType Kind; | ||||
▲ Show 20 Lines • Show All 506 Lines • ▼ Show 20 Lines | public: | ||||
StringRef getFixedSizePortion() const { return FixedSizePortion; } | StringRef getFixedSizePortion() const { return FixedSizePortion; } | ||||
/// @} | /// @} | ||||
static bool classof(const MCFragment *F) { | static bool classof(const MCFragment *F) { | ||||
return F->getKind() == MCFragment::FT_CVDefRange; | return F->getKind() == MCFragment::FT_CVDefRange; | ||||
} | } | ||||
}; | }; | ||||
class MCBoundaryAlignFragment : public MCFragment { | |||||
private: | |||||
/// The size of the MCBoundaryAlignFragment. | |||||
reames: Please add a note that the size is lazily set during relaxation, and is not meaningful before… | |||||
/// Note: The size is lazily set during relaxation, and is not meaningful | |||||
Don’t duplicate function or class name at the beginning of the comment (BranchPadding - ). (ref: https://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments) MaskRay: Don’t duplicate function or class name at the beginning of the comment (`BranchPadding - `). | |||||
/// 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. | |||||
bool Fused : 1; | |||||
/// Flag to indicate whether NOPs should be emitted. | |||||
bool EmitNops : 1; | |||||
public: | |||||
MCBoundaryAlignFragment(Align AlignBoundary, bool Fused = false, | |||||
Full stop. MaskRay: Full stop. | |||||
bool EmitNops = false, MCSection *Sec = nullptr) | |||||
: MCFragment(FT_BoundaryAlign, false, Sec), AlignBoundary(AlignBoundary), | |||||
Fused(Fused), EmitNops(EmitNops) {} | |||||
/// \name Accessors | |||||
/// @{ | |||||
Align getAlignment() const { return AlignBoundary; } | |||||
uint64_t getSize() const { return Size; } | |||||
Not Done ReplyInline ActionsGlobal variables are forbidden in LLVM libraries; there could be multiple LLVMContexts in the same process. efriedma: Global variables are forbidden in LLVM libraries; there could be multiple LLVMContexts in the… | |||||
bool canEmitNops() const { return EmitNops; } | |||||
bool isFused() const { return Fused; } | |||||
void setFused(bool Value) { Fused = Value; } | |||||
void setEmitNops(bool Value) { EmitNops = Value; } | |||||
void setSize(uint64_t Value) { Size = Value; } | |||||
/// @} | |||||
// | |||||
static bool classof(const MCFragment *F) { | |||||
return F->getKind() == MCFragment::FT_BoundaryAlign; | |||||
} | |||||
}; | |||||
} // end namespace llvm | } // end namespace llvm | ||||
#endif // LLVM_MC_MCFRAGMENT_H | #endif // LLVM_MC_MCFRAGMENT_H | ||||
Move llvm_unreachable below the switch, otherwise clang will give a warning: warning: default label in switch which covers all enumera tion values [-Wcovered-switch-default] Unfortunately all GCC (even 9) -Wall will warn warning: control reaches end of non-void function [-Wreturn-type] unless you place an unreachable statement. MaskRay: Move llvm_unreachable below the switch, otherwise clang will give a warning:
warning… | |||||
Not Done ReplyInline ActionsStore AlignBoundarySize as a shift value, then needPadding doesn't even need to call Log2_64(). MaskRay: Store AlignBoundarySize as a shift value, then `needPadding` doesn't even need to call Log2_64… |
Please add a note that the size is lazily set during relaxation, and is not meaningful before that.