예제 #1
0
std::vector<DexField*> create_merger_fields(
    const DexType* owner, const std::vector<DexField*>& mergeable_fields) {
  std::vector<DexField*> res;
  size_t cnt = 0;
  for (const auto f : mergeable_fields) {
    auto type = f->get_type();
    std::string name;
    if (type == get_byte_type() || type == get_char_type() ||
        type == get_short_type() || type == get_int_type()) {
      type = get_int_type();
      name = "i";
    } else if (type == get_boolean_type()) {
      type = get_boolean_type();
      name = "z";
    } else if (type == get_long_type()) {
      type = get_long_type();
      name = "j";
    } else if (type == get_float_type()) {
      type = get_float_type();
      name = "f";
    } else if (type == get_double_type()) {
      type = get_double_type();
      name = "d";
    } else {
      static DexType* string_type = DexType::make_type("Ljava/lang/String;");
      if (type == string_type) {
        type = string_type;
        name = "s";
      } else {
        char t = type_shorty(type);
        always_assert(t == 'L' || t == '[');
        type = get_object_type();
        name = "l";
      }
    }

    name = name + std::to_string(cnt);
    auto field = static_cast<DexField*>(
        DexField::make_field(owner, DexString::make_string(name), type));
    field->make_concrete(ACC_PUBLIC);
    res.push_back(field);
    cnt++;
  }

  TRACE(TERA, 8, "  created merger fields %d \n", res.size());
  return res;
}
    ObjectList<Type> Type::get_floating_types()
    {
        Type all_floating_types[] =
        {
            Type(get_float_type()),
            Type(get_double_type()),
            Type(get_long_double_type()),
        };

        return ObjectList<Type>(all_floating_types);
    }
예제 #3
0
static void init_spu_types(void)
{
  V16QI_type_node = build_vector_type (intQI_type_node, 16);
  V8HI_type_node = build_vector_type (intHI_type_node, 16);
  V4SI_type_node = build_vector_type (intSI_type_node, 16);
  V2DI_type_node = build_vector_type (intDI_type_node, 16);
  V4SF_type_node = build_vector_type (float_type_node, 16);
  V2DF_type_node = build_vector_type (double_type_node, 16);

  unsigned_V16QI_type_node = build_vector_type (unsigned_intQI_type_node, 16);
  unsigned_V8HI_type_node = build_vector_type (unsigned_intHI_type_node, 16);
  unsigned_V4SI_type_node = build_vector_type (unsigned_intSI_type_node, 16);
  unsigned_V2DI_type_node = build_vector_type (unsigned_intDI_type_node, 16);

  spu_builtin_types[SPU_BTI_QUADWORD] = V16QI_type_node;

  spu_builtin_types[SPU_BTI_7] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_S7] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_U7] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_S10] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_S10_4] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_U14] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_16] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_S16] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_S16_2] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_U16] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_U16_2] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_U18] = get_signed_int_type();

  spu_builtin_types[SPU_BTI_INTQI] = get_signed_char_type();
  spu_builtin_types[SPU_BTI_INTHI] = get_signed_short_int_type();
  spu_builtin_types[SPU_BTI_INTSI] = get_signed_int_type();
  spu_builtin_types[SPU_BTI_INTDI] = get_signed_long_long_int_type();
  spu_builtin_types[SPU_BTI_UINTQI] = get_unsigned_char_type();
  spu_builtin_types[SPU_BTI_UINTHI] = get_unsigned_short_int_type();
  spu_builtin_types[SPU_BTI_UINTSI] = get_unsigned_int_type();
  spu_builtin_types[SPU_BTI_UINTDI] = get_unsigned_long_long_int_type();

  spu_builtin_types[SPU_BTI_FLOAT] = get_float_type();
  spu_builtin_types[SPU_BTI_DOUBLE] = get_double_type();

  spu_builtin_types[SPU_BTI_VOID] = get_void_type();

  spu_builtin_types[SPU_BTI_PTR] = 
      get_cv_qualified_type(get_pointer_type(get_void_type()),
              CV_CONST | CV_VOLATILE);
}
static implicit_info_t* get_default_fortran_implicit(void)
{
    static implicit_info_t* result;
    if (result == NULL)
    {
        result = allocate_implicit_info();

        char c;
        for (c = 'a'; c <= 'z'; c++)
        {
            (*(result->data->implicit_letter_set))[c - 'a'] = get_float_type();
        }
        for (c = 'i'; c <= 'n'; c++)
        {
            (*(result->data->implicit_letter_set))[c - 'a'] = get_signed_int_type();
        }
        result->data->letter_set_is_shared = 1;
    }

    return result;
}
예제 #5
0
FloatConstant* NodeBuilder::float_const(float v)
{
  char buf[64];
  sprintf(buf, "%f", v);
  return create_float_constant(_suif_env, get_float_type(), String(buf));
}
예제 #6
0
Float_type&
Builder::get_float_type(int p, Qualifier_set q)
{
  return get_float_type(object_type, p, q);
}
예제 #7
0
파일: parser.cpp 프로젝트: Jenny-fa/beaker
// Parse a primary type.
//
//    primary-type -> 'bool'
//                  | 'int'
//                  | 'char'
//                  | id-type
//                  | function-type
//
//    function-type -> '(' type-list ')' '->' type
//
//    type-list -> type | type-list ',' type
Type const*
Parser::primary_type()
{
  // id-type
  if (Token tok = match_if(identifier_tok))
    return on_id_type(tok);

  // bool
  else if (match_if(bool_kw))
    return get_boolean_type();

  // char
  else if (match_if(char_kw))
    return get_character_type();

  // int
  else if (match_if(int_kw))
    return get_integer_type();

  // uint
  else if (match_if(uint_kw))
    return get_integer_type(false);

  // short
  else if (match_if(short_kw))
    return get_integer_type(16);

  // ushort
  else if (match_if(ushort_kw))
    return get_integer_type(false, 16);

  // long
  else if (match_if(long_kw))
    return get_integer_type(64);

  // ulong
  else if (match_if(ulong_kw))
    return get_integer_type(false, 64);

  // int16
  else if (match_if(int16_kw))
    return get_integer_type(16);

  // uint16
  else if (match_if(uint16_kw))
    return get_integer_type(false, 16);

  // int32
  else if (match_if(int32_kw))
    return get_integer_type();

  // uint32
  else if (match_if(uint32_kw))
    return get_integer_type(false);

  // int64
  else if (match_if(int64_kw))
    return get_integer_type(64);

  // uint64
  else if (match_if(uint64_kw))
    return get_integer_type(false, 64);

  // float
  else if (match_if(float_kw))
      return get_float_type();

  // double
  else if (match_if(double_kw))
      return get_double_type();

  // function-type
  else if (match_if(lparen_tok)) {
    Type_seq ts;
    while (true) {
      ts.push_back(type());
      if (match_if(comma_tok))
        continue;
      else
        break;
    }
    match(rparen_tok);
    match(arrow_tok);
    Type const* t = type();
    return on_function_type(ts, t);
  }

  // error
  //
  // TODO: Make this a little less vague.
  else
    error("invalid type");
}
예제 #8
0
파일: builder.hpp 프로젝트: asutton/beaker
// Returns the canonical type `float64`.
inline float_type& builder::get_float64_type() { return get_float_type(64); }
예제 #9
0
파일: builder.hpp 프로젝트: asutton/beaker
// Returns the canonical type `float32`.
inline float_type& builder::get_float32_type() { return get_float_type(32); }