wrench-0.0.6.3
Safe HaskellNone
LanguageHaskell2010

Wrench.Translator.Parser.Misc

Synopsis

Documentation

nothing :: Monad m => m a -> m (Maybe b) Source #

referenceWithDirective :: IsWord w => Parser (Ref w) Source #

A reference that may be wrapped in a %hi / %lo relocation directive.

The two directives are designed to be used as a pair:

lui  rd, %hi(x)
addi rd, rd, %lo(x)

%lo keeps the low 12 bits and sign-extends them from bit 11, because that is what the instructions consuming the field do with it (see fitSigned): %lo(0xFFFFFFFF) is -1, not 0xFFF. To compensate for that borrow, %hi rounds the value up by half a field (+0x800) before taking its upper 20 bits, so the pair reconstructs x exactly for every 32-bit x.

referenceWithFn :: IsWord w => (w -> w) -> Parser (Ref w) Source #

data SectionItem i Source #

Constructors

Item i 
Org Int