Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::compiler::Address Class Reference

#include <assembler_arm.h>

Inheritance diagram for dart::compiler::Address:
dart::ValueObject dart::ValueObject dart::compiler::Operand dart::compiler::Operand dart::ValueObject dart::ValueObject dart::ValueObject dart::ValueObject dart::ValueObject dart::ValueObject dart::ValueObject dart::ValueObject dart::compiler::FieldAddress dart::compiler::FieldAddress dart::compiler::FieldAddress dart::compiler::FieldAddress dart::compiler::FieldAddress

Public Types

enum  OffsetKind { Immediate , IndexRegister , ScaledIndexRegister }
 
enum  Mode {
  kModeMask = (8 | 4 | 1) << 21 , Offset = (8 | 4 | 0) << 21 , PreIndex = (8 | 4 | 1) << 21 , PostIndex = (0 | 4 | 0) << 21 ,
  NegOffset = (8 | 0 | 0) << 21 , NegPreIndex = (8 | 0 | 1) << 21 , NegPostIndex = (0 | 0 | 0) << 21
}
 
enum  AddressType {
  Offset = (8 | 4 | 0) << 21 , PreIndex = (8 | 4 | 1) << 21 , PostIndex = (0 | 4 | 0) << 21 , PairOffset ,
  PairPreIndex , PairPostIndex , Reg , PCOffset ,
  Unknown
}
 
enum  Scaling { Unscaled , Scaled }
 
- Public Types inherited from dart::compiler::Operand
enum  OperandType {
  Shifted , Extended , Immediate , BitfieldImm ,
  Unknown
}
 

Public Member Functions

 Address (const Address &other)
 
Addressoperator= (const Address &other)
 
bool Equals (const Address &other) const
 
 Address (Register rn, int32_t offset=0, Mode am=Offset)
 
 Address (Register rn, Register r, Mode am)
 
 Address (Register rn, Register rm, Shift shift=LSL, uint32_t shift_imm=0, Mode am=Offset)
 
 Address (Register rn, Register rm, Shift shift, Register r, Mode am=Offset)
 
 Address (const Address &other)
 
Addressoperator= (const Address &other)
 
bool can_writeback_to (Register r) const
 
 Address (Register rn, int32_t offset=0, AddressType at=Offset)
 
 Address (Register rn, Register offset, AddressType at)=delete
 
 Address (Register rn, Register rm, Extend ext=UXTX, Scaling scale=Unscaled)
 
 Address (Register base, int32_t disp)
 
 Address (Register index, ScaleFactor scale, int32_t disp)
 
 Address (Register index, ScaleFactor scale, Register r)
 
 Address (Register base, Register index, ScaleFactor scale, int32_t disp)
 
 Address (Register base, Register index, ScaleFactor scale, Register r)
 
 Address (const Address &other)
 
Addressoperator= (const Address &other)
 
 Address (Register base, intptr_t offset)
 
 Address (Register base)
 
 Address (Register base, Register index)=delete
 
Register base () const
 
intptr_t offset () const
 
 Address (Register base, int32_t disp)
 
 Address (Register base, Register r)
 
 Address (Register index, ScaleFactor scale, int32_t disp)
 
 Address (Register index, ScaleFactor scale, Register r)
 
 Address (Register base, Register index, ScaleFactor scale, int32_t disp)
 
 Address (Register base, Register index, ScaleFactor scale, Register r)
 
 Address (const Address &other)
 
Addressoperator= (const Address &other)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 
- Public Member Functions inherited from dart::compiler::Operand
 Operand ()
 
 Operand (const Operand &other)
 
Operandoperator= (const Operand &other)
 
 Operand (uint32_t immediate)
 
 Operand (uint32_t rotate, uint32_t immed8)
 
 Operand (Register rm)
 
 Operand (Register rm, Shift shift, uint32_t shift_imm)
 
 Operand (Register rm, Shift shift, Register rs)
 
 Operand ()
 
 Operand (const Operand &other)
 
Operandoperator= (const Operand &other)
 
 Operand (Register rm)
 
 Operand (Register rm, Shift shift, int32_t imm)
 
 Operand (Register rm, Shift shift, Register r)
 
 Operand (Register rm, Extend extend, int32_t imm)
 
 Operand (Register rm, Extend extend, Register r)
 
 Operand (int32_t imm)
 
 Operand (uint8_t n, int8_t imm_s, int8_t imm_r)
 
uint8_t mod () const
 
Register rm () const
 
ScaleFactor scale () const
 
Register index () const
 
Register base () const
 
int8_t disp8 () const
 
int32_t disp32 () const
 
 Operand (const Operand &other)
 
Operandoperator= (const Operand &other)
 
bool Equals (const Operand &other) const
 
uint8_t rex () const
 
uint8_t mod () const
 
Register rm () const
 
ScaleFactor scale () const
 
Register index () const
 
Register base () const
 
int8_t disp8 () const
 
int32_t disp32 () const
 
 Operand (const Operand &other)
 
Operandoperator= (const Operand &other)
 
bool Equals (const Operand &other) const
 

Static Public Member Functions

static OperandSize OperandSizeFor (intptr_t cid)
 
static bool CanHoldLoadOffset (OperandSize size, int32_t offset, int32_t *offset_mask)
 
static bool CanHoldStoreOffset (OperandSize size, int32_t offset, int32_t *offset_mask)
 
static bool CanHoldImmediateOffset (bool is_load, intptr_t cid, int64_t offset)
 
static bool CanHoldOffset (int32_t offset, AddressType at=Offset, OperandSize sz=kEightBytes)
 
static Address PC (int32_t pc_off)
 
static Address Pair (Register rn, int32_t offset=0, AddressType at=PairOffset)
 
static Address PC (Register r)=delete
 
static OperandSize OperandSizeFor (intptr_t cid)
 
static Address Absolute (const uword addr)
 
static Address AddressRIPRelative (int32_t disp)
 
static Address AddressBaseImm32 (Register base, int32_t disp)
 
static Address AddressBaseImm32 (Register base, Register r)
 
- Static Public Member Functions inherited from dart::compiler::Operand
static bool CanHold (uint32_t immediate, Operand *o)
 
static bool IsImmLogical (uint64_t value, uint8_t width, Operand *imm_op)
 
static OperandType CanHold (int64_t imm, uint8_t sz, Operand *op)
 

Friends

class Assembler
 

Additional Inherited Members

- Protected Member Functions inherited from dart::compiler::Operand
 Operand ()
 
void SetModRM (int mod, Register rm)
 
void SetSIB (ScaleFactor scale, Register index, Register base)
 
void SetDisp8 (int8_t disp)
 
void SetDisp32 (int32_t disp)
 
 Operand ()
 
void SetModRM (int mod, Register rm)
 
void SetSIB (ScaleFactor scale, Register index, Register base)
 
void SetDisp8 (int8_t disp)
 
void SetDisp32 (int32_t disp)
 

Detailed Description

Definition at line 221 of file assembler_arm.h.

Member Enumeration Documentation

◆ AddressType

Enumerator
Offset 
PreIndex 
PostIndex 
PairOffset 
PairPreIndex 
PairPostIndex 
Reg 
PCOffset 
Unknown 

Definition at line 150 of file assembler_arm64.h.

◆ Mode

Enumerator
kModeMask 
Offset 
PreIndex 
PostIndex 
NegOffset 
NegPreIndex 
NegPostIndex 

Definition at line 230 of file assembler_arm.h.

230 {
231 kModeMask = (8 | 4 | 1) << 21,
232 // bit encoding P U W
233 Offset = (8 | 4 | 0) << 21, // offset (w/o writeback to base)
234 PreIndex = (8 | 4 | 1) << 21, // pre-indexed addressing with writeback
235 PostIndex = (0 | 4 | 0) << 21, // post-indexed addressing with writeback
236 NegOffset = (8 | 0 | 0) << 21, // negative offset (w/o writeback to base)
237 NegPreIndex = (8 | 0 | 1) << 21, // negative pre-indexed with writeback
238 NegPostIndex = (0 | 0 | 0) << 21 // negative post-indexed with writeback
239 };

