2018-02-23 12:06:40 +01:00
|
|
|
//===- MipsInstructionSelector.cpp ------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
/// This file implements the targeting of the InstructionSelector class for
|
|
|
|
/// Mips.
|
|
|
|
/// \todo This should be generated by TableGen.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "MipsRegisterBankInfo.h"
|
|
|
|
#include "MipsSubtarget.h"
|
|
|
|
#include "MipsTargetMachine.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class MipsInstructionSelector : public InstructionSelector {
|
|
|
|
public:
|
|
|
|
MipsInstructionSelector(const MipsTargetMachine &TM, const MipsSubtarget &STI,
|
|
|
|
const MipsRegisterBankInfo &RBI);
|
|
|
|
|
|
|
|
bool select(MachineInstr &I, CodeGenCoverage &CoverageInfo) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const MipsInstrInfo &TII;
|
|
|
|
const MipsRegisterInfo &TRI;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
|
|
|
MipsInstructionSelector::MipsInstructionSelector(
|
|
|
|
const MipsTargetMachine &TM, const MipsSubtarget &STI,
|
|
|
|
const MipsRegisterBankInfo &RBI)
|
2018-02-23 16:47:05 +01:00
|
|
|
: InstructionSelector(), TII(*STI.getInstrInfo()),
|
|
|
|
TRI(*STI.getRegisterInfo()) {}
|
2018-02-23 12:06:40 +01:00
|
|
|
|
|
|
|
bool MipsInstructionSelector::select(MachineInstr &I,
|
|
|
|
CodeGenCoverage &CoverageInfo) const {
|
|
|
|
|
|
|
|
if (!isPreISelGenericOpcode(I.getOpcode())) {
|
|
|
|
// Not global isel generic opcode.
|
|
|
|
// TODO: select copy
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We didn't select anything.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
InstructionSelector *createMipsInstructionSelector(const MipsTargetMachine &TM,
|
|
|
|
MipsSubtarget &Subtarget,
|
|
|
|
MipsRegisterBankInfo &RBI) {
|
|
|
|
return new MipsInstructionSelector(TM, Subtarget, RBI);
|
|
|
|
}
|
|
|
|
} // end namespace llvm
|