Go to the documentation of this file.
34 #include "llvm/Config/llvm-config.h"
40 #define DEBUG_TYPE "machine-stable-hash"
44 STATISTIC(StableHashBailingMachineBasicBlock,
45 "Number of encountered unsupported MachineOperands that were "
46 "MachineBasicBlocks while computing stable hashes");
47 STATISTIC(StableHashBailingConstantPoolIndex,
48 "Number of encountered unsupported MachineOperands that were "
49 "ConstantPoolIndex while computing stable hashes");
50 STATISTIC(StableHashBailingTargetIndexNoName,
51 "Number of encountered unsupported MachineOperands that were "
52 "TargetIndex with no name");
54 "Number of encountered unsupported MachineOperands that were "
55 "GlobalAddress while computing stable hashes");
57 "Number of encountered unsupported MachineOperands that were "
58 "BlockAddress while computing stable hashes");
59 STATISTIC(StableHashBailingMetadataUnsupported,
60 "Number of encountered unsupported MachineOperands that were "
61 "Metadata of an unsupported kind while computing stable hashes");
70 DefOpcodes.push_back(
Def.getOpcode());
89 StableHashBailingMachineBasicBlock++;
92 StableHashBailingConstantPoolIndex++;
95 StableHashBailingBlockAddress++;
98 StableHashBailingMetadataUnsupported++;
101 StableHashBailingGlobalAddress++;
108 StableHashBailingTargetIndexNoName++;
126 std::vector<llvm::stable_hash> ShuffleMaskHashes;
134 ShuffleMaskHashes.size()));
159 bool HashConstantPoolIndices,
160 bool HashMemOperands) {
163 HashComponents.
reserve(
MI.getNumOperands() +
MI.getNumMemOperands() + 2);
164 HashComponents.push_back(
MI.getOpcode());
165 HashComponents.push_back(
MI.getFlags());
167 if (!HashVRegs && MO.isReg() && MO.isDef() &&
173 MO.getType(), MO.getTargetFlags(), MO.getIndex()));
180 HashComponents.push_back(StableHash);
183 for (
const auto *
Op :
MI.memoperands()) {
184 if (!HashMemOperands)
186 HashComponents.push_back(
static_cast<unsigned>(
Op->getSize()));
187 HashComponents.push_back(
static_cast<unsigned>(
Op->getFlags()));
188 HashComponents.push_back(
static_cast<unsigned>(
Op->getOffset()));
189 HashComponents.push_back(
static_cast<unsigned>(
Op->getSuccessOrdering()));
190 HashComponents.push_back(
static_cast<unsigned>(
Op->getAddrSpace()));
191 HashComponents.push_back(
static_cast<unsigned>(
Op->getSyncScopeID()));
192 HashComponents.push_back(
static_cast<unsigned>(
Op->getBaseAlign().value()));
193 HashComponents.push_back(
static_cast<unsigned>(
Op->getFailureOrdering()));
197 HashComponents.end());
206 HashComponents.end());
215 HashComponents.end());
@ MO_BlockAddress
Address of a basic block.
stable_hash stable_hash_combine_string(const StringRef &S)
@ MO_Immediate
Immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
stable_hash stable_hash_combine_range(InputIteratorT First, InputIteratorT Last)
Compute a stable_hash for a sequence of values.
stable_hash stable_hash_combine(stable_hash A, stable_hash B)
@ MO_ShuffleMask
Other IR Constant for ISel (shuffle masks)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
@ MO_RegisterLiveOut
Mask of live-out registers.
stable_hash stable_hash_combine_array(const stable_hash *P, size_t C)
Intrinsic::ID getIntrinsicID() const
const APInt & getValue() const
Return the constant as an APInt value reference.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
@ MO_CFIIndex
MCCFIInstruction index.
const char * getTargetIndexName() const
getTargetIndexName - If this MachineOperand is a TargetIndex that has a name, attempt to get the name...
bool isCImm() const
isCImm - Test if this is a MO_CImmediate operand.
const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
const APFloat & getValueAPF() const
int64_t getOffset() const
Return the offset from the symbol in this operand.
MCSymbol * getMCSymbol() const
@ MO_Register
Register operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
@ MO_GlobalAddress
Address of a global value.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
@ MO_FrameIndex
Abstract Stack Frame Index.
stable_hash stableHashValue(const MachineOperand &MO)
MachineOperand class - Representation of each machine instruction operand.
STATISTIC(NumFunctions, "Total number of functions")
StringRef getName() const
getName - Get the symbol name.
APInt bitcastToAPInt() const
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
@ MO_Metadata
Metadata reference (for debug info)
unsigned getTargetFlags() const
Representation of each machine instruction.
const ConstantInt * getCImm() const
iterator_range< def_instr_iterator > def_instructions(Register Reg) const
@ MO_Predicate
Generic predicate for ISel.
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
const ConstantFP * getFPImm() const
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
unsigned getPredicate() const
ArrayRef< int > getShuffleMask() const
@ MO_TargetIndex
Target-dependent index+offset operand.
@ MO_FPImmediate
Floating-point immediate operand.
Register getReg() const
getReg - Returns the register number.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
@ MO_CImmediate
Immediate >64bit operand.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
OutputIt transform(R &&Range, OutputIt d_first, UnaryFunction F)
Wrapper function around std::transform to apply a function to a range and store the result elsewhere.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
@ MO_IntrinsicID
Intrinsic ID for ISel.
unsigned const MachineRegisterInfo * MRI
unsigned getSubReg() const
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
@ MO_ExternalSymbol
Name of external global symbol.
unsigned getCFIIndex() const
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
const char * getSymbolName() const
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
@ MO_RegisterMask
Mask of preserved registers.
void reserve(size_type N)
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.