github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/include/jit/jit-value.h (about) 1 /* 2 * jit-value.h - Functions for manipulating temporary values. 3 * 4 * Copyright (C) 2004 Southern Storm Software, Pty Ltd. 5 * 6 * The libjit library is free software: you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public License 8 * as published by the Free Software Foundation, either version 2.1 of 9 * the License, or (at your option) any later version. 10 * 11 * The libjit library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with the libjit library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef _JIT_VALUE_H 22 #define _JIT_VALUE_H 23 24 #include <jit/jit-common.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /* 31 * Full struction that can hold a constant of any type. 32 */ 33 typedef struct 34 { 35 jit_type_t type; 36 union 37 { 38 void *ptr_value; 39 jit_int int_value; 40 jit_uint uint_value; 41 jit_nint nint_value; 42 jit_nuint nuint_value; 43 jit_long long_value; 44 jit_ulong ulong_value; 45 jit_float32 float32_value; 46 jit_float64 float64_value; 47 jit_nfloat nfloat_value; 48 49 } un; 50 51 } jit_constant_t; 52 53 /* 54 * External function declarations. 55 */ 56 jit_value_t jit_value_create(jit_function_t func, jit_type_t type) JIT_NOTHROW; 57 jit_value_t jit_value_create_nint_constant 58 (jit_function_t func, jit_type_t type, jit_nint const_value) JIT_NOTHROW; 59 jit_value_t jit_value_create_long_constant 60 (jit_function_t func, jit_type_t type, jit_long const_value) JIT_NOTHROW; 61 jit_value_t jit_value_create_float32_constant 62 (jit_function_t func, jit_type_t type, 63 jit_float32 const_value) JIT_NOTHROW; 64 jit_value_t jit_value_create_float64_constant 65 (jit_function_t func, jit_type_t type, 66 jit_float64 const_value) JIT_NOTHROW; 67 jit_value_t jit_value_create_nfloat_constant 68 (jit_function_t func, jit_type_t type, 69 jit_nfloat const_value) JIT_NOTHROW; 70 jit_value_t jit_value_create_constant 71 (jit_function_t func, const jit_constant_t *const_value) JIT_NOTHROW; 72 jit_value_t jit_value_get_param 73 (jit_function_t func, unsigned int param) JIT_NOTHROW; 74 jit_value_t jit_value_get_struct_pointer(jit_function_t func) JIT_NOTHROW; 75 int jit_value_is_temporary(jit_value_t value) JIT_NOTHROW; 76 int jit_value_is_local(jit_value_t value) JIT_NOTHROW; 77 int jit_value_is_constant(jit_value_t value) JIT_NOTHROW; 78 int jit_value_is_parameter(jit_value_t value) JIT_NOTHROW; 79 void jit_value_ref(jit_function_t func, jit_value_t value) JIT_NOTHROW; 80 void jit_value_set_volatile(jit_value_t value) JIT_NOTHROW; 81 int jit_value_is_volatile(jit_value_t value) JIT_NOTHROW; 82 void jit_value_set_addressable(jit_value_t value) JIT_NOTHROW; 83 int jit_value_is_addressable(jit_value_t value) JIT_NOTHROW; 84 jit_type_t jit_value_get_type(jit_value_t value) JIT_NOTHROW; 85 jit_function_t jit_value_get_function(jit_value_t value) JIT_NOTHROW; 86 jit_block_t jit_value_get_block(jit_value_t value) JIT_NOTHROW; 87 jit_context_t jit_value_get_context(jit_value_t value) JIT_NOTHROW; 88 jit_constant_t jit_value_get_constant(jit_value_t value) JIT_NOTHROW; 89 jit_nint jit_value_get_nint_constant(jit_value_t value) JIT_NOTHROW; 90 jit_long jit_value_get_long_constant(jit_value_t value) JIT_NOTHROW; 91 jit_float32 jit_value_get_float32_constant(jit_value_t value) JIT_NOTHROW; 92 jit_float64 jit_value_get_float64_constant(jit_value_t value) JIT_NOTHROW; 93 jit_nfloat jit_value_get_nfloat_constant(jit_value_t value) JIT_NOTHROW; 94 int jit_value_is_true(jit_value_t value) JIT_NOTHROW; 95 int jit_constant_convert 96 (jit_constant_t *result, const jit_constant_t *value, 97 jit_type_t type, int overflow_check) JIT_NOTHROW; 98 99 #ifdef __cplusplus 100 }; 101 #endif 102 103 #endif /* _JIT_VALUE_H */