// Get the byte sequence for this opcode, including prefix.
std::vector<uint8_t> GetBytes() const;
// Get the lane count of an extract/replace simd op.
uint32_t GetSimdLaneCount() const;
// Return 1 if |alignment| matches the alignment of |opcode|, or if // |alignment| is WABT_USE_NATURAL_ALIGNMENT. bool IsNaturallyAligned(Address alignment) const;
// If |alignment| is WABT_USE_NATURAL_ALIGNMENT, return the alignment of // |opcode|, else return |alignment|.
Address GetAlignment(Address alignment) const;
struct Info { const char* name; const char* decomp;
Type result_type;
Type param_types[3];
Address memory_size;
uint8_t prefix;
uint32_t code;
uint32_t prefix_code; // See PrefixCode below. Used for fast lookup.
};
static uint32_t PrefixCode(uint8_t prefix, uint32_t code) {
if (code >= (1 << MAX_OPCODE_BITS)) { // Clamp to (2^bits - 1), since we know that it is an invalid code.
code = (1 << MAX_OPCODE_BITS) - 1;
} return (prefix << MAX_OPCODE_BITS) | code;
}
// The Opcode struct only stores an enumeration (Opcode::Enum) of all valid // opcodes, densely packed. We want to be able to store invalid opcodes as // well, for display to the user. To encode these, we use PrefixCode() to // generate a uint32_t of the prefix/code pair, then negate the value so it // doesn't overlap with the valid enum values. The negation is done using // `~code + 1` since prefix_code is unsigned, and MSVC warns if you use - on // an unsigned value. // // | 0 | Opcode::Invalid | INT32_MAX+1 UINT32_MAX | // |---------------|-------------------------|---------------------------| // | valid opcodes | unused space | invalid opcodes | // static Enum EncodeInvalidOpcode(uint32_t prefix_code) {
Enum result = static_cast<Enum>(~prefix_code + 1);
assert(result >= Invalid); return result;
}
if (WABT_LIKELY(prefix_code < WABT_ARRAY_SIZE(WabtOpcodeCodeTable))) {
uint32_t value = WabtOpcodeCodeTable[prefix_code]; // The default value in the table is 0. That's a valid value, but only if // the code is 0 (for nop).
if (WABT_LIKELY(value != 0 || code == 0)) { return Opcode(static_cast<Enum>(value));
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.