mirror of
https://github.com/GaloisInc/macaw.git
synced 2024-12-27 16:15:12 +03:00
Turn fail-stop errors into macaw translation failures
Previously, macaw-ppc (and macaw-arm) would call `error` if there were no semantics available for a decoded instruction. This was useful during initial development, but it is a problem for deployment. Now just turn missing semantics into TranslationErrors, which appear as block terminators in macaw IR. This will require more diligence in monitoring TranslationErrors for patterns that need to be addressed.
This commit is contained in:
parent
8d3c501fd0
commit
f260dad575
@ -135,14 +135,13 @@ instructionMatcher ltr ena ae lib archSpecificMatcher formulas operandResultType
|
||||
]
|
||||
return (lam, fullDefs)
|
||||
|
||||
-- | Unimplemented instructions return Nothing here, which will be translated
|
||||
-- into a TranslationError inside the generator.
|
||||
unimplementedInstruction :: Q (Name, Dec)
|
||||
unimplementedInstruction = do
|
||||
fname <- newName "noMatch"
|
||||
arg1Nm <- newName "unknownOpcode"
|
||||
fdecl <- funD fname
|
||||
[clause [varP arg1Nm]
|
||||
(normalB [| error ("Unimplemented instruction: " ++ show $(varE arg1Nm)) |])
|
||||
[]]
|
||||
fdecl <- funD fname [clause [varP arg1Nm] (normalB [| Nothing |]) []]
|
||||
return (fname, fdecl)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user