mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
9667127c14
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
77 lines
2.4 KiB
C++
77 lines
2.4 KiB
C++
//===-- Nios2ISelDAGToDAG.cpp - A Dag to Dag Inst Selector for Nios2 ------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines an instruction selector for the NIOS2 target.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Nios2.h"
|
|
#include "Nios2TargetMachine.h"
|
|
#include "llvm/CodeGen/SelectionDAGISel.h"
|
|
#include "llvm/Support/Debug.h"
|
|
using namespace llvm;
|
|
|
|
#define DEBUG_TYPE "nios2-isel"
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Instruction Selector Implementation
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Nios2DAGToDAGISel - NIOS2 specific code to select NIOS2 machine
|
|
// instructions for SelectionDAG operations.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace {
|
|
|
|
class Nios2DAGToDAGISel : public SelectionDAGISel {
|
|
/// Subtarget - Keep a pointer to the Nios2 Subtarget around so that we can
|
|
/// make the right decision when generating code for different targets.
|
|
const Nios2Subtarget *Subtarget;
|
|
|
|
public:
|
|
explicit Nios2DAGToDAGISel(Nios2TargetMachine &TM, CodeGenOpt::Level OL)
|
|
: SelectionDAGISel(TM, OL) {}
|
|
|
|
bool runOnMachineFunction(MachineFunction &MF) override {
|
|
Subtarget = &MF.getSubtarget<Nios2Subtarget>();
|
|
return SelectionDAGISel::runOnMachineFunction(MF);
|
|
}
|
|
|
|
void Select(SDNode *N) override;
|
|
|
|
// Pass Name
|
|
StringRef getPassName() const override {
|
|
return "NIOS2 DAG->DAG Pattern Instruction Selection";
|
|
}
|
|
|
|
#include "Nios2GenDAGISel.inc"
|
|
};
|
|
} // namespace
|
|
|
|
// Select instructions not customized! Used for
|
|
// expanded, promoted and normal instructions
|
|
void Nios2DAGToDAGISel::Select(SDNode *Node) {
|
|
|
|
// If we have a custom node, we already have selected!
|
|
if (Node->isMachineOpcode()) {
|
|
LLVM_DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");
|
|
Node->setNodeId(-1);
|
|
return;
|
|
}
|
|
|
|
// Select the default instruction
|
|
SelectCode(Node);
|
|
}
|
|
|
|
FunctionPass *llvm::createNios2ISelDag(Nios2TargetMachine &TM,
|
|
CodeGenOpt::Level OptLevel) {
|
|
return new Nios2DAGToDAGISel(TM, OptLevel);
|
|
}
|