Implement an iterator over encodings (#96)

* Implement an iterator over encodings

* Implement TargetIsa::legal_encodings

* Exclude non-boolean settings of isa flags bytes

* Address flake8 long line error
This commit is contained in:
Aleksey Kuznetsov
2017-06-19 20:52:19 +05:00
committed by Jakob Stoklund Olesen
parent 342121aba0
commit 1a480a2578
7 changed files with 139 additions and 92 deletions

View File

@@ -87,6 +87,10 @@ def gen_getters(sgrp, fmt):
"""
fmt.doc_comment("User-defined settings.")
with fmt.indented('impl Flags {', '}'):
fmt.doc_comment('Returns inner slice of bytes.')
fmt.doc_comment('The byte-sized settings are not included.')
with fmt.indented('pub fn predicate_bytes(&self) -> &[u8] {', '}'):
fmt.line('&self.bytes[{}..]'.format(sgrp.boolean_offset))
fmt.doc_comment('Dynamic numbered predicate getter.')
with fmt.indented(
'pub fn numbered_predicate(&self, p: usize) -> bool {', '}'):