mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
9bcfdf98f1
clear what information these functions are actually using. This is also a micro-optimization, as passing a SDNode * around is simpler than passing a { SDNode *, int } by value or reference. llvm-svn: 92564
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
//===-- PIC16ISelDAGToDAG.cpp - A dag to dag inst selector for PIC16 ------===//
|
|
//
|
|
// 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 PIC16 target.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#define DEBUG_TYPE "pic16-isel"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include "PIC16ISelDAGToDAG.h"
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
using namespace llvm;
|
|
|
|
/// createPIC16ISelDag - This pass converts a legalized DAG into a
|
|
/// PIC16-specific DAG, ready for instruction scheduling.
|
|
FunctionPass *llvm::createPIC16ISelDag(PIC16TargetMachine &TM) {
|
|
return new PIC16DAGToDAGISel(TM);
|
|
}
|
|
|
|
|
|
/// InstructionSelect - This callback is invoked by
|
|
/// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
|
|
void PIC16DAGToDAGISel::InstructionSelect() {
|
|
SelectRoot(*CurDAG);
|
|
CurDAG->RemoveDeadNodes();
|
|
}
|
|
|
|
/// Select - Select instructions not customized! Used for
|
|
/// expanded, promoted and normal instructions.
|
|
SDNode* PIC16DAGToDAGISel::Select(SDNode *N) {
|
|
|
|
// Select the default instruction.
|
|
SDNode *ResNode = SelectCode(N);
|
|
|
|
return ResNode;
|
|
}
|
|
|
|
|
|
// SelectDirectAddr - Match a direct address for DAG.
|
|
// A direct address could be a globaladdress or externalsymbol.
|
|
bool PIC16DAGToDAGISel::SelectDirectAddr(SDNode *Op, SDValue N,
|
|
SDValue &Address) {
|
|
// Return true if TGA or ES.
|
|
if (N.getOpcode() == ISD::TargetGlobalAddress
|
|
|| N.getOpcode() == ISD::TargetExternalSymbol) {
|
|
Address = N;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|