[WebAssembly] Implement WebAssemblyInstrInfo::copyPhysReg
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyInstrInfo.cpp
1 //===-- WebAssemblyInstrInfo.cpp - WebAssembly Instruction Information ----===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief This file contains the WebAssembly implementation of the
12 /// TargetInstrInfo class.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #include "WebAssemblyInstrInfo.h"
17 #include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
18 #include "WebAssemblySubtarget.h"
19 #include "llvm/CodeGen/MachineFrameInfo.h"
20 #include "llvm/CodeGen/MachineInstrBuilder.h"
21 #include "llvm/CodeGen/MachineMemOperand.h"
22 #include "llvm/CodeGen/MachineRegisterInfo.h"
23 using namespace llvm;
24
25 #define DEBUG_TYPE "wasm-instr-info"
26
27 #define GET_INSTRINFO_CTOR_DTOR
28 #include "WebAssemblyGenInstrInfo.inc"
29
30 WebAssemblyInstrInfo::WebAssemblyInstrInfo(const WebAssemblySubtarget &STI)
31     : RI(STI.getTargetTriple()) {}
32
33 void WebAssemblyInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
34                                        MachineBasicBlock::iterator I,
35                                        DebugLoc DL, unsigned DestReg,
36                                        unsigned SrcReg, bool KillSrc) const {
37   BuildMI(MBB, I, DL, get(WebAssembly::COPY), DestReg)
38       .addReg(SrcReg, KillSrc ? RegState::Kill : 0);
39 }