llvm/llvm/lib/Target/Sparc/LeonPasses.cpp

//===------ LeonPasses.cpp - Define passes specific to LEON ---------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//
//===----------------------------------------------------------------------===//

#include "LeonPasses.h"
#include "SparcSubtarget.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/Support/raw_ostream.h"

usingnamespacellvm;

char ErrataWorkaround::ID =;

ErrataWorkaround::ErrataWorkaround() :{}

INITIALIZE_PASS()

// Move iterator to the next instruction in the function, ignoring
// meta instructions and inline assembly. Returns false when reaching
// the end of the function.
bool ErrataWorkaround::moveNext(MachineBasicBlock::iterator &I) {}

void ErrataWorkaround::insertNop(MachineBasicBlock::iterator I) {}

bool ErrataWorkaround::isFloat(MachineBasicBlock::iterator I) {}

bool ErrataWorkaround::isDivSqrt(MachineBasicBlock::iterator I) {}

// Prevents the following code sequence from being generated:
// (stb/sth/st/stf) -> (single non-store/load instruction) -> (any store)
// If the sequence is detected a NOP instruction is inserted after
// the first store instruction.
bool ErrataWorkaround::checkSeqTN0009A(MachineBasicBlock::iterator I) {}

// Prevents the following code sequence from being generated:
// (std/stdf) -> (any store)
// If the sequence is detected a NOP instruction is inserted after
// the first store instruction.
bool ErrataWorkaround::checkSeqTN0009B(MachineBasicBlock::iterator I) {}

// Insert a NOP at branch target if load in delay slot and atomic
// instruction at branch target. Also insert a NOP between load
// instruction and atomic instruction (swap or casa).
bool ErrataWorkaround::checkSeqTN0010(MachineBasicBlock::iterator I) {}

// Do not allow functions to begin with an atomic instruction
bool ErrataWorkaround::checkSeqTN0010First(MachineBasicBlock &MBB) {}

// Inserts a NOP instruction at the target of an integer branch if the
// target is a floating-point instruction or floating-point branch.
bool ErrataWorkaround::checkSeqTN0012(MachineBasicBlock::iterator I) {}

// Prevents the following code sequence from being generated:
// (div/sqrt) -> (2 to 3 floating-point operations or loads) -> (div/sqrt)
// If the sequence is detected one or two NOP instruction are inserted after
// the first div/sqrt instruction. No NOPs are inserted if one of the floating-
// point instructions in the middle of the sequence is a (div/sqrt), or if
// they have dependency on the destination register of the first (div/sqrt).
//
// The function also prevents the following code sequence from being generated,
// (div/sqrt) -> (branch), by inserting a NOP instruction after the (div/sqrt).
bool ErrataWorkaround::checkSeqTN0013(MachineBasicBlock::iterator I) {}

bool ErrataWorkaround::runOnMachineFunction(MachineFunction &MF) {}

LEONMachineFunctionPass::LEONMachineFunctionPass(char &ID)
    :{}

//*****************************************************************************
//**** InsertNOPLoad pass
//*****************************************************************************
// This pass fixes the incorrectly working Load instructions that exists for
// some earlier versions of the LEON processor line. NOP instructions must
// be inserted after the load instruction to ensure that the Load instruction
// behaves as expected for these processors.
//
// This pass inserts a NOP after any LD or LDF instruction.
//
char InsertNOPLoad::ID =;

InsertNOPLoad::InsertNOPLoad() :{}

bool InsertNOPLoad::runOnMachineFunction(MachineFunction &MF) {}



//*****************************************************************************
//**** DetectRoundChange pass
//*****************************************************************************
// To prevent any explicit change of the default rounding mode, this pass
// detects any call of the fesetround function.
// A warning is generated to ensure the user knows this has happened.
//
// Detects an erratum in UT699 LEON 3 processor

char DetectRoundChange::ID =;

DetectRoundChange::DetectRoundChange() :{}

bool DetectRoundChange::runOnMachineFunction(MachineFunction &MF) {}

//*****************************************************************************
//**** FixAllFDIVSQRT pass
//*****************************************************************************
// This pass fixes the incorrectly working FDIVx and FSQRTx instructions that
// exist for some earlier versions of the LEON processor line. Five NOP
// instructions need to be inserted after these instructions to ensure the
// correct result is placed in the destination registers before they are used.
//
// This pass implements two fixes:
//  1) fixing the FSQRTS and FSQRTD instructions.
//  2) fixing the FDIVS and FDIVD instructions.
//
// FSQRTS and FDIVS are converted to FDIVD and FSQRTD respectively earlier in
// the pipeline when this option is enabled, so this pass needs only to deal
// with the changes that still need implementing for the "double" versions
// of these instructions.
//
char FixAllFDIVSQRT::ID =;

FixAllFDIVSQRT::FixAllFDIVSQRT() :{}

bool FixAllFDIVSQRT::runOnMachineFunction(MachineFunction &MF) {}