Go to the documentation of this file.
25 #define DEBUG_TYPE "wasm-set-p2align-operands"
34 return "WebAssembly Set p2align Operands";
50 "Set the p2align operands for WebAssembly loads and stores",
54 return new WebAssemblySetP2AlignOperands();
58 assert(
MI.getOperand(OperandNo).getImm() == 0 &&
59 "ISel should set p2align operands to 0");
61 "Load and store instructions have exactly one mem operand");
62 assert((*
MI.memoperands_begin())->getSize() ==
64 "Default p2align value should be natural");
65 assert(
MI.getDesc().OpInfo[OperandNo].OperandType ==
67 "Load and store instructions should have a p2align operand");
74 MI.getOperand(OperandNo).setImm(P2Align);
77 bool WebAssemblySetP2AlignOperands::runOnMachineFunction(
MachineFunction &MF) {
79 dbgs() <<
"********** Set p2align Operands **********\n"
80 <<
"********** Function: " << MF.
getName() <<
'\n';
85 for (
auto &
MBB : MF) {
86 for (
auto &
MI :
MBB) {
89 if (P2AlignOpNum != -1) {
This is an optimization pass for GlobalISel generic memory operations.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
unsigned Log2(Align A)
Returns the log2 of the alignment.
Represent the analysis usage information of a pass.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Representation of each machine instruction.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
void setPreservesCFG()
This function should be called by the pass, iff they do not:
StringRef - Represent a constant reference to a string, i.e.
AnalysisUsage & addPreservedID(const void *ID)
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
INITIALIZE_PASS(WebAssemblySetP2AlignOperands, DEBUG_TYPE, "Set the p2align operands for WebAssembly loads and stores", false, false) FunctionPass *llvm
@ OPERAND_P2ALIGN
p2align immediate for load and store address alignment.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
FunctionPass * createWebAssemblySetP2AlignOperands()
static void rewriteP2Align(MachineInstr &MI, unsigned OperandNo)
FunctionPass class - This class is used to implement most global optimizations.
to esp esp setne al movzbw ax esp setg cl movzbw cx cmove cx cl jne LBB1_2 esp which is much esp edx eax decl edx jle L7 esp ret p2align
int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIndex)
unsigned GetDefaultP2Align(unsigned Opc)