comparison lib/Target/Lanai/LanaiISelDAGToDAG.cpp @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents 3a76565eade5
children
comparison
equal deleted inserted replaced
134:3a76565eade5 147:c2174574ed3a
1 //===-- LanaiISelDAGToDAG.cpp - A dag to dag inst selector for Lanai ------===// 1 //===-- LanaiISelDAGToDAG.cpp - A dag to dag inst selector for Lanai ------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 // 8 //
10 // This file defines an instruction selector for the Lanai target. 9 // This file defines an instruction selector for the Lanai target.
11 // 10 //
12 //===----------------------------------------------------------------------===// 11 //===----------------------------------------------------------------------===//
13 12
14 #include "Lanai.h" 13 #include "LanaiAluCode.h"
15 #include "LanaiMachineFunctionInfo.h" 14 #include "LanaiMachineFunctionInfo.h"
16 #include "LanaiRegisterInfo.h" 15 #include "LanaiRegisterInfo.h"
17 #include "LanaiSubtarget.h" 16 #include "LanaiSubtarget.h"
18 #include "LanaiTargetMachine.h" 17 #include "LanaiTargetMachine.h"
19 #include "llvm/CodeGen/MachineConstantPool.h" 18 #include "llvm/CodeGen/MachineConstantPool.h"
273 void LanaiDAGToDAGISel::Select(SDNode *Node) { 272 void LanaiDAGToDAGISel::Select(SDNode *Node) {
274 unsigned Opcode = Node->getOpcode(); 273 unsigned Opcode = Node->getOpcode();
275 274
276 // If we have a custom node, we already have selected! 275 // If we have a custom node, we already have selected!
277 if (Node->isMachineOpcode()) { 276 if (Node->isMachineOpcode()) {
278 DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n"); 277 LLVM_DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");
279 return; 278 return;
280 } 279 }
281 280
282 // Instruction Selection not handled by the auto-generated tablegen selection 281 // Instruction Selection not handled by the auto-generated tablegen selection
283 // should be handled here. 282 // should be handled here.
314 } 313 }
315 314
316 void LanaiDAGToDAGISel::selectFrameIndex(SDNode *Node) { 315 void LanaiDAGToDAGISel::selectFrameIndex(SDNode *Node) {
317 SDLoc DL(Node); 316 SDLoc DL(Node);
318 SDValue Imm = CurDAG->getTargetConstant(0, DL, MVT::i32); 317 SDValue Imm = CurDAG->getTargetConstant(0, DL, MVT::i32);
319 int FI = dyn_cast<FrameIndexSDNode>(Node)->getIndex(); 318 int FI = cast<FrameIndexSDNode>(Node)->getIndex();
320 EVT VT = Node->getValueType(0); 319 EVT VT = Node->getValueType(0);
321 SDValue TFI = CurDAG->getTargetFrameIndex(FI, VT); 320 SDValue TFI = CurDAG->getTargetFrameIndex(FI, VT);
322 unsigned Opc = Lanai::ADD_I_LO; 321 unsigned Opc = Lanai::ADD_I_LO;
323 if (Node->hasOneUse()) { 322 if (Node->hasOneUse()) {
324 CurDAG->SelectNodeTo(Node, Opc, VT, TFI, Imm); 323 CurDAG->SelectNodeTo(Node, Opc, VT, TFI, Imm);