00001 /* -*- coding:utf-8 -*- 00002 Copyright (c) 2009, Fixstars Corporation 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 * Redistributions of source code must retain the above copyright notice, 00009 this list of conditions and the following disclaimer. 00010 00011 * Redistributions in binary form must reproduce the above copyright notice, 00012 this list of conditions and the following disclaimer in the documentation 00013 and/or other materials provided with the distribution. 00014 00015 * Neither the name of Fixstars Corporation nor the names of its contributors 00016 may be used to endorse or promote products derived from this software 00017 without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00022 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 00023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00026 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00027 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00028 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00035 #ifndef CTRUMP_AST_ABI_H 00036 #define CTRUMP_AST_ABI_H 00037 00038 #include <stddef.h> 00039 #include "ctrump/common/dll.h" 00040 00041 struct ctrump_texpr; 00042 00046 struct ctrump_abi { 00047 int sizeof_pointer; 00048 int sizeof_long; 00049 int sizeof_int; 00050 int sizeof_short; 00051 int sizeof_bool; 00052 int sizeof_longlong; 00053 int sizeof_float; 00054 int sizeof_double; 00055 int sizeof_long_double; 00056 int sizeof_enum; 00057 int sizeof_vector; 00058 00059 int alignof_pointer; 00060 int alignof_long; 00061 int alignof_int; 00062 int alignof_short; 00063 int alignof_bool; 00064 int alignof_longlong; 00065 int alignof_float; 00066 int alignof_double; 00067 int alignof_long_double; 00068 int alignof_enum; 00069 int alignof_vector; 00070 00071 int is_char_signed; 00072 }; 00073 00074 CTRUMP_EXTDEF extern const struct ctrump_abi ctrump_spu_abi; 00075 CTRUMP_EXTDEF extern const struct ctrump_abi ctrump_ppc32_abi; 00076 CTRUMP_EXTDEF extern const struct ctrump_abi ctrump_ppc64_abi; 00077 CTRUMP_EXTDEF extern const struct ctrump_abi ctrump_x86_abi; 00078 CTRUMP_EXTDEF extern const struct ctrump_abi ctrump_x86LP64_abi; 00079 00083 CTRUMP_EXTDEF int ctrump_texpr_size(size_t *size, 00084 size_t *align, 00085 const struct ctrump_abi *abi, 00086 const struct ctrump_texpr *type); 00087 00088 struct ctrump_record_type; 00089 struct ctrump_symbol; 00090 00094 CTRUMP_EXTDEF int ctrump_struct_field_offset(const struct ctrump_record_type *record, 00095 const struct ctrump_symbol *field_tag, 00096 const struct ctrump_abi *abi); 00097 00103 CTRUMP_EXTDEF int ctrump_is_bitconvertion_on_type_conversion(const struct ctrump_texpr *convert_to, 00104 const struct ctrump_texpr *convert_from, 00105 const struct ctrump_abi *abi); 00106 00107 #endif