Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Create RefPositions without TreeNodeInfo (#16517)
Browse files Browse the repository at this point in the history
* Create RefPositions without TreeNodeInfo

* Remove all references to TreeNodeInfo

* Fix function header comments
  • Loading branch information
CarolEidt authored May 23, 2018
1 parent 74d0196 commit b39a5b2
Show file tree
Hide file tree
Showing 14 changed files with 3,311 additions and 3,455 deletions.
1 change: 0 additions & 1 deletion src/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ if (WIN32)
lsra_reftypes.h
lsra.h
namedintrinsiclist.h
nodeinfo.h
objectalloc.h
opcode.h
phase.h
Expand Down
6 changes: 5 additions & 1 deletion src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2957,6 +2957,11 @@ class Compiler
CORINFO_METHOD_HANDLE method,
CORINFO_SIG_INFO* sig,
bool mustExpand);

public:
static int numArgsOfHWIntrinsic(GenTreeHWIntrinsic* node);

protected:
#ifdef _TARGET_XARCH_
static InstructionSet lookupHWIntrinsicISA(const char* className);
static NamedIntrinsic lookupHWIntrinsic(const char* methodName, InstructionSet isa);
Expand Down Expand Up @@ -3016,7 +3021,6 @@ class Compiler

public:
static HWIntrinsicCategory categoryOfHWIntrinsic(NamedIntrinsic intrinsic);
static int numArgsOfHWIntrinsic(GenTreeHWIntrinsic* node);

protected:
static HWIntrinsicFlag flagsOfHWIntrinsic(NamedIntrinsic intrinsic);
Expand Down
15 changes: 6 additions & 9 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,9 @@ int GenTree::GetRegisterDstCount() const
GenTree* temp = const_cast<GenTree*>(this);
return temp->AsCall()->GetReturnTypeDesc()->GetReturnRegCount();
}
else if (IsCopyOrReloadOfMultiRegCall())
else if (IsCopyOrReload())
{
// A multi-reg copy or reload, will have valid regs for only those
// positions that need to be copied or reloaded. Hence we need
// to consider only those registers for computing reg mask.

GenTree* tree = const_cast<GenTree*>(this);
GenTreeCopyOrReload* copyOrReload = tree->AsCopyOrReload();
GenTreeCall* call = copyOrReload->gtGetOp1()->AsCall();
return call->GetReturnTypeDesc()->GetReturnRegCount();
return gtGetOp1()->GetRegisterDstCount();
}
#if defined(_TARGET_ARM_)
else if (OperIsPutArgSplit())
Expand Down Expand Up @@ -7019,6 +7012,10 @@ GenTree* Compiler::gtNewPutArgReg(var_types type, GenTree* arg, regNumber argReg
#if defined(_TARGET_ARM_)
// A PUTARG_REG could be a MultiRegOp on arm since we could move a double register to two int registers.
node = new (this, GT_PUTARG_REG) GenTreeMultiRegOp(GT_PUTARG_REG, type, arg, nullptr);
if (type == TYP_LONG)
{
node->AsMultiRegOp()->gtOtherReg = REG_NEXT(argReg);
}
#else
node = gtNewOperNode(GT_PUTARG_REG, type, arg);
#endif
Expand Down
15 changes: 14 additions & 1 deletion src/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "valuenumtype.h"
#include "jitstd.h"
#include "jithashtable.h"
#include "nodeinfo.h"
#include "simd.h"
#include "namedintrinsiclist.h"

Expand Down Expand Up @@ -1302,6 +1301,20 @@ struct GenTree
return OperIsShiftOrRotate(OperGet());
}

static bool OperIsMul(genTreeOps gtOper)
{
return (gtOper == GT_MUL) || (gtOper == GT_MULHI)
#if !defined(_TARGET_64BIT_)
|| (gtOper == GT_MUL_LONG)
#endif
;
}

bool OperIsMul() const
{
return OperIsMul(gtOper);
}

bool OperIsArithmetic() const
{
genTreeOps op = OperGet();
Expand Down
51 changes: 51 additions & 0 deletions src/jit/hwintrinsicArm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,57 @@ bool Compiler::impCheckImmediate(GenTree* immediateOp, unsigned int max)
return immediateOp->IsCnsIntOrI() && (immediateOp->AsIntConCommon()->IconValue() < max);
}

//------------------------------------------------------------------------
// numArgsOfHWIntrinsic: gets the number of arguments for the hardware intrinsic.
// This attempts to do a table based lookup but will fallback to the number
// of operands in 'node' if the table entry is -1.
//
// Arguments:
// node -- GenTreeHWIntrinsic* node with nullptr default value
//
// Return Value:
// number of arguments
//
int Compiler::numArgsOfHWIntrinsic(GenTreeHWIntrinsic* node)
{
NamedIntrinsic intrinsic = node->gtHWIntrinsicId;

assert(intrinsic != NI_Illegal);
assert(intrinsic > NI_HW_INTRINSIC_START && intrinsic < NI_HW_INTRINSIC_END);

GenTree* op1 = node->gtGetOp1();
GenTree* op2 = node->gtGetOp2();
int numArgs = 0;

if (op1 == nullptr)
{
return 0;
}

if (op1->OperIsList())
{
numArgs = 0;
GenTreeArgList* list = op1->AsArgList();

while (list != nullptr)
{
numArgs++;
list = list->Rest();
}

// We should only use a list if we have 3 operands.
assert(numArgs >= 3);
return numArgs;
}

if (op2 == nullptr)
{
return 1;
}

return 2;
}

//------------------------------------------------------------------------
// impHWIntrinsic: dispatch hardware intrinsics to their own implementation
// function
Expand Down
40 changes: 17 additions & 23 deletions src/jit/hwintrinsicxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ unsigned Compiler::simdSizeOfHWIntrinsic(NamedIntrinsic intrinsic, CORINFO_SIG_I
return simdSize;
}

// TODO_XARCH-CQ - refactoring of numArgsOfHWIntrinsic fast path into inlinable
// function and slow local static function may increase performance significantly

//------------------------------------------------------------------------
// numArgsOfHWIntrinsic: gets the number of arguments for the hardware intrinsic.
// This attempts to do a table based lookup but will fallback to the number
Expand Down Expand Up @@ -255,36 +252,33 @@ int Compiler::numArgsOfHWIntrinsic(GenTreeHWIntrinsic* node)
GenTree* op1 = node->gtGetOp1();
GenTree* op2 = node->gtGetOp2();

if (op2 != nullptr)
if (op1 == nullptr)
{
return 2;
return 0;
}

if (op1 != nullptr)
if (op1->OperIsList())
{
if (op1->OperIsList())
{
numArgs = 0;
GenTreeArgList* list = op1->AsArgList();
numArgs = 0;
GenTreeArgList* list = op1->AsArgList();

while (list != nullptr)
{
numArgs++;
list = list->Rest();
}

assert(numArgs > 0);
return numArgs;
}
else
while (list != nullptr)
{
return 1;
numArgs++;
list = list->Rest();
}

// We should only use a list if we have 3 operands.
assert(numArgs >= 3);
return numArgs;
}
else

if (op2 == nullptr)
{
return 0;
return 1;
}

return 2;
}

//------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit b39a5b2

Please sign in to comment.