14#ifndef LLVM_CODEGEN_MIRYAMLMAPPING_H
15#define LLVM_CODEGEN_MIRYAMLMAPPING_H
54 if (
const auto *
Node =
55 reinterpret_cast<yaml::Input *
>(Ctx)->getCurrentNode())
118 if (
const auto *
Node =
119 reinterpret_cast<yaml::Input *
>(Ctx)->getCurrentNode())
134 IO.
enumCase(EntryKind,
"gp-rel64-block-address",
136 IO.
enumCase(EntryKind,
"gp-rel32-block-address",
150 out <<
uint64_t(Alignment ? Alignment->value() : 0U);
153 unsigned long long n;
155 return "invalid number";
157 return "must be 0 or a power of two";
166 OS << Alignment.
value();
169 unsigned long long N;
171 return "invalid number";
173 return "must be a power of two";
211 std::vector<FlowStringValue>());
290 YamlIO.
mapOptional(
"offset", Object.Offset, (int64_t)0);
293 YamlIO.
mapOptional(
"alignment", Object.Alignment, std::nullopt);
295 YamlIO.
mapOptional(
"callee-saved-register", Object.CalleeSavedRegister,
297 YamlIO.
mapOptional(
"callee-saved-restored", Object.CalleeSavedRestored,
299 YamlIO.
mapOptional(
"local-offset", Object.LocalOffset,
300 std::optional<int64_t>());
301 YamlIO.
mapOptional(
"debug-info-variable", Object.DebugVar,
303 YamlIO.
mapOptional(
"debug-info-expression", Object.DebugExpr,
305 YamlIO.
mapOptional(
"debug-info-location", Object.DebugLoc,
328 YamlIO.
mapRequired(
"entry-value-register", Object.EntryValueRegister);
329 YamlIO.
mapRequired(
"debug-info-variable", Object.DebugVar);
330 YamlIO.
mapRequired(
"debug-info-expression", Object.DebugExpr);
331 YamlIO.
mapRequired(
"debug-info-location", Object.DebugLoc);
392 YamlIO.
mapOptional(
"offset", Object.Offset, (int64_t)0);
394 YamlIO.
mapOptional(
"alignment", Object.Alignment, std::nullopt);
397 YamlIO.
mapOptional(
"isImmutable", Object.IsImmutable,
false);
398 YamlIO.
mapOptional(
"isAliased", Object.IsAliased,
false);
400 YamlIO.
mapOptional(
"callee-saved-register", Object.CalleeSavedRegister,
402 YamlIO.
mapOptional(
"callee-saved-restored", Object.CalleeSavedRestored,
404 YamlIO.
mapOptional(
"debug-info-variable", Object.DebugVar,
406 YamlIO.
mapOptional(
"debug-info-expression", Object.DebugExpr,
408 YamlIO.
mapOptional(
"debug-info-location", Object.DebugLoc,
439 if (
Scalar.starts_with(
"%stack.")) {
441 }
else if (
Scalar.starts_with(
"%fixed-stack.")) {
445 return "Invalid frame index, needs to start with %stack. or "
449 return "Invalid frame index, not a valid number";
451 if (
const auto *
Node =
452 reinterpret_cast<yaml::Input *
>(Ctx)->getCurrentNode())
515 std::vector<CallSiteInfo::ArgRegPair>());
597 YamlIO.
mapOptional(
"blocks", Entry.Blocks, std::vector<FlowStringValue>());
657 std::vector<MachineJumpTable::Entry>());
712 Other.CVBytesOfCalleeSavedRegisters &&
740 YamlIO.
mapOptional(
"cvBytesOfCalleeSavedRegisters",
764 static void mapping(
IO &YamlIO, std::unique_ptr<MachineFunctionInfo> &MFI) {
766 MFI->mappingImpl(YamlIO);
849 std::vector<VirtualRegisterDefinition>());
851 std::vector<MachineFunctionLiveIn>());
853 std::optional<std::vector<FlowStringValue>>());
856 std::vector<FixedMachineStackObject>());
858 std::vector<MachineStackObject>());
860 std::vector<EntryValueObject>());
862 std::vector<CallSiteInfo>());
864 std::vector<DebugValueSubstitution>());
866 std::vector<MachineConstantPoolValue>());
872 std::vector<StringValue>());
875 std::vector<CalledGlobal>());
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequen...
This is an important base class in LLVM.
Tagged union holding either a T or a Error.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
JTEntryKind
JTEntryKind - This enum indicates how each entry of the jump table is represented and emitted.
@ EK_GPRel32BlockAddress
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
@ EK_Inline
EK_Inline - Jump table entries are emitted inline at their point of use.
@ EK_LabelDifference32
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table.
@ EK_Custom32
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
@ EK_LabelDifference64
EK_LabelDifference64 - Each entry is the address of the block minus the address of the jump table.
@ EK_BlockAddress
EK_BlockAddress - Each entry is a plain address of block, e.g.: .word LBB123.
@ EK_GPRel64BlockAddress
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
static LLVM_ABI void printStackObjectReference(raw_ostream &OS, unsigned FrameIndex, bool IsFixed, StringRef Name)
Print a stack object reference.
Represents a range in source code.
StringRef - Represent a constant reference to a string, i.e.
bool consumeInteger(unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
LLVM_ABI Value(Type *Ty, unsigned scid)
This class implements an extremely fast bulk output stream that can only output to a stream.
void mapOptional(const char *Key, T &Val)
virtual bool outputting() const =0
void mapRequired(const char *Key, T &Val)
void enumCase(T &Val, const char *Str, const T ConstVal)
Abstract base class for all Nodes.
SMRange getSourceRange() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
QuotingType
Describe which type of quotes should be used when quoting is necessary.
QuotingType needsQuotes(StringRef S, bool ForcePreserveAsString=true)
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
@ Sub
Subtraction of integers.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t value() const
This is a hole in the type system and should not be abused.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
static void output(const BlockStringValue &S, void *Ctx, raw_ostream &OS)
static StringRef input(StringRef Scalar, void *Ctx, BlockStringValue &S)
This class should be specialized by type that requires custom conversion to/from a YAML literal block...
bool operator==(const BlockStringValue &Other) const
bool operator==(const ArgRegPair &Other) const
Serializable representation of CallSiteInfo.
std::vector< uint64_t > CalleeTypeIds
Numeric callee type identifiers for the callgraph section.
std::vector< ArgRegPair > ArgForwardingRegs
MachineInstrLoc CallLocation
bool operator==(const CallSiteInfo &Other) const
bool operator==(const CalledGlobal &Other) const
Serializable representation of debug value substitutions.
bool operator==(const DebugValueSubstitution &Other) const
Serializable representation of the MCRegister variant of MachineFunction::VariableDbgInfo.
bool operator==(const EntryValueObject &Other) const
StringValue EntryValueRegister
Serializable representation of the fixed stack object from the MachineFrameInfo class.
bool operator==(const FixedMachineStackObject &Other) const
StringValue CalleeSavedRegister
TargetStackID::Value StackID
FlowStringValue(std::string Value)
FlowStringValue()=default
A serializaable representation of a reference to a stack object or fixed stack object.
Expected< int > getFI(const llvm::MachineFrameInfo &MFI) const
bool operator==(const MachineConstantPoolValue &Other) const
Serializable representation of MachineFrameInfo.
bool operator==(const MachineFrameInfo &Other) const
std::vector< SaveRestorePointEntry > RestorePoints
bool IsCalleeSavedInfoValid
unsigned MaxCallFrameSize
~0u means: not computed yet.
StringValue StackProtector
std::vector< SaveRestorePointEntry > SavePoints
bool HasMustTailInVarArgFunc
unsigned CVBytesOfCalleeSavedRegisters
bool HasOpaqueSPAdjustment
bool IsReturnAddressTaken
StringValue FunctionContext
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.
virtual void mappingImpl(IO &YamlIO)
virtual ~MachineFunctionInfo()=default
bool operator==(const MachineFunctionLiveIn &Other) const
StringValue VirtualRegister
std::vector< MachineStackObject > StackObjects
std::vector< StringValue > MachineMetadataNodes
std::optional< std::vector< FlowStringValue > > CalleeSavedRegisters
std::vector< CalledGlobal > CalledGlobals
std::optional< bool > HasFakeUses
std::vector< EntryValueObject > EntryValueObjects
std::optional< bool > NoPHIs
bool TracksDebugUserValues
std::vector< MachineConstantPoolValue > Constants
std::optional< bool > NoVRegs
std::vector< CallSiteInfo > CallSitesInfo
std::vector< MachineFunctionLiveIn > LiveIns
std::vector< VirtualRegisterDefinition > VirtualRegisters
std::vector< FixedMachineStackObject > FixedStackObjects
std::optional< bool > IsSSA
std::vector< DebugValueSubstitution > DebugValueSubstitutions
std::unique_ptr< MachineFunctionInfo > MachineFuncInfo
Constant pool.
MachineJumpTable JumpTableInfo
MachineFrameInfo FrameInfo
Identifies call instruction location in machine function.
bool operator==(const MachineInstrLoc &Other) const
bool operator==(const Entry &Other) const
std::vector< FlowStringValue > Blocks
bool operator==(const MachineJumpTable &Other) const
std::vector< Entry > Entries
MachineJumpTableInfo::JTEntryKind Kind
Serializable representation of stack object from the MachineFrameInfo class.
StringValue CalleeSavedRegister
bool operator==(const MachineStackObject &Other) const
TargetStackID::Value StackID
std::optional< int64_t > LocalOffset
static void mapping(IO &YamlIO, CallSiteInfo &CSInfo)
static void mapping(IO &YamlIO, CallSiteInfo::ArgRegPair &ArgReg)
static void mapping(IO &YamlIO, CalledGlobal &CG)
static void mapping(IO &YamlIO, DebugValueSubstitution &Sub)
static void mapping(yaml::IO &YamlIO, EntryValueObject &Object)
static void mapping(yaml::IO &YamlIO, FixedMachineStackObject &Object)
static void mapping(IO &YamlIO, MachineConstantPoolValue &Constant)
static void mapping(IO &YamlIO, MachineFrameInfo &MFI)
static void mapping(IO &YamlIO, MachineFunctionLiveIn &LiveIn)
static void mapping(IO &YamlIO, MachineFunction &MF)
static void mapping(IO &YamlIO, MachineJumpTable &JT)
static void mapping(IO &YamlIO, MachineJumpTable::Entry &Entry)
static void mapping(yaml::IO &YamlIO, MachineStackObject &Object)
static void mapping(IO &YamlIO, SaveRestorePointEntry &Entry)
static void mapping(IO &YamlIO, VirtualRegisterDefinition &Reg)
static void mapping(IO &YamlIO, std::unique_ptr< MachineFunctionInfo > &MFI)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
bool operator==(const SaveRestorePointEntry &Other) const
static void enumeration(yaml::IO &IO, FixedMachineStackObject::ObjectType &Type)
static void enumeration(yaml::IO &IO, MachineJumpTableInfo::JTEntryKind &EntryKind)
static void enumeration(yaml::IO &IO, MachineStackObject::ObjectType &Type)
static void enumeration(yaml::IO &IO, TargetStackID::Value &ID)
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
static StringRef input(StringRef Scalar, void *, Align &Alignment)
static QuotingType mustQuote(StringRef)
static void output(const Align &Alignment, void *, llvm::raw_ostream &OS)
static QuotingType mustQuote(StringRef S)
static void output(const FlowStringValue &S, void *, raw_ostream &OS)
static StringRef input(StringRef Scalar, void *Ctx, FlowStringValue &S)
static void output(const FrameIndex &FI, void *, raw_ostream &OS)
static StringRef input(StringRef Scalar, void *Ctx, FrameIndex &FI)
static QuotingType mustQuote(StringRef S)
static StringRef input(StringRef Scalar, void *, MaybeAlign &Alignment)
static void output(const MaybeAlign &Alignment, void *, llvm::raw_ostream &out)
static QuotingType mustQuote(StringRef)
static StringRef input(StringRef Scalar, void *Ctx, StringValue &S)
static QuotingType mustQuote(StringRef S)
static void output(const StringValue &S, void *, raw_ostream &OS)
static StringRef input(StringRef Scalar, void *Ctx, UnsignedValue &Value)
static QuotingType mustQuote(StringRef Scalar)
static void output(const UnsignedValue &Value, void *Ctx, raw_ostream &OS)
This class should be specialized by type that requires custom conversion to/from a yaml scalar.
A wrapper around std::string which contains a source range that's being set during parsing.
StringValue(const char Val[])
StringValue(std::string Value)
bool operator==(const StringValue &Other) const
A wrapper around unsigned which contains a source range that's being set during parsing.
bool operator==(const UnsignedValue &Other) const
UnsignedValue(unsigned Value)
bool operator==(const VirtualRegisterDefinition &Other) const
std::vector< FlowStringValue > RegisterFlags
StringValue PreferredRegister