Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
dart::PcRelativePatternBase Class Reference

#include <instructions_arm64.h>

Inheritance diagram for dart::PcRelativePatternBase:
dart::ValueObject dart::ValueObject dart::PcRelativeCallPattern dart::PcRelativeCallPattern dart::PcRelativeTailCallPattern dart::PcRelativeTailCallPattern

Public Member Functions

 PcRelativePatternBase (uword pc)
 
int32_t distance ()
 
void set_distance (int32_t distance)
 
bool IsValid () const
 
 PcRelativePatternBase (uword pc)
 
int32_t distance ()
 
void set_distance (int32_t distance)
 
bool IsValid () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Static Public Attributes

static constexpr intptr_t kLowerCallingRange = -(1 << 27)
 
static constexpr intptr_t kUpperCallingRange = (1 << 27) - Instr::kInstrSize
 
static constexpr int kLengthInBytes = 1 * Instr::kInstrSize
 
static constexpr intptr_t kLengthInBytes = 8
 

Protected Attributes

uword pc_
 

Detailed Description

Definition at line 193 of file instructions_arm64.h.

Constructor & Destructor Documentation

◆ PcRelativePatternBase() [1/2]

dart::PcRelativePatternBase::PcRelativePatternBase ( uword  pc)
inlineexplicit

Definition at line 199 of file instructions_arm64.h.

◆ PcRelativePatternBase() [2/2]

dart::PcRelativePatternBase::PcRelativePatternBase ( uword  pc)
inlineexplicit

Definition at line 188 of file instructions_riscv.h.

188: pc_(pc) {}

Member Function Documentation

◆ distance() [1/2]

int32_t dart::PcRelativePatternBase::distance ( )
inline

Definition at line 203 of file instructions_arm64.h.

203 {
204#if !defined(DART_PRECOMPILED_RUNTIME)
206 *reinterpret_cast<int32_t*>(pc_));
207#else
208 UNREACHABLE();
209 return 0;
210#endif
211 }
#define UNREACHABLE()
Definition: assert.h:248
static int64_t DecodeImm26BranchOffset(int32_t instr)

◆ distance() [2/2]

int32_t dart::PcRelativePatternBase::distance ( )
inline

Definition at line 190 of file instructions_riscv.h.

190 {
191 Instr auipc(LoadUnaligned(reinterpret_cast<uint32_t*>(pc_)));
192 Instr jalr(LoadUnaligned(reinterpret_cast<uint32_t*>(pc_ + 4)));
193 return auipc.utype_imm() + jalr.itype_imm();
194 }
static T LoadUnaligned(const T *ptr)
Definition: unaligned.h:14

◆ IsValid() [1/2]

bool dart::PcRelativePatternBase::IsValid ( ) const

◆ IsValid() [2/2]

bool dart::PcRelativePatternBase::IsValid ( ) const

◆ set_distance() [1/2]

void dart::PcRelativePatternBase::set_distance ( int32_t  distance)
inline

Definition at line 213 of file instructions_arm64.h.

213 {
214#if !defined(DART_PRECOMPILED_RUNTIME)
215 int32_t* word = reinterpret_cast<int32_t*>(pc_);
217#else
218 UNREACHABLE();
219#endif
220 }
static int32_t EncodeImm26BranchOffset(int64_t imm, int32_t instr)
intptr_t word
Definition: globals.h:500

◆ set_distance() [2/2]

void dart::PcRelativePatternBase::set_distance ( int32_t  distance)
inline

Definition at line 196 of file instructions_riscv.h.

196 {
197 Instr auipc(LoadUnaligned(reinterpret_cast<uint32_t*>(pc_)));
198 Instr jalr(LoadUnaligned(reinterpret_cast<uint32_t*>(pc_ + 4)));
199 intx_t imm = distance;
200 intx_t lo = ImmLo(imm);
201 intx_t hi = ImmHi(imm);
202 StoreUnaligned(reinterpret_cast<uint32_t*>(pc_), EncodeUTypeImm(hi) |
203 EncodeRd(auipc.rd()) |
204 EncodeOpcode(AUIPC));
205 StoreUnaligned(reinterpret_cast<uint32_t*>(pc_ + 4),
206 EncodeITypeImm(lo) | EncodeRs1(jalr.rs1()) |
207 EncodeFunct3(F3_0) | EncodeRd(jalr.rd()) |
208 EncodeOpcode(JALR));
209 }
uint32_t EncodeUTypeImm(intptr_t imm)
intx_t ImmHi(intx_t imm)
static void StoreUnaligned(T *ptr, T value)
Definition: unaligned.h:22
uint32_t EncodeITypeImm(intptr_t imm)
intx_t ImmLo(intx_t imm)

Member Data Documentation

◆ kLengthInBytes [1/2]

constexpr int dart::PcRelativePatternBase::kLengthInBytes = 1 * Instr::kInstrSize
staticconstexpr

Definition at line 201 of file instructions_arm64.h.

◆ kLengthInBytes [2/2]

constexpr intptr_t dart::PcRelativePatternBase::kLengthInBytes = 8
staticconstexpr

Definition at line 182 of file instructions_riscv.h.

◆ kLowerCallingRange

static constexpr intptr_t dart::PcRelativePatternBase::kLowerCallingRange = -(1 << 27)
staticconstexpr

Definition at line 196 of file instructions_arm64.h.

◆ kUpperCallingRange

static constexpr intptr_t dart::PcRelativePatternBase::kUpperCallingRange = (1 << 27) - Instr::kInstrSize
staticconstexpr

Definition at line 197 of file instructions_arm64.h.

◆ pc_

uword dart::PcRelativePatternBase::pc_
protected

Definition at line 225 of file instructions_arm64.h.


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