◆ OffsetKind

Enumerator
Immediate 
IndexRegister 
ScaledIndexRegister 

Definition at line 223 of file assembler_arm.h.

◆ Scaling

Enumerator
Unscaled 
Scaled 

Definition at line 227 of file assembler_arm64.h.

Constructor & Destructor Documentation

◆ Address() [1/25]

dart::compiler::Address::Address ( const Address other)
inline

Definition at line 241 of file assembler_arm.h.

242 : ValueObject(),
243 encoding_(other.encoding_),
244 kind_(other.kind_),
245 base_(other.base_),
246 offset_(other.offset_) {}

◆ Address() [2/25]

dart::compiler::Address::Address ( Register  rn,
int32_t  offset = 0,
Mode  am = Offset 
)
inlineexplicit

Definition at line 260 of file assembler_arm.h.

260 {
261 kind_ = Immediate;
262 base_ = rn;
263 offset_ = offset;
264 // If the offset can't be encoded in fewer bits, then it'll conflict with
265 // the encoding of the mode and we won't be able to retrieve it later.
267 if (offset < 0) {
268 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign.
269 } else {
270 encoding_ = am | offset;
271 }
272 encoding_ |= ArmEncode::Rn(rn);
273 }
static bool MagnitudeIsUint(intptr_t N, T value)
Definition: utils.h:352
static uint32_t Rn(Register rn)
#define ASSERT(E)
@ kOpcodeShift

◆ Address() [3/25]

dart::compiler::Address::Address ( Register  rn,
Register  r,
Mode  am 
)

◆ Address() [4/25]

dart::compiler::Address::Address ( Register  rn,
Register  rm,
Shift  shift = LSL,
uint32_t  shift_imm = 0,
Mode  am = Offset 
)
inline

Definition at line 279 of file assembler_arm.h.

283 {
284 Operand o(rm, shift, shift_imm);
285
286 if ((shift == LSL) && (shift_imm == 0)) {
287 kind_ = IndexRegister;
288 } else {
289 kind_ = ScaledIndexRegister;
290 }
291 encoding_ = o.encoding() | am | ArmEncode::Rn(rn);
292 }

◆ Address() [5/25]

dart::compiler::Address::Address ( Register  rn,
Register  rm,
Shift  shift,
Register  r,
Mode  am = Offset 
)

◆ Address() [6/25]

dart::compiler::Address::Address ( const Address other)
inline

Definition at line 137 of file assembler_arm64.h.

138 : ValueObject(),
139 type_(other.type_),
140 base_(other.base_),
141 offset_(other.offset_) {}

◆ Address() [7/25]

dart::compiler::Address::Address ( Register  rn,
int32_t  offset = 0,
AddressType  at = Offset 
)
inlineexplicit

Definition at line 174 of file assembler_arm64.h.

174 {
175 ASSERT((rn != kNoRegister) && (rn != R31) && (rn != ZR));
176 type_ = at;
177 base_ = rn;
178 offset_ = offset;
179 }
@ kNoRegister
Definition: constants_arm.h:99

◆ Address() [8/25]

dart::compiler::Address::Address ( Register  rn,
Register  offset,
AddressType  at 
)
delete

◆ Address() [9/25]

dart::compiler::Address::Address ( Register  rn,
Register  rm,
Extend  ext = UXTX,
Scaling  scale = Unscaled 
)
inline

Definition at line 235 of file assembler_arm64.h.

238 {
239 ASSERT((rn != R31) && (rn != ZR));
240 ASSERT((rm != R31) && (rm != CSP));
241 // Can only scale when ext = UXTX.
242 ASSERT((scale != Scaled) || (ext == UXTX));
243 ASSERT((ext == UXTW) || (ext == UXTX) || (ext == SXTW) || (ext == SXTX));
244 type_ = Reg;
245 base_ = rn;
246 // Use offset_ to store pre-encoded scale, extend and rm.
247 offset_ = ((scale == Scaled) ? B12 : 0) | Arm64Encode::Rm(rm) |
248 (static_cast<int32_t>(ext) << kExtendTypeShift);
249 }
static uint32_t Rm(Register rm)
ScaleFactor scale() const
@ kExtendTypeShift

