LLVM 22.0.0git
MIParser.cpp File Reference
#include "llvm/CodeGen/MIRParser/MIParser.h"
#include "MILexer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/AsmParser/SlotMapping.h"
#include "llvm/CodeGen/MIRFormatter.h"
#include "llvm/CodeGen/MIRPrinter.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/PseudoSourceValueManager.h"
#include "llvm/CodeGen/RegisterBank.h"
#include "llvm/CodeGen/RegisterBankInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGenTypes/LowLevelType.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/MC/LaneBitmask.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string>
#include <utility>

Go to the source code of this file.

Typedefs

typedef function_ref< bool(StringRef::iterator Loc, const Twine &)> ErrorCallbackType

Functions

static void mapValueToSlot (const Value *V, ModuleSlotTracker &MST, DenseMap< unsigned, const Value * > &Slots2Values)
static void initSlots2Values (const Function &F, DenseMap< unsigned, const Value * > &Slots2Values)
 Creates the mapping from slot numbers to function's unnamed IR values.
static const chartoString (MIToken::TokenKind TokenKind)
static const charprintImplicitRegisterFlag (const MachineOperand &MO)
static std::string getRegisterName (const TargetRegisterInfo *TRI, Register Reg)
static bool isImplicitOperandIn (const MachineOperand &ImplicitOperand, ArrayRef< ParsedMachineOperand > Operands)
 Return true if the parsed machine operands contain a given machine operand.
static bool parseIRConstant (StringRef::iterator Loc, StringRef StringValue, PerFunctionMIParsingState &PFS, const Constant *&C, ErrorCallbackType ErrCB)
static bool verifyScalarSize (uint64_t Size)
static bool verifyVectorElementCount (uint64_t NumElts)
static bool verifyAddrSpace (uint64_t AddrSpace)
static bool getHexUint (const MIToken &Token, APInt &Result)
static bool getUnsigned (const MIToken &Token, unsigned &Result, ErrorCallbackType ErrCB)
static bool parseGlobalValue (const MIToken &Token, PerFunctionMIParsingState &PFS, GlobalValue *&GV, ErrorCallbackType ErrCB)
static bool parseIRValue (const MIToken &Token, PerFunctionMIParsingState &PFS, const Value *&V, ErrorCallbackType ErrCB)
static void initSlots2BasicBlocks (const Function &F, DenseMap< unsigned, const BasicBlock * > &Slots2BasicBlocks)
static const BasicBlockgetIRBlockFromSlot (unsigned Slot, const DenseMap< unsigned, const BasicBlock * > &Slots2BasicBlocks)

Typedef Documentation

◆ ErrorCallbackType

Definition at line 622 of file MIParser.cpp.

Function Documentation

◆ getHexUint()

bool getHexUint ( const MIToken & Token,
APInt & Result )
static

◆ getIRBlockFromSlot()

const BasicBlock * getIRBlockFromSlot ( unsigned Slot,
const DenseMap< unsigned, const BasicBlock * > & Slots2BasicBlocks )
static

◆ getRegisterName()

◆ getUnsigned()

◆ initSlots2BasicBlocks()

◆ initSlots2Values()

void initSlots2Values ( const Function & F,
DenseMap< unsigned, const Value * > & Slots2Values )
static

Creates the mapping from slot numbers to function's unnamed IR values.

Definition at line 360 of file MIParser.cpp.

References F, I, llvm::ModuleSlotTracker::incorporateFunction(), and mapValueToSlot().

Referenced by llvm::PerFunctionMIParsingState::getIRValue().

◆ isImplicitOperandIn()

bool isImplicitOperandIn ( const MachineOperand & ImplicitOperand,
ArrayRef< ParsedMachineOperand > Operands )
static

Return true if the parsed machine operands contain a given machine operand.

Definition at line 1423 of file MIParser.cpp.

References I, llvm::MachineOperand::isIdenticalTo(), and Operands.

◆ mapValueToSlot()

void mapValueToSlot ( const Value * V,
ModuleSlotTracker & MST,
DenseMap< unsigned, const Value * > & Slots2Values )
static

◆ parseGlobalValue()

◆ parseIRConstant()

◆ parseIRValue()

◆ printImplicitRegisterFlag()

const char * printImplicitRegisterFlag ( const MachineOperand & MO)
static

◆ toString()

◆ verifyAddrSpace()

bool verifyAddrSpace ( uint64_t AddrSpace)
static

Definition at line 1927 of file MIParser.cpp.

References llvm::isUInt().

◆ verifyScalarSize()

bool verifyScalarSize ( uint64_t Size)
static

Definition at line 1919 of file MIParser.cpp.

References llvm::isUInt(), and Size.

◆ verifyVectorElementCount()

bool verifyVectorElementCount ( uint64_t NumElts)
static

Definition at line 1923 of file MIParser.cpp.

References llvm::isUInt().