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:
Tristan Ravitch 2019-02-01 08:37:50 -08:00
parent 8d3c501fd0
commit f260dad575

View File

@ -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)