2020#include " WinException.h"
2121#include " llvm/ADT/APFloat.h"
2222#include " llvm/ADT/APInt.h"
23+ #include " llvm/ADT/BitmaskEnum.h"
2324#include " llvm/ADT/DenseMap.h"
2425#include " llvm/ADT/STLExtras.h"
2526#include " llvm/ADT/SmallPtrSet.h"
@@ -205,6 +206,17 @@ class AddrLabelMapCallbackPtr final : CallbackVH {
205206};
206207} // namespace
207208
209+ namespace callgraph {
210+ LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE ();
211+ enum Flags : uint8_t {
212+ None = 0 ,
213+ IsIndirectTarget = 1u << 0 ,
214+ HasDirectCallees = 1u << 1 ,
215+ HasIndirectCallees = 1u << 2 ,
216+ LLVM_MARK_AS_BITMASK_ENUM (/* LargestValue*/ HasIndirectCallees)
217+ };
218+ } // namespace callgraph
219+
208220class llvm ::AddrLabelMap {
209221 MCContext &Context;
210222 struct AddrLabelSymEntry {
@@ -1696,19 +1708,14 @@ void AsmPrinter::emitCallGraphSection(const MachineFunction &MF,
16961708 const auto &DirectCallees = FuncCGInfo.DirectCallees ;
16971709 const auto &IndirectCalleeTypeIDs = FuncCGInfo.IndirectCalleeTypeIDs ;
16981710
1699- enum CallGraphFlags : uint8_t {
1700- IsIndirectTargetFlag = 1u << 0 ,
1701- HasDirectCalleesFlag = 1u << 1 ,
1702- HasIndirectCalleesFlag = 1u << 2 ,
1703- };
1704-
1705- uint8_t Flags = 0 ;
1711+ using namespace callgraph ;
1712+ Flags CGFlags = Flags::None;
17061713 if (IsIndirectTarget)
1707- Flags |= IsIndirectTargetFlag ;
1714+ CGFlags |= Flags::IsIndirectTarget ;
17081715 if (DirectCallees.size () > 0 )
1709- Flags |= HasDirectCalleesFlag ;
1716+ CGFlags |= Flags::HasDirectCallees ;
17101717 if (IndirectCalleeTypeIDs.size () > 0 )
1711- Flags |= HasIndirectCalleesFlag ;
1718+ CGFlags |= Flags::HasIndirectCallees ;
17121719
17131720 // Emit function's call graph information.
17141721 // 1) CallGraphSectionFormatVersion
@@ -1726,7 +1733,7 @@ void AsmPrinter::emitCallGraphSection(const MachineFunction &MF,
17261733 // 7) Number of unique indirect target type IDs, if at least one exists.
17271734 // 8) Each unique indirect target type id.
17281735 OutStreamer->emitInt8 (CallGraphSectionFormatVersion::V_0);
1729- OutStreamer->emitInt8 (Flags );
1736+ OutStreamer->emitInt8 (static_cast < uint8_t >(CGFlags) );
17301737 OutStreamer->emitSymbolValue (FunctionSymbol, TM.getProgramPointerSize ());
17311738 const auto *TypeId = extractNumericCGTypeId (F);
17321739 if (IsIndirectTarget && TypeId)
0 commit comments