llvm/llvm/unittests/MI/LiveIntervalTest.cpp

#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MIRParser/MIRParser.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "gtest/gtest.h"

#include "../lib/CodeGen/RegisterCoalescer.h"

usingnamespacellvm;

namespace llvm {
  void initializeTestPassPass(PassRegistry &);
}

namespace {

void initLLVM() {}

/// Create a TargetMachine. As we lack a dedicated always available target for
/// unittests, we go for "AMDGPU" to be able to test normal and subregister
/// liveranges.
std::unique_ptr<LLVMTargetMachine> createTargetMachine() {}

std::unique_ptr<Module> parseMIR(LLVMContext &Context,
                                 legacy::PassManagerBase &PM,
                                 std::unique_ptr<MIRParser> &MIR,
                                 const LLVMTargetMachine &TM,
                                 StringRef MIRCode) {}

struct TestPass : public MachineFunctionPass {};

template <typename AnalysisType>
struct TestPassT : public TestPass {};

static MachineInstr &getMI(MachineFunction &MF, unsigned At,
                           unsigned BlockNum) {}

/**
 * Move instruction number \p From in front of instruction number \p To and
 * update affected liveness intervals with LiveIntervalAnalysis::handleMove().
 */
static void testHandleMove(MachineFunction &MF, LiveIntervals &LIS,
                           unsigned From, unsigned To, unsigned BlockNum = 0) {}

/**
 * Move instructions numbered \p From inclusive through instruction number
 * \p To into a newly formed bundle and update affected liveness intervals
 * with LiveIntervalAnalysis::handleMoveIntoNewBundle().
 */
static void testHandleMoveIntoNewBundle(MachineFunction &MF, LiveIntervals &LIS,
                                        unsigned From, unsigned To,
                                        unsigned BlockNum = 0) {}

/**
 * Split block numbered \p BlockNum at instruction \p SplitAt using
 * MachineBasicBlock::splitAt updating liveness intervals.
 */
static void testSplitAt(MachineFunction &MF, LiveIntervals &LIS,
                        unsigned SplitAt, unsigned BlockNum) {}

/**
 * Helper function to test for interference between a hard register and a
 * virtual register live ranges.
 */
static bool checkRegUnitInterference(LiveIntervals &LIS,
                                     const TargetRegisterInfo &TRI,
                                     const LiveInterval &VirtReg,
                                     MCRegister PhysReg) {}

template <typename AnalysisType>
static void doTest(StringRef MIRFunc,
                   typename TestPassT<AnalysisType>::TestFx T,
                   bool ShouldPass = true) {}

static void liveIntervalTest(StringRef MIRFunc,
                             TestPassT<LiveIntervalsWrapperPass>::TestFx T,
                             bool ShouldPass = true) {}

static void liveVariablesTest(StringRef MIRFunc,
                              TestPassT<LiveVariablesWrapperPass>::TestFx T,
                              bool ShouldPass = true) {}

} // End of anonymous namespace.

char TestPass::ID =;
INITIALIZE_PASS()

TEST(LiveIntervalTest, MoveUpDef) {}

TEST(LiveIntervalTest, MoveUpRedef) {}

TEST(LiveIntervalTest, MoveUpEarlyDef) {}

TEST(LiveIntervalTest, MoveUpEarlyRedef) {}

TEST(LiveIntervalTest, MoveUpKill) {}

TEST(LiveIntervalTest, MoveUpKillFollowing) {}

// TODO: Construct a situation where we have intervals following a hole
// while still having connected components.

TEST(LiveIntervalTest, MoveDownDef) {}

TEST(LiveIntervalTest, MoveDownRedef) {}

TEST(LiveIntervalTest, MoveDownEarlyDef) {}

TEST(LiveIntervalTest, MoveDownEarlyRedef) {}

TEST(LiveIntervalTest, MoveDownKill) {}

TEST(LiveIntervalTest, MoveDownKillFollowing) {}

TEST(LiveIntervalTest, MoveUndefUse) {}

TEST(LiveIntervalTest, MoveUpValNos) {}

TEST(LiveIntervalTest, MoveOverUndefUse0) {}

TEST(LiveIntervalTest, MoveOverUndefUse1) {}

TEST(LiveIntervalTest, SubRegMoveDown) {}

TEST(LiveIntervalTest, SubRegMoveUp) {}

TEST(LiveIntervalTest, DeadSubRegMoveUp) {}

TEST(LiveIntervalTest, EarlyClobberSubRegMoveUp) {}

TEST(LiveIntervalTest, TestMoveSubRegDefAcrossUseDef) {}

TEST(LiveIntervalTest, TestMoveSubRegDefAcrossUseDefMulti) {}

TEST(LiveIntervalTest, TestMoveSubRegUseAcrossMainRangeHole) {}

TEST(LiveIntervalTest, TestMoveSubRegsOfOneReg) {}

TEST(LiveIntervalTest, BundleUse) {}

TEST(LiveIntervalTest, BundleDef) {}

TEST(LiveIntervalTest, BundleRedef) {}

TEST(LiveIntervalTest, BundleInternalUse) {}

TEST(LiveIntervalTest, BundleUndefUse) {}

TEST(LiveIntervalTest, BundleSubRegUse) {}

TEST(LiveIntervalTest, BundleSubRegDef) {}

TEST(LiveIntervalTest, SplitAtOneInstruction) {}

TEST(LiveIntervalTest, SplitAtMultiInstruction) {}

TEST(LiveIntervalTest, RepairIntervals) {}

TEST(LiveIntervalTest, AdjacentIntervals) {}

TEST(LiveIntervalTest, LiveThroughSegments) {}

TEST(LiveVariablesTest, recomputeForSingleDefVirtReg_handle_undef1) {}

TEST(LiveVariablesTest, recomputeForSingleDefVirtReg_handle_undef2) {}

int main(int argc, char **argv) {}