summaryrefslogtreecommitdiff
path: root/src/jit/codegenlegacy.cpp
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2017-10-11 17:36:23 -0700
committerBrian Sullivan <briansul@microsoft.com>2017-10-11 17:36:23 -0700
commit33a13db3e7ac4845172e664dcba8e63a79f544ae (patch)
tree8711cc8d9ee9fd46a32b5cb152186e65f57436a2 /src/jit/codegenlegacy.cpp
parent25bf8677c0f3c5e18f9100d92e7eee915de4e85d (diff)
downloadcoreclr-33a13db3e7ac4845172e664dcba8e63a79f544ae.tar.gz
coreclr-33a13db3e7ac4845172e664dcba8e63a79f544ae.tar.bz2
coreclr-33a13db3e7ac4845172e664dcba8e63a79f544ae.zip
Refactor code for constant handles that reference opts.compReloc to use ImmedValNeedsReloc()
Diffstat (limited to 'src/jit/codegenlegacy.cpp')
-rw-r--r--src/jit/codegenlegacy.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index fa85df63a3..c05923e0ae 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -4872,11 +4872,11 @@ void CodeGen::genStressRegs(GenTreePtr tree)
void CodeGen::genCodeForTreeConst(GenTreePtr tree, regMaskTP destReg, regMaskTP bestReg)
{
noway_assert(tree->IsCnsIntOrI());
-
- ssize_t ival = tree->gtIntConCommon.IconValue();
- regMaskTP needReg = destReg;
- regNumber reg;
- bool needReloc = compiler->opts.compReloc && tree->IsIconHandle();
+ GenTreeIntConCommon* con = tree->AsIntConCommon();
+ ssize_t ival = con->IconValue();
+ bool needReloc = con->ImmedValNeedsReloc(compiler);
+ regMaskTP needReg = destReg;
+ regNumber reg;
#if REDUNDANT_LOAD
@@ -11603,8 +11603,10 @@ void CodeGen::genCodeForTreeSmpOpAsg(GenTreePtr tree)
case GT_CNS_INT:
+ GenTreeIntConCommon* con;
+ con = op2->AsIntConCommon();
ssize_t ival;
- ival = op2->gtIntCon.gtIconVal;
+ ival = con->IconValue();
emitAttr size;
size = emitTypeSize(tree->TypeGet());
@@ -11660,7 +11662,7 @@ void CodeGen::genCodeForTreeSmpOpAsg(GenTreePtr tree)
/* Move the value into the target */
noway_assert(op1->gtOper != GT_REG_VAR);
- if (compiler->opts.compReloc && op2->IsIconHandle())
+ if (con->ImmedValNeedsReloc(compiler))
{
/* The constant is actually a handle that may need relocation
applied to it. genComputeReg will do the right thing (see
@@ -16661,7 +16663,8 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
else
#endif
{
- bool needReloc = compiler->opts.compReloc && curr->IsIconHandle();
+ GenTreeIntConCommon* con = curr->AsIntConCommon();
+ bool needReloc = con->ImmedValNeedsReloc(compiler);
emitAttr attr = needReloc ? EA_HANDLE_CNS_RELOC : emitTypeSize(type);
instGen_Store_Imm_Into_Lcl(type, attr, curr->gtIntCon.gtIconVal,
compiler->lvaOutgoingArgSpaceVar, argOffset);