diff options
author | Kai Nacke <kai@redstar.de> | 2022-07-12 22:13:04 -0400 |
---|---|---|
committer | Kai Nacke <kai@redstar.de> | 2022-11-13 11:07:33 -0500 |
commit | 30ace16d45cabb5ebd7e384e2c6e5dbb6465db71 (patch) | |
tree | 458a40eaf69882da2f1de11ba14d20b32bcb57fe | |
parent | 3aa661dc13f007c7c333ec90931547135730e9ed (diff) | |
download | llvm-30ace16d45cabb5ebd7e384e2c6e5dbb6465db71.zip llvm-30ace16d45cabb5ebd7e384e2c6e5dbb6465db71.tar.gz llvm-30ace16d45cabb5ebd7e384e2c6e5dbb6465db71.tar.bz2 |
[m88k] Add instruction select for G_FRAME_INDEX
-rw-r--r-- | llvm/lib/Target/M88k/GISel/M88kInstructionSelector.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Target/M88k/GISel/M88kInstructionSelector.cpp b/llvm/lib/Target/M88k/GISel/M88kInstructionSelector.cpp index a3aadff..8dde934 100644 --- a/llvm/lib/Target/M88k/GISel/M88kInstructionSelector.cpp +++ b/llvm/lib/Target/M88k/GISel/M88kInstructionSelector.cpp @@ -62,6 +62,8 @@ private: void renderHI16(MachineInstrBuilder &MIB, const MachineInstr &I, int OpIdx = -1) const; + bool selectFrameIndex(MachineInstr &I, MachineBasicBlock &MBB, + MachineRegisterInfo &MRI) const; bool selectGlobalValue(MachineInstr &I, MachineBasicBlock &MBB, MachineRegisterInfo &MRI) const; bool selectUbfx(MachineInstr &I, MachineBasicBlock &MBB, @@ -194,6 +196,20 @@ void M88kInstructionSelector::renderHI16(MachineInstrBuilder &MIB, MIB.addImm(Val); } +bool M88kInstructionSelector::selectFrameIndex(MachineInstr &I, + MachineBasicBlock &MBB, + MachineRegisterInfo &MRI) const { + assert(I.getOpcode() == TargetOpcode::G_FRAME_INDEX && "Unexpected G code"); + + MachineInstr *MI = BuildMI(MBB, I, I.getDebugLoc(), TII.get(M88k::ADDri)) + .add(I.getOperand(0)) + .add(I.getOperand(1)) + .addImm(0); + I.eraseFromParent(); + return constrainSelectedInstRegOperands(*MI, TII, TRI, RBI); + return false; +} + bool M88kInstructionSelector::selectGlobalValue( MachineInstr &I, MachineBasicBlock &MBB, MachineRegisterInfo &MRI) const { assert(I.getOpcode() == TargetOpcode::G_GLOBAL_VALUE && "Unexpected G code"); @@ -938,6 +954,8 @@ bool M88kInstructionSelector::select(MachineInstr &I) { return selectGlobalValue(I, MBB, MRI); case TargetOpcode::G_PTR_ADD: return selectPtrAdd(I, MBB, MRI); + case TargetOpcode::G_FRAME_INDEX: + return selectFrameIndex(I, MBB, MRI); case TargetOpcode::G_UBFX: case TargetOpcode::G_SBFX: case TargetOpcode::G_SEXT_INREG: |