Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Reopt indicate function type rather than return type on LLVM calls #319

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading