Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
locations_helpers_test.cc File Reference
#include "vm/compiler/backend/locations_helpers.h"
#include "vm/dart_api_impl.h"
#include "vm/dart_entry.h"
#include "vm/unit_test.h"

Go to the source code of this file.

Classes

class  dart::MockInstruction
 

Namespaces

namespace  dart
 

Macros

#define Reg(index)   (static_cast<Register>(index))
 
#define Fpu(index)   (static_cast<FpuRegister>(index))
 
#define ReqReg   Location::RequiresRegister()
 
#define ReqFpu   Location::RequiresFpuRegister()
 
#define RegLoc(index)   Location::RegisterLocation(Reg(index))
 
#define FpuLoc(index)   Location::FpuRegisterLocation(Fpu(index))
 
#define INSTRUCTION_TEST(Name, Arity, Signature, ExpectedOut, ExpectedIn, ExpectedTemp, AllocatedOut, AllocatedIn, AllocatedTemp)
 

Typedefs

typedef ZoneGrowableArray< Locationdart::LocationArray
 

Functions

static LocationArraydart::MakeLocationArray ()
 
static LocationArraydart::MakeLocationArray (Location loc0)
 
static LocationArraydart::MakeLocationArray (Location loc0, Location loc1)
 
static void dart::ValidateSummary (LocationSummary *locs, Location expected_output, const LocationArray *expected_inputs, const LocationArray *expected_temps)
 
static void dart::FillSummary (LocationSummary *locs, Location expected_output, const LocationArray *expected_inputs, const LocationArray *expected_temps)
 
 dart::INSTRUCTION_TEST (Unary, 1,(Register out, Register in), ReqReg,(ReqReg),(), RegLoc(0),(RegLoc(1)),())
 
 dart::INSTRUCTION_TEST (Binary1, 2,(Register out, Register in0, FpuRegister in1), ReqReg,(ReqReg, Location::RequiresFpuRegister()),(), RegLoc(0),(RegLoc(1), FpuLoc(2)),())
 
 dart::INSTRUCTION_TEST (Binary2, 2,(Register out, FpuRegister in0, Register in1), ReqReg,(ReqFpu, ReqReg),(), RegLoc(0),(FpuLoc(1), RegLoc(2)),())
 
 dart::INSTRUCTION_TEST (FixedOutput, 0,(Fixed< Register, Reg(3)> out), RegLoc(3),(),(), RegLoc(3),(),())
 
 dart::INSTRUCTION_TEST (FixedInput, 1,(FpuRegister out, Fixed< FpuRegister, Fpu(3)> in), ReqFpu,(FpuLoc(3)),(), FpuLoc(0),(FpuLoc(3)),())
 
 dart::INSTRUCTION_TEST (SameAsFirstInput, 2,(SameAsFirstInput, Register in0, Register in1), Location::SameAsFirstInput(),(ReqReg, ReqReg),(), RegLoc(0),(RegLoc(0), RegLoc(1)),())
 
 dart::INSTRUCTION_TEST (Temps, 2,(Register out, Register in0, FpuRegister in1, Temp< FpuRegister > temp0, Temp< Register > temp1), ReqReg,(ReqReg, ReqFpu),(ReqFpu, ReqReg), RegLoc(0),(RegLoc(1), FpuLoc(2)),(FpuLoc(3), RegLoc(4)))
 
 dart::INSTRUCTION_TEST (FixedTemp, 0,(FpuRegister out, Temp< Fixed< FpuRegister, Fpu(3)> > temp), ReqFpu,(),(FpuLoc(3)), FpuLoc(4),(),(FpuLoc(3)))
 

Macro Definition Documentation

◆ Fpu

#define Fpu (   index)    (static_cast<FpuRegister>(index))

Definition at line 13 of file locations_helpers_test.cc.

◆ FpuLoc

#define FpuLoc (   index)    Location::FpuRegisterLocation(Fpu(index))

Definition at line 18 of file locations_helpers_test.cc.

◆ INSTRUCTION_TEST

#define INSTRUCTION_TEST (   Name,
  Arity,
  Signature,
  ExpectedOut,
  ExpectedIn,
  ExpectedTemp,
  AllocatedOut,
  AllocatedIn,
  AllocatedTemp 
)
Value:
class Name##Instr : public MockInstruction { \
public: \
LocationSummary* MakeLocationSummary(Zone* zone, bool opt) const; \
void EmitNativeCode(FlowGraphCompiler* compiler); \
virtual intptr_t InputCount() const { \
return Arity; \
} \
}; \
TEST_CASE(LocationsHelpers_##Name) { \
const Location expected_out = ExpectedOut; \
const LocationArray* expected_inputs = MakeLocationArray ExpectedIn; \
const LocationArray* expected_temps = MakeLocationArray ExpectedTemp; \
\
const Location allocated_out = AllocatedOut; \
const LocationArray* allocated_inputs = MakeLocationArray AllocatedIn; \
const LocationArray* allocated_temps = MakeLocationArray AllocatedTemp; \
\
Name##Instr* instr = new Name##Instr(); \
LocationSummary* locs = instr->locs(); \
\
ValidateSummary(locs, expected_out, expected_inputs, expected_temps); \
FillSummary(locs, allocated_out, allocated_inputs, allocated_temps); \
\
instr->EmitNativeCode(nullptr); \
} \
DEFINE_BACKEND(Name, Signature)
ImplicitString Name
Definition DMSrcSink.h:38
ZoneGrowableArray< Location > LocationArray
static LocationArray * MakeLocationArray()

Definition at line 86 of file locations_helpers_test.cc.

89 : public MockInstruction { \
90 public: \
91 LocationSummary* MakeLocationSummary(Zone* zone, bool opt) const; \
92 void EmitNativeCode(FlowGraphCompiler* compiler); \
93 virtual intptr_t InputCount() const { \
94 return Arity; \
95 } \
96 }; \
97 TEST_CASE(LocationsHelpers_##Name) { \
98 const Location expected_out = ExpectedOut; \
99 const LocationArray* expected_inputs = MakeLocationArray ExpectedIn; \
100 const LocationArray* expected_temps = MakeLocationArray ExpectedTemp; \
101 \
102 const Location allocated_out = AllocatedOut; \
103 const LocationArray* allocated_inputs = MakeLocationArray AllocatedIn; \
104 const LocationArray* allocated_temps = MakeLocationArray AllocatedTemp; \
105 \
106 Name##Instr* instr = new Name##Instr(); \
107 LocationSummary* locs = instr->locs(); \
108 \
109 ValidateSummary(locs, expected_out, expected_inputs, expected_temps); \
110 FillSummary(locs, allocated_out, allocated_inputs, allocated_temps); \
111 \
112 instr->EmitNativeCode(nullptr); \
113 } \
114 DEFINE_BACKEND(Name, Signature)

◆ Reg

#define Reg (   index)    (static_cast<Register>(index))

Definition at line 12 of file locations_helpers_test.cc.

◆ RegLoc

#define RegLoc (   index)    Location::RegisterLocation(Reg(index))

Definition at line 17 of file locations_helpers_test.cc.

◆ ReqFpu

#define ReqFpu   Location::RequiresFpuRegister()

Definition at line 16 of file locations_helpers_test.cc.

◆ ReqReg

#define ReqReg   Location::RequiresRegister()

Definition at line 15 of file locations_helpers_test.cc.