diff options
author | Alex Bradbury <asb@lowrisc.org> | 2017-11-08 12:20:01 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2017-11-08 12:20:01 +0000 |
commit | 21ae2e7a5694eb1b7e379ee8a3bfefed139301f4 (patch) | |
tree | ac6aed3445418204b8ec6cd05f149643aa3da3c9 /lib/Target/RISCV/RISCVInstrInfo.cpp | |
parent | c5abad3f598b6970aa3098cb09dd8ee116a430a5 (diff) |
[RISCV] Codegen support for memory operations
This required the implementation of RISCVTargetInstrInfo::copyPhysReg. Support
for lowering global addresses follow in the next patch.
Differential Revision: https://reviews.llvm.org/D29934
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/RISCV/RISCVInstrInfo.cpp')
-rw-r--r-- | lib/Target/RISCV/RISCVInstrInfo.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Target/RISCV/RISCVInstrInfo.cpp b/lib/Target/RISCV/RISCVInstrInfo.cpp index 92db5358ce4..ebb7174002d 100644 --- a/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -29,3 +29,15 @@ using namespace llvm; RISCVInstrInfo::RISCVInstrInfo() : RISCVGenInstrInfo() {} + +void RISCVInstrInfo::copyPhysReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + const DebugLoc &DL, unsigned DstReg, + unsigned SrcReg, bool KillSrc) const { + assert(RISCV::GPRRegClass.contains(DstReg, SrcReg) && + "Impossible reg-to-reg copy"); + + BuildMI(MBB, MBBI, DL, get(RISCV::ADDI), DstReg) + .addReg(SrcReg, getKillRegState(KillSrc)) + .addImm(0); +} |