Go to the documentation of this file.
57 std::unique_ptr<PerTargetMIParsingState>
Target;
61 bool NoLLVMIR =
false;
64 bool NoMIRDocuments =
false;
95 std::unique_ptr<Module>
129 std::vector<CalleeSavedInfo> &CSIInfo,
131 bool IsRestored,
int FrameIdx);
133 template <
typename T>
185 In(SM.getMemoryBuffer(SM.AddNewSourceBuffer(
std::
move(Contents),
SMLoc()))
188 Filename(Filename), ProcessIRFunction(Callback) {
229 std::unique_ptr<Module>
231 if (!In.setCurrentDocument()) {
235 NoMIRDocuments =
true;
236 auto M = std::make_unique<Module>(Filename,
Context);
237 if (
auto LayoutOverride = DataLayoutCallback(
M->getTargetTriple()))
238 M->setDataLayout(*LayoutOverride);
242 std::unique_ptr<Module>
M;
245 if (
const auto *BSN =
246 dyn_cast_or_null<yaml::BlockScalarNode>(In.getCurrentNode())) {
249 Context, &IRSlots, DataLayoutCallback);
255 if (!In.setCurrentDocument())
256 NoMIRDocuments =
true;
259 M = std::make_unique<Module>(Filename,
Context);
260 if (
auto LayoutOverride = DataLayoutCallback(
M->getTargetTriple()))
261 M->setDataLayout(*LayoutOverride);
276 }
while (In.setCurrentDocument());
289 if (ProcessIRFunction)
290 ProcessIRFunction(*
F);
298 yaml::EmptyContext Ctx;
302 TM.createDefaultFuncInfoYAML());
304 yaml::yamlize(In, YamlMF,
false, Ctx);
315 return error(
Twine(
"function '") + FunctionName +
316 "' isn't defined in the provided LLVM IR");
320 return error(
Twine(
"redefinition of machine function '") + FunctionName +
350 bool HasInlineAsm =
false;
351 bool AllTiedOpsRewritten =
true, HasTiedOps =
false;
356 if (
MI.isInlineAsm())
358 for (
unsigned I = 0;
I <
MI.getNumOperands(); ++
I) {
363 if (MO.
isUse() &&
MI.isRegTiedToDefOperand(
I, &DefIdx)) {
365 if (MO.
getReg() !=
MI.getOperand(DefIdx).getReg())
366 AllTiedOpsRewritten =
false;
373 MF.setHasInlineAsm(HasInlineAsm);
375 if (HasTiedOps && AllTiedOpsRewritten)
397 Twine(
" call instruction block out of range.") +
400 if (MILoc.
Offset >= CallB->size())
402 Twine(
" call instruction offset out of range.") +
403 " Unable to reference instruction at bb: " +
405 auto CallI = std::next(CallB->instr_begin(), MILoc.
Offset);
408 Twine(
" call site info should reference call "
409 "instruction. Instruction at bb:") +
411 " is not a call instruction");
413 for (
auto ArgRegPair : YamlCSInfo.ArgForwardingRegs) {
416 return error(
Error, ArgRegPair.Reg.SourceRange);
420 if (
TM.Options.EmitCallSiteInfo)
425 return error(
Twine(
"Call site info provided but not used"));
429 void MIRParserImpl::setupDebugValueTracking(
433 unsigned MaxInstrNum = 0;
436 MaxInstrNum =
std::max((
unsigned)
MI.peekDebugInstrNum(), MaxInstrNum);
437 MF.setDebugInstrNumberingCount(MaxInstrNum);
441 MF.makeDebugValueSubstitution({Sub.SrcInst, Sub.SrcOp},
442 {Sub.DstInst, Sub.DstOp}, Sub.Subreg);
564 computeFunctionProperties(MF);
569 setupDebugValueTracking(MF, PFS, YamlMF);
590 return error(VReg.ID.SourceRange.Start,
591 Twine(
"redefinition of virtual register '%") +
592 Twine(VReg.ID.Value) +
"'");
593 Info.Explicit =
true;
597 Info.D.RegBank =
nullptr;
599 const auto *RC =
Target->getRegClass(VReg.Class.Value);
607 VReg.Class.SourceRange.Start,
608 Twine(
"use of undefined register class or register bank '") +
609 VReg.Class.Value +
"'");
611 Info.D.RegBank = RegBank;
615 if (!VReg.PreferredRegister.Value.empty()) {
617 return error(VReg.Class.SourceRange.Start,
618 Twine(
"preferred register can only be set for normal vregs"));
621 VReg.PreferredRegister.Value,
Error))
622 return error(
Error, VReg.PreferredRegister.SourceRange);
627 for (
const auto &LiveIn : YamlMF.
LiveIns) {
630 return error(
Error, LiveIn.Register.SourceRange);
632 if (!LiveIn.VirtualRegister.Value.empty()) {
636 return error(
Error, LiveIn.VirtualRegister.SourceRange);
650 CalleeSavedRegisters.push_back(
Reg);
668 error(
Twine(
"Cannot determine class/bank of virtual register ") +
674 if (
Info.PreferredReg != 0)
753 std::vector<CalleeSavedInfo> CSIInfo;
765 Twine(
"StackID is not supported by target"));
772 Twine(
"redefinition of fixed stack object '%fixed-stack.") +
775 Object.CalleeSavedRestored, ObjectIdx))
786 if (!
Name.Value.empty()) {
787 Alloca = dyn_cast_or_null<AllocaInst>(
788 F.getValueSymbolTable()->lookup(
Name.Value));
791 "alloca instruction named '" +
Name.Value +
792 "' isn't defined in the function '" +
F.getName() +
797 Twine(
"StackID is not supported by target"));
811 Twine(
"redefinition of stack object '%stack.") +
814 Object.CalleeSavedRestored, ObjectIdx))
822 if (!CSIInfo.empty())
847 std::vector<CalleeSavedInfo> &CSIInfo,
849 if (RegisterSource.
Value.empty())
857 CSIInfo.push_back(CSI);
862 template <
typename T>
868 Result = dyn_cast<T>(Node);
871 "expected a reference to a '" + TypeString +
876 template <
typename T>
878 const T &Object,
int FrameIdx) {
881 MDNode *Var =
nullptr, *Expr =
nullptr, *Loc =
nullptr;
882 if (parseMDNode(PFS, Var,
Object.DebugVar) ||
883 parseMDNode(PFS, Expr,
Object.DebugExpr) ||
884 parseMDNode(PFS, Loc,
Object.DebugLoc))
886 if (!Var && !Expr && !Loc)
915 for (
const auto &YamlConstant : YamlMF.
Constants) {
916 if (YamlConstant.IsTargetSpecific)
918 return error(YamlConstant.Value.SourceRange.Start,
919 "Can't parse target-specific constant pool entries yet");
923 return error(
Error, YamlConstant.Value.SourceRange);
924 const Align PrefTypeAlign =
926 const Align Alignment = YamlConstant.Alignment.getValueOr(PrefTypeAlign);
928 if (!ConstantPoolSlots.
insert(std::make_pair(YamlConstant.ID.Value, Index))
930 return error(YamlConstant.ID.SourceRange.Start,
931 Twine(
"redefinition of constant pool item '%const.") +
932 Twine(YamlConstant.ID.Value) +
"'");
940 for (
const auto &Entry : YamlJTI.
Entries) {
941 std::vector<MachineBasicBlock *> Blocks;
942 for (
const auto &MBBSource : Entry.Blocks) {
944 if (parseMBBReference(PFS,
MBB, MBBSource.Value))
951 return error(Entry.ID.SourceRange.Start,
952 Twine(
"redefinition of jump table entry '%jump-table.") +
953 Twine(Entry.ID.Value) +
"'");
979 if (parseMachineMetadata(PFS, MDS))
985 "use of undefined metadata '!" +
1013 unsigned Line = LineAndColumn.first +
Error.getLineNo() - 1;
1014 unsigned Column =
Error.getColumnNo();
1022 if (L.line_number() == Line) {
1025 auto Indent = LineStr.
find(
Error.getLineContents());
1033 Error.getMessage(), LineStr,
Error.getRanges(),
1042 std::unique_ptr<Module>
1044 return Impl->parseIRModule(DataLayoutCallback);
1048 return Impl->parseMachineFunctions(
M, MMI);
1055 if (std::error_code EC = FileOrErr.getError()) {
1057 "Could not open input file: " + EC.message());
1064 std::unique_ptr<MIRParser>
1068 auto Filename = Contents->getBufferIdentifier();
1074 "Can't read MIR with a Context that discards named Values")));
1077 return std::make_unique<MIRParser>(std::make_unique<MIRParserImpl>(
void reportDiagnostic(const SMDiagnostic &Diag)
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
Information about stack frame layout on the target.
static void handleYAMLDiag(const SMDiagnostic &Diag, void *Context)
std::unique_ptr< Module > parseIRModule(DataLayoutCallbackTy DataLayoutCallback=[](StringRef) { return None;})
Parses the optional LLVM IR module in the MIR file.
void setReturnAddressIsTaken(bool s)
A forward iterator which reads text lines from a buffer.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
MachineJumpTable JumpTableInfo
void assignBeginEndSections()
Assign IsBeginSection IsEndSection fields for basic blocks in this function.
Target - Wrapper for Target specific information.
void setCVBytesOfCalleeSavedRegisters(unsigned S)
static constexpr size_t npos
bool error(const Twine &Message)
Report an error with the given message at unknown location.
LLVM_NODISCARD size_t find(char C, size_t From=0) const
Search for the first character C in the string.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
std::vector< MachineStackObject > StackObjects
DenseMap< unsigned, int > StackObjectSlots
Reg
All possible values of the reg field in the ModR/M byte.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist,...
void setCallsUnwindInit(bool b)
DenseMap< unsigned, int > FixedStackObjectSlots
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool parseMachineInstructions(PerFunctionMIParsingState &PFS, StringRef Src, SMDiagnostic &Error)
Parse the machine instructions.
void setStackSize(uint64_t Size)
Set the size of the stack.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
virtual void mirFileLoaded(MachineFunction &MF) const
This is called after a .mir file was loaded.
bool parseCalleeSavedRegister(PerFunctionMIParsingState &PFS, std::vector< CalleeSavedInfo > &CSIInfo, const yaml::StringValue &RegisterSource, bool IsRestored, int FrameIdx)
StringMap< VRegInfo * > VRegInfosNamed
Properties which a MachineFunction may have at a given point in time.
void setMaxCallFrameSize(unsigned S)
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
bool parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS, const T &Object, int FrameIdx)
std::unique_ptr< Module > parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, DataLayoutCallbackTy DataLayoutCallback=[](StringRef) { return None;})
parseAssemblyFile and parseAssemblyString are wrappers around this function.
void setAdjustsStack(bool V)
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
void setHasEHFunclets(bool V)
int CreateVariableSizedObject(Align Alignment, const AllocaInst *Alloca)
Notify the MachineFrameInfo object that a variable sized object has been created.
bool initializeJumpTableInfo(PerFunctionMIParsingState &PFS, const yaml::MachineJumpTable &YamlJTI)
unsigned const TargetRegisterInfo * TRI
unsigned CVBytesOfCalleeSavedRegisters
bool parseRegisterInfo(PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
void setObjectAlignment(int ObjectIdx, Align Alignment)
setObjectAlignment - Change the alignment of the specified stack object.
bool parseMachineBasicBlockDefinitions(PerFunctionMIParsingState &PFS, StringRef Src, SMDiagnostic &Error)
Parse the machine basic block definitions, and skip the machine instructions.
LLVM Basic Block Representation.
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there's a call to a "returns twice" function.
void setHasStackMap(bool s=true)
void push_back(MachineInstr *MI)
DenseMap< unsigned, unsigned > JumpTableSlots
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
bool parseStackObjectReference(PerFunctionMIParsingState &PFS, int &FI, StringRef Src, SMDiagnostic &Error)
bool parseMDNode(PerFunctionMIParsingState &PFS, MDNode *&Node, StringRef Src, SMDiagnostic &Error)
This class implements the register bank concept.
Represents a location in source code.
bool initializeConstantPool(PerFunctionMIParsingState &PFS, MachineConstantPool &ConstantPool, const yaml::MachineFunction &YamlMF)
void ensureMaxAlignment(Align Alignment)
Make sure the function is at least Align bytes aligned.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void setAlignment(Align A)
setAlignment - Set the alignment of the function.
void setCalleeSavedInfoValid(bool v)
std::unique_ptr< MachineFunctionInfo > MachineFuncInfo
Constant pool.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
const LLVMTargetMachine & getTarget() const
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
const MachineFunctionProperties & getProperties() const
Get the function properties.
MachineOperand class - Representation of each machine instruction operand.
void setHasOpaqueSPAdjustment(bool B)
MachineFunctionProperties & set(Property P)
void setCalleeSavedRegs(ArrayRef< MCPhysReg > CSRs)
Sets the updated Callee Saved Registers list.
This class contains meta information specific to a module.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
unsigned getMainFileID() const
Optional< std::vector< FlowStringValue > > CalleeSavedRegisters
void setHasWinCFI(bool v)
void freezeReservedRegs(const MachineFunction &)
freezeReservedRegs - Called by the register allocator to freeze the set of reserved registers before ...
MIRParserImpl(std::unique_ptr< MemoryBuffer > Contents, StringRef Filename, LLVMContext &Context, std::function< void(Function &)> ProcessIRFunction)
MachineFrameInfo FrameInfo
Analysis containing CSE Info
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.
This struct is a compact representation of a valid (non-zero power of two) alignment.
LLVM_NODISCARD bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
bool def_empty(Register RegNo) const
def_empty - Return true if there are no instructions defining the specified register (it may be live-...
const MemoryBuffer * getMemoryBuffer(unsigned i) const
std::string str() const
Return the twine contents as a std::string.
An efficient, type-erasing, non-owning reference to a callable.
StringValue StackProtector
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
DenseMap< Register, VRegInfo * > VRegInfos
void setCalleeSavedInfo(std::vector< CalleeSavedInfo > CSI)
Used by prolog/epilog inserter to set the function's callee saved information.
void setHasMustTailInVarArgFunc(bool B)
This struct contains the mappings from the slot numbers to unnamed metadata nodes,...
This is an important base class in LLVM.
int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset, bool IsImmutable=false)
Create a spill slot at a fixed location on the stack.
bool parseMachineMetadata(PerFunctionMIParsingState &PFS, StringRef Src, SMRange SourceRange, SMDiagnostic &Error)
virtual bool isSupportedStackID(TargetStackID::Value ID) const
void addCallArgsForwardingRegs(const MachineInstr *CallI, CallSiteInfoImpl &&CallInfo)
Start tracking the arguments passed to the call CallI.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Representation of each machine instruction.
VRegInfo & getVRegInfo(Register Num)
void setHasEHCatchret(bool V)
void setRegBank(Register Reg, const RegisterBank &RegBank)
Set the register bank to RegBank for Reg.
bool shouldDiscardValueNames() const
Return true if the Context runtime configuration is set to discard all value names.
Module * getParent()
Get the module that this global value is contained inside of...
StringValue FunctionContext
std::map< unsigned, std::pair< TempMDTuple, SMLoc > > MachineForwardRefMDNodes
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.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
This is an important class for using LLVM in a threaded context.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
void setObjectOffset(int ObjectIdx, int64_t SPOffset)
Set the stack frame offset of the specified object.
void setRestorePoint(MachineBasicBlock *NewRestore)
void setFunctionContextIndex(int I)
void mapLocalFrameObject(int ObjectIndex, int64_t Offset)
Map a frame index into the local object block.
void setSimpleHint(Register VReg, Register PrefReg)
Specify the preferred (target independent) register allocation hint for the specified virtual registe...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
std::vector< FixedMachineStackObject > FixedStackObjects
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.
void setHasTailCall(bool V=true)
MachineOperand * getOneDef(Register Reg) const
Returns the defining operand if there is exactly one operand defining the specified register,...
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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.
bool initializeMachineFunction(const yaml::MachineFunction &YamlMF, MachineFunction &MF)
Initialize the machine function to the state that's described in the MIR file.
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
print Print MemDeps of function
bool initializeFrameInfo(PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
bool parseMachineMetadataNodes(PerFunctionMIParsingState &PFS, MachineFunction &MF, const yaml::MachineFunction &YMF)
Register getReg() const
getReg - Returns the register number.
bool hasOneDef(Register RegNo) const
Return true if there is exactly one operand defining the specified register.
A Module instance is used to store all the information related to an LLVM module.
A wrapper around std::string which contains a source range that's being set during parsing.
void setSavePoint(MachineBasicBlock *NewSave)
bool HasOpaqueSPAdjustment
std::vector< Entry > Entries
unsigned MaxCallFrameSize
~0u means: not computed yet.
void setStackID(int ObjectIdx, uint8_t ID)
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.
bool isEHPad() const
Returns true if the block is a landing pad.
void setHasEHScopes(bool V)
StringRef - Represent a constant reference to a string, i.e.
Analysis the ScalarEvolution expression for r is this
MachineJumpTableInfo::JTEntryKind Kind
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
void invalidateLiveness()
invalidateLiveness - Indicates that register liveness is no longer being tracked accurately.
MIRParser(std::unique_ptr< MIRParserImpl > Impl)
MachineFunction & getOrCreateMachineFunction(Function &F)
Returns the MachineFunction constructed for the IR function F.
bool hasBBSections() const
Returns true if this function has basic block sections enabled.
MachineFunctionProperties & reset(Property P)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
unsigned const MachineRegisterInfo * MRI
SourceMgr::DiagKind getKind() const
Wrapper class representing virtual and physical registers.
unsigned getSubReg() const
Serializable representation of MachineFrameInfo.
std::vector< DebugValueSubstitution > DebugValueSubstitutions
std::vector< VirtualRegisterDefinition > VirtualRegisters
bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool initializeCallSiteInfo(PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
bool IsReturnAddressTaken
Function & getFunction()
Return the LLVM function that this machine code represents.
virtual const TargetFrameLowering * getFrameLowering() const
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
This class implements the parsing of LLVM IR that's embedded inside a MIR file.
MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
const char * getPointer() const
Lightweight error class with error context and mandatory checking.
virtual const uint32_t * getCustomEHPadPreservedMask(const MachineFunction &MF) const
Return a register mask for the registers preserved by the unwinder, or nullptr if no custom mask is n...
DenseMap< unsigned, unsigned > ConstantPoolSlots
void addPhysRegsUsedFromRegMask(const uint32_t *RegMask)
addPhysRegsUsedFromRegMask - Mark any registers not in RegMask as used.
std::unique_ptr< Module > parseIRModule(DataLayoutCallbackTy DataLayoutCallback)
Try to parse the optional LLVM module and the machine functions in the MIR file.
bool TracksDebugUserValues
This class describes a target machine that is implemented with the LLVM target-independent code gener...
unsigned AddNewSourceBuffer(std::unique_ptr< MemoryBuffer > F, SMLoc IncludeLoc)
Add a new source buffer to this source manager.
Function * createDummyFunction(StringRef Name, Module &M)
Create an empty function with the given name.
void setStackProtectorIndex(int I)
bool parseMachineFunctions(Module &M, MachineModuleInfo &MMI)
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.
bool parseVirtualRegisterReference(PerFunctionMIParsingState &PFS, VRegInfo *&Info, StringRef Src, SMDiagnostic &Error)
std::vector< MachineFunctionLiveIn > LiveIns
@ ExternalLinkage
Externally visible function.
Constant * parseConstantValue(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type and a constant value in the given string.
static Type * getVoidTy(LLVMContext &C)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool HasMustTailInVarArgFunc
Represents a range in source code.
Align max(MaybeAlign Lhs, Align Rhs)
void setHasPatchPoint(bool s=true)
std::vector< StringValue > MachineMetadataNodes
const LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
static SMLoc getFromPointer(const char *Ptr)
void setOffsetAdjustment(int Adj)
Set the correction for frame offsets.
bool parseRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
const char LLVMTargetMachineRef TM
Identifies call instruction location in machine function.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
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.
This function has undefined behavior.
void setFrameAddressIsTaken(bool T)
an instruction to allocate memory on the stack
bool parseMachineFunction(Module &M, MachineModuleInfo &MMI)
Parse the machine function in the current YAML document.
std::vector< CallSiteInfo > CallSitesInfo
bool parseMBBReference(PerFunctionMIParsingState &PFS, MachineBasicBlock *&MBB, StringRef Src, SMDiagnostic &Error)
void setBBSectionsType(BasicBlockSection V)
void setLocalFrameSize(int64_t sz)
Set the size of the local object blob.
Diagnostic information for machine IR parser.
LLVM Value Representation.
void setHasVAStart(bool B)
bool parseMachineFunctions(Module &M, MachineModuleInfo &MMI)
Parses MachineFunctions in the MIR file and add them to the given MachineModuleInfo MMI.
static bool isSSA(const MachineFunction &MF)
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable.
void setCallsEHReturn(bool b)
void setRegClass(Register Reg, const TargetRegisterClass *RC)
setRegClass - Set the register class of the specified virtual register.
std::vector< MachineConstantPoolValue > Constants
llvm::BasicBlockSection getBBSectionsType() const
If basic blocks should be emitted into their own section, corresponding to -fbasic-block-sections.
bool setupRegisterInfo(const PerFunctionMIParsingState &PFS, const yaml::MachineFunction &YamlMF)
reference emplace_back(ArgTypes &&... Args)