mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-17 00:57:54 +00:00
factor out a simple helper function to create a label for PC-relative
instructions (PICADD, PICLDR, et.al.) llvm-svn: 114243
This commit is contained in:
parent
a19f7799fb
commit
c909422ee9
@ -1383,6 +1383,14 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
static MCSymbol *getPICLabel(const char *Prefix, unsigned FunctionNumber,
|
||||||
|
unsigned LabelId, MCContext &Ctx) {
|
||||||
|
|
||||||
|
MCSymbol *Label = Ctx.GetOrCreateSymbol(Twine(Prefix)
|
||||||
|
+ "PC" + Twine(FunctionNumber) + "_" + Twine(LabelId));
|
||||||
|
return Label;
|
||||||
|
}
|
||||||
|
|
||||||
void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
||||||
ARMMCInstLower MCInstLowering(OutContext, *Mang, *this);
|
ARMMCInstLower MCInstLowering(OutContext, *Mang, *this);
|
||||||
switch (MI->getOpcode()) {
|
switch (MI->getOpcode()) {
|
||||||
@ -1396,12 +1404,9 @@ void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
|||||||
// This adds the address of LPC0 to r0.
|
// This adds the address of LPC0 to r0.
|
||||||
|
|
||||||
// Emit the label.
|
// Emit the label.
|
||||||
// FIXME: MOVE TO SHARED PLACE.
|
OutStreamer.EmitLabel(getPICLabel(MAI->getPrivateGlobalPrefix(),
|
||||||
unsigned Id = (unsigned)MI->getOperand(2).getImm();
|
getFunctionNumber(), MI->getOperand(2).getImm(),
|
||||||
const char *Prefix = MAI->getPrivateGlobalPrefix();
|
OutContext));
|
||||||
MCSymbol *Label =OutContext.GetOrCreateSymbol(Twine(Prefix)
|
|
||||||
+ "PC" + Twine(getFunctionNumber()) + "_" + Twine(Id));
|
|
||||||
OutStreamer.EmitLabel(Label);
|
|
||||||
|
|
||||||
// Form and emit the add.
|
// Form and emit the add.
|
||||||
MCInst AddInst;
|
MCInst AddInst;
|
||||||
@ -1422,13 +1427,9 @@ void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
|||||||
// This adds the address of LPC0 to r0.
|
// This adds the address of LPC0 to r0.
|
||||||
|
|
||||||
// Emit the label.
|
// Emit the label.
|
||||||
// FIXME: MOVE TO SHARED PLACE.
|
OutStreamer.EmitLabel(getPICLabel(MAI->getPrivateGlobalPrefix(),
|
||||||
unsigned Id = (unsigned)MI->getOperand(2).getImm();
|
getFunctionNumber(), MI->getOperand(2).getImm(),
|
||||||
const char *Prefix = MAI->getPrivateGlobalPrefix();
|
OutContext));
|
||||||
MCSymbol *Label =OutContext.GetOrCreateSymbol(Twine(Prefix)
|
|
||||||
+ "PC" + Twine(getFunctionNumber()) + "_" + Twine(Id));
|
|
||||||
OutStreamer.EmitLabel(Label);
|
|
||||||
|
|
||||||
|
|
||||||
// Form and emit the add.
|
// Form and emit the add.
|
||||||
MCInst AddInst;
|
MCInst AddInst;
|
||||||
@ -1459,12 +1460,9 @@ void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
|||||||
// a PC-relative address at the ldr instruction.
|
// a PC-relative address at the ldr instruction.
|
||||||
|
|
||||||
// Emit the label.
|
// Emit the label.
|
||||||
// FIXME: MOVE TO SHARED PLACE.
|
OutStreamer.EmitLabel(getPICLabel(MAI->getPrivateGlobalPrefix(),
|
||||||
unsigned Id = (unsigned)MI->getOperand(2).getImm();
|
getFunctionNumber(), MI->getOperand(2).getImm(),
|
||||||
const char *Prefix = MAI->getPrivateGlobalPrefix();
|
OutContext));
|
||||||
MCSymbol *Label =OutContext.GetOrCreateSymbol(Twine(Prefix)
|
|
||||||
+ "PC" + Twine(getFunctionNumber()) + "_" + Twine(Id));
|
|
||||||
OutStreamer.EmitLabel(Label);
|
|
||||||
|
|
||||||
// Form and emit the load
|
// Form and emit the load
|
||||||
unsigned Opcode;
|
unsigned Opcode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user