◆ Address() [10/25]

dart::compiler::Address::Address ( Register  base,
int32_t  disp 
)
inline

Definition at line 146 of file assembler_ia32.h.

146 {
147 if (disp == 0 && base != EBP) {
148 SetModRM(0, base);
149 if (base == ESP) SetSIB(TIMES_1, ESP, base);
150 } else if (Utils::IsInt(8, disp)) {
151 SetModRM(1, base);
152 if (base == ESP) SetSIB(TIMES_1, ESP, base);
153 SetDisp8(disp);
154 } else {
155 SetModRM(2, base);
156 if (base == ESP) SetSIB(TIMES_1, ESP, base);
157 SetDisp32(disp);
158 }
159 }
static bool IsInt(intptr_t N, T value)
Definition: utils.h:313
void SetSIB(ScaleFactor scale, Register index, Register base)
void SetDisp8(int8_t disp)
void SetModRM(int mod, Register rm)
void SetDisp32(int32_t disp)

◆ Address() [11/25]

dart::compiler::Address::Address ( Register  index,
ScaleFactor  scale,
int32_t  disp 
)
inline

Definition at line 161 of file assembler_ia32.h.

161 {
162 ASSERT(index != ESP); // Illegal addressing mode.
163 ASSERT(scale != TIMES_16); // Unsupported scale factor.
164 SetModRM(0, ESP);
166 SetDisp32(disp);
167 }
Register index() const
@ TIMES_16

◆ Address() [12/25]

dart::compiler::Address::Address ( Register  index,
ScaleFactor  scale,
Register  r 
)

◆ Address() [13/25]

dart::compiler::Address::Address ( Register  base,
Register  index,
ScaleFactor  scale,
int32_t  disp 
)
inline

Definition at line 172 of file assembler_ia32.h.

172 {
173 ASSERT(index != ESP); // Illegal addressing mode.
174 ASSERT(scale != TIMES_16); // Unsupported scale factor.
175 if (disp == 0 && base != EBP) {
176 SetModRM(0, ESP);
178 } else if (Utils::IsInt(8, disp)) {
179 SetModRM(1, ESP);
181 SetDisp8(disp);
182 } else {
183 SetModRM(2, ESP);
185 SetDisp32(disp);
186 }
187 }

◆ Address() [14/25]

dart::compiler::Address::Address ( Register  base,
Register  index,
ScaleFactor  scale,
Register  r 
)

◆ Address() [15/25]

dart::compiler::Address::Address ( const Address other)
inline

Definition at line 192 of file assembler_ia32.h.

192: Operand(other) {}

◆ Address() [16/25]

dart::compiler::Address::Address ( Register  base,
intptr_t  offset 
)
inline

Definition at line 38 of file assembler_riscv.h.

38: base_(base), offset_(offset) {}

◆ Address() [17/25]

dart::compiler::Address::Address ( Register  base)
inlineexplicit

Definition at line 39 of file assembler_riscv.h.

39: base_(base), offset_(0) {}

◆ Address() [18/25]

dart::compiler::Address::Address ( Register  base,
Register  index 
)
delete

◆ Address() [19/25]

dart::compiler::Address::Address ( Register  base,
int32_t  disp 
)
inline

Definition at line 174 of file assembler_x64.h.

174 {
175 if ((disp == 0) && ((base & 7) != RBP)) {
176 SetModRM(0, base);
177 if ((base & 7) == RSP) {
179 }
180 } else if (Utils::IsInt(8, disp)) {
181 SetModRM(1, base);
182 if ((base & 7) == RSP) {
184 }
185 SetDisp8(disp);
186 } else {
187 SetModRM(2, base);
188 if ((base & 7) == RSP) {
190 }
191 SetDisp32(disp);
192 }
193 }

◆ Address() [20/25]

