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

Remove JIT LEGACY_BACKEND code #18064

Merged
merged 11 commits into from
May 22, 2018
34 changes: 0 additions & 34 deletions src/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ set( JIT_SOURCES
register_arg_convention.cpp
regset.cpp
scopeinfo.cpp
sharedfloat.cpp
sideeffects.cpp
sm.cpp
smdata.cpp
Expand Down Expand Up @@ -95,7 +94,6 @@ if (WIN32)
block.h
blockset.h
codegen.h
codegenclassic.h
codegeninterface.h
codegenlinear.h
compiler.h
Expand All @@ -120,7 +118,6 @@ if (WIN32)
emitpub.h
emitxarch.h
error.h
fp.h
gentree.h
gtlist.h
gtstructs.h
Expand Down Expand Up @@ -166,8 +163,6 @@ if (WIN32)
register.h
registerarm.h
registerarm64.h
registerfp.h
registerxmm.h
reglist.h
regpair.h
regset.h
Expand Down Expand Up @@ -196,20 +191,6 @@ if (WIN32)
)
endif(WIN32)

# The following defines all the source files used by the "legacy" back-end (#ifdef LEGACY_BACKEND).
# It is always safe to include both legacy and non-legacy files in the build, as everything is properly
# #ifdef'ed, though it makes the build slightly slower to do so. Note there is only a legacy backend for
# x86 and ARM.

set(JIT_ARM_LEGACY_SOURCES
codegenlegacy.cpp
registerfp.cpp
)
set(JIT_I386_LEGACY_SOURCES
codegenlegacy.cpp
stackfp.cpp
)

# Define all the architecture-specific source files

set( JIT_AMD64_SOURCES
Expand All @@ -226,21 +207,18 @@ set( JIT_AMD64_SOURCES
)

set( JIT_ARM_SOURCES
${JIT_ARM_LEGACY_SOURCES}
codegenarmarch.cpp
codegenarm.cpp
decomposelongs.cpp
emitarm.cpp
lowerarmarch.cpp
lowerarm.cpp
lsraarmarch.cpp
lsraarm.cpp
targetarm.cpp
unwindarm.cpp
)

set( JIT_I386_SOURCES
${JIT_I386_LEGACY_SOURCES}
codegenxarch.cpp
decomposelongs.cpp
emitxarch.cpp
Expand All @@ -259,7 +237,6 @@ set( JIT_ARM64_SOURCES
codegenarm64.cpp
emitarm64.cpp
lowerarmarch.cpp
lowerarm64.cpp
lsraarmarch.cpp
lsraarm64.cpp
simd.cpp
Expand Down Expand Up @@ -377,11 +354,6 @@ endif (FEATURE_MERGE_JIT_AND_ENGINE)

add_subdirectory(standalone)

if (CLR_CMAKE_TARGET_ARCH_ARM)
# Build arm32 legacy_backend to run on both x86 host (crossgen build) and arm host (native).
add_subdirectory(legacyjit)
endif (CLR_CMAKE_TARGET_ARCH_ARM)

if (CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64)
# On x86, build RyuJIT/ARM32 cross-compiling altjit.
# On amd64, build RyuJIT/ARM64 cross-compiling altjit.
Expand All @@ -399,9 +371,3 @@ if ((CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64) AND WIN32)
# On amd64, build Linux/AMD64 altjit. This enables UNIX_AMD64_ABI.
add_subdirectory(linuxnonjit)
endif ()

if (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
# On Windows x86, build altjit generating Windows/ARM32 code using LEGACY_BACKEND.
# (Note: we could also create linuxlegacynonjit for generating Linux/ARM32 code using LEGACY_BACKEND, if needed.)
add_subdirectory(legacynonjit)
endif (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
10 changes: 1 addition & 9 deletions src/jit/DIRS.proj
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,13 @@
</PropertyGroup>

<ItemGroup Condition="'$(BuildExePhase)' == '1'">
<!-- x86 and ARM clrjit.dll are built in the JIT32 directory; we build FrankenJit here -->
<!-- x86 and ARM clrjit.dll are built in the JIT32 directory -->
<ProjectFile Condition="'$(BuildArchitecture)' != 'i386' and '$(BuildArchitecture)' != 'arm'" Include="dll\jit.nativeproj" />
</ItemGroup>

<!-- Only the main JIT gets built for CoreSys. The other jits (e.g., altjits) do not. -->
<ItemGroup Condition="'$(BuildExePhase)' == '1' and '$(BuildProjectName)' != 'CoreSys'">

<!-- FrankenJit and FrankenAltJit builds are disabled. We do not test them in CoreCLR and changes from there regularly break legacy_bakend for x86, it is why it is disabled now
and should be completely deleted soon. -->
<!-- Build the "FrankenJit" (RyuJIT front-end, legacy back-end) and "FrankenAltjit". These can't conflict with the names of the JIT32 directory outputs. -->
<!--
<ProjectFile Condition="'$(BuildArchitecture)' == 'i386' or '$(BuildArchitecture)' == 'arm'" Include="frankenjit\frankenjit.nativeproj" />
<ProjectFile Condition="'$(BuildArchitecture)' == 'i386'" Include="frankenaltjit\frankenaltjit.nativeproj" />
-->

<!-- This might be useful, to help make sure JIT devs build all configurations of the JIT (including crossgen), but
it appears to cause problems with the build system, and it slows down normal JIT developer productivity by adding a seldom-useful build.
<ProjectFile Include="crossgen\jit_crossgen.nativeproj" />
Expand Down
3 changes: 0 additions & 3 deletions src/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4772,9 +4772,6 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Gen
case GT_RSH:
case GT_RSZ:
case GT_NEG:
#ifdef LEGACY_BACKEND
case GT_CHS:
#endif
case GT_CAST:
case GT_INTRINSIC:
break;
Expand Down
20 changes: 0 additions & 20 deletions src/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,17 +363,10 @@ void BasicBlock::dspFlags()
{
printf("IBC ");
}
#ifdef LEGACY_BACKEND
if (bbFlags & BBF_FORWARD_SWITCH)
{
printf("fswitch ");
}
#else // !LEGACY_BACKEND
if (bbFlags & BBF_IS_LIR)
{
printf("LIR ");
}
#endif // LEGACY_BACKEND
if (bbFlags & BBF_KEEP_BBJ_ALWAYS)
{
printf("KEEP ");
Expand Down Expand Up @@ -636,9 +629,6 @@ bool BasicBlock::CloneBlockState(
to->bbCodeOffs = from->bbCodeOffs;
to->bbCodeOffsEnd = from->bbCodeOffsEnd;
VarSetOps::AssignAllowUninitRhs(compiler, to->bbScope, from->bbScope);
#if FEATURE_STACK_FP_X87
to->bbFPStateX87 = from->bbFPStateX87;
#endif // FEATURE_STACK_FP_X87
to->bbNatLoopNum = from->bbNatLoopNum;
#ifdef DEBUG
to->bbLoopNum = from->bbLoopNum;
Expand All @@ -663,28 +653,20 @@ bool BasicBlock::CloneBlockState(
// LIR helpers
void BasicBlock::MakeLIR(GenTree* firstNode, GenTree* lastNode)
{
#ifdef LEGACY_BACKEND
unreached();
#else // !LEGACY_BACKEND
assert(!IsLIR());
assert((firstNode == nullptr) == (lastNode == nullptr));
assert((firstNode == lastNode) || firstNode->Precedes(lastNode));

m_firstNode = firstNode;
m_lastNode = lastNode;
bbFlags |= BBF_IS_LIR;
#endif // LEGACY_BACKEND
}

bool BasicBlock::IsLIR()
{
#ifdef LEGACY_BACKEND
return false;
#else // !LEGACY_BACKEND
const bool isLIR = (bbFlags & BBF_IS_LIR) != 0;
assert((bbTreeList == nullptr) || ((isLIR) == !bbTreeList->IsStatement()));
return isLIR;
#endif // LEGACY_BACKEND
}

//------------------------------------------------------------------------
Expand Down Expand Up @@ -1311,12 +1293,10 @@ BasicBlock* Compiler::bbNewBasicBlock(BBjumpKinds jumpKind)
block->bbNum = ++fgBBNumMax;
}

#ifndef LEGACY_BACKEND
if (compRationalIRForm)
{
block->bbFlags |= BBF_IS_LIR;
}
#endif // !LEGACY_BACKEND

block->bbRefs = 1;
block->bbWeight = BB_UNITY_WEIGHT;
Expand Down
24 changes: 0 additions & 24 deletions src/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ struct BasicBlockList;
struct flowList;
struct EHblkDsc;

#if FEATURE_STACK_FP_X87
struct FlatFPStateX87;
#endif

/*****************************************************************************
*
* The following describes a switch block.
Expand Down Expand Up @@ -429,17 +425,7 @@ struct BasicBlock : private LIR::Range

#define BBF_COLD 0x10000000 // BB is cold
#define BBF_PROF_WEIGHT 0x20000000 // BB weight is computed from profile data

#ifdef LEGACY_BACKEND

#define BBF_FORWARD_SWITCH 0x40000000 // Aux flag used in FP codegen to know if a jmptable entry has been forwarded

#else // !LEGACY_BACKEND

#define BBF_IS_LIR 0x40000000 // Set if the basic block contains LIR (as opposed to HIR)

#endif // LEGACY_BACKEND

#define BBF_KEEP_BBJ_ALWAYS 0x80000000 // A special BBJ_ALWAYS block, used by EH code generation. Keep the jump kind
// as BBJ_ALWAYS. Used for the paired BBJ_ALWAYS block following the
// BBJ_CALLFINALLY block, as well as, on x86, the final step block out of a
Expand Down Expand Up @@ -473,14 +459,8 @@ struct BasicBlock : private LIR::Range

// Flags a block should not have had before it is split.

#ifdef LEGACY_BACKEND
#define BBF_SPLIT_NONEXIST \
(BBF_CHANGED | BBF_LOOP_HEAD | BBF_LOOP_CALL0 | BBF_LOOP_CALL1 | BBF_RETLESS_CALL | BBF_LOOP_PREHEADER | \
BBF_COLD | BBF_FORWARD_SWITCH)
#else // !LEGACY_BACKEND
#define BBF_SPLIT_NONEXIST \
(BBF_CHANGED | BBF_LOOP_HEAD | BBF_LOOP_CALL0 | BBF_LOOP_CALL1 | BBF_RETLESS_CALL | BBF_LOOP_PREHEADER | BBF_COLD)
#endif // LEGACY_BACKEND

// Flags lost by the top block when a block is split.
// Note, this is a conservative guess.
Expand Down Expand Up @@ -999,10 +979,6 @@ struct BasicBlock : private LIR::Range
verTypeVal* bbTypesOut; // list of variable types on output
#endif // VERIFIER

#if FEATURE_STACK_FP_X87
FlatFPStateX87* bbFPStateX87; // State of FP stack on entry to the basic block
#endif // FEATURE_STACK_FP_X87

/* The following fields used for loop detection */

typedef unsigned char loopNumber;
Expand Down
49 changes: 4 additions & 45 deletions src/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CodeGen : public CodeGenInterface
bool nogen = false);

private:
#if defined(_TARGET_XARCH_) && !FEATURE_STACK_FP_X87
#if defined(_TARGET_XARCH_)
// Bit masks used in negating a float or double number.
// This is to avoid creating more than one data constant for these bitmasks when a
// method has more than one GT_NEG operation on floating point values.
Expand All @@ -68,7 +68,7 @@ class CodeGen : public CodeGenInterface

// Generates SSE41 code for the given tree as a round operation
void genSSE41RoundOp(GenTreeOp* treeNode);
#endif // defined(_TARGET_XARCH_) && !FEATURE_STACK_FP_X87
#endif // defined(_TARGET_XARCH_)

void genPrepForCompiler();

Expand Down Expand Up @@ -143,16 +143,6 @@ class CodeGen : public CodeGenInterface
}
#endif // REG_OPT_RSVD

#ifdef LEGACY_BACKEND
regNumber findStkLclInReg(unsigned lclNum)
{
#ifdef DEBUG
genInterruptibleUsed = true;
#endif
return regTracker.rsLclIsInReg(lclNum);
}
#endif

//-------------------------------------------------------------------------

bool genUseBlockInit; // true if we plan to block-initialize the local stack frame
Expand Down Expand Up @@ -199,16 +189,6 @@ class CodeGen : public CodeGenInterface
void genGenerateStackProbe();
#endif

#ifdef LEGACY_BACKEND
regMaskTP genNewLiveRegMask(GenTree* first, GenTree* second);

// During codegen, determine the LiveSet after tree.
// Preconditions: must be called during codegen, when compCurLife and
// compCurLifeTree are being maintained, and tree must occur in the current
// statement.
VARSET_VALRET_TP genUpdateLiveSetForward(GenTree* tree);
#endif

//-------------------------------------------------------------------------

void genReportEH();
Expand Down Expand Up @@ -260,17 +240,10 @@ class CodeGen : public CodeGenInterface
void genCodeForBBlist();

public:
#ifndef LEGACY_BACKEND
// genSpillVar is called by compUpdateLifeVar in the !LEGACY_BACKEND case
void genSpillVar(GenTree* tree);
#endif // !LEGACY_BACKEND

protected:
#ifndef LEGACY_BACKEND
void genEmitHelperCall(unsigned helper, int argSize, emitAttr retSize, regNumber callTarget = REG_NA);
#else
void genEmitHelperCall(unsigned helper, int argSize, emitAttr retSize);
#endif

void genGCWriteBarrier(GenTree* tgt, GCInfo::WriteBarrierForm wbf);

Expand All @@ -284,10 +257,6 @@ class CodeGen : public CodeGenInterface

void genExitCode(BasicBlock* block);

#ifdef LEGACY_BACKEND
GenTree* genMakeConst(const void* cnsAddr, var_types cnsType, GenTree* cnsTree, bool dblAlign);
#endif

void genJumpToThrowHlpBlk(emitJumpKind jumpKind, SpecialCodeKind codeKind, GenTree* failBlk = nullptr);

void genCheckOverflow(GenTree* tree);
Expand Down Expand Up @@ -417,19 +386,17 @@ class CodeGen : public CodeGenInterface

#endif // _TARGET_AMD64_

#if defined(_TARGET_XARCH_) && !FEATURE_STACK_FP_X87
#if defined(_TARGET_XARCH_)

// Save/Restore callee saved float regs to stack
void genPreserveCalleeSavedFltRegs(unsigned lclFrameSize);
void genRestoreCalleeSavedFltRegs(unsigned lclFrameSize);
// Generate VZeroupper instruction to avoid AVX/SSE transition penalty
void genVzeroupperIfNeeded(bool check256bitOnly = true);

#endif // _TARGET_XARCH_ && FEATURE_STACK_FP_X87
#endif // _TARGET_XARCH_

#if !FEATURE_STACK_FP_X87
void genZeroInitFltRegs(const regMaskTP& initFltRegs, const regMaskTP& initDblRegs, const regNumber& initReg);
#endif // !FEATURE_STACK_FP_X87

regNumber genGetZeroReg(regNumber initReg, bool* pInitRegZeroed);

Expand Down Expand Up @@ -796,11 +763,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
unsigned genTrnslLocalVarCount;
#endif

#ifndef LEGACY_BACKEND
#include "codegenlinear.h"
#else // LEGACY_BACKEND
#include "codegenclassic.h"
#endif // LEGACY_BACKEND

/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Expand All @@ -819,10 +782,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
public:
void instInit();

#ifdef LEGACY_BACKEND
regNumber genGetZeroRegister();
#endif

void instGen(instruction ins);
#ifdef _TARGET_XARCH_
void instNop(unsigned size);
Expand Down
Loading