diff options
| author | Jim Laskey <jlaskey@mac.com> | 2006-09-07 22:06:40 +0000 | 
|---|---|---|
| committer | Jim Laskey <jlaskey@mac.com> | 2006-09-07 22:06:40 +0000 | 
| commit | a0f3d17daac73c9c71aad497b298cbe82848f726 (patch) | |
| tree | 66926558c3c809eb673cc06c4bd7a2cc9d0cec7a /lib/Target | |
| parent | 8e8de8f7765a08ab3aa4f48b302cf19ccb9740e2 (diff) | |
| download | external_llvm-a0f3d17daac73c9c71aad497b298cbe82848f726.zip external_llvm-a0f3d17daac73c9c71aad497b298cbe82848f726.tar.gz external_llvm-a0f3d17daac73c9c71aad497b298cbe82848f726.tar.bz2 | |
Make target asm info a property of the target machine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30162 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
| -rw-r--r-- | lib/Target/ARM/ARMAsmPrinter.cpp | 17 | ||||
| -rw-r--r-- | lib/Target/ARM/ARMTargetMachine.h | 5 | ||||
| -rw-r--r-- | lib/Target/Alpha/AlphaAsmPrinter.cpp | 12 | ||||
| -rw-r--r-- | lib/Target/Alpha/AlphaTargetMachine.cpp | 3 | ||||
| -rw-r--r-- | lib/Target/Alpha/AlphaTargetMachine.h | 9 | ||||
| -rw-r--r-- | lib/Target/IA64/IA64AsmPrinter.cpp | 27 | ||||
| -rw-r--r-- | lib/Target/IA64/IA64TargetMachine.h | 5 | ||||
| -rw-r--r-- | lib/Target/PowerPC/PPCAsmPrinter.cpp | 44 | ||||
| -rw-r--r-- | lib/Target/PowerPC/PPCTargetMachine.h | 4 | ||||
| -rw-r--r-- | lib/Target/Sparc/SparcAsmPrinter.cpp | 16 | ||||
| -rw-r--r-- | lib/Target/Sparc/SparcTargetMachine.h | 4 | ||||
| -rw-r--r-- | lib/Target/TargetMachine.cpp | 2 | ||||
| -rwxr-xr-x | lib/Target/X86/X86ATTAsmPrinter.cpp | 2 | ||||
| -rwxr-xr-x | lib/Target/X86/X86ATTAsmPrinter.h | 2 | ||||
| -rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 83 | ||||
| -rwxr-xr-x | lib/Target/X86/X86AsmPrinter.h | 7 | ||||
| -rwxr-xr-x | lib/Target/X86/X86IntelAsmPrinter.cpp | 2 | ||||
| -rwxr-xr-x | lib/Target/X86/X86IntelAsmPrinter.h | 3 | ||||
| -rw-r--r-- | lib/Target/X86/X86TargetMachine.h | 4 | 
19 files changed, 59 insertions, 192 deletions
| diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index 98c3790..2a0c404 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -38,20 +38,8 @@ using namespace llvm;  namespace {    Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); -  struct VISIBILITY_HIDDEN ARMTargetAsmInfo : public TargetAsmInfo { -    ARMTargetAsmInfo() { -      Data16bitsDirective = "\t.half\t"; -      Data32bitsDirective = "\t.word\t"; -      Data64bitsDirective = 0; -      ZeroDirective = "\t.skip\t"; -      CommentString = "@"; -      ConstantPoolSection = "\t.text\n"; -      AlignmentIsInBytes = false; -    } -  }; -    struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter { -    ARMAsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T) +    ARMAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)        : AsmPrinter(O, TM, T) {      } @@ -113,8 +101,7 @@ namespace {  ///  FunctionPass *llvm::createARMCodePrinterPass(std::ostream &o,                                                 TargetMachine &tm) { -  ARMTargetAsmInfo *TAI = new ARMTargetAsmInfo(); -  return new ARMAsmPrinter(o, tm, TAI); +  return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo());  }  /// runOnMachineFunction - This uses the printMachineInstruction() diff --git a/lib/Target/ARM/ARMTargetMachine.h b/lib/Target/ARM/ARMTargetMachine.h index f09b92b..bf8deba 100644 --- a/lib/Target/ARM/ARMTargetMachine.h +++ b/lib/Target/ARM/ARMTargetMachine.h @@ -20,6 +20,7 @@  #include "llvm/Target/TargetFrameInfo.h"  #include "ARMInstrInfo.h"  #include "ARMFrameInfo.h" +#include "ARMTargetAsmInfo.h"  namespace llvm { @@ -40,6 +41,10 @@ public:    virtual const TargetData       *getTargetData() const { return &DataLayout; }    static unsigned getModuleMatchQuality(const Module &M); +  virtual const TargetAsmInfo *createTargetAsmInfo() const { +    return static_cast<const TargetAsmInfo *>(new ARMTargetAsmInfo(*this)); +  } +    // Pass Pipeline Configuration    virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);    virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,  diff --git a/lib/Target/Alpha/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AlphaAsmPrinter.cpp index d709ed7..2ce4865 100644 --- a/lib/Target/Alpha/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AlphaAsmPrinter.cpp @@ -29,20 +29,13 @@ using namespace llvm;  namespace {    Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); -  struct VISIBILITY_HIDDEN AlphaTargetAsmInfo : public TargetAsmInfo { -    AlphaTargetAsmInfo() { -      AlignmentIsInBytes = false; -      PrivateGlobalPrefix = "$"; -    } -  }; -    struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter {      /// Unique incrementer for label values for referencing Global values.      ///      unsigned LabelNumber; -    AlphaAsmPrinter(std::ostream &o, TargetMachine &tm, TargetAsmInfo *T) +    AlphaAsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T)         : AsmPrinter(o, tm, T), LabelNumber(0) {      } @@ -82,8 +75,7 @@ namespace {  ///  FunctionPass *llvm::createAlphaCodePrinterPass (std::ostream &o,                                                    TargetMachine &tm) { -  AlphaTargetAsmInfo *TAI = new AlphaTargetAsmInfo(); -  return new AlphaAsmPrinter(o, tm, TAI); +  return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo());  }  #include "AlphaGenAsmWriter.inc" diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index 9c9f52d..cbe0cdb 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/lib/Target/Alpha/AlphaTargetMachine.cpp @@ -53,7 +53,8 @@ AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS)    : DataLayout("e"),      FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),      JITInfo(*this), -    Subtarget(M, FS) { +    Subtarget(M, FS), +    AsmInfo(NULL) {  } diff --git a/lib/Target/Alpha/AlphaTargetMachine.h b/lib/Target/Alpha/AlphaTargetMachine.h index d71c7ce..d47ca82 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.h +++ b/lib/Target/Alpha/AlphaTargetMachine.h @@ -20,6 +20,7 @@  #include "AlphaInstrInfo.h"  #include "AlphaJITInfo.h"  #include "AlphaSubtarget.h" +#include "AlphaTargetAsmInfo.h"  namespace llvm { @@ -31,9 +32,13 @@ class AlphaTargetMachine : public LLVMTargetMachine {    TargetFrameInfo FrameInfo;    AlphaJITInfo JITInfo;    AlphaSubtarget Subtarget; +  AlphaTargetAsmInfo *AsmInfo;  public:    AlphaTargetMachine(const Module &M, const std::string &FS); +  ~AlphaTargetMachine() { +    if (AsmInfo) delete AsmInfo; +  }    virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }    virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; } @@ -46,6 +51,10 @@ public:      return &JITInfo;    } +  virtual const TargetAsmInfo *createTargetAsmInfo() const { +    return static_cast<const TargetAsmInfo *>(new AlphaTargetAsmInfo(*this)); +  } +    static unsigned getJITMatchQuality();    static unsigned getModuleMatchQuality(const Module &M); diff --git a/lib/Target/IA64/IA64AsmPrinter.cpp b/lib/Target/IA64/IA64AsmPrinter.cpp index 1de1215..4a16777 100644 --- a/lib/Target/IA64/IA64AsmPrinter.cpp +++ b/lib/Target/IA64/IA64AsmPrinter.cpp @@ -23,8 +23,8 @@  #include "llvm/Assembly/Writer.h"  #include "llvm/CodeGen/AsmPrinter.h"  #include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/Target/TargetMachine.h"  #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetMachine.h"  #include "llvm/Support/Mangler.h"  #include "llvm/ADT/Statistic.h"  #include <iostream> @@ -32,31 +32,11 @@ using namespace llvm;  namespace {    Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); - -  struct VISIBILITY_HIDDEN IA64TargetAsmInfo : public TargetAsmInfo { -    IA64TargetAsmInfo() { -      CommentString = "//"; -      Data8bitsDirective = "\tdata1\t";     // FIXME: check that we are -      Data16bitsDirective = "\tdata2.ua\t"; // disabling auto-alignment -      Data32bitsDirective = "\tdata4.ua\t"; // properly -      Data64bitsDirective = "\tdata8.ua\t"; -      ZeroDirective = "\t.skip\t"; -      AsciiDirective = "\tstring\t"; - -      GlobalVarAddrPrefix=""; -      GlobalVarAddrSuffix=""; -      FunctionAddrPrefix="@fptr("; -      FunctionAddrSuffix=")"; -       -      // FIXME: would be nice to have rodata (no 'w') when appropriate? -      ConstantPoolSection = "\n\t.section .data, \"aw\", \"progbits\"\n"; -    } -  };    struct IA64AsmPrinter : public AsmPrinter {      std::set<std::string> ExternalFunctionNames, ExternalObjectNames; -    IA64AsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T) +    IA64AsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)        : AsmPrinter(O, TM, T) {      } @@ -366,8 +346,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) {  ///  FunctionPass *llvm::createIA64CodePrinterPass(std::ostream &o,                                                IA64TargetMachine &tm) { -  IA64TargetAsmInfo *TAI = new IA64TargetAsmInfo(); -  return new IA64AsmPrinter(o, tm, TAI); +  return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo());  } diff --git a/lib/Target/IA64/IA64TargetMachine.h b/lib/Target/IA64/IA64TargetMachine.h index 5a4b6b6..61ac05f 100644 --- a/lib/Target/IA64/IA64TargetMachine.h +++ b/lib/Target/IA64/IA64TargetMachine.h @@ -19,6 +19,7 @@  #include "llvm/Target/TargetFrameInfo.h"  #include "IA64InstrInfo.h"  #include "IA64ISelLowering.h" +#include "IA64TargetAsmInfo.h"  namespace llvm { @@ -40,6 +41,10 @@ public:      return &InstrInfo.getRegisterInfo();    }    virtual const TargetData       *getTargetData() const { return &DataLayout; } +   +  virtual const TargetAsmInfo *createTargetAsmInfo() const { +    return static_cast<const TargetAsmInfo *>(new IA64TargetAsmInfo(*this)); +  }    static unsigned getModuleMatchQuality(const Module &M); diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 9ec7106..b50fc45 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -50,7 +50,7 @@ namespace {    struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter {      std::set<std::string> FnStubs, GVStubs; -    PPCAsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T) +    PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)        : AsmPrinter(O, TM, T) {}      virtual const char *getPassName() const { @@ -239,49 +239,14 @@ namespace {    }; -  struct VISIBILITY_HIDDEN DarwinTargetAsmInfo : public TargetAsmInfo { -    DarwinTargetAsmInfo(PPCTargetMachine &TM) { -      bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); - -      CommentString = ";"; -      GlobalPrefix = "_"; -      PrivateGlobalPrefix = "L"; -      ZeroDirective = "\t.space\t"; -      SetDirective = "\t.set"; -      Data64bitsDirective = isPPC64 ? ".quad\t" : 0;   -      AlignmentIsInBytes = false; -      ConstantPoolSection = "\t.const\t"; -      JumpTableDataSection = ".const"; -      JumpTableTextSection = "\t.text"; -      LCOMMDirective = "\t.lcomm\t"; -      StaticCtorsSection = ".mod_init_func"; -      StaticDtorsSection = ".mod_term_func"; -      InlineAsmStart = "# InlineAsm Start"; -      InlineAsmEnd = "# InlineAsm End"; -       -      NeedsSet = true; -      AddressSize = isPPC64 ? 8 : 4; -      DwarfAbbrevSection = ".section __DWARF,__debug_abbrev"; -      DwarfInfoSection = ".section __DWARF,__debug_info"; -      DwarfLineSection = ".section __DWARF,__debug_line"; -      DwarfFrameSection = ".section __DWARF,__debug_frame"; -      DwarfPubNamesSection = ".section __DWARF,__debug_pubnames"; -      DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes"; -      DwarfStrSection = ".section __DWARF,__debug_str"; -      DwarfLocSection = ".section __DWARF,__debug_loc"; -      DwarfARangesSection = ".section __DWARF,__debug_aranges"; -      DwarfRangesSection = ".section __DWARF,__debug_ranges"; -      DwarfMacInfoSection = ".section __DWARF,__debug_macinfo"; -    } -  }; -    /// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS    /// X    struct VISIBILITY_HIDDEN DarwinAsmPrinter : public PPCAsmPrinter {      DwarfWriter DW; -    DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM, TargetAsmInfo *T) +    DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM, +                     const TargetAsmInfo *T)        : PPCAsmPrinter(O, TM, T), DW(O, this, T) {        bool isPPC64 = TM.getSubtargetImpl()->isPPC64();      } @@ -309,8 +274,7 @@ namespace {  ///  FunctionPass *llvm::createDarwinCodePrinterPass(std::ostream &o,                                                  PPCTargetMachine &tm) { -  TargetAsmInfo *TAI = new DarwinTargetAsmInfo(tm); -  return new DarwinAsmPrinter(o, tm, TAI); +  return new DarwinAsmPrinter(o, tm, tm.getTargetAsmInfo());  }  // Include the auto-generated portion of the assembly writer diff --git a/lib/Target/PowerPC/PPCTargetMachine.h b/lib/Target/PowerPC/PPCTargetMachine.h index 9a77a4f..d11f015 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.h +++ b/lib/Target/PowerPC/PPCTargetMachine.h @@ -19,6 +19,7 @@  #include "PPCJITInfo.h"  #include "PPCInstrInfo.h"  #include "PPCISelLowering.h" +#include "PPCTargetAsmInfo.h"  #include "llvm/Target/TargetMachine.h"  #include "llvm/Target/TargetData.h" @@ -55,6 +56,9 @@ public:      return InstrItins;    } +  virtual const TargetAsmInfo *createTargetAsmInfo() const { +    return static_cast<const TargetAsmInfo *>(new DarwinTargetAsmInfo(*this)); +  }    // Pass Pipeline Configuration    virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index 2bc6f63..1e6efcb 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -37,19 +37,8 @@ using namespace llvm;  namespace {    Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); -  struct VISIBILITY_HIDDEN SparcTargetAsmInfo : public TargetAsmInfo { -    SparcTargetAsmInfo() { -      Data16bitsDirective = "\t.half\t"; -      Data32bitsDirective = "\t.word\t"; -      Data64bitsDirective = 0;  // .xword is only supported by V9. -      ZeroDirective = "\t.skip\t"; -      CommentString = "!"; -      ConstantPoolSection = "\t.section \".rodata\",#alloc\n"; -    } -  }; -    struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter { -    SparcAsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T) +    SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)        : AsmPrinter(O, TM, T) {      } @@ -85,8 +74,7 @@ namespace {  ///  FunctionPass *llvm::createSparcCodePrinterPass(std::ostream &o,                                                 TargetMachine &tm) { -  SparcTargetAsmInfo *TAI = new SparcTargetAsmInfo(); -  return new SparcAsmPrinter(o, tm, TAI); +  return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo());  }  /// runOnMachineFunction - This uses the printMachineInstruction() diff --git a/lib/Target/Sparc/SparcTargetMachine.h b/lib/Target/Sparc/SparcTargetMachine.h index e377afa..995d346 100644 --- a/lib/Target/Sparc/SparcTargetMachine.h +++ b/lib/Target/Sparc/SparcTargetMachine.h @@ -19,6 +19,7 @@  #include "llvm/Target/TargetFrameInfo.h"  #include "SparcInstrInfo.h"  #include "SparcSubtarget.h" +#include "SparcTargetAsmInfo.h"  namespace llvm { @@ -41,6 +42,9 @@ public:    virtual const TargetData       *getTargetData() const { return &DataLayout; }    static unsigned getModuleMatchQuality(const Module &M); +  virtual const TargetAsmInfo *createTargetAsmInfo() const { +    return static_cast<const TargetAsmInfo *>(new SparcTargetAsmInfo(*this)); +  }    // Pass Pipeline Configuration    virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 3a9c8b3..3ca64c4 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -11,6 +11,7 @@  //  //===----------------------------------------------------------------------===// +#include "llvm/Target/TargetAsmInfo.h"  #include "llvm/Target/TargetMachine.h"  #include "llvm/Target/TargetOptions.h"  #include "llvm/Support/CommandLine.h" @@ -95,6 +96,7 @@ namespace {  //  TargetMachine::~TargetMachine() { +  if (AsmInfo) delete AsmInfo;  }  /// getRelocationModel - Returns the code generation relocation model. The diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index 6c54d69..e3653e4 100755 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -16,8 +16,10 @@  #include "X86ATTAsmPrinter.h"  #include "X86.h"  #include "X86TargetMachine.h" +#include "X86TargetAsmInfo.h"  #include "llvm/Module.h"  #include "llvm/Support/Mangler.h" +#include "llvm/Target/TargetAsmInfo.h"  #include "llvm/Target/TargetOptions.h"  #include <iostream>  using namespace llvm; diff --git a/lib/Target/X86/X86ATTAsmPrinter.h b/lib/Target/X86/X86ATTAsmPrinter.h index e060150..ff707ca 100755 --- a/lib/Target/X86/X86ATTAsmPrinter.h +++ b/lib/Target/X86/X86ATTAsmPrinter.h @@ -20,7 +20,7 @@  namespace llvm {  struct X86ATTAsmPrinter : public X86SharedAsmPrinter { - X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, TargetAsmInfo *T) + X86ATTAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T)      : X86SharedAsmPrinter(O, TM, T) { }    virtual const char *getPassName() const { diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 2e32f34..4a54e59 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -23,88 +23,12 @@  #include "llvm/Type.h"  #include "llvm/Assembly/Writer.h"  #include "llvm/Support/Mangler.h" +#include "llvm/Target/TargetAsmInfo.h"  using namespace llvm;  Statistic<> llvm::EmittedInsts("asm-printer",                                 "Number of machine instrs printed"); -X86TargetAsmInfo::X86TargetAsmInfo(X86TargetMachine &TM) { -  const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>(); -   -  //FIXME - Should to be simplified. -    -  switch (Subtarget->TargetType) { -  case X86Subtarget::isDarwin: -    AlignmentIsInBytes = false; -    GlobalPrefix = "_"; -    Data64bitsDirective = 0;       // we can't emit a 64-bit unit -    ZeroDirective = "\t.space\t";  // ".space N" emits N zeros. -    PrivateGlobalPrefix = "L";     // Marker for constant pool idxs -    ConstantPoolSection = "\t.const\n"; -    JumpTableDataSection = "\t.const\n"; // FIXME: depends on PIC mode -    FourByteConstantSection = "\t.literal4\n"; -    EightByteConstantSection = "\t.literal8\n"; -    LCOMMDirective = "\t.lcomm\t"; -    COMMDirectiveTakesAlignment = false; -    HasDotTypeDotSizeDirective = false; -    StaticCtorsSection = ".mod_init_func"; -    StaticDtorsSection = ".mod_term_func"; -    InlineAsmStart = "# InlineAsm Start"; -    InlineAsmEnd = "# InlineAsm End"; -    SetDirective = "\t.set"; -     -    NeedsSet = true; -    DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; -    DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; -    DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; -    DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; -    DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; -    DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; -    DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; -    DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug"; -    DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug"; -    DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; -    DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; -    break; -  case X86Subtarget::isCygwin: -    GlobalPrefix = "_"; -    COMMDirectiveTakesAlignment = false; -    HasDotTypeDotSizeDirective = false; -    StaticCtorsSection = "\t.section .ctors,\"aw\""; -    StaticDtorsSection = "\t.section .dtors,\"aw\""; -    break; -  case X86Subtarget::isWindows: -    GlobalPrefix = "_"; -    HasDotTypeDotSizeDirective = false; -    break; -  default: break; -  } -   -  if (Subtarget->isFlavorIntel()) { -    GlobalPrefix = "_"; -    CommentString = ";"; -   -    PrivateGlobalPrefix = "$"; -    AlignDirective = "\talign\t"; -    ZeroDirective = "\tdb\t"; -    ZeroDirectiveSuffix = " dup(0)"; -    AsciiDirective = "\tdb\t"; -    AscizDirective = 0; -    Data8bitsDirective = "\tdb\t"; -    Data16bitsDirective = "\tdw\t"; -    Data32bitsDirective = "\tdd\t"; -    Data64bitsDirective = "\tdq\t"; -    HasDotTypeDotSizeDirective = false; -     -    TextSection = "_text"; -    DataSection = "_data"; -    SwitchToSectionDirective = ""; -    TextSectionStartSuffix = "\tsegment 'CODE'"; -    DataSectionStartSuffix = "\tsegment 'DATA'"; -    SectionEndDirectiveSuffix = "\tends\n"; -  } -} -  /// doInitialization  bool X86SharedAsmPrinter::doInitialization(Module &M) {      if (Subtarget->isTargetDarwin()) { @@ -255,11 +179,10 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {  FunctionPass *llvm::createX86CodePrinterPass(std::ostream &o,                                               X86TargetMachine &tm) {    const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>(); -  TargetAsmInfo *TAI = new X86TargetAsmInfo(tm);    if (Subtarget->isFlavorIntel()) { -    return new X86IntelAsmPrinter(o, tm, TAI); +    return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo());    } else { -    return new X86ATTAsmPrinter(o, tm, TAI); +    return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo());    }  } diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h index aa8129b..8d32f59 100755 --- a/lib/Target/X86/X86AsmPrinter.h +++ b/lib/Target/X86/X86AsmPrinter.h @@ -22,7 +22,6 @@  #include "llvm/CodeGen/DwarfWriter.h"  #include "llvm/CodeGen/MachineDebugInfo.h"  #include "llvm/ADT/Statistic.h" -#include "llvm/Target/TargetAsmInfo.h"  #include <set> @@ -30,15 +29,11 @@ namespace llvm {  extern Statistic<> EmittedInsts; -struct VISIBILITY_HIDDEN X86TargetAsmInfo : public TargetAsmInfo { -  X86TargetAsmInfo(X86TargetMachine &TM); -}; -  struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter {    DwarfWriter DW;    X86SharedAsmPrinter(std::ostream &O, X86TargetMachine &TM, -                      TargetAsmInfo *T) +                      const TargetAsmInfo *T)      : AsmPrinter(O, TM, T), DW(O, this, T) {      Subtarget = &TM.getSubtarget<X86Subtarget>();    } diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index 7be50e7..ddf807f 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -14,11 +14,13 @@  //===----------------------------------------------------------------------===//  #include "X86IntelAsmPrinter.h" +#include "X86TargetAsmInfo.h"  #include "X86.h"  #include "llvm/Constants.h"  #include "llvm/Module.h"  #include "llvm/Assembly/Writer.h"  #include "llvm/Support/Mangler.h" +#include "llvm/Target/TargetAsmInfo.h"  #include "llvm/Target/TargetOptions.h"  using namespace llvm; diff --git a/lib/Target/X86/X86IntelAsmPrinter.h b/lib/Target/X86/X86IntelAsmPrinter.h index 8e0e8ba..ef0af2a 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.h +++ b/lib/Target/X86/X86IntelAsmPrinter.h @@ -21,7 +21,8 @@  namespace llvm {  struct X86IntelAsmPrinter : public X86SharedAsmPrinter { -  X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM, TargetAsmInfo *T) +  X86IntelAsmPrinter(std::ostream &O, X86TargetMachine &TM, +                     const TargetAsmInfo *T)        : X86SharedAsmPrinter(O, TM, T) {    } diff --git a/lib/Target/X86/X86TargetMachine.h b/lib/Target/X86/X86TargetMachine.h index 9b50c7e..0bbef05 100644 --- a/lib/Target/X86/X86TargetMachine.h +++ b/lib/Target/X86/X86TargetMachine.h @@ -21,6 +21,7 @@  #include "X86InstrInfo.h"  #include "X86JITInfo.h"  #include "X86Subtarget.h" +#include "X86TargetAsmInfo.h"  #include "X86ISelLowering.h"  namespace llvm { @@ -50,6 +51,9 @@ public:    static unsigned getModuleMatchQuality(const Module &M);    static unsigned getJITMatchQuality(); +  virtual const TargetAsmInfo *createTargetAsmInfo() const { +    return static_cast<const TargetAsmInfo *>(new X86TargetAsmInfo(*this)); +  }    // Set up the pass pipeline.    virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);   | 
