// Copyright 2022 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef jit_riscv64_constant_Base_constant_riscv_h_ #define jit_riscv64_constant_Base_constant_riscv_h_
#include"mozilla/Assertions.h"
#include <stdint.h>
namespace js { namespace jit {
// On RISC-V Simulator breakpoints can have different codes: // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, // the simulator will run through them and print the registers. // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() // instructions (see Assembler::stop()). // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the // debugger. const uint32_t kMaxTracepointCode = 63; const uint32_t kMaxWatchpointCode = 31; const uint32_t kMaxStopCode = 127; const uint32_t kWasmTrapCode = 6;
static_assert(kMaxWatchpointCode < kMaxStopCode);
static_assert(kMaxTracepointCode < kMaxStopCode);
// ----- Emulated conditions. // On RISC-V we use this enum to abstract from conditional branch instructions. // The 'U' prefix is used to specify unsigned comparisons. // Opposite conditions must be paired as odd/even numbers // because 'NegateCondition' function flips LSB to negate condition. enum RiscvCondition { // Any value < 0 is considered no_condition.
overflow = 0,
no_overflow = 1,
Uless = 2,
Ugreater_equal = 3,
Uless_equal = 4,
Ugreater = 5,
equal = 6,
not_equal = 7, // Unordered or Not Equal.
less = 8,
greater_equal = 9,
less_equal = 10,
greater = 11,
cc_always = 12,
// Aliases.
eq = equal,
ne = not_equal,
ge = greater_equal,
lt = less,
gt = greater,
le = less_equal,
al = cc_always,
ult = Uless,
uge = Ugreater_equal,
ule = Uless_equal,
ugt = Ugreater,
};
// ----- Coprocessor conditions. enum FPUCondition {
kNoFPUCondition = -1,
EQ = 0x02, // Ordered and Equal
NE = 0x03, // Unordered or Not Equal
LT = 0x04, // Ordered and Less Than
GE = 0x05, // Ordered and Greater Than or Equal
LE = 0x06, // Ordered and Less Than or Equal
GT = 0x07, // Ordered and Greater Than
};
enum FPURoundingMode {
RNE = 0b000, // Round to Nearest, ties to Even
RTZ = 0b001, // Round towards Zero
RDN = 0b010, // Round Down (towards -infinity)
RUP = 0b011, // Round Up (towards +infinity)
RMM = 0b100, // Round to Nearest, tiest to Max Magnitude
DYN = 0b111 // In instruction's rm field, selects dynamic rounding mode; // In Rounding Mode register, Invalid
};
enum MemoryOdering {
PSI = 0b1000, // PI or SI
PSO = 0b0100, // PO or SO
PSR = 0b0010, // PR or SR
PSW = 0b0001, // PW or SW
PSIORW = PSI | PSO | PSR | PSW
};
// The classes of immediate branch ranges, in order of increasing range. enum ImmBranchRangeType {
CondBranchRangeType, // RISCV branch
UncondBranchRangeType, // RISCV jal
UnknownBranchRangeType,
// Number of 'short-range' branch range types. // RISCV branch and jal are both considered 'short-range'.
NumShortBranchRangeTypes = UnknownBranchRangeType
};
inline ImmBranchRangeType OffsetSizeToImmBranchRangeType(OffsetSize bits) { switch (bits) { case kOffset21: return UncondBranchRangeType; case kOffset13: return CondBranchRangeType; default:
MOZ_CRASH("Unimplement");
}
}
inline OffsetSize ImmBranchRangeTypeToOffsetSize(ImmBranchRangeType type) { switch (type) { case CondBranchRangeType: return kOffset13; case UncondBranchRangeType: return kOffset21; default:
MOZ_CRASH("Unimplement");
}
}
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.