Differentiate between global and weak symbol loads
authorMisha Brukman <brukman+llvm@gmail.com>
Tue, 20 Jul 2004 15:45:27 +0000 (15:45 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Tue, 20 Jul 2004 15:45:27 +0000 (15:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15035 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPC32AsmPrinter.cpp
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/PowerPC/PowerPCAsmPrinter.cpp

index 4e2b90e4b75cfef17d384e7004cc83d7c9e23037..6c6b66afb08ff35efb4333276b0b4f6713396fff 100644 (file)
@@ -224,10 +224,7 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
 void Printer::emitGlobalConstant(const Constant *CV) {  
   const TargetData &TD = TM.getTargetData();
 
-  if (CV->isNullValue()) {
-    O << "\t.space\t " << TD.getTypeSize(CV->getType()) << "\n";      
-    return;
-  } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
+  if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
     if (isStringCompatible(CVA)) {
       O << "\t.ascii ";
       printAsCString(O, CVA);
@@ -524,7 +521,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
   }
 
   O << TII.getName(MI->getOpcode()) << " ";
-  if (Opcode == PPC32::LOADLoAddr) {
+  if (Opcode == PPC32::LOADLoDirect || Opcode == PPC32::LOADLoIndirect) {
     printOp(MI->getOperand(0));
     O << ", lo16(";
     printOp(MI->getOperand(2));
@@ -676,7 +673,7 @@ bool Printer::doFinalization(Module &M) {
 
   // Output stubs for external global variables
   if (GVStubs.begin() != GVStubs.end())
-    O << "\t.non_lazy_symbol_pointer\n";
+    O << ".data\n\t.non_lazy_symbol_pointer\n";
   for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end(); 
        i != e; ++i) {
     O << "L" << *i << "$non_lazy_ptr:\n";
index 4e2b90e4b75cfef17d384e7004cc83d7c9e23037..6c6b66afb08ff35efb4333276b0b4f6713396fff 100644 (file)
@@ -224,10 +224,7 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
 void Printer::emitGlobalConstant(const Constant *CV) {  
   const TargetData &TD = TM.getTargetData();
 
-  if (CV->isNullValue()) {
-    O << "\t.space\t " << TD.getTypeSize(CV->getType()) << "\n";      
-    return;
-  } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
+  if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
     if (isStringCompatible(CVA)) {
       O << "\t.ascii ";
       printAsCString(O, CVA);
@@ -524,7 +521,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
   }
 
   O << TII.getName(MI->getOpcode()) << " ";
-  if (Opcode == PPC32::LOADLoAddr) {
+  if (Opcode == PPC32::LOADLoDirect || Opcode == PPC32::LOADLoIndirect) {
     printOp(MI->getOperand(0));
     O << ", lo16(";
     printOp(MI->getOperand(2));
@@ -676,7 +673,7 @@ bool Printer::doFinalization(Module &M) {
 
   // Output stubs for external global variables
   if (GVStubs.begin() != GVStubs.end())
-    O << "\t.non_lazy_symbol_pointer\n";
+    O << ".data\n\t.non_lazy_symbol_pointer\n";
   for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end(); 
        i != e; ++i) {
     O << "L" << *i << "$non_lazy_ptr:\n";
index 4e2b90e4b75cfef17d384e7004cc83d7c9e23037..6c6b66afb08ff35efb4333276b0b4f6713396fff 100644 (file)
@@ -224,10 +224,7 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
 void Printer::emitGlobalConstant(const Constant *CV) {  
   const TargetData &TD = TM.getTargetData();
 
-  if (CV->isNullValue()) {
-    O << "\t.space\t " << TD.getTypeSize(CV->getType()) << "\n";      
-    return;
-  } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
+  if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
     if (isStringCompatible(CVA)) {
       O << "\t.ascii ";
       printAsCString(O, CVA);
@@ -524,7 +521,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
   }
 
   O << TII.getName(MI->getOpcode()) << " ";
-  if (Opcode == PPC32::LOADLoAddr) {
+  if (Opcode == PPC32::LOADLoDirect || Opcode == PPC32::LOADLoIndirect) {
     printOp(MI->getOperand(0));
     O << ", lo16(";
     printOp(MI->getOperand(2));
@@ -676,7 +673,7 @@ bool Printer::doFinalization(Module &M) {
 
   // Output stubs for external global variables
   if (GVStubs.begin() != GVStubs.end())
-    O << "\t.non_lazy_symbol_pointer\n";
+    O << ".data\n\t.non_lazy_symbol_pointer\n";
   for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end(); 
        i != e; ++i) {
     O << "L" << *i << "$non_lazy_ptr:\n";