Skip to content

Commit

Permalink
Merge pull request #320 from GaloisInc/vr/get-inferred-type
Browse files Browse the repository at this point in the history
return a typed LLVM value when no type was inferred
  • Loading branch information
Ptival authored Oct 18, 2024
2 parents 522b792 + f0c8453 commit bfd2266
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions reopt/Main_reopt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,7 @@ collectInvariants ref evt = do
_ -> do
pure ()

-- | This command is called when reopt is called with no specific
-- action.
-- | This command is called when reopt is called with no specific action.
performReopt :: Args -> FilePath -> IO ()
performReopt args elfPath = do
let somethingToDo = isJust (cfgExportPath args) || shouldRecover args
Expand Down
9 changes: 5 additions & 4 deletions src/Reopt/CFG/LLVM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,9 +1252,8 @@ resolveLoadNameAndType memRep =
error $ "Vector width of " ++ show n ++ " is too large."
pure ("v" ++ show n ++ eltName, L.Vector (fromIntegral (natValue n)) eltType)

-- | The type inference will infer a pointer-to-struct type for the
-- pointer (or a conflict type if one is detected). This will do a
-- GEP or cast as required.
-- | The type inference will infer a pointer-to-struct type for the pointer (or a conflict type if
-- one is detected). This will do a GEP or cast as required.
pointerForMemOp ::
forall arch.
FnArchConstraints arch =>
Expand All @@ -1270,7 +1269,9 @@ pointerForMemOp ctx ptr pointeeType = do
getInferredTypeBBLLVM ptr >>= \case
Just FPtrTy{} -> llvmGEPFromPtr pointeeType 0 ptrV
Just FConflictTy{} -> llvmAsPtr ctx pointeeType ptrV
t -> error $ "Unexpected type at pointerForMemOp " ++ show (PP.pretty t)
Just t -> error $ "Unexpected type at pointerForMemOp: " ++ show (PP.pretty t)
Nothing -> return ptrV
-- error $ "No inferred type for " ++ show (PP.pretty ptr)

-- | Convert an assignment to a llvm expression
rhsToLLVM ::
Expand Down

0 comments on commit bfd2266

Please sign in to comment.