5#ifndef RUNTIME_VM_COMPILER_FFI_NATIVE_LOCATION_H_
6#define RUNTIME_VM_COMPILER_FFI_NATIVE_LOCATION_H_
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
18#if !defined(FFI_UNIT_TESTS)
30class NativeRegistersLocation;
31class NativeFpuRegistersLocation;
32class NativeStackLocation;
33class MultipleNativeLocations;
34class PointerToMemoryLocation;
35class BothNativeLocations;
65#if !defined(FFI_UNIT_TESTS)
90 const NativeType& new_container_type)
const = 0;
92#if defined(TARGET_ARCH_ARM)
101 virtual bool IsStack()
const {
return false; }
104 virtual bool IsBoth()
const {
return false; }
107#if !defined(FFI_UNIT_TESTS)
116#if !defined(FFI_UNIT_TESTS)
130 intptr_t index)
const {
180 regs_->
Add(register1);
181 regs_->
Add(register2);
197#if !defined(FFI_UNIT_TESTS)
205 intptr_t index)
const;
231 intptr_t fpu_register)
234 fpu_reg_(fpu_register) {}
240 fpu_reg_(fpu_register) {}
241#if defined(TARGET_ARCH_ARM)
247 fpu_reg_(fpu_register) {}
248 NativeFpuRegistersLocation(
const NativeType&
payload_type,
253 fpu_reg_(fpu_register) {}
262 new_payload_type, new_container_type, fpu_reg_kind_, fpu_reg_);
268#if !defined(FFI_UNIT_TESTS)
279#if defined(TARGET_ARCH_ARM)
291 bool IsLowestBits()
const;
296 virtual bool Equals(
const NativeLocation& other)
const;
320 base_register_, offset_in_bytes_);
326 const intptr_t size_slots = size / compiler::target::kWordSize;
327 return offset_in_bytes_ % compiler::target::kWordSize == 0 &&
328 size % compiler::target::kWordSize == 0 &&
329 (size_slots == 1 || size_slots == 2);
332#if !defined(FFI_UNIT_TESTS)
339 ASSERT(compiler::target::kWordSize == 8);
346 intptr_t index)
const;
360 intptr_t offset_in_words()
const {
361 ASSERT(offset_in_bytes_ % compiler::target::kWordSize == 0);
362 return offset_in_bytes_ / compiler::target::kWordSize;
366 intptr_t offset_in_bytes_;
420 return pointer_return_location_;
469 location0_(location0),
470 location1_(location1) {}
473 virtual bool IsBoth()
const {
return true; }
490 ASSERT(index == 0 || index == 1);
503#if !defined(FFI_UNIT_TESTS)
506 const NativeStackLocation& loc);
const T & At(intptr_t index) const
static Location FpuRegisterLocation(FpuRegister reg)
static Location DoubleStackSlot(intptr_t stack_index, Register base)
virtual ~BothNativeLocations()
virtual bool IsBoth() const
BothNativeLocations(const NativeLocation &location0, const NativeLocation &location1)
virtual intptr_t StackTopInBytes() const
const NativeLocation & location(intptr_t index) const
virtual NativeLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const
virtual void PrintTo(BaseTextBuffer *f) const
const NativeLocations & locations() const
virtual NativeLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const
virtual void PrintTo(BaseTextBuffer *f) const
virtual intptr_t StackTopInBytes() const
MultipleNativeLocations(const NativeCompoundType &payload_type, const NativeLocations &locations)
virtual ~MultipleNativeLocations()
virtual bool IsMultiple() const
virtual NativeFpuRegistersLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const
virtual bool IsFpuRegisters() const
NativeFpuRegistersLocation(const NativeType &payload_type, const NativeType &container_type, FpuRegisterKind fpu_reg_kind, intptr_t fpu_register)
virtual bool Equals(const NativeLocation &other) const
virtual void PrintTo(BaseTextBuffer *f) const
NativeFpuRegistersLocation(const NativeType &payload_type, const NativeType &container_type, FpuRegister fpu_register)
FpuRegisterKind fpu_reg_kind() const
virtual bool IsExpressibleAsLocation() const
virtual Location AsLocation() const
virtual ~NativeFpuRegistersLocation()
FpuRegister fpu_reg() const
virtual bool IsMultiple() const
virtual ~NativeLocation()
virtual bool IsFpuRegisters() const
virtual bool IsPointerToMemory() const
virtual bool IsBoth() const
NativeLocation & WidenTo8Bytes(Zone *zone) const
const MultipleNativeLocations & AsMultiple() const
virtual bool IsExpressibleAsLocation() const
virtual intptr_t StackTopInBytes() const
virtual Location AsLocation() const
const NativeType & container_type() const
virtual bool IsStack() const
virtual void PrintTo(BaseTextBuffer *f) const
const NativeRegistersLocation & AsRegisters() const
static bool LocationCanBeExpressed(Location loc, Representation rep)
const PointerToMemoryLocation & AsPointerToMemory() const
NativeLocation(const NativeType &payload_type, const NativeType &container_type)
virtual NativeLocation & Split(Zone *zone, intptr_t num_parts, intptr_t index) const
static NativeLocation & FromLocation(Zone *zone, Location loc, Representation rep)
const char * ToCString() const
const NativeStackLocation & AsStack() const
virtual NativeLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const =0
NativeLocation & WidenTo4Bytes(Zone *zone) const
virtual bool IsRegisters() const
static NativeLocation & FromPairLocation(Zone *zone, Location loc, Representation rep, intptr_t index)
const BothNativeLocations & AsBoth() const
virtual bool Equals(const NativeLocation &other) const
const NativeFpuRegistersLocation & AsFpuRegisters() const
const NativeType & payload_type() const
NativeRegistersLocation(const NativeType &payload_type, const NativeType &container_type, ZoneGrowableArray< Register > *registers)
virtual bool Equals(const NativeLocation &other) const
NativeRegistersLocation(Zone *zone, const NativeType &payload_type, const NativeType &container_type, Register register1, Register register2)
intptr_t num_regs() const
virtual ~NativeRegistersLocation()
virtual bool IsExpressibleAsLocation() const
virtual bool IsRegisters() const
virtual NativeRegistersLocation & Split(Zone *zone, intptr_t num_parts, intptr_t index) const
virtual Location AsLocation() const
Register reg_at(intptr_t index) const
virtual void PrintTo(BaseTextBuffer *f) const
NativeRegistersLocation(Zone *zone, const NativeType &payload_type, const NativeType &container_type, Register reg)
virtual NativeRegistersLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const
virtual Location AsLocation() const
virtual bool IsExpressibleAsLocation() const
virtual ~NativeStackLocation()
virtual bool IsStack() const
Location AsDoubleStackSlotLocation() const
Register base_register() const
virtual NativeStackLocation & Split(Zone *zone, intptr_t num_parts, intptr_t index) const
virtual intptr_t StackTopInBytes() const
NativeStackLocation(const NativeType &payload_type, const NativeType &container_type, Register base_register, intptr_t offset_in_bytes)
virtual void PrintTo(BaseTextBuffer *f) const
virtual NativeStackLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const
intptr_t offset_in_bytes() const
virtual bool Equals(const NativeLocation &other) const
virtual intptr_t SizeInBytes() const =0
PointerToMemoryLocation(const NativeLocation &pointer_location, const NativeLocation &pointer_return_location, const NativeCompoundType &object_pointed_to)
virtual intptr_t StackTopInBytes() const
const NativeLocation & pointer_location() const
PointerToMemoryLocation(const NativeLocation &pointer_location, const NativeCompoundType &object_pointed_to)
virtual NativeLocation & WithOtherNativeType(Zone *zone, const NativeType &new_payload_type, const NativeType &new_container_type) const
virtual void PrintTo(BaseTextBuffer *f) const
virtual bool Equals(const NativeLocation &other) const
const NativeLocation & pointer_return_location() const
virtual ~PointerToMemoryLocation()
virtual bool IsPointerToMemory() const
intptr_t SizeFromFpuRegisterKind(enum FpuRegisterKind kind)
compiler::Address NativeLocationToStackSlotAddress(const NativeStackLocation &loc)
enum FpuRegisterKind FpuRegisterKindFromSize(intptr_t size_in_bytes)
ZoneGrowableArray< const NativeLocation * > NativeLocations
#define UNREACHABLE_THIS()