X86Tables: add Literal() helper

Any time we get the value of Literal, we want to assert that it's actually a
literal. We've been open coding this pattern sporadically throughout the
opcodedispatcher. Let's add an ergonomic helper to fetch the value of literal,
asserting that the value is indeed literal.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2024-06-21 14:35:46 -04:00
parent fac9972bad
commit edf1a7970d

View File

@ -137,6 +137,10 @@ struct DecodedOperand {
bool IsSIB() const {
return Type == OpType::SIB;
}
uint64_t Literal() const {
LOGMAN_THROW_A_FMT(IsLiteral(), "Precondition: must be a literal");
return Data.Literal.Value;
}
union TypeUnion {
struct GPRType {