jit_emit_const.c 910 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include "jit_emit_const.h"
  6. #include "../jit_frontend.h"
  7. bool
  8. jit_compile_op_i32_const(JitCompContext *cc, int32 i32_const)
  9. {
  10. JitReg value = NEW_CONST(I32, i32_const);
  11. PUSH_I32(value);
  12. return true;
  13. fail:
  14. return false;
  15. }
  16. bool
  17. jit_compile_op_i64_const(JitCompContext *cc, int64 i64_const)
  18. {
  19. JitReg value = NEW_CONST(I64, i64_const);
  20. PUSH_I64(value);
  21. return true;
  22. fail:
  23. return false;
  24. }
  25. bool
  26. jit_compile_op_f32_const(JitCompContext *cc, float32 f32_const)
  27. {
  28. JitReg value = NEW_CONST(F32, f32_const);
  29. PUSH_F32(value);
  30. return true;
  31. fail:
  32. return false;
  33. }
  34. bool
  35. jit_compile_op_f64_const(JitCompContext *cc, float64 f64_const)
  36. {
  37. JitReg value = NEW_CONST(F64, f64_const);
  38. PUSH_F64(value);
  39. return true;
  40. fail:
  41. return false;
  42. }