56 std::unique_ptr<PerTargetMIParsingState>
Target;
60 bool NoLLVMIR =
false;
63 bool NoMIRDocuments =
false;
65 std::function<void(
Function &)> ProcessIRFunction;
70 std::function<
void(
Function &)> ProcessIRFunction);
94 std::unique_ptr<Module>
128 std::vector<CalleeSavedInfo> &CSIInfo,
130 bool IsRestored,
int FrameIdx);
142 template <
typename T>
192 std::function<
void(
Function &)> Callback)
194 In(SM.getMemoryBuffer(SM.AddNewSourceBuffer(
std::
move(Contents),
SMLoc()))
197 Filename(Filename), ProcessIRFunction(Callback) {
238std::unique_ptr<Module>
240 if (!In.setCurrentDocument()) {
244 NoMIRDocuments =
true;
245 auto M = std::make_unique<Module>(Filename,
Context);
246 if (
auto LayoutOverride =
247 DataLayoutCallback(M->getTargetTriple(), M->getDataLayoutStr()))
248 M->setDataLayout(*LayoutOverride);
252 std::unique_ptr<Module> M;
255 if (
const auto *BSN =
256 dyn_cast_or_null<yaml::BlockScalarNode>(In.getCurrentNode())) {
259 Context, &IRSlots, DataLayoutCallback);
265 if (!In.setCurrentDocument())
266 NoMIRDocuments =
true;
269 M = std::make_unique<Module>(Filename,
Context);
270 if (
auto LayoutOverride =
271 DataLayoutCallback(M->getTargetTriple(), M->getDataLayoutStr()))
272 M->setDataLayout(*LayoutOverride);
287 }
while (In.setCurrentDocument());
293 auto &
Context = M.getContext();
300 if (ProcessIRFunction)
301 ProcessIRFunction(*
F);
309 yaml::EmptyContext Ctx;
313 TM.createDefaultFuncInfoYAML());
315 yaml::yamlize(In, YamlMF,
false, Ctx);
321 Function *
F = M.getFunction(FunctionName);
326 return error(
Twine(
"function '") + FunctionName +
327 "' isn't defined in the provided LLVM IR");
331 return error(
Twine(
"redefinition of machine function '") + FunctionName +
344 for (
unsigned I = 0,
E =
MRI.getNumVirtRegs();
I !=
E; ++
I) {
346 if (!
MRI.hasOneDef(Reg) && !
MRI.def_empty(Reg))
361 bool HasInlineAsm =
false;
362 bool AllTiedOpsRewritten =
true, HasTiedOps =
false;
367 if (
MI.isInlineAsm())
369 for (
unsigned I = 0;
I <
MI.getNumOperands(); ++
I) {
374 if (MO.
isUse() &&
MI.isRegTiedToDefOperand(
I, &DefIdx)) {
376 if (MO.
getReg() !=
MI.getOperand(DefIdx).getReg())
377 AllTiedOpsRewritten =
false;
384 MF.setHasInlineAsm(HasInlineAsm);
386 if (HasTiedOps && AllTiedOpsRewritten)
395 if (
MRI.getNumVirtRegs() == 0)
408 Twine(
" call instruction block out of range.") +
411 if (MILoc.
Offset >= CallB->size())
413 Twine(
" call instruction offset out of range.") +
414 " Unable to reference instruction at bb: " +
416 auto CallI = std::next(CallB->instr_begin(), MILoc.
Offset);
419 Twine(
" call site info should reference call "
420 "instruction. Instruction at bb:") +
422 " is not a call instruction");
424 for (
auto ArgRegPair : YamlCSInfo.ArgForwardingRegs) {
427 return error(
Error, ArgRegPair.Reg.SourceRange);
431 if (
TM.Options.EmitCallSiteInfo)
436 return error(
Twine(
"Call site info provided but not used"));
440void MIRParserImpl::setupDebugValueTracking(
444 unsigned MaxInstrNum = 0;
447 MaxInstrNum = std::max((
unsigned)
MI.peekDebugInstrNum(), MaxInstrNum);
448 MF.setDebugInstrNumberingCount(MaxInstrNum);
452 MF.makeDebugValueSubstitution({Sub.SrcInst, Sub.SrcOp},
453 {Sub.DstInst, Sub.DstOp}, Sub.Subreg);
577 MRI.freezeReservedRegs(MF);
579 computeFunctionProperties(MF);
584 setupDebugValueTracking(MF, PFS, YamlMF);
605 return error(VReg.ID.SourceRange.Start,
606 Twine(
"redefinition of virtual register '%") +
607 Twine(VReg.ID.Value) +
"'");
608 Info.Explicit =
true;
612 Info.D.RegBank =
nullptr;
614 const auto *RC =
Target->getRegClass(VReg.Class.Value);
622 VReg.Class.SourceRange.Start,
623 Twine(
"use of undefined register class or register bank '") +
624 VReg.Class.Value +
"'");
626 Info.D.RegBank = RegBank;
630 if (!VReg.PreferredRegister.Value.empty()) {
632 return error(VReg.Class.SourceRange.Start,
633 Twine(
"preferred register can only be set for normal vregs"));
636 VReg.PreferredRegister.Value,
Error))
637 return error(
Error, VReg.PreferredRegister.SourceRange);
642 for (
const auto &LiveIn : YamlMF.
LiveIns) {
645 return error(
Error, LiveIn.Register.SourceRange);
647 if (!LiveIn.VirtualRegister.Value.empty()) {
651 return error(
Error, LiveIn.VirtualRegister.SourceRange);
685 error(
Twine(
"Cannot determine class/bank of virtual register ") +
690 if (!
Info.D.RC->isAllocatable()) {
691 error(
Twine(
"Cannot use non-allocatable class '") +
692 TRI->getRegClassName(
Info.D.RC) +
"' for virtual register " +
698 MRI.setRegClass(Reg,
Info.D.RC);
699 if (
Info.PreferredReg != 0)
700 MRI.setSimpleHint(Reg,
Info.PreferredReg);
705 MRI.setRegBank(Reg, *
Info.D.RegBank);
724 if (
auto *
RegMask =
TRI->getCustomEHPadPreservedMask(MF))
777 std::vector<CalleeSavedInfo> CSIInfo;
783 Object.IsImmutable, Object.IsAliased);
788 return error(Object.ID.SourceRange.Start,
789 Twine(
"StackID is not supported by target"));
795 return error(Object.ID.SourceRange.Start,
796 Twine(
"redefinition of fixed stack object '%fixed-stack.") +
797 Twine(Object.ID.Value) +
"'");
799 Object.CalleeSavedRestored, ObjectIdx))
810 return error(
Error, Object.EntryValueRegister.SourceRange);
811 if (!Reg.isPhysical())
812 return error(Object.EntryValueRegister.SourceRange.Start,
813 "Expected physical register for entry value field");
815 PFS, Object.DebugVar, Object.DebugExpr, Object.DebugLoc);
818 if (MaybeInfo->DIVar || MaybeInfo->DIExpr || MaybeInfo->DILoc)
820 Reg.asMCReg(), MaybeInfo->DILoc);
828 if (!
Name.Value.empty()) {
829 Alloca = dyn_cast_or_null<AllocaInst>(
830 F.getValueSymbolTable()->lookup(
Name.Value));
833 "alloca instruction named '" +
Name.Value +
834 "' isn't defined in the function '" +
F.getName() +
838 return error(Object.ID.SourceRange.Start,
839 Twine(
"StackID is not supported by target"));
845 Object.Size, Object.Alignment.valueOrOne(),
852 return error(Object.ID.SourceRange.Start,
853 Twine(
"redefinition of stack object '%stack.") +
854 Twine(Object.ID.Value) +
"'");
856 Object.CalleeSavedRestored, ObjectIdx))
858 if (Object.LocalOffset)
864 if (!CSIInfo.empty())
889 std::vector<CalleeSavedInfo> &CSIInfo,
891 if (RegisterSource.
Value.empty())
899 CSIInfo.push_back(CSI);
910 Result = dyn_cast<T>(
Node);
912 return Parser.
error(Source.SourceRange.Start,
913 "expected a reference to a '" + TypeString +
924 if (parseMDNode(PFS, Var, VarStr) || parseMDNode(PFS, Expr, ExprStr) ||
925 parseMDNode(PFS, Loc, LocStr))
939 const T &Object,
int FrameIdx) {
940 std::optional<VarExprLoc> MaybeInfo =
941 parseVarExprLoc(PFS, Object.DebugVar, Object.DebugExpr, Object.DebugLoc);
946 if (MaybeInfo->DIVar || MaybeInfo->DIExpr || MaybeInfo->DILoc)
954 if (Source.Value.empty())
968 for (
const auto &YamlConstant : YamlMF.
Constants) {
969 if (YamlConstant.IsTargetSpecific)
971 return error(YamlConstant.Value.SourceRange.Start,
972 "Can't parse target-specific constant pool entries yet");
976 return error(
Error, YamlConstant.Value.SourceRange);
977 const Align PrefTypeAlign =
979 const Align Alignment = YamlConstant.Alignment.value_or(PrefTypeAlign);
981 if (!ConstantPoolSlots.
insert(std::make_pair(YamlConstant.ID.Value,
Index))
983 return error(YamlConstant.ID.SourceRange.Start,
984 Twine(
"redefinition of constant pool item '%const.") +
985 Twine(YamlConstant.ID.Value) +
"'");
993 for (
const auto &Entry : YamlJTI.
Entries) {
994 std::vector<MachineBasicBlock *>
Blocks;
995 for (
const auto &MBBSource : Entry.Blocks) {
997 if (parseMBBReference(PFS,
MBB, MBBSource.Value))
1004 return error(Entry.ID.SourceRange.Start,
1005 Twine(
"redefinition of jump table entry '%jump-table.") +
1006 Twine(Entry.ID.Value) +
"'");
1032 if (parseMachineMetadata(PFS, MDS))
1038 "use of undefined metadata '!" +
1052 (HasQuote ? 1 : 0));
1066 unsigned Line = LineAndColumn.first +
Error.getLineNo() - 1;
1067 unsigned Column =
Error.getColumnNo();
1075 if (L.line_number() == Line) {
1078 auto Indent = LineStr.
find(
Error.getLineContents());
1086 Error.getMessage(), LineStr,
Error.getRanges(),
1095std::unique_ptr<Module>
1097 return Impl->parseIRModule(DataLayoutCallback);
1101 return Impl->parseMachineFunctions(M, MMI);
1106 std::function<
void(
Function &)> ProcessIRFunction) {
1108 if (std::error_code EC = FileOrErr.getError()) {
1110 "Could not open input file: " + EC.message());
1117std::unique_ptr<MIRParser>
1120 std::function<
void(
Function &)> ProcessIRFunction) {
1121 auto Filename = Contents->getBufferIdentifier();
1127 "Can't read MIR with a Context that discards named Values")));
1130 return std::make_unique<MIRParser>(std::make_unique<MIRParserImpl>(
1131 std::move(Contents), Filename,
Context, ProcessIRFunction));
unsigned const MachineRegisterInfo * MRI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
This file defines the DenseMap class.
DenseMap< Block *, BlockRelaxAux > Blocks
static bool isSSA(const MachineFunction &MF)
static void handleYAMLDiag(const SMDiagnostic &Diag, void *Context)
static bool typecheckMDNode(T *&Result, MDNode *Node, const yaml::StringValue &Source, StringRef TypeString, MIRParserImpl &Parser)
Verify that given node is of a certain type. Return true on error.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
unsigned const TargetRegisterInfo * TRI
Module.h This file contains the declarations for the Module class.
const char LLVMTargetMachineRef TM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static constexpr uint32_t RegMask
an instruction to allocate memory on the stack
LLVM Basic Block Representation.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
This is an important base class in LLVM.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Diagnostic information for machine IR parser.
Lightweight error class with error context and mandatory checking.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Module * getParent()
Get the module that this global value is contained inside of...
@ ExternalLinkage
Externally visible function.
This is an important class for using LLVM in a threaded context.
bool shouldDiscardValueNames() const
Return true if the Context runtime configuration is set to discard all value names.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
This class implements the parsing of LLVM IR that's embedded inside a MIR file.
bool error(const Twine &Message)
Report an error with the given message at unknown location.
void reportDiagnostic(const SMDiagnostic &Diag)
bool setupRegisterInfo(const PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
bool parseRegisterInfo(PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
bool initializeFrameInfo(PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
Function * createDummyFunction(StringRef Name, Module &M)
Create an empty function with the given name.
bool parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS, const T &Object, int FrameIdx)
bool initializeMachineFunction(const yaml::MachineFunction &YamlMF, MachineFunction &MF)
Initialize the machine function to the state that's described in the MIR file.
std::unique_ptr< Module > parseIRModule(DataLayoutCallbackTy DataLayoutCallback)
Try to parse the optional LLVM module and the machine functions in the MIR file.
bool initializeJumpTableInfo(PerFunctionMIParsingState &PFS, const yaml::MachineJumpTable &YamlJTI)
bool parseMachineFunctions(Module &M, MachineModuleInfo &MMI)
bool initializeConstantPool(PerFunctionMIParsingState &PFS, MachineConstantPool &ConstantPool, const yaml::MachineFunction &YamlMF)
MIRParserImpl(std::unique_ptr< MemoryBuffer > Contents, StringRef Filename, LLVMContext &Context, std::function< void(Function &)> ProcessIRFunction)
std::optional< VarExprLoc > parseVarExprLoc(PerFunctionMIParsingState &PFS, const yaml::StringValue &VarStr, const yaml::StringValue &ExprStr, const yaml::StringValue &LocStr)
bool parseMachineFunction(Module &M, MachineModuleInfo &MMI)
Parse the machine function in the current YAML document.
bool parseCalleeSavedRegister(PerFunctionMIParsingState &PFS, std::vector< CalleeSavedInfo > &CSIInfo, const yaml::StringValue &RegisterSource, bool IsRestored, int FrameIdx)
bool parseMachineMetadataNodes(PerFunctionMIParsingState &PFS, MachineFunction &MF, const yaml::MachineFunction &YMF)
bool initializeCallSiteInfo(PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
MIRParser(std::unique_ptr< MIRParserImpl > Impl)
std::unique_ptr< Module > parseIRModule(DataLayoutCallbackTy DataLayoutCallback=[](StringRef, StringRef) { return std::nullopt;})
Parses the optional LLVM IR module in the MIR file.
bool parseMachineFunctions(Module &M, MachineModuleInfo &MMI)
Parses MachineFunctions in the MIR file and add them to the given MachineModuleInfo MMI.
bool isEHPad() const
Returns true if the block is a landing pad.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
void setAdjustsStack(bool V)
void setRestorePoint(MachineBasicBlock *NewRestore)
int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it.
void ensureMaxAlignment(Align Alignment)
Make sure the function is at least Align bytes aligned.
void setHasPatchPoint(bool s=true)
void setLocalFrameSize(int64_t sz)
Set the size of the local object blob.
void setObjectOffset(int ObjectIdx, int64_t SPOffset)
Set the stack frame offset of the specified object.
void setFrameAddressIsTaken(bool T)
void setHasStackMap(bool s=true)
void setCVBytesOfCalleeSavedRegisters(unsigned S)
void setStackID(int ObjectIdx, uint8_t ID)
void setHasTailCall(bool V=true)
void setStackProtectorIndex(int I)
void setCalleeSavedInfoValid(bool v)
void setReturnAddressIsTaken(bool s)
void mapLocalFrameObject(int ObjectIndex, int64_t Offset)
Map a frame index into the local object block.
void setOffsetAdjustment(int Adj)
Set the correction for frame offsets.
void setHasOpaqueSPAdjustment(bool B)
void setCalleeSavedInfo(std::vector< CalleeSavedInfo > CSI)
Used by prolog/epilog inserter to set the function's callee saved information.
int CreateVariableSizedObject(Align Alignment, const AllocaInst *Alloca)
Notify the MachineFrameInfo object that a variable sized object has been created.
void setSavePoint(MachineBasicBlock *NewSave)
void setMaxCallFrameSize(unsigned S)
int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset, bool IsImmutable=false)
Create a spill slot at a fixed location on the stack.
void setStackSize(uint64_t Size)
Set the size of the stack.
void setHasVAStart(bool B)
void setHasMustTailInVarArgFunc(bool B)
void setObjectAlignment(int ObjectIdx, Align Alignment)
setObjectAlignment - Change the alignment of the specified stack object.
void setFunctionContextIndex(int I)
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
MachineFunctionProperties & reset(Property P)
void setBBSectionsType(BasicBlockSection V)
void setCallsUnwindInit(bool b)
void setHasEHFunclets(bool V)
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there's a call to a "returns twice" function.
void setHasWinCFI(bool v)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist,...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void setHasEHCatchret(bool V)
void setCallsEHReturn(bool b)
void setAlignment(Align A)
setAlignment - Set the alignment of the function.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
bool hasBBSections() const
Returns true if this function has basic block sections enabled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void addCallArgsForwardingRegs(const MachineInstr *CallI, CallSiteInfoImpl &&CallInfo)
Start tracking the arguments passed to the call CallI.
Function & getFunction()
Return the LLVM function that this machine code represents.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
void setIsOutlined(bool V)
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const MachineFunctionProperties & getProperties() const
Get the function properties.
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable in a stack slot.
void setHasEHScopes(bool V)
bool verify(Pass *p=nullptr, const char *Banner=nullptr, bool AbortOnError=true) const
Run the current MachineFunction through the machine code verifier, useful for debugger use.
void assignBeginEndSections()
Assign IsBeginSection IsEndSection fields for basic blocks in this function.
Representation of each machine instruction.
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
This class contains meta information specific to a module.
MachineFunction & getOrCreateMachineFunction(Function &F)
Returns the MachineFunction constructed for the IR function F.
const LLVMTargetMachine & getTarget() const
MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
Register getReg() const
getReg - Returns the register number.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
void invalidateLiveness()
invalidateLiveness - Indicates that register liveness is no longer being tracked accurately.
void setCalleeSavedRegs(ArrayRef< MCPhysReg > CSRs)
Sets the updated Callee Saved Registers list.
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
A Module instance is used to store all the information related to an LLVM module.
This class implements the register bank concept.
Wrapper class representing virtual and physical registers.
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
SourceMgr::DiagKind getKind() const
Represents a location in source code.
static SMLoc getFromPointer(const char *Ptr)
constexpr const char * getPointer() const
Represents a range in source code.
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
unsigned getMainFileID() const
std::pair< unsigned, unsigned > getLineAndColumn(SMLoc Loc, unsigned BufferID=0) const
Find the line and column number for the specified location in the specified file.
const MemoryBuffer * getMemoryBuffer(unsigned i) const
SMDiagnostic GetMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges={}, ArrayRef< SMFixIt > FixIts={}) const
Return an SMDiagnostic at the specified location with the specified string.
unsigned AddNewSourceBuffer(std::unique_ptr< MemoryBuffer > F, SMLoc IncludeLoc)
Add a new source buffer to this source manager.
StringRef - Represent a constant reference to a string, i.e.
bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static constexpr size_t npos
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Information about stack frame layout on the target.
virtual bool isSupportedStackID(TargetStackID::Value ID) const
llvm::BasicBlockSection getBBSectionsType() const
If basic blocks should be emitted into their own section, corresponding to -fbasic-block-sections.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
virtual void mirFileLoaded(MachineFunction &MF) const
This is called after a .mir file was loaded.
virtual const TargetFrameLowering * getFrameLowering() const
Target - Wrapper for Target specific information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::string str() const
Return the twine contents as a std::string.
static Type * getVoidTy(LLVMContext &C)
This function has undefined behavior.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
An efficient, type-erasing, non-owning reference to a callable.
A forward iterator which reads text lines from a buffer.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
bool parseStackObjectReference(PerFunctionMIParsingState &PFS, int &FI, StringRef Src, SMDiagnostic &Error)
bool parseMDNode(PerFunctionMIParsingState &PFS, MDNode *&Node, StringRef Src, SMDiagnostic &Error)
bool parseMachineBasicBlockDefinitions(PerFunctionMIParsingState &PFS, StringRef Src, SMDiagnostic &Error)
Parse the machine basic block definitions, and skip the machine instructions.
bool parseMBBReference(PerFunctionMIParsingState &PFS, MachineBasicBlock *&MBB, StringRef Src, SMDiagnostic &Error)
std::unique_ptr< MIRParser > createMIRParserFromFile(StringRef Filename, SMDiagnostic &Error, LLVMContext &Context, std::function< void(Function &)> ProcessIRFunction=nullptr)
This function is the main interface to the MIR serialization format parser.
std::unique_ptr< MIRParser > createMIRParser(std::unique_ptr< MemoryBuffer > Contents, LLVMContext &Context, std::function< void(Function &)> ProcessIRFunction=nullptr)
This function is another interface to the MIR serialization format parser.
std::unique_ptr< Module > parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, DataLayoutCallbackTy DataLayoutCallback=[](StringRef, StringRef) { return std::nullopt;})
parseAssemblyFile and parseAssemblyString are wrappers around this function.
bool parseMachineInstructions(PerFunctionMIParsingState &PFS, StringRef Src, SMDiagnostic &Error)
Parse the machine instructions.
bool parseRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
Constant * parseConstantValue(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type and a constant value in the given string.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
bool parseMachineMetadata(PerFunctionMIParsingState &PFS, StringRef Src, SMRange SourceRange, SMDiagnostic &Error)
bool parseVirtualRegisterReference(PerFunctionMIParsingState &PFS, VRegInfo *&Info, StringRef Src, SMDiagnostic &Error)
bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
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.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
DenseMap< unsigned, unsigned > JumpTableSlots
VRegInfo & getVRegInfo(Register Num)
DenseMap< unsigned, int > FixedStackObjectSlots
DenseMap< unsigned, unsigned > ConstantPoolSlots
StringMap< VRegInfo * > VRegInfosNamed
DenseMap< unsigned, int > StackObjectSlots
std::map< unsigned, std::pair< TempMDTuple, SMLoc > > MachineForwardRefMDNodes
DenseMap< Register, VRegInfo * > VRegInfos
This struct contains the mappings from the slot numbers to unnamed metadata nodes,...
Identifies call instruction location in machine function.
Serializable representation of MachineFrameInfo.
unsigned MaxCallFrameSize
~0u means: not computed yet.
StringValue StackProtector
bool HasMustTailInVarArgFunc
unsigned CVBytesOfCalleeSavedRegisters
bool HasOpaqueSPAdjustment
bool IsReturnAddressTaken
StringValue FunctionContext
std::vector< MachineStackObject > StackObjects
std::vector< StringValue > MachineMetadataNodes
std::optional< std::vector< FlowStringValue > > CalleeSavedRegisters
std::vector< EntryValueObject > EntryValueObjects
bool TracksDebugUserValues
std::vector< MachineConstantPoolValue > Constants
std::vector< CallSiteInfo > CallSitesInfo
std::vector< MachineFunctionLiveIn > LiveIns
std::vector< VirtualRegisterDefinition > VirtualRegisters
std::vector< FixedMachineStackObject > FixedStackObjects
std::vector< DebugValueSubstitution > DebugValueSubstitutions
std::unique_ptr< MachineFunctionInfo > MachineFuncInfo
Constant pool.
MachineJumpTable JumpTableInfo
MachineFrameInfo FrameInfo
std::vector< Entry > Entries
MachineJumpTableInfo::JTEntryKind Kind
A wrapper around std::string which contains a source range that's being set during parsing.