dart::compiler::Address::Address ( Register  base,
Register  r 
)

◆ Address() [21/25]

dart::compiler::Address::Address ( Register  index,
ScaleFactor  scale,
int32_t  disp 
)
inline

Definition at line 198 of file assembler_x64.h.

198 {
199 ASSERT(index != RSP); // Illegal addressing mode.
200 ASSERT(scale != TIMES_16); // Unsupported scale factor.
201 SetModRM(0, RSP);
203 SetDisp32(disp);
204 }

◆ Address() [22/25]

dart::compiler::Address::Address ( Register  index,
ScaleFactor  scale,
Register  r 
)

◆ Address() [23/25]

dart::compiler::Address::Address ( Register  base,
Register  index,
ScaleFactor  scale,
int32_t  disp 
)
inline

Definition at line 209 of file assembler_x64.h.

209 {
210 ASSERT(index != RSP); // Illegal addressing mode.
211 ASSERT(scale != TIMES_16); // Unsupported scale factor.
212 if ((disp == 0) && ((base & 7) != RBP)) {
213 SetModRM(0, RSP);
215 } else if (Utils::IsInt(8, disp)) {
216 SetModRM(1, RSP);
218 SetDisp8(disp);
219 } else {
220 SetModRM(2, RSP);
222 SetDisp32(disp);
223 }
224 }

◆ Address() [24/25]

dart::compiler::Address::Address ( Register  base,
Register  index,
ScaleFactor  scale,
Register  r 
)

◆ Address() [25/25]

dart::compiler::Address::Address ( const Address other)
inline

Definition at line 229 of file assembler_x64.h.

229: Operand(other) {}

Member Function Documentation

◆ Absolute()

static Address dart::compiler::Address::Absolute ( const uword  addr)
inlinestatic

Definition at line 199 of file assembler_ia32.h.

199 {
201 result.SetModRM(0, EBP);
202 result.SetDisp32(addr);
203 return result;
204 }
Address(const Address &other)
GAsyncResult * result

◆ AddressBaseImm32() [1/2]

static Address dart::compiler::Address::AddressBaseImm32 ( Register  base,
int32_t  disp 
)
inlinestatic

Definition at line 239 of file assembler_x64.h.

239 {
240 return Address(base, disp, true);
241 }

◆ AddressBaseImm32() [2/2]

static Address dart::compiler::Address::AddressBaseImm32 ( Register  base,
Register  r 
)
static

◆ AddressRIPRelative()

static Address dart::compiler::Address::AddressRIPRelative ( int32_t  disp)
inlinestatic

Definition at line 236 of file assembler_x64.h.

236 {
237 return Address(RIPRelativeDisp(disp));
238 }

◆ base()

Register dart::compiler::Address::base ( ) const
inline

Definition at line 44 of file assembler_riscv.h.

44{ return base_; }

◆ can_writeback_to()

bool dart::compiler::Address::can_writeback_to ( Register  r) const
inline

Definition at line 165 of file assembler_arm64.h.

165 {
166 if (type() == PreIndex || type() == PostIndex || type() == PairPreIndex ||
167 type() == PairPostIndex) {
168 return ConcreteRegister(base()) != ConcreteRegister(r);
169 }
170 return true;
171 }
Register ConcreteRegister(LinkRegister)

◆ CanHoldImmediateOffset()

static bool dart::compiler::Address::CanHoldImmediateOffset ( bool  is_load,
intptr_t  cid,
int64_t  offset 
)
static

◆ CanHoldLoadOffset()

static bool dart::compiler::Address::CanHoldLoadOffset ( OperandSize  size,
int32_t  offset,
int32_t *  offset_mask 
)
static

◆ CanHoldOffset()

static bool dart::compiler::Address::CanHoldOffset ( int32_t  offset,
AddressType  at = Offset,
OperandSize  sz = kEightBytes 
)
inlinestatic

Definition at line 184 of file assembler_arm64.h.

186 {
187 if (at == Offset) {
188 // Offset fits in 12 bit unsigned and has right alignment for sz,
189 // or fits in 9 bit signed offset with no alignment restriction.
190 const int32_t scale = Log2OperandSizeBytes(sz);
191 return (Utils::IsUint(12 + scale, offset) &&
192 (offset == ((offset >> scale) << scale))) ||
193 (Utils::IsInt(9, offset));
194 } else if (at == PCOffset) {
195 return Utils::IsInt(21, offset) && (offset == ((offset >> 2) << 2));
196 } else if ((at == PreIndex) || (at == PostIndex)) {
197 return Utils::IsInt(9, offset);
198 } else {
199 ASSERT((at == PairOffset) || (at == PairPreIndex) ||
200 (at == PairPostIndex));
201 const int32_t scale = Log2OperandSizeBytes(sz);
202 return (Utils::IsInt(7 + scale, offset) &&
203 (static_cast<uint32_t>(offset) ==
204 ((static_cast<uint32_t>(offset) >> scale) << scale)));
205 }
206 }
static bool IsUint(intptr_t N, T value)
Definition: utils.h:328
static int Log2OperandSizeBytes(OperandSize os)

◆ CanHoldStoreOffset()

static bool dart::compiler::Address::CanHoldStoreOffset ( OperandSize  size,
int32_t  offset,
int32_t *  offset_mask 
)
static

◆ Equals()

bool dart::compiler::Address::Equals ( const Address other) const
inline

Definition at line 256 of file assembler_arm.h.

256 {
257 return (encoding_ == other.encoding_) && (kind_ == other.kind_);
258 }

◆ offset()

intptr_t dart::compiler::Address::offset ( ) const
inline

Definition at line 45 of file assembler_riscv.h.

45{ return offset_; }

◆ OperandSizeFor() [1/2]

static OperandSize dart::compiler::Address::OperandSizeFor ( intptr_t  cid)
static

◆ OperandSizeFor() [2/2]

static OperandSize dart::compiler::Address::OperandSizeFor ( intptr_t  cid)
static

◆ operator=() [1/4]

Address & dart::compiler::Address::operator= ( const Address other)
inline

Definition at line 248 of file assembler_arm.h.

248 {
249 encoding_ = other.encoding_;
250 kind_ = other.kind_;
251 base_ = other.base_;
252 offset_ = other.offset_;
253 return *this;
254 }

◆ operator=() [2/4]

Address & dart::compiler::Address::operator= ( const Address other)
inline

Definition at line 143 of file assembler_arm64.h.

143 {
144 type_ = other.type_;
145 base_ = other.base_;
146 offset_ = other.offset_;
147 return *this;
148 }

◆ operator=() [3/4]

Address & dart::compiler::Address::operator= ( const Address other)
inline

Definition at line 194 of file assembler_ia32.h.

194 {
195 Operand::operator=(other);
196 return *this;
197 }
Operand & operator=(const Operand &other)

◆ operator=() [4/4]

Address & dart::compiler::Address::operator= ( const Address other)
inline

Definition at line 231 of file assembler_x64.h.

231 {
232 Operand::operator=(other);
233 return *this;
234 }

◆ Pair()

static Address dart::compiler::Address::Pair ( Register  rn,
int32_t  offset = 0,
AddressType  at = PairOffset 
)
inlinestatic

Definition at line 218 of file assembler_arm64.h.

220 {
221 return Address(rn, offset, at);
222 }

◆ PC() [1/2]

static Address dart::compiler::Address::PC ( int32_t  pc_off)
inlinestatic

Definition at line 209 of file assembler_arm64.h.

209 {
210 ASSERT(CanHoldOffset(pc_off, PCOffset));
212 addr.base_ = kNoRegister;
213 addr.type_ = PCOffset;
214 addr.offset_ = pc_off;
215 return addr;
216 }
static bool CanHoldOffset(int32_t offset, AddressType at=Offset, OperandSize sz=kEightBytes)

◆ PC() [2/2]

static Address dart::compiler::Address::PC ( Register  r)
staticdelete

Friends And Related Function Documentation

◆ Assembler

Assembler
friend

Definition at line 366 of file assembler_arm.h.


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