Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
dart::RepresentationUtils Struct Reference

#include <locations.h>

Inheritance diagram for dart::RepresentationUtils:
dart::AllStatic

Static Public Member Functions

static constexpr bool IsUnboxedInteger (Representation rep)
 
static constexpr bool IsUnboxed (Representation rep)
 
static constexpr size_t ValueSize (Representation rep)
 
static bool IsUnsignedInteger (Representation rep)
 
static compiler::OperandSize OperandSize (Representation rep)
 
static int64_t MinValue (Representation rep)
 
static int64_t MaxValue (Representation rep)
 
static bool IsRepresentable (Representation rep, int64_t value)
 
static Representation RepresentationOfArrayElement (classid_t cid)
 
static const char * ToCString (Representation rep)
 

Detailed Description

Definition at line 86 of file locations.h.

Member Function Documentation

◆ IsRepresentable()

bool dart::RepresentationUtils::IsRepresentable ( Representation  rep,
int64_t  value 
)
static

Definition at line 72 of file locations.cc.

72 {
74 const intptr_t bit_size = ValueSize(rep) * kBitsPerByte;
75 return IsUnsignedInteger(rep) ? Utils::IsUint(bit_size, value)
76 : Utils::IsInt(bit_size, value);
77}
static bool IsUint(intptr_t N, T value)
Definition: utils.h:328
#define ASSERT(E)
uint8_t value
constexpr intptr_t kBitsPerByte
Definition: globals.h:463
static constexpr size_t ValueSize(Representation rep)
Definition: locations.h:112
static constexpr bool IsUnboxedInteger(Representation rep)
Definition: locations.h:92
static bool IsUnsignedInteger(Representation rep)
Definition: locations.h:126

◆ IsUnboxed()

static constexpr bool dart::RepresentationUtils::IsUnboxed ( Representation  rep)
inlinestaticconstexpr

Definition at line 101 of file locations.h.

101 {
102 switch (rep) {
104 default:
105 return false;
106 }
107 }
#define FOR_EACH_UNBOXED_REPRESENTATION_KIND(M)
Definition: locations.h:42
#define REP_IN_SET_CLAUSE(name, __, ___, ____)
Definition: locations.h:87

◆ IsUnboxedInteger()

static constexpr bool dart::RepresentationUtils::IsUnboxedInteger ( Representation  rep)
inlinestaticconstexpr

Definition at line 92 of file locations.h.

92 {
93 switch (rep) {
95 default:
96 return false;
97 }
98 }
#define FOR_EACH_INTEGER_REPRESENTATION_KIND(M)
Definition: locations.h:31

◆ IsUnsignedInteger()

static bool dart::RepresentationUtils::IsUnsignedInteger ( Representation  rep)
inlinestatic

Definition at line 126 of file locations.h.

126 {
127 switch (rep) {
128#define REP_IS_UNSIGNED_CLAUSE(name, __, unsigned, ___) \
129 case k##name: \
130 return unsigned;
132#undef REP_IS_UNSIGNED_CLAUSE
133 default:
134 return false;
135 }
136 }
#define REP_IS_UNSIGNED_CLAUSE(name, __, unsigned, ___)

◆ MaxValue()

int64_t dart::RepresentationUtils::MaxValue ( Representation  rep)
static

Definition at line 62 of file locations.cc.

62 {
63 switch (rep) {
65 default:
67 return kMaxInt64;
68 }
69}
#define UNREACHABLE()
Definition: assert.h:248
#define REP_MAX_VALUE_CLAUSE(name, ___, ____, type)
Definition: locations.cc:59
constexpr int64_t kMaxInt64
Definition: globals.h:486

◆ MinValue()

int64_t dart::RepresentationUtils::MinValue ( Representation  rep)
static

Definition at line 49 of file locations.cc.

49 {
50 switch (rep) {
52 default:
54 return kMinInt64;
55 }
56}
#define REP_MIN_VALUE_CLAUSE(name, ___, ____, type)
Definition: locations.cc:46
constexpr int64_t kMinInt64
Definition: globals.h:485

◆ OperandSize()

compiler::OperandSize dart::RepresentationUtils::OperandSize ( Representation  rep)
static

Definition at line 16 of file locations.cc.

16 {
17 if (rep == kTagged) return compiler::kObjectBytes;
18
19 // Untagged addresses are either loaded from and stored to word size native
20 // fields or generated from already-extended tagged addresses when
21 // compressed pointers are enabled.
22 if (rep == kUntagged) return compiler::kWordBytes;
23
24 if (IsUnboxedInteger(rep)) {
25 switch (ValueSize(rep)) {
26 case 8:
30 case 4:
33 case 2:
36 case 1:
39 }
40 }
41
44}
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309
static constexpr intptr_t kWordSize
Definition: runtime_api.h:274
constexpr OperandSize kWordBytes

◆ RepresentationOfArrayElement()

Representation dart::RepresentationUtils::RepresentationOfArrayElement ( classid_t  cid)
static

Definition at line 79 of file locations.cc.

80 {
82 // Normalize typed data cids to the internal cid for the switch statement.
85 }
86 switch (cid) {
87#define ARRAY_CASE(Name) case k##Name##Cid:
89#undef ARRAY_CASE
90 case kRecordCid:
91 case kTypeArgumentsCid:
92 return kTagged;
93 case kTypedDataInt8ArrayCid:
94 return kUnboxedInt8;
95 case kOneByteStringCid:
96 case kTypedDataUint8ArrayCid:
97 case kTypedDataUint8ClampedArrayCid:
98 case kExternalTypedDataUint8ArrayCid:
99 case kExternalTypedDataUint8ClampedArrayCid:
100 return kUnboxedUint8;
101 case kTypedDataInt16ArrayCid:
102 return kUnboxedInt16;
103 case kTwoByteStringCid:
104 case kTypedDataUint16ArrayCid:
105 return kUnboxedUint16;
106 case kTypedDataInt32ArrayCid:
107 return kUnboxedInt32;
108 case kTypedDataUint32ArrayCid:
109 return kUnboxedUint32;
110 case kTypedDataInt64ArrayCid:
111 case kTypedDataUint64ArrayCid:
112 return kUnboxedInt64;
113 case kTypedDataFloat32ArrayCid:
114 return kUnboxedFloat;
115 case kTypedDataFloat64ArrayCid:
116 return kUnboxedDouble;
117 case kTypedDataInt32x4ArrayCid:
118 return kUnboxedInt32x4;
119 case kTypedDataFloat32x4ArrayCid:
120 return kUnboxedFloat32x4;
121 case kTypedDataFloat64x2ArrayCid:
122 return kUnboxedFloat64x2;
123 default:
124 FATAL("Unexpected array cid %u", cid);
125 return kTagged;
126 }
127}
#define CLASS_LIST_ARRAYS(V)
Definition: class_id.h:128
#define FATAL(error)
#define ARRAY_CASE(Name)
const int kNumTypedDataCidRemainders
Definition: class_id.h:265
bool IsTypedDataBaseClassId(intptr_t index)
Definition: class_id.h:429
const int kTypedDataCidRemainderInternal
Definition: class_id.h:261
static const ClassId kFirstTypedDataCid
Definition: class_id.h:377
const intptr_t cid

◆ ToCString()

const char * dart::RepresentationUtils::ToCString ( Representation  rep)
static

Definition at line 129 of file locations.cc.

129 {
130 switch (repr) {
131#define REPR_CASE(Name, PrintName, __, ___) \
132 case k##Name: \
133 return #PrintName;
135#undef KIND_CASE
136 default:
137 UNREACHABLE();
138 }
139 return nullptr;
140}
#define REPR_CASE(Name, PrintName, __, ___)
#define FOR_EACH_REPRESENTATION_KIND(M)
Definition: locations.h:61

◆ ValueSize()

static constexpr size_t dart::RepresentationUtils::ValueSize ( Representation  rep)
inlinestaticconstexpr

Definition at line 112 of file locations.h.

112 {
113 switch (rep) {
114#define REP_SIZEOF_CLAUSE(name, __, ___, type) \
115 case k##name: \
116 return sizeof(type);
118#undef REP_SIZEOF_CLAUSE
119 default:
120 UNREACHABLE();
122 }
123 }
#define REP_SIZEOF_CLAUSE(name, __, ___, type)
#define FOR_EACH_SIMPLE_REPRESENTATION_KIND(M)
Definition: locations.h:53

The documentation for this struct was generated from the following files: