OSDN Git Service

Add support for changes in DwarfWriter.
authorJim Laskey <jlaskey@mac.com>
Wed, 21 Feb 2007 22:47:38 +0000 (22:47 +0000)
committerJim Laskey <jlaskey@mac.com>
Wed, 21 Feb 2007 22:47:38 +0000 (22:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34478 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter.cpp
lib/Target/PowerPC/PPCAsmPrinter.cpp

index 88136c0..e3ca8aa 100644 (file)
@@ -105,6 +105,10 @@ namespace llvm {
     /// generate the appropriate value.
     virtual const std::string getGlobalLinkName(const GlobalVariable *GV) const;
 
+    /// EmitExternalGlobal - Emit the external reference to a global variable.
+    /// Should be overridden if an indirect reference should be used.
+    virtual void EmitExternalGlobal(const GlobalVariable *GV);
+
   protected:
     /// doInitialization - Set up the AsmPrinter when we are working on a new
     /// module.  If your pass overrides this, it must make sure to explicitly
@@ -204,6 +208,7 @@ namespace llvm {
 
     /// EOL - Print a newline character to asm stream.  If a comment is present
     /// then it will be printed first.  Comments should not contain '\n'.
+    void EOL() const;
     void EOL(const std::string &Comment) const;
     
     /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
index 771d64c..c5d1c31 100644 (file)
@@ -370,6 +370,14 @@ const std::string AsmPrinter::getGlobalLinkName(const GlobalVariable *GV) const{
   return LinkName;
 }
 
+/// EmitExternalGlobal - Emit the external reference to a global variable.
+/// Should be overridden if an indirect reference should be used.
+void AsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) {
+  O << getGlobalLinkName(GV);
+}
+
+
+
 //===----------------------------------------------------------------------===//
 /// LEB 128 number encoding.
 
@@ -440,6 +448,9 @@ void AsmPrinter::PrintHex(int Value) const {
 
 /// EOL - Print a newline character to asm stream.  If a comment is present
 /// then it will be printed first.  Comments should not contain '\n'.
+void AsmPrinter::EOL() const {
+  O << "\n";
+}
 void AsmPrinter::EOL(const std::string &Comment) const {
   if (AsmVerbose && !Comment.empty()) {
     O << "\t"
@@ -569,6 +580,7 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
   O << TAI->getAlignDirective() << NumBits << "\n";
 }
 
+    
 /// EmitZeros - Emit a block of zeros.
 ///
 void AsmPrinter::EmitZeros(uint64_t NumZeros) const {
index c3ae5c8..fc95227 100644 (file)
@@ -280,6 +280,8 @@ namespace {
     
     virtual bool runOnMachineFunction(MachineFunction &F) = 0;
     virtual bool doFinalization(Module &M) = 0;
+
+    virtual void EmitExternalGlobal(const GlobalVariable *GV);
   };
 
   /// LinuxAsmPrinter - PowerPC assembly printer, customized for Linux
@@ -401,6 +403,18 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
   }
 }
 
+/// EmitExternalGlobal - In this case we need to use the indirect symbol.
+///
+void PPCAsmPrinter::EmitExternalGlobal(const GlobalVariable *GV) {
+  std::string Name = getGlobalLinkName(GV);
+  if (TM.getRelocationModel() != Reloc::Static) {
+    GVStubs.insert(Name);
+    O << "L" << Name << "$non_lazy_ptr";
+    return;
+  }
+  O << Name;
+}
+
 /// PrintAsmOperand - Print out an operand for an inline asm expression.
 ///
 bool PPCAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,