Remove dead/unreachable code from ARM32 and ARM64 emitters (#18878)
authorEgor Chesakov <Egor.Chesakov@microsoft.com>
Fri, 13 Jul 2018 00:41:17 +0000 (17:41 -0700)
committerGitHub <noreply@github.com>
Fri, 13 Jul 2018 00:41:17 +0000 (17:41 -0700)
src/jit/emit.h
src/jit/emitarm.cpp
src/jit/emitarm.h
src/jit/emitarm64.h
src/jit/emitinl.h

index 987aa4b..03f4d42 100644 (file)
@@ -1255,6 +1255,8 @@ protected:
         int     iddcDspVal;
     };
 
+#ifdef _TARGET_XARCH_
+
     struct instrDescAmd : instrDesc // large addrmode disp
     {
         ssize_t idaAmdVal;
@@ -1266,6 +1268,8 @@ protected:
         ssize_t idacAmdVal;
     };
 
+#endif // _TARGET_XARCH_
+
     struct instrDescCGCA : instrDesc // call with ...
     {
         VARSET_TP idcGCvars;    // ... updated GC vars or
@@ -1297,13 +1301,6 @@ protected:
 #endif                                     // MULTIREG_HAS_SECOND_GC_RET
     };
 
-    struct instrDescArmFP : instrDesc
-    {
-        regNumber r1;
-        regNumber r2;
-        regNumber r3;
-    };
-
     insUpdateModes emitInsUpdateMode(instruction ins);
     insFormat emitInsModeFormat(instruction ins, insFormat base);
 
@@ -1315,17 +1312,21 @@ protected:
     size_t emitGetInstrDescSize(const instrDesc* id);
     size_t emitGetInstrDescSizeSC(const instrDesc* id);
 
+#ifdef _TARGET_XARCH_
+
     ssize_t emitGetInsCns(instrDesc* id);
     ssize_t emitGetInsDsp(instrDesc* id);
     ssize_t emitGetInsAmd(instrDesc* id);
-    ssize_t emitGetInsCnsDsp(instrDesc* id, ssize_t* dspPtr);
-    ssize_t emitGetInsSC(instrDesc* id);
+
     ssize_t emitGetInsCIdisp(instrDesc* id);
     unsigned emitGetInsCIargs(instrDesc* id);
 
     // Return the argument count for a direct call "id".
     int emitGetInsCDinfo(instrDesc* id);
 
+#endif // _TARGET_XARCH_
+
+    ssize_t emitGetInsSC(instrDesc* id);
     unsigned emitInsCount;
 
 /************************************************************************/
@@ -1791,6 +1792,8 @@ private:
         return (instrDescCnsDsp*)emitAllocInstr(sizeof(instrDescCnsDsp), attr);
     }
 
+#ifdef _TARGET_XARCH_
+
     instrDescAmd* emitAllocInstrAmd(emitAttr attr)
     {
         return (instrDescAmd*)emitAllocInstr(sizeof(instrDescAmd), attr);
@@ -1801,6 +1804,8 @@ private:
         return (instrDescCnsAmd*)emitAllocInstr(sizeof(instrDescCnsAmd), attr);
     }
 
+#endif // _TARGET_XARCH_
+
     instrDescCGCA* emitAllocInstrCGCA(emitAttr attr)
     {
         return (instrDescCGCA*)emitAllocInstr(sizeof(instrDescCGCA), attr);
@@ -2423,6 +2428,8 @@ inline size_t emitter::emitGetInstrDescSizeSC(const instrDesc* id)
     }
 }
 
+#ifdef _TARGET_XARCH_
+
 /*****************************************************************************
  *
  *  The following helpers should be used to access the various values that
@@ -2447,36 +2454,6 @@ inline ssize_t emitter::emitGetInsDsp(instrDesc* id)
     return 0;
 }
 
-inline ssize_t emitter::emitGetInsCnsDsp(instrDesc* id, ssize_t* dspPtr)
-{
-    if (id->idIsLargeCns())
-    {
-        if (id->idIsLargeDsp())
-        {
-            *dspPtr = ((instrDescCnsDsp*)id)->iddcDspVal;
-            return ((instrDescCnsDsp*)id)->iddcCnsVal;
-        }
-        else
-        {
-            *dspPtr = 0;
-            return ((instrDescCns*)id)->idcCnsVal;
-        }
-    }
-    else
-    {
-        if (id->idIsLargeDsp())
-        {
-            *dspPtr = ((instrDescDsp*)id)->iddDspVal;
-            return id->idSmallCns();
-        }
-        else
-        {
-            *dspPtr = 0;
-            return id->idSmallCns();
-        }
-    }
-}
-
 /*****************************************************************************
  *
  *  Get hold of the argument count for an indirect call.
@@ -2499,6 +2476,8 @@ inline unsigned emitter::emitGetInsCIargs(instrDesc* id)
     }
 }
 
+#endif // _TARGET_XARCH_
+
 /*****************************************************************************
  *
  *  Returns true if the given register contains a live GC ref.
index b425caa..b32b974 100644 (file)
@@ -5455,20 +5455,6 @@ BYTE* emitter::emitOutputIT(BYTE* dst, instruction ins, insFormat fmt, code_t co
 #endif // FEATURE_ITINSTRUCTION
 
 /*****************************************************************************
- *
- *  Output a 32-bit nop instruction.
- */
-
-BYTE* emitter::emitOutputNOP(BYTE* dst, instruction ins, insFormat fmt)
-{
-    code_t code = emitInsCode(ins, fmt);
-
-    dst += emitOutput_Thumb2Instr(dst, code);
-
-    return dst;
-}
-
-/*****************************************************************************
 *
  *  Append the machine code corresponding to the given instruction descriptor
  *  to the code block at '*dp'; the base of the code block is 'bp', and 'ig'
@@ -6457,27 +6443,6 @@ void emitter::emitDispInst(instruction ins, insFlags flags)
     } while (len < 8);
 }
 
-/*****************************************************************************
- *
- *  Display an reloc value
- *  If we are formatting for an assembly listing don't print the hex value
- *  since it will prevent us from doing assembly diffs
- */
-void emitter::emitDispReloc(int value, bool addComma)
-{
-    if (emitComp->opts.disAsm)
-    {
-        printf("(reloc)");
-    }
-    else
-    {
-        printf("(reloc 0x%x)", dspPtr(value));
-    }
-
-    if (addComma)
-        printf(", ");
-}
-
 #define STRICT_ARM_ASM 0
 
 /*****************************************************************************
@@ -6626,10 +6591,6 @@ void emitter::emitDispReg(regNumber reg, emitAttr attr, bool addComma)
         printf(", ");
 }
 
-void emitter::emitDispFloatReg(regNumber reg, emitAttr attr, bool addComma)
-{
-}
-
 /*****************************************************************************
  *
  *  Display an addressing operand [reg]
index 966db8e..702588a 100644 (file)
@@ -20,18 +20,9 @@ struct CnsVal
 
 insSize emitInsSize(insFormat insFmt);
 
-BYTE* emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc = NULL);
-BYTE* emitOutputSV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc = NULL);
-BYTE* emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc = NULL);
-
-BYTE* emitOutputR(BYTE* dst, instrDesc* id);
-BYTE* emitOutputRI(BYTE* dst, instrDesc* id);
-BYTE* emitOutputRR(BYTE* dst, instrDesc* id);
-BYTE* emitOutputIV(BYTE* dst, instrDesc* id);
 #ifdef FEATURE_ITINSTRUCTION
 BYTE* emitOutputIT(BYTE* dst, instruction ins, insFormat fmt, code_t condcode);
 #endif // FEATURE_ITINSTRUCTION
-BYTE* emitOutputNOP(BYTE* dst, instruction ins, insFormat fmt);
 
 BYTE* emitOutputLJ(insGroup* ig, BYTE* dst, instrDesc* id);
 BYTE* emitOutputShortBranch(BYTE* dst, instruction ins, insFormat fmt, ssize_t distVal, instrDescJmp* id);
@@ -45,17 +36,13 @@ static unsigned emitOutput_Thumb2Instr(BYTE* dst, code_t code);
 
 #ifdef DEBUG
 
-const char* emitFPregName(unsigned reg, bool varName = true);
-
 void emitDispInst(instruction ins, insFlags flags);
-void emitDispReloc(int value, bool addComma);
 void emitDispImm(int imm, bool addComma, bool alwaysHex = false);
 void emitDispCond(int cond);
 void emitDispShiftOpts(insOpts opt);
 void emitDispRegmask(int imm, bool encodedPC_LR);
 void emitDispRegRange(regNumber reg, int len, emitAttr attr);
 void emitDispReg(regNumber reg, emitAttr attr, bool addComma);
-void emitDispFloatReg(regNumber reg, emitAttr attr, bool addComma);
 void emitDispAddrR(regNumber reg, emitAttr attr);
 void emitDispAddrRI(regNumber reg, int imm, emitAttr attr);
 void emitDispAddrRR(regNumber reg1, regNumber reg2, emitAttr attr);
@@ -87,20 +74,12 @@ void emitDispIns(instrDesc* id,
 /************************************************************************/
 
 private:
-instrDesc* emitNewInstrAmd(emitAttr attr, int dsp);
-instrDesc* emitNewInstrAmdCns(emitAttr attr, int dsp, int cns);
-
 instrDesc* emitNewInstrCallDir(
     int argCnt, VARSET_VALARG_TP GCvars, regMaskTP gcrefRegs, regMaskTP byrefRegs, emitAttr retSize);
 
 instrDesc* emitNewInstrCallInd(
     int argCnt, ssize_t disp, VARSET_VALARG_TP GCvars, regMaskTP gcrefRegs, regMaskTP byrefRegs, emitAttr retSize);
 
-void emitGetInsCns(instrDesc* id, CnsVal* cv);
-int emitGetInsAmdCns(instrDesc* id, CnsVal* cv);
-void emitGetInsDcmCns(instrDesc* id, CnsVal* cv);
-int emitGetInsAmdAny(instrDesc* id);
-
 /************************************************************************/
 /*               Private helpers for instruction output                 */
 /************************************************************************/
@@ -119,28 +98,7 @@ emitter::code_t emitInsCode(instruction ins, insFormat fmt);
 void emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataReg, GenTreeIndir* indir);
 void emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataReg, GenTreeIndir* indir, int offset);
 
-/*****************************************************************************
-*
-*  Convert between an index scale in bytes to a smaller encoding used for
-*  storage in instruction descriptors.
-*/
-
-inline emitter::opSize emitEncodeScale(size_t scale)
-{
-    assert(scale == 1 || scale == 2 || scale == 4 || scale == 8);
-
-    return emitSizeEncode[scale - 1];
-}
-
-inline emitAttr emitDecodeScale(unsigned ensz)
-{
-    assert(ensz < 4);
-
-    return emitter::emitSizeDecode[ensz];
-}
-
 static bool isModImmConst(int imm);
-
 static int encodeModImmConst(int imm);
 
 static int insUnscaleImm(int imm, emitAttr size);
@@ -324,7 +282,7 @@ void emitIns_R_C(instruction ins, emitAttr attr, regNumber reg, CORINFO_FIELD_HA
 
 void emitIns_C_R(instruction ins, emitAttr attr, CORINFO_FIELD_HANDLE fldHnd, regNumber reg, int offs);
 
-void emitIns_C_I(instruction ins, emitAttr attr, CORINFO_FIELD_HANDLE fdlHnd, ssize_t offs, ssize_t val);
+void emitIns_C_I(instruction ins, emitAttr attr, CORINFO_FIELD_HANDLE fdlHnd, int offs, ssize_t val);
 
 void emitIns_R_L(instruction ins, emitAttr attr, BasicBlock* dst, regNumber reg);
 
index 0838d6e..1b03dff 100644 (file)
@@ -67,9 +67,6 @@ void emitDispIns(instrDesc* id,
 /************************************************************************/
 
 private:
-instrDesc* emitNewInstrAmd(emitAttr attr, int dsp);
-instrDesc* emitNewInstrAmdCns(emitAttr attr, int dsp, int cns);
-
 instrDesc* emitNewInstrCallDir(int              argCnt,
                                VARSET_VALARG_TP GCvars,
                                regMaskTP        gcrefRegs,
@@ -85,11 +82,6 @@ instrDesc* emitNewInstrCallInd(int              argCnt,
                                emitAttr         retSize,
                                emitAttr         secondRetSize);
 
-void emitGetInsCns(instrDesc* id, CnsVal* cv);
-ssize_t emitGetInsAmdCns(instrDesc* id, CnsVal* cv);
-void emitGetInsDcmCns(instrDesc* id, CnsVal* cv);
-ssize_t emitGetInsAmdAny(instrDesc* id);
-
 /************************************************************************/
 /*               Private helpers for instruction output                 */
 /************************************************************************/
index 82ad53d..b53cf69 100644 (file)
@@ -118,6 +118,8 @@ inline regNumber emitter::inst3opImulReg(instruction ins)
  *  get stored in different places within the instruction descriptor.
  */
 
+#ifdef _TARGET_XARCH_
+
 inline ssize_t emitter::emitGetInsAmd(instrDesc* id)
 {
     return id->idIsLargeDsp() ? ((instrDescAmd*)id)->idaAmdVal : id->idAddr()->iiaAddrMode.amDisp;
@@ -220,6 +222,8 @@ inline ssize_t emitter::emitGetInsAmdAny(instrDesc* id)
     return id->idAddr()->iiaAddrMode.amDisp;
 }
 
+#endif // _TARGET_XARCH_
+
 /*****************************************************************************
  *
  *  Convert between a register mask and a smaller version for storage.