mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-03 00:33:09 +00:00
Don't print a label for the first MBB in a function.
Compile this: %_2E_str_8 = external global [75 x sbyte] implementation ; Functions: declare int %printf(sbyte*, ...) void %test() %tmp.101 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([75 x sbyte]* %_2E_str_8, int 0, int 0) ) ; <int> [#uses=0] unreachable } to this: main_endif_2E_8: save -96, %o6, %o6 sethi %hi(_2E_str_8), %l0 add %l0, %lo(_2E_str_8), %o0 call printf nop instead of this: main_endif_2E_8: save -96, %o6, %o6 sethi %hi(_2E_str_8), %l0 or %g0, %lo(_2E_str_8), %l1 ;; extra instruction add %l1, %l0, %o0 call printf nop git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25335 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b22c08b808
commit
4fca01731a
@ -112,6 +112,7 @@ bool SparcV8AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
// Print a label for the basic block.
|
// Print a label for the basic block.
|
||||||
|
if (I != MF.begin())
|
||||||
O << ".LBB" << Mang->getValueName(MF.getFunction ())
|
O << ".LBB" << Mang->getValueName(MF.getFunction ())
|
||||||
<< "_" << I->getNumber () << ":\t! "
|
<< "_" << I->getNumber () << ":\t! "
|
||||||
<< I->getBasicBlock ()->getName () << "\n";
|
<< I->getBasicBlock ()->getName () << "\n";
|
||||||
@ -135,8 +136,8 @@ void SparcV8AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
|
|||||||
if (MI->getOpcode() == V8::SETHIi && !MO.isRegister() && !MO.isImmediate()) {
|
if (MI->getOpcode() == V8::SETHIi && !MO.isRegister() && !MO.isImmediate()) {
|
||||||
O << "%hi(";
|
O << "%hi(";
|
||||||
CloseParen = true;
|
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(";
|
O << "%lo(";
|
||||||
CloseParen = true;
|
CloseParen = true;
|
||||||
}
|
}
|
||||||
|
@ -724,6 +724,13 @@ def : Pat<(V8lo tglobaladdr:$in), (ORri G0, tglobaladdr:$in)>;
|
|||||||
def : Pat<(V8hi tconstpool:$in), (SETHIi tconstpool:$in)>;
|
def : Pat<(V8hi tconstpool:$in), (SETHIi tconstpool:$in)>;
|
||||||
def : Pat<(V8lo tconstpool:$in), (ORri G0, 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:
|
// Calls:
|
||||||
def : Pat<(call tglobaladdr:$dst),
|
def : Pat<(call tglobaladdr:$dst),
|
||||||
(CALL tglobaladdr:$dst)>;
|
(CALL tglobaladdr:$dst)>;
|
||||||
|
@ -112,6 +112,7 @@ bool SparcV8AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
// Print a label for the basic block.
|
// Print a label for the basic block.
|
||||||
|
if (I != MF.begin())
|
||||||
O << ".LBB" << Mang->getValueName(MF.getFunction ())
|
O << ".LBB" << Mang->getValueName(MF.getFunction ())
|
||||||
<< "_" << I->getNumber () << ":\t! "
|
<< "_" << I->getNumber () << ":\t! "
|
||||||
<< I->getBasicBlock ()->getName () << "\n";
|
<< I->getBasicBlock ()->getName () << "\n";
|
||||||
@ -135,8 +136,8 @@ void SparcV8AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
|
|||||||
if (MI->getOpcode() == V8::SETHIi && !MO.isRegister() && !MO.isImmediate()) {
|
if (MI->getOpcode() == V8::SETHIi && !MO.isRegister() && !MO.isImmediate()) {
|
||||||
O << "%hi(";
|
O << "%hi(";
|
||||||
CloseParen = true;
|
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(";
|
O << "%lo(";
|
||||||
CloseParen = true;
|
CloseParen = true;
|
||||||
}
|
}
|
||||||
|
@ -724,6 +724,13 @@ def : Pat<(V8lo tglobaladdr:$in), (ORri G0, tglobaladdr:$in)>;
|
|||||||
def : Pat<(V8hi tconstpool:$in), (SETHIi tconstpool:$in)>;
|
def : Pat<(V8hi tconstpool:$in), (SETHIi tconstpool:$in)>;
|
||||||
def : Pat<(V8lo tconstpool:$in), (ORri G0, 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:
|
// Calls:
|
||||||
def : Pat<(call tglobaladdr:$dst),
|
def : Pat<(call tglobaladdr:$dst),
|
||||||
(CALL tglobaladdr:$dst)>;
|
(CALL tglobaladdr:$dst)>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user