Skip to content

Commit

Permalink
Merge pull request #319 from GaloisInc/vr/fix-llvm-call-return-type
Browse files Browse the repository at this point in the history
fix Reopt indicate function type rather than return type on LLVM calls
  • Loading branch information
Ptival authored Oct 17, 2024
2 parents 6452992 + 530b4f4 commit 522b792
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Reopt/CFG/LLVM.hs
Original file line number Diff line number Diff line change
Expand Up @@ -840,19 +840,19 @@ call (valueOf -> f) args =
case L.typedType f of
L.PtrTo (L.FunTy res _argTypes _varArgs) -> do
case res of
L.PrimType L.Void -> do
error "Call expected to return a value, but returns void."
_ -> do
fmap (L.Typed res) $ evalInstr $ L.Call False (L.typedType f) (L.typedValue f) args
_ -> error $ "Call given non-function pointer argument:\n" ++ show f
L.PrimType L.Void ->
error "call: expected to return a value, but returns void."
_ ->
L.Typed res <$> evalInstr (L.Call False res (L.typedValue f) args)
_ -> error $ "call: given non-function pointer argument:\n" ++ show f

-- | Generate a non-tail call that does not return a value
call_ :: HasValue v => v -> [L.Typed L.Value] -> BBLLVM arch ()
call_ (valueOf -> f) args =
case L.typedType f of
L.PtrTo (L.FunTy (L.PrimType L.Void) _argTypes _varArgs) -> do
effect $ L.Call False (L.typedType f) (L.typedValue f) args
_ -> error $ "call_ given non-function pointer argument\n" ++ show f
_ -> error $ "call_: given non-function pointer argument\n" ++ show f

-- | Sign extend a boolean value to the given width.
carryValue ::
Expand Down

0 comments on commit 522b792

Please sign in to comment.