35#define DEBUG_TYPE "arc-isel"
36#define PASS_NAME "ARC DAG->DAG Pattern Instruction Selection"
46 ARCDAGToDAGISel() =
delete;
60#include "ARCGenDAGISel.inc"
63char ARCDAGToDAGISel::ID;
72 CodeGenOpt::Level OptLevel) {
73 return new ARCDAGToDAGISel(
TM, OptLevel);
93 !CurDAG->isBaseWithConstantOffset(
Addr)) {
96 int FI = cast<FrameIndexSDNode>(
Addr)->getIndex();
97 Base = CurDAG->getTargetFrameIndex(
98 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
107 int32_t RHSC =
RHS->getSExtValue();
116 int FI = cast<FrameIndexSDNode>(
Base)->getIndex();
117 Base = CurDAG->getTargetFrameIndex(
118 FI, TLI->getPointerTy(CurDAG->getDataLayout()));
136 int32_t RHSC =
RHS->getSExtValue();
150 if ((FIN = dyn_cast<FrameIndexSDNode>(
Addr))) {
151 Base = CurDAG->getTargetFrameIndex(FIN->
getIndex(), MVT::i32);
157 if ((FIN = dyn_cast<FrameIndexSDNode>(
Addr.getOperand(0))) &&
158 (CN = dyn_cast<ConstantSDNode>(
Addr.getOperand(1))) &&
161 Base = CurDAG->getTargetFrameIndex(FIN->
getIndex(), MVT::i32);
170void ARCDAGToDAGISel::Select(
SDNode *
N) {
171 switch (
N->getOpcode()) {
173 uint64_t CVal = cast<ConstantSDNode>(
N)->getZExtValue();
174 ReplaceNode(
N, CurDAG->getMachineNode(
175 isInt<12>(CVal) ? ARC::MOV_rs12 : ARC::MOV_rlimm,
177 CurDAG->getTargetConstant(CVal,
SDLoc(
N), MVT::i32)));
amdgpu AMDGPU Register Bank Select
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const char LLVMTargetMachineRef TM
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file describes how to lower LLVM code to machine code.
int64_t getSExtValue() const
FunctionPass class - This class is used to implement most global optimizations.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Level
Code generation optimization level.
@ ADD
Simple integer binary arithmetic operators.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createARCISelDag(ARCTargetMachine &TM, CodeGenOpt::Level OptLevel)
This pass converts a legalized DAG into a ARC-specific DAG, ready for instruction scheduling.