<commit_before>//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "Backend.h"

// PeepsMD::Init
void
PeepsMD::Init(Peeps *peeps)
{
    this->peeps = peeps;
}

// PeepsMD::ProcessImplicitRegs
// Note: only do calls for now
void
PeepsMD::ProcessImplicitRegs(IR::Instr *instr)
{
    if (LowererMD::IsCall(instr))
    {
#define REGDAT(Name, Listing, Encode, Type, BitVec) \
        if (!((BitVec) & (RA_CALLEESAVE | RA_DONTALLOCATE))) \
        { \
            this->peeps->ClearReg(Reg ## Name); \
        }
#include "RegList.h"
    }
    else if (instr->m_opcode == Js::OpCode::IMUL)
    {
        this->peeps->ClearReg(RegRDX);
    }
    else if (instr->m_opcode == Js::OpCode::IDIV)
    {
        if (instr->GetDst()->AsRegOpnd()->GetReg() == RegRDX)
        {
            this->peeps->ClearReg(RegRAX);
        }
        else
        {
            Assert(instr->GetDst()->AsRegOpnd()->GetReg() == RegRAX);
            this->peeps->ClearReg(RegRDX);
        }
    }
    else if (instr->m_opcode == Js::OpCode::XCHG)
    {
        // At time of writing, I believe that src1 is always identical to dst, but clear both for robustness.

        // Either of XCHG's operands (but not both) can be a memory address, so only clear registers.
        if (instr->GetSrc1()->IsRegOpnd())
        {
            this->peeps->ClearReg(instr->GetSrc1()->AsRegOpnd()->GetReg());
        }<commit_msg>[MERGE #4256 @MikeHolman] fix missing implicit kill for DIV<commit_after>//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "Backend.h"

// PeepsMD::Init
void
PeepsMD::Init(Peeps *peeps)
{
    this->peeps = peeps;
}

// PeepsMD::ProcessImplicitRegs
// Note: only do calls for now
void
PeepsMD::ProcessImplicitRegs(IR::Instr *instr)
{
    if (LowererMD::IsCall(instr))
    {
#define REGDAT(Name, Listing, Encode, Type, BitVec) \
        if (!((BitVec) & (RA_CALLEESAVE | RA_DONTALLOCATE))) \
        { \
            this->peeps->ClearReg(Reg ## Name); \
        }
#include "RegList.h"
    }
    else if (instr->m_opcode == Js::OpCode::IMUL)
    {
        this->peeps->ClearReg(RegRDX);
    }
    else if (instr->m_opcode == Js::OpCode::IDIV || instr->m_opcode == Js::OpCode::DIV)
    {
        if (instr->GetDst()->AsRegOpnd()->GetReg() == RegRDX)
        {
            this->peeps->ClearReg(RegRAX);
        }
        else
        {
            Assert(instr->GetDst()->AsRegOpnd()->GetReg() == RegRAX);
            this->peeps->ClearReg(RegRDX);
        }
    }
    else if (instr->m_opcode == Js::OpCode::XCHG)
    {
        // At time of writing, I believe that src1 is always identical to dst, but clear both for robustness.

        // Either of XCHG's operands (but not both) can be a memory address, so only clear registers.
        if (instr->GetSrc1()->IsRegOpnd())
        {
            this->peeps->ClearReg(instr->GetSrc1()->AsRegOpnd()->GetReg());
        }
{'fraction_non_alphanumeric': 0.2545662100456621, 'fraction_numerical': 0.0028538812785388126, 'mean_word_length': 1.6837672281776417, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3283419', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1051, 'n_words': 240}