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();
59 "ISel should set p2align operands to 0");
61 "Load and store instructions have exactly one mem operand");
64 "Default p2align value should be natural");
67 "Load and store instructions should have a p2align operand");
71 P2Align = std::min(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) {
88 MI.getOpcode(), WebAssembly::OpName::p2align);
89 if (P2AlignOpNum != -1) {
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
This class represents lattice values for constants.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
unsigned GetDefaultP2Align(unsigned Opc)
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
static uint32_t getAlignment(const MCSectionCOFF &Sec)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
uint8_t OperandType
Information about the type of the operand.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
AnalysisUsage & addPreservedID(const void *ID)
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
This file provides WebAssembly-specific target descriptions.
Represent the analysis usage information of a pass.
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
void setImm(int64_t immVal)
FunctionPass class - This class is used to implement most global optimizations.
FunctionPass * createWebAssemblySetP2AlignOperands()
INITIALIZE_PASS(WebAssemblySetP2AlignOperands, DEBUG_TYPE, "Set the p2align operands for WebAssembly loads and stores", false, false) FunctionPass *llvm
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
This file contains the WebAssembly implementation of the TargetInstrInfo class.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Representation of each machine instruction.
p2align immediate for load and store address alignment.
This file declares WebAssembly-specific per-machine-function information.
int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIndex)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MCOperandInfo * OpInfo
StringRef - Represent a constant reference to a string, i.e.
static void rewriteP2Align(MachineInstr &MI, unsigned OperandNo)
const MachineOperand & getOperand(unsigned i) const
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.