From 33a13db3e7ac4845172e664dcba8e63a79f544ae Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Wed, 11 Oct 2017 17:36:23 -0700 Subject: Refactor code for constant handles that reference opts.compReloc to use ImmedValNeedsReloc() --- src/jit/codegenlegacy.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/jit/codegenlegacy.cpp') 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); -- cgit v1.2.3