diff options
-rw-r--r-- | lib/Target/Sparc/SparcAsmPrinter.cpp | 11 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcInstrInfo.td | 7 | ||||
-rw-r--r-- | lib/Target/SparcV8/SparcV8AsmPrinter.cpp | 11 | ||||
-rw-r--r-- | lib/Target/SparcV8/SparcV8InstrInfo.td | 7 |
4 files changed, 26 insertions, 10 deletions
diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index 7e5448eaad..e804848278 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -112,9 +112,10 @@ bool SparcV8AsmPrinter::runOnMachineFunction(MachineFunction &MF) { for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I) { // Print a label for the basic block. - O << ".LBB" << Mang->getValueName(MF.getFunction ()) - << "_" << I->getNumber () << ":\t! " - << I->getBasicBlock ()->getName () << "\n"; + if (I != MF.begin()) + O << ".LBB" << Mang->getValueName(MF.getFunction ()) + << "_" << I->getNumber () << ":\t! " + << I->getBasicBlock ()->getName () << "\n"; for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { // Print the assembly for the instruction. @@ -135,8 +136,8 @@ void SparcV8AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { if (MI->getOpcode() == V8::SETHIi && !MO.isRegister() && !MO.isImmediate()) { O << "%hi("; CloseParen = true; - } else if (MI->getOpcode() ==V8::ORri &&!MO.isRegister() &&!MO.isImmediate()) - { + } else if ((MI->getOpcode() == V8::ORri || MI->getOpcode() == V8::ADDri) + && !MO.isRegister() && !MO.isImmediate()) { O << "%lo("; CloseParen = true; } diff --git a/lib/Target/Sparc/SparcInstrInfo.td b/lib/Target/Sparc/SparcInstrInfo.td index f736e96876..9613bc5fd4 100644 --- a/lib/Target/Sparc/SparcInstrInfo.td +++ b/lib/Target/Sparc/SparcInstrInfo.td @@ -724,6 +724,13 @@ def : Pat<(V8lo tglobaladdr:$in), (ORri G0, tglobaladdr:$in)>; def : Pat<(V8hi tconstpool:$in), (SETHIi tconstpool:$in)>; def : Pat<(V8lo tconstpool:$in), (ORri G0, tconstpool:$in)>; +// Add reg, lo. This is used when taking the addr of a global/constpool entry. +def : Pat<(add IntRegs:$r, (V8lo tglobaladdr:$in)), + (ADDri IntRegs:$r, tglobaladdr:$in)>; +def : Pat<(add IntRegs:$r, (V8lo tconstpool:$in)), + (ADDri IntRegs:$r, tconstpool:$in)>; + + // Calls: def : Pat<(call tglobaladdr:$dst), (CALL tglobaladdr:$dst)>; diff --git a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp index 7e5448eaad..e804848278 100644 --- a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp +++ b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp @@ -112,9 +112,10 @@ bool SparcV8AsmPrinter::runOnMachineFunction(MachineFunction &MF) { for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I) { // Print a label for the basic block. - O << ".LBB" << Mang->getValueName(MF.getFunction ()) - << "_" << I->getNumber () << ":\t! " - << I->getBasicBlock ()->getName () << "\n"; + if (I != MF.begin()) + O << ".LBB" << Mang->getValueName(MF.getFunction ()) + << "_" << I->getNumber () << ":\t! " + << I->getBasicBlock ()->getName () << "\n"; for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { // Print the assembly for the instruction. @@ -135,8 +136,8 @@ void SparcV8AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { if (MI->getOpcode() == V8::SETHIi && !MO.isRegister() && !MO.isImmediate()) { O << "%hi("; CloseParen = true; - } else if (MI->getOpcode() ==V8::ORri &&!MO.isRegister() &&!MO.isImmediate()) - { + } else if ((MI->getOpcode() == V8::ORri || MI->getOpcode() == V8::ADDri) + && !MO.isRegister() && !MO.isImmediate()) { O << "%lo("; CloseParen = true; } diff --git a/lib/Target/SparcV8/SparcV8InstrInfo.td b/lib/Target/SparcV8/SparcV8InstrInfo.td index f736e96876..9613bc5fd4 100644 --- a/lib/Target/SparcV8/SparcV8InstrInfo.td +++ b/lib/Target/SparcV8/SparcV8InstrInfo.td @@ -724,6 +724,13 @@ def : Pat<(V8lo tglobaladdr:$in), (ORri G0, tglobaladdr:$in)>; def : Pat<(V8hi tconstpool:$in), (SETHIi tconstpool:$in)>; def : Pat<(V8lo tconstpool:$in), (ORri G0, tconstpool:$in)>; +// Add reg, lo. This is used when taking the addr of a global/constpool entry. +def : Pat<(add IntRegs:$r, (V8lo tglobaladdr:$in)), + (ADDri IntRegs:$r, tglobaladdr:$in)>; +def : Pat<(add IntRegs:$r, (V8lo tconstpool:$in)), + (ADDri IntRegs:$r, tconstpool:$in)>; + + // Calls: def : Pat<(call tglobaladdr:$dst), (CALL tglobaladdr:$dst)>; |