19#define DEBUG_TYPE "wasm-legalinfo"
32 G_UDIV, G_SDIV, G_UREM, G_SREM, G_AND, G_OR,
35 .widenScalarToNextPow2(0)
39 .legalFor({{s32, s32}, {s64, s64}})
40 .widenScalarToNextPow2(0)
45 .legalFor({{s32, s32}, {s64, s64}})
46 .widenScalarToNextPow2(1)
53 .legalFor({{s32, s32}, {s64, s64}})
54 .scalarSameSizeAs(1, 0)
60 .legalFor({{s64, s32}})
61 .clampScalar(0, s64, s64)
66 .clampScalar(0, s32, s32)
80 switch (
MI.getOpcode()) {
81 case TargetOpcode::G_SEXT_INREG: {
82 assert(
MI.getOperand(2).isImm() &&
"Expected immediate");
85 auto [DstType, SrcType] =
MI.getFirst2LLTs();
86 auto ExtFromWidth =
MI.getOperand(2).getImm();
88 if (ExtFromWidth == 8 || ExtFromWidth == 16 ||
89 (DstType.getScalarSizeInBits() == 64 && ExtFromWidth == 32)) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Interface for Targets to specify which operations they can successfully select and how the others sho...
This file declares the targeting of the Machinelegalizer class for WebAssembly.
This file provides WebAssembly-specific target descriptions.
This file declares the WebAssembly-specific subclass of TargetSubtarget.
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
LLVM_ABI void computeTables()
Compute any ancillary tables needed to quickly decide how an operation should be handled.
LegalizeRuleSet & legalFor(std::initializer_list< LLT > Types)
The instruction is legal when type index 0 is any type in the given list.
LegalizeRuleSet & scalarSameSizeAs(unsigned TypeIdx, unsigned SameSizeIdx)
Change the type TypeIdx to have the same scalar size as type SameSizeIdx.
LegalizeRuleSet & lower()
The instruction is lowered.
LegalizeRuleSet & clampScalar(unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
Limit the range of scalar sizes to MinTy and MaxTy.
LegalizeRuleSet & customFor(std::initializer_list< LLT > Types)
@ UnableToLegalize
Some kind of error has occurred and we could not legalize this instruction.
LLVM_ABI LegalizeResult lower(MachineInstr &MI, unsigned TypeIdx, LLT Ty)
Legalize an instruction by splitting it into simpler parts, hopefully understood by the target.
LegalizeRuleSet & getActionDefinitionsBuilder(unsigned Opcode)
Get the action definition builder for the given opcode.
const LegacyLegalizerInfo & getLegacyLegalizerInfo() const
Representation of each machine instruction.
bool legalizeCustom(LegalizerHelper &Helper, MachineInstr &MI, LostDebugLocObserver &LocObserver) const override
Called for instructions with the Custom LegalizationAction.
WebAssemblyLegalizerInfo(const WebAssemblySubtarget &ST)
Invariant opcodes: All instruction sets have these as their low opcodes.
This is an optimization pass for GlobalISel generic memory operations.