Skip to content

Commit 087c00e

Browse files
committed
[PPC][BOLT] Port createPushRegisters for PowerPC
1 parent 92e2fd6 commit 087c00e

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

bolt/lib/Target/PowerPC/PPCMCPlusBuilder.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,36 @@
99
// This file provides PowerPC-specific MCPlus builder.
1010
//
1111
//===----------------------------------------------------------------------===//
12+
13+
#include "bolt/Core/MCPlusBuilder.h"
14+
#include "llvm/MC/MCInst.h"
15+
#include "llvm/MC/MCPhysReg.h"
16+
#include "llvm/Target/PowerPC/PPCInstrInfo.h"
17+
#include "llvm/Target/PowerPC/PPCRegisterInfo.h"
18+
19+
namespace llvm {
20+
namespace bolt {
21+
22+
class PPCMCPlusBuilder : public MCPlusBuilder{
23+
public:
24+
using MCPlusBuilder::MCPlusBuilder;
25+
26+
// Create instructions to push two registers onto the stack
27+
static void createPushRegisters(MCInst &Inst1, MCInst &Inst2, MCPhysReg Reg1, MCPhysReg /*Reg2*/){
28+
29+
Inst1.clear();
30+
Inst1.setOpcode(PPC::STDU);
31+
Inst1.addOperand(MCOperand::createReg(PPC::R1)); // destination (SP)
32+
Inst1.addOperand(MCOperand::createReg(PPC::R1)); // base (SP)
33+
Inst1.addOperand(MCOperand::createImm(-16)); // offset
34+
35+
Inst2.clear();
36+
Inst2.setOpcode(PPC::STD);
37+
Inst2.addOperand(MCOperand::createReg(Reg1)); // source register
38+
Inst2.addOperand(MCOperand::createReg(PPC::R1)); // base (SP)
39+
Inst2.addOperand(MCOperand::createImm(0)); // offset
40+
}
41+
};
42+
43+
} // namespace bolt
44+
} // namespace llvm
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//===- bolt/Target/PowerPC/PPCMCSymbolizer.cpp ------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//===- bolt/Target/PowerPC/PPCMCSymbolizer.cpp --------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)