11f5207b7SJohn Levon #ifndef TARGET_H 21f5207b7SJohn Levon #define TARGET_H 31f5207b7SJohn Levon 41f5207b7SJohn Levon extern struct symbol *size_t_ctype; 51f5207b7SJohn Levon extern struct symbol *ssize_t_ctype; 6*c85f09ccSJohn Levon extern struct symbol *intmax_ctype; 7*c85f09ccSJohn Levon extern struct symbol *uintmax_ctype; 8*c85f09ccSJohn Levon extern struct symbol *int64_ctype; 9*c85f09ccSJohn Levon extern struct symbol *uint64_ctype; 10*c85f09ccSJohn Levon extern struct symbol *int32_ctype; 11*c85f09ccSJohn Levon extern struct symbol *uint32_ctype; 12*c85f09ccSJohn Levon extern struct symbol *wchar_ctype; 13*c85f09ccSJohn Levon extern struct symbol *wint_ctype; 141f5207b7SJohn Levon 151f5207b7SJohn Levon /* 161f5207b7SJohn Levon * For "__attribute__((aligned))" 171f5207b7SJohn Levon */ 181f5207b7SJohn Levon extern int max_alignment; 191f5207b7SJohn Levon 201f5207b7SJohn Levon /* 211f5207b7SJohn Levon * Integer data types 221f5207b7SJohn Levon */ 231f5207b7SJohn Levon extern int bits_in_bool; 241f5207b7SJohn Levon extern int bits_in_char; 251f5207b7SJohn Levon extern int bits_in_short; 261f5207b7SJohn Levon extern int bits_in_int; 271f5207b7SJohn Levon extern int bits_in_long; 281f5207b7SJohn Levon extern int bits_in_longlong; 291f5207b7SJohn Levon extern int bits_in_longlonglong; 301f5207b7SJohn Levon 311f5207b7SJohn Levon extern int max_int_alignment; 321f5207b7SJohn Levon 331f5207b7SJohn Levon /* 341f5207b7SJohn Levon * Floating point data types 351f5207b7SJohn Levon */ 361f5207b7SJohn Levon extern int bits_in_float; 371f5207b7SJohn Levon extern int bits_in_double; 381f5207b7SJohn Levon extern int bits_in_longdouble; 391f5207b7SJohn Levon 401f5207b7SJohn Levon extern int max_fp_alignment; 411f5207b7SJohn Levon 421f5207b7SJohn Levon /* 431f5207b7SJohn Levon * Pointer data type 441f5207b7SJohn Levon */ 451f5207b7SJohn Levon extern int bits_in_pointer; 461f5207b7SJohn Levon extern int pointer_alignment; 471f5207b7SJohn Levon 481f5207b7SJohn Levon /* 491f5207b7SJohn Levon * Enum data types 501f5207b7SJohn Levon */ 511f5207b7SJohn Levon extern int bits_in_enum; 521f5207b7SJohn Levon extern int enum_alignment; 531f5207b7SJohn Levon 541f5207b7SJohn Levon /* 551f5207b7SJohn Levon * Helper functions for converting bits to bytes and vice versa. 561f5207b7SJohn Levon */ 571f5207b7SJohn Levon bits_to_bytes(int bits)581f5207b7SJohn Levonstatic inline int bits_to_bytes(int bits) 591f5207b7SJohn Levon { 601f5207b7SJohn Levon return bits >= 0 ? (bits + bits_in_char - 1) / bits_in_char : -1; 611f5207b7SJohn Levon } 621f5207b7SJohn Levon bytes_to_bits(int bytes)631f5207b7SJohn Levonstatic inline int bytes_to_bits(int bytes) 641f5207b7SJohn Levon { 651f5207b7SJohn Levon return bytes * bits_in_char; 661f5207b7SJohn Levon } 671f5207b7SJohn Levon array_element_offset(unsigned long base_bits,int idx)681f5207b7SJohn Levonstatic inline unsigned long array_element_offset(unsigned long base_bits, int idx) 691f5207b7SJohn Levon { 701f5207b7SJohn Levon int fragment = base_bits % bits_in_char; 711f5207b7SJohn Levon if (fragment) 721f5207b7SJohn Levon base_bits += bits_in_char - fragment; 731f5207b7SJohn Levon return base_bits * idx; 741f5207b7SJohn Levon } 751f5207b7SJohn Levon 761f5207b7SJohn Levon #endif 77