[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h X86AsmPrinter.cpp X86AsmPrinter.h X86IntelAsmPrinter.cpp X86IntelAsmPrinter.h X86TargetMachine.h
Jim Laskey
jlaskey at apple.com
Thu Sep 7 15:07:04 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.59 -> 1.60
X86ATTAsmPrinter.h updated: 1.14 -> 1.15
X86AsmPrinter.cpp updated: 1.194 -> 1.195
X86AsmPrinter.h updated: 1.28 -> 1.29
X86IntelAsmPrinter.cpp updated: 1.53 -> 1.54
X86IntelAsmPrinter.h updated: 1.22 -> 1.23
X86TargetMachine.h updated: 1.38 -> 1.39
---
Log message:
Make target asm info a property of the target machine.
---
Diffs of the changes: (+15 -88)
X86ATTAsmPrinter.cpp | 2 +
X86ATTAsmPrinter.h | 2 -
X86AsmPrinter.cpp | 83 +------------------------------------------------
X86AsmPrinter.h | 7 ----
X86IntelAsmPrinter.cpp | 2 +
X86IntelAsmPrinter.h | 3 +
X86TargetMachine.h | 4 ++
7 files changed, 15 insertions(+), 88 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.59 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.60
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.59 Wed Sep 6 13:34:40 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Thu Sep 7 17:06:40 2006
@@ -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;
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.h
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.14 llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.15
--- llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.14 Wed Sep 6 13:34:40 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.h Thu Sep 7 17:06:40 2006
@@ -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 {
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.194 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.195
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.194 Thu Sep 7 07:23:47 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp Thu Sep 7 17:06:40 2006
@@ -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 @@
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());
}
}
Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.28 llvm/lib/Target/X86/X86AsmPrinter.h:1.29
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.28 Wed Sep 6 13:34:40 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Thu Sep 7 17:06:40 2006
@@ -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 @@
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>();
}
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.53 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.54
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.53 Wed Sep 6 13:34:40 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Thu Sep 7 17:06:40 2006
@@ -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;
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.h
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.22 llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.23
--- llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.22 Wed Sep 6 13:34:40 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.h Thu Sep 7 17:06:40 2006
@@ -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) {
}
Index: llvm/lib/Target/X86/X86TargetMachine.h
diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.38 llvm/lib/Target/X86/X86TargetMachine.h:1.39
--- llvm/lib/Target/X86/X86TargetMachine.h:1.38 Sun Sep 3 23:14:57 2006
+++ llvm/lib/Target/X86/X86TargetMachine.h Thu Sep 7 17:06:40 2006
@@ -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 @@
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);
More information about the llvm-commits
mailing list