Clean up handling of NOPs in the x64 backend.

1. Restricts max nop size to 15 instead of 16.
2. Fixes an edge case where gen_nop() would return a zero sized intruction on multiples of 16.
3. Clarifies the documentation of the gen_nop interface to state that returning zero is allowed when preferred_size is zero.
This commit is contained in:
Kasey Carrothers
2021-01-27 22:45:35 -08:00
parent 7f840870c7
commit f76a9d436e
2 changed files with 4 additions and 4 deletions

View File

@@ -178,7 +178,7 @@ pub trait MachInst: Clone + Debug {
/// request a NOP of that size, or as close to it as possible. The machine
/// backend may return a NOP whose binary encoding is smaller than the
/// preferred size, but must not return a NOP that is larger. However,
/// the instruction must have a nonzero size.
/// the instruction must have a nonzero size if preferred_size is nonzero.
fn gen_nop(preferred_size: usize) -> Self;
/// Get the register universe for this backend.