GDB (xrefs)

Classes | Macros | Enumerations | Functions | Variables
/tmp/gdb-8.1/gdb/opencl-lang.c File Reference
`#include "defs.h"`
`#include "gdbtypes.h"`
`#include "symtab.h"`
`#include "expression.h"`
`#include "parser-defs.h"`
`#include "language.h"`
`#include "varobj.h"`
`#include "c-lang.h"`

Go to the source code of this file.

## Classes
struct | lval_closure

## Macros
#define | OCL_P_TYPE(TYPE)
#define | HEXCHAR_TO_INT(C)
#define | OCL_STRING(S) #S
#define | BUILD_OCL_VTYPES(TYPE)

## Enumerations
enum | opencl_primitive_types { OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), OCL_P_TYPE =(char), opencl_primitive_type_bool, opencl_primitive_type_unsigned_char, opencl_primitive_type_unsigned_short, opencl_primitive_type_unsigned_int, opencl_primitive_type_unsigned_long, opencl_primitive_type_size_t, opencl_primitive_type_ptrdiff_t, opencl_primitive_type_intptr_t, opencl_primitive_type_uintptr_t, opencl_primitive_type_void, nr_opencl_primitive_types }

## Functions
static struct type ** | builtin_opencl_type (struct gdbarch *gdbarch)
static struct type * | lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code, unsigned int el_length, unsigned int flag_unsigned, int n)
static int | array_has_dups (int *arr, int n)
static struct lval_closure * | allocate_lval_closure (int *indices, int n, struct value *val)
static void | lval_func_read (struct value *v)
static void | lval_func_write (struct value *v, struct value *fromval)
static int | lval_func_check_synthetic_pointer (const struct value *v, LONGEST offset, int length)
static void * | lval_func_copy_closure (const struct value *v)
static void | lval_func_free_closure (struct value *v)
static struct value * | create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside, int *indices, int n)
static struct value * | opencl_component_ref (struct expression *exp, struct value *val, char *comps, enum noside noside)
static struct value * | opencl_logical_not (struct expression *exp, struct value *arg)
static int | scalar_relop (struct value *val1, struct value *val2, enum exp_opcode op)
static struct value * | vector_relop (struct expression *exp, struct value *val1, struct value *val2, enum exp_opcode op)
static struct value * | opencl_value_cast (struct type *type, struct value *arg)
static struct value * | opencl_relop (struct expression *exp, struct value *arg1, struct value *arg2, enum exp_opcode op)
static struct value * | evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
static void | opencl_print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags)
static void | opencl_language_arch_info (struct gdbarch *gdbarch, struct language_arch_info *lai)
static void * | build_opencl_types (struct gdbarch *gdbarch)
void | _initialize_opencl_language (void)

## Variables
static struct gdbarch_data * | opencl_type_data
static const struct lval_funcs | opencl_value_funcs
const struct exp_descriptor | exp_descriptor_opencl
const struct language_defn | opencl_language_defn

## Macro Definition Documentation

## ◆ BUILD_OCL_VTYPES

#define BUILD_OCL_VTYPES | ( |  | TYPE | ) |

Value:
types[opencl_primitive_type_##TYPE##2] \
= init_vector_type (types[opencl_primitive_type_##TYPE], 2); \
TYPE_NAME (types[opencl_primitive_type_##TYPE##2]) = OCL_STRING(TYPE ## 2); \
types[opencl_primitive_type_##TYPE##3] \
= init_vector_type (types[opencl_primitive_type_##TYPE], 3); \
TYPE_NAME (types[opencl_primitive_type_##TYPE##3]) = OCL_STRING(TYPE ## 3); \
TYPE_LENGTH (types[opencl_primitive_type_##TYPE##3]) \
= 4 * TYPE_LENGTH (types[opencl_primitive_type_##TYPE]); \
types[opencl_primitive_type_##TYPE##4] \
= init_vector_type (types[opencl_primitive_type_##TYPE], 4); \
TYPE_NAME (types[opencl_primitive_type_##TYPE##4]) = OCL_STRING(TYPE ## 4); \
types[opencl_primitive_type_##TYPE##8] \
= init_vector_type (types[opencl_primitive_type_##TYPE], 8); \
TYPE_NAME (types[opencl_primitive_type_##TYPE##8]) = OCL_STRING(TYPE ## 8); \
types[opencl_primitive_type_##TYPE##16] \
= init_vector_type (types[opencl_primitive_type_##TYPE], 16); \
TYPE_NAME (types[opencl_primitive_type_##TYPE##16]) = OCL_STRING(TYPE ## 16)
OCL_STRING
#define OCL_STRING(S)
init_vector_type
struct type * init_vector_type(struct type *elt_type, int n)
Definition: gdbtypes.c:1334
rcuh_kind::TYPE
TYPE_LENGTH
#define TYPE_LENGTH(thistype)
Definition: gdbtypes.h:1235

Referenced by build_opencl_types().

## ◆ HEXCHAR_TO_INT

#define HEXCHAR_TO_INT | ( |  | C | ) |

Value:
((C >= '0' && C <= '9') ? \
C-'0' : ((C >= 'A' && C <= 'F') ? \
C-'A'+10 : ((C >= 'a' && C <= 'f') ? \
C-'a'+10 : -1)))

Referenced by opencl_component_ref().

## ◆ OCL_P_TYPE

#define OCL_P_TYPE | ( |  | TYPE | ) |

Value:
opencl_primitive_type_##TYPE,\
opencl_primitive_type_##TYPE##2,\
opencl_primitive_type_##TYPE##3,\
opencl_primitive_type_##TYPE##4,\
opencl_primitive_type_##TYPE##8,\
opencl_primitive_type_##TYPE##16
rcuh_kind::TYPE

Definition at line 32 of file opencl-lang.c.

## ◆ OCL_STRING

#define OCL_STRING | ( |  | S | ) | #S

## Enumeration Type Documentation

## ◆ opencl_primitive_types

enum opencl_primitive_types

Enumerator
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
OCL_P_TYPE |
opencl_primitive_type_bool |
opencl_primitive_type_unsigned_char |
opencl_primitive_type_unsigned_short |
opencl_primitive_type_unsigned_int |
opencl_primitive_type_unsigned_long |
opencl_primitive_type_size_t |
opencl_primitive_type_ptrdiff_t |
opencl_primitive_type_intptr_t |
opencl_primitive_type_uintptr_t |
opencl_primitive_type_void |
nr_opencl_primitive_types |

Definition at line 40 of file opencl-lang.c.

## Function Documentation

## ◆ _initialize_opencl_language()

void _initialize_opencl_language | ( | void |  | ) |

Definition at line 1181 of file opencl-lang.c.

References build_opencl_types(), gdbarch_data_register_post_init(), and opencl_type_data.

## ◆ allocate_lval_closure()

static struct lval_closure* allocate_lval_closure | ( | int * | indices,
|  | int | n,
|  | struct value * | val
| ) |  |
| static

Definition at line 153 of file opencl-lang.c.

References lval_closure::indices, lval_closure::n, lval_closure::refc, lval_closure::val, value_incref(), XCNEW, and XCNEWVEC.

Referenced by create_value().

## ◆ array_has_dups()

static int array_has_dups | ( | int * | arr,
|  | int | n
| ) |  |
| static

Definition at line 118 of file opencl-lang.c.

Referenced by create_value().

## ◆ build_opencl_types()

static void* build_opencl_types | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 1094 of file opencl-lang.c.

References arch_boolean_type(), arch_float_type(), arch_integer_type(), arch_type(), BUILD_OCL_VTYPES, floatformats_ieee_double, floatformats_ieee_half, floatformats_ieee_single, GDBARCH_OBSTACK_CALLOC, gdbarch_ptr_bit(), nr_opencl_primitive_types, opencl_primitive_type_bool, opencl_primitive_type_intptr_t, opencl_primitive_type_ptrdiff_t, opencl_primitive_type_size_t, opencl_primitive_type_uintptr_t, opencl_primitive_type_unsigned_char, opencl_primitive_type_unsigned_int, opencl_primitive_type_unsigned_long, opencl_primitive_type_unsigned_short, opencl_primitive_type_void, TARGET_CHAR_BIT, and TYPE_CODE_VOID.

Referenced by _initialize_opencl_language().

## ◆ builtin_opencl_type()

static struct type** builtin_opencl_type | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 68 of file opencl-lang.c.

References gdbarch_data(), and opencl_type_data.

Referenced by lookup_opencl_vector_type(), and opencl_language_arch_info().

## ◆ create_value()

static struct value* create_value | ( | struct gdbarch * | gdbarch,
|  | struct value * | val,
|  | enum noside | noside,
|  | int * | indices,
|  | int | n
| ) |  |
| static

Definition at line 317 of file opencl-lang.c.

References allocate_computed_value(), allocate_lval_closure(), allocate_value(), array_has_dups(), check_typedef(), EVAL_AVOID_SIDE_EFFECTS, lval_closure::indices, init_vector_type(), lookup_opencl_vector_type(), make_cv_type(), lval_closure::n, not_lval, opencl_value_funcs, TYPE_CODE, TYPE_CONST, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_UNSIGNED, TYPE_VOLATILE, lval_closure::val, value_contents(), value_contents_writeable(), VALUE_LVAL, value_subscript(), value_type(), and value_zero().

Referenced by opencl_component_ref().

## ◆ evaluate_subexp_opencl()

static struct value* evaluate_subexp_opencl | ( | struct type * | expect_type,
|  | struct expression * | exp,
|  | int * | pos,
|  | enum noside | noside
| ) |  |
| static

Definition at line 727 of file opencl-lang.c.

References _, allocate_value(), BYTES_TO_EXP_ELEM, check_typedef(), deprecated_value_modifiable(), expression::elts, error(), EVAL_AVOID_SIDE_EFFECTS, EVAL_SKIP, evaluate_subexp(), evaluate_subexp_c(), expression::gdbarch, get_array_bounds(), language_bool_type(), expression::language_defn, exp_element::longconst, longest_to_int(), lval_internalvar, NULL_TYPE, exp_element::opcode, opencl_component_ref(), opencl_logical_not(), opencl_relop(), opencl_value_cast(), exp_element::string, exp_element::type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_UNSIGNED, TYPE_VECTOR, value_assign(), value_contents_all(), value_contents_writeable(), value_from_longest(), value_logical_not(), VALUE_LVAL, value_struct_elt(), value_subscript(), value_type(), and value_zero().

## ◆ lookup_opencl_vector_type()

static struct type* lookup_opencl_vector_type | ( | struct gdbarch * | gdbarch,
|  | enum type_code | code,
|  | unsigned int | el_length,
|  | unsigned int | flag_unsigned,
|  | int | n
| ) |  |
| static

Definition at line 78 of file opencl-lang.c.

References _, builtin_opencl_type(), code, error(), get_array_bounds(), type::length, nr_opencl_primitive_types, type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_UNSIGNED, and TYPE_VECTOR.

Referenced by create_value(), opencl_logical_not(), and vector_relop().

## ◆ lval_func_check_synthetic_pointer()

static int lval_func_check_synthetic_pointer | ( | const struct value * | v,
|  | LONGEST | offset,
|  | int | length
| ) |  |
| static

Definition at line 243 of file opencl-lang.c.

References check_typedef(), lval_closure::indices, lval_closure::n, offset, TYPE_LENGTH, TYPE_TARGET_TYPE, lval_closure::val, value_bits_synthetic_pointer(), value_computed_closure(), and value_type().

## ◆ lval_func_copy_closure()

static void* lval_func_copy_closure | ( | const struct value * | v | ) |
| static

Definition at line 277 of file opencl-lang.c.

References lval_closure::refc, and value_computed_closure().

## ◆ lval_func_free_closure()

static void lval_func_free_closure | ( | struct value * | v | ) |
| static

Definition at line 287 of file opencl-lang.c.

References lval_closure::indices, lval_closure::refc, lval_closure::val, value_computed_closure(), value_free(), and xfree().

## ◆ lval_func_read()

static void lval_func_read | ( | struct value * | v | ) |
| static

Definition at line 168 of file opencl-lang.c.

References _, check_typedef(), error(), gdb_assert, get_array_bounds(), lval_closure::indices, offset, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, lval_closure::val, value_computed_closure(), value_contents(), value_contents_raw(), value_offset(), and value_type().

## ◆ lval_func_write()

static void lval_func_write | ( | struct value * | v,
|  | struct value * | fromval
| ) |  |
| static

Definition at line 196 of file opencl-lang.c.

References _, allocate_value(), check_typedef(), error(), gdb_assert, get_array_bounds(), lval_closure::indices, lval_closure::n, offset, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_LENGTH, TYPE_TARGET_TYPE, lval_closure::val, value_assign(), value_computed_closure(), value_contents(), value_contents_writeable(), value_free_to_mark(), value_mark(), value_offset(), value_subscript(), and value_type().

## ◆ opencl_component_ref()

static struct value* opencl_component_ref | ( | struct expression * | exp,
|  | struct value * | val,
|  | char * | comps,
|  | enum noside | noside
| ) |  |
| static

Definition at line 379 of file opencl-lang.c.

References _, check_typedef(), create_value(), error(), expression::gdbarch, get_array_bounds(), HEXCHAR_TO_INT, and value_type().

Referenced by evaluate_subexp_opencl().

## ◆ opencl_language_arch_info()

static void opencl_language_arch_info | ( | struct gdbarch * | gdbarch,
|  | struct language_arch_info * | lai
| ) |  |
| static

Definition at line 1018 of file opencl-lang.c.

References language_arch_info::bool_type_default, language_arch_info::bool_type_symbol, builtin_opencl_type(), language_arch_info::primitive_type_vector, and language_arch_info::string_char_type.

## ◆ opencl_logical_not()

static struct value* opencl_logical_not | ( | struct expression * | exp,
|  | struct value * | arg
| ) |  |
| static

Definition at line 493 of file opencl-lang.c.

References _, allocate_value(), check_typedef(), error(), expression::gdbarch, get_array_bounds(), language_bool_type(), expression::language_defn, lookup_opencl_vector_type(), memset(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_INT, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_VECTOR, value_contents_writeable(), value_from_longest(), value_logical_not(), value_subscript(), and value_type().

Referenced by evaluate_subexp_opencl().

## ◆ opencl_print_type()

static void opencl_print_type | ( | struct type * | type,
|  | const char * | varstring,
|  | struct ui_file * | stream,
|  | int | show,
|  | int | level,
|  | const struct type_print_options * | flags
| ) |  |
| static

Definition at line 999 of file opencl-lang.c.

References c_print_type(), check_typedef(), flags, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_NAME, and TYPE_VECTOR.

## ◆ opencl_relop()

static struct value* opencl_relop | ( | struct expression * | exp,
|  | struct value * | arg1,
|  | struct value * | arg2,
|  | enum exp_opcode | op
| ) |  |
| static

Definition at line 683 of file opencl-lang.c.

References _, check_typedef(), error(), expression::gdbarch, is_integral_type(), language_bool_type(), expression::language_defn, opencl_value_cast(), scalar_relop(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_FLT, TYPE_VECTOR, value_from_longest(), value_type(), and vector_relop().

Referenced by evaluate_subexp_opencl().

## ◆ opencl_value_cast()

static struct value* opencl_value_cast | ( | struct type * | type,
|  | struct value * | arg
| ) |  |
| static

Definition at line 634 of file opencl-lang.c.

References check_typedef(), coerce_ref(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_DECFLOAT, TYPE_CODE_ENUM, TYPE_CODE_FLT, TYPE_CODE_INT, TYPE_CODE_RANGE, TYPE_CODE_REF, TYPE_TARGET_TYPE, TYPE_VECTOR, value_cast(), value_type(), and value_vector_widen().

Referenced by evaluate_subexp_opencl(), and opencl_relop().

## ◆ scalar_relop()

static int scalar_relop | ( | struct value * | val1,
|  | struct value * | val2,
|  | enum exp_opcode | op
| ) |  |
| static

Definition at line 537 of file opencl-lang.c.

References _, error(), value_equal(), value_less(), and value_logical_not().

Referenced by opencl_relop(), and vector_relop().

## ◆ vector_relop()

static struct value* vector_relop | ( | struct expression * | exp,
|  | struct value * | val1,
|  | struct value * | val2,
|  | enum exp_opcode | op
| ) |  |
| static

Definition at line 577 of file opencl-lang.c.

References _, allocate_value(), check_typedef(), error(), expression::gdbarch, get_array_bounds(), lookup_opencl_vector_type(), memset(), scalar_relop(), TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_INT, TYPE_LENGTH, TYPE_TARGET_TYPE, TYPE_UNSIGNED, TYPE_VECTOR, value_contents_writeable(), value_subscript(), and value_type().

Referenced by opencl_relop().

## Variable Documentation

## ◆ exp_descriptor_opencl

const struct exp_descriptor exp_descriptor_opencl

Initial value:
=
{
print_subexp_standard,
operator_length_standard,
operator_check_standard,
op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_opencl
}
operator_check_standard
int operator_check_standard(struct expression *exp, int pos, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
Definition: parse.c:1723
evaluate_subexp_opencl
static struct value * evaluate_subexp_opencl(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
Definition: opencl-lang.c:727
dump_subexp_body_standard
int dump_subexp_body_standard(struct expression *exp, struct ui_file *stream, int elt)
Definition: expprint.c:795
print_subexp_standard
void print_subexp_standard(struct expression *exp, int *pos, struct ui_file *stream, enum precedence prec)
Definition: expprint.c:58
operator_length_standard
void operator_length_standard(const struct expression *expr, int endpos, int *oplenp, int *argsp)
Definition: parse.c:837
op_name_standard
const char * op_name_standard(enum exp_opcode opcode)
Definition: expprint.c:695

Definition at line 1034 of file opencl-lang.c.

## ◆ opencl_language_defn

const struct language_defn opencl_language_defn

## ◆ opencl_type_data

struct gdbarch_data* opencl_type_data
| static

Definition at line 65 of file opencl-lang.c.

Referenced by _initialize_opencl_language(), and builtin_opencl_type().

## ◆ opencl_value_funcs

const struct lval_funcs opencl_value_funcs
| static

Initial value:
=
{
lval_func_read,
lval_func_write,
NULL,
NULL,
lval_func_check_synthetic_pointer,
lval_func_copy_closure,
lval_func_free_closure
}
lval_func_free_closure
static void lval_func_free_closure(struct value *v)
Definition: opencl-lang.c:287
lval_func_read
static void lval_func_read(struct value *v)
Definition: opencl-lang.c:168
lval_func_copy_closure
static void * lval_func_copy_closure(const struct value *v)
Definition: opencl-lang.c:277
lval_func_write
static void lval_func_write(struct value *v, struct value *fromval)
Definition: opencl-lang.c:196
lval_func_check_synthetic_pointer
static int lval_func_check_synthetic_pointer(const struct value *v, LONGEST offset, int length)
Definition: opencl-lang.c:243

Definition at line 301 of file opencl-lang.c.

Referenced by create_value().