25 #define DEBUG_TYPE "wasm-set-p2align-operands"
34 return "WebAssembly Set p2align Operands";
50 return new WebAssemblySetP2AlignOperands();
55 "ISel should set p2align operands to 0");
57 "Load and store instructions have exactly one mem operand");
61 "Default p2align value should be natural");
64 "Load and store instructions should have a p2align operand");
74 bool WebAssemblySetP2AlignOperands::runOnMachineFunction(
MachineFunction &MF) {
76 dbgs() <<
"********** Set p2align Operands **********\n"
77 <<
"********** Function: " << MF.
getName() <<
'\n';
82 for (
auto &
MBB : MF) {
83 for (
auto &
MI :
MBB) {
84 switch (
MI.getOpcode()) {
85 case WebAssembly::LOAD_I32:
86 case WebAssembly::LOAD_I64:
87 case WebAssembly::LOAD_F32:
88 case WebAssembly::LOAD_F64:
89 case WebAssembly::LOAD8_S_I32:
90 case WebAssembly::LOAD8_U_I32:
91 case WebAssembly::LOAD16_S_I32:
92 case WebAssembly::LOAD16_U_I32:
93 case WebAssembly::LOAD8_S_I64:
94 case WebAssembly::LOAD8_U_I64:
95 case WebAssembly::LOAD16_S_I64:
96 case WebAssembly::LOAD16_U_I64:
97 case WebAssembly::LOAD32_S_I64:
98 case WebAssembly::LOAD32_U_I64:
101 case WebAssembly::STORE_I32:
102 case WebAssembly::STORE_I64:
103 case WebAssembly::STORE_F32:
104 case WebAssembly::STORE_F64:
105 case WebAssembly::STORE8_I32:
106 case WebAssembly::STORE16_I32:
107 case WebAssembly::STORE8_I64:
108 case WebAssembly::STORE16_I64:
109 case WebAssembly::STORE32_I64:
static const unsigned LoadP2AlignOperandNo
The operand number of the load or store p2align in load/store instructions.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
static const unsigned StoreP2AlignOperandNo
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
uint8_t OperandType
Information about the type of the operand.
static unsigned getAlignment(GlobalVariable *GV)
AnalysisUsage & addPreservedID(const void *ID)
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with etc Experimental Use value profile to guide fuzzing Number of simultaneous worker processes to run the jobs If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const MachineOperand & getOperand(unsigned i) const
This file provides WebAssembly-specific target descriptions.
FunctionPass * createWebAssemblySetP2AlignOperands()
Represent the analysis usage information of a pass.
void setImm(int64_t immVal)
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
FunctionPass class - This class is used to implement most global optimizations.
unsigned GetDefaultP2Align(unsigned Opcode)
Return the default p2align value for a load or store with the given opcode.
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.
static void RewriteP2Align(MachineInstr &MI, unsigned OperandNo)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MCOperandInfo * OpInfo
StringRef - Represent a constant reference to a string, i.e.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
unsigned Log2_64(uint64_t Value)
Log2_64 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.