llvm.org GIT mirror llvm / 32b952a
Reapply 56585:56589 with proper fix for some gcc versions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56621 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
12 changed file(s) with 224 addition(s) and 184 deletion(s). Raw diff Collapse all Expand all
2323 class Type;
2424 class Mangler;
2525
26 struct DarwinTargetAsmInfo: public virtual TargetAsmInfo {
26 struct DarwinTargetAsmInfo: public TargetAsmInfo {
2727 const Section* TextCoalSection;
2828 const Section* ConstDataCoalSection;
2929 const Section* ConstDataSection;
2222 class GlobalVariable;
2323 class Type;
2424
25 struct ELFTargetAsmInfo: public virtual TargetAsmInfo {
25 struct ELFTargetAsmInfo: public TargetAsmInfo {
2626 explicit ELFTargetAsmInfo(const TargetMachine &TM);
2727
2828 virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
123123 private:
124124 mutable StringMap
Sections;
125125 mutable SectionFlags::FlagsStringsMapType FlagsStrings;
126 void fillDefaultValues();
126127 protected:
127128 //===------------------------------------------------------------------===//
128129 // Properties to be set by the target writer, used to configure asm printer.
509510
510511 public:
511512 TargetAsmInfo();
513 TargetAsmInfo(const TargetMachine &TM);
512514 virtual ~TargetAsmInfo();
513515
514516 const Section* getNamedSection(const char *Name,
1616 #include
1717 using namespace llvm;
1818
19 static const char *const arm_asm_table[] = {
19 const char *const llvm::arm_asm_table[] = {
2020 "{r0}", "r0",
2121 "{r1}", "r1",
2222 "{r2}", "r2",
4141 "{cc}", "cc",
4242 0,0};
4343
44 ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
45 AsmTransCBE = arm_asm_table;
46
47 AlignmentIsInBytes = false;
48 Data64bitsDirective = 0;
49 CommentString = "@";
50 ConstantPoolSection = "\t.text\n";
51 COMMDirectiveTakesAlignment = false;
52 InlineAsmStart = "@ InlineAsm Start";
53 InlineAsmEnd = "@ InlineAsm End";
54 LCOMMDirective = "\t.lcomm\t";
55 }
44 // Instantiate 'common' cases.
45 TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo);
46 TEMPLATE_INSTANTIATION(
47 unsigned ARMTargetAsmInfo::getInlineAsmLength(const char*) const);
48 TEMPLATE_INSTANTIATION(
49 unsigned ARMTargetAsmInfo::countArguments(const char*) const);
50 TEMPLATE_INSTANTIATION(
51 unsigned ARMTargetAsmInfo::countString(const char*) const);
5652
5753 ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
58 ARMTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
54 ARMTargetAsmInfo(TM) {
5955 Subtarget = &DTM->getSubtarget();
6056
6157 GlobalPrefix = "_";
10399 }
104100
105101 ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMTargetMachine &TM):
106 ARMTargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
102 ARMTargetAsmInfo(TM) {
107103 Subtarget = &ETM->getSubtarget();
108104
109105 NeedsSet = false;
137133
138134 /// Count the number of comma-separated arguments.
139135 /// Do not try to detect errors.
140 unsigned ARMTargetAsmInfo::countArguments(const char* p) const {
136 template
137 unsigned ARMTargetAsmInfo::countArguments(const char* p) const {
141138 unsigned count = 0;
142139 while (*p && isspace(*p) && *p != '\n')
143140 p++;
144141 count++;
145 while (*p && *p!='\n' &&
146 strncmp(p, CommentString, strlen(CommentString))!=0) {
142 while (*p && *p!='\n' &&
143 strncmp(p, BaseTAI::CommentString,
144 strlen(BaseTAI::CommentString))!=0) {
147145 if (*p==',')
148146 count++;
149147 p++;
153151
154152 /// Count the length of a string enclosed in quote characters.
155153 /// Do not try to detect errors.
156 unsigned ARMTargetAsmInfo::countString(const char* p) const {
154 template
155 unsigned ARMTargetAsmInfo::countString(const char* p) const {
157156 unsigned count = 0;
158157 while (*p && isspace(*p) && *p!='\n')
159158 p++;
165164 }
166165
167166 /// ARM-specific version of TargetAsmInfo::getInlineAsmLength.
168 unsigned ARMTargetAsmInfo::getInlineAsmLength(const char *s) const {
167 template
168 unsigned ARMTargetAsmInfo::getInlineAsmLength(const char *s) const {
169169 // Make a lowercase-folded version of s for counting purposes.
170170 char *q, *s_copy = (char *)malloc(strlen(s) + 1);
171171 strcpy(s_copy, s);
191191 break;
192192 }
193193 // Ignore everything from comment char(s) to EOL
194 if (strncmp(Str, CommentString, strlen(CommentString))==-0)
194 if (strncmp(Str, BaseTAI::CommentString, strlen(BaseTAI::CommentString))==-0)
195195 atInsnStart = false;
196196 // FIXME do something like the following for non-Darwin
197197 else if (*Str == '.' && Subtarget->isTargetDarwin()) {
281281 Length += 4; // ARM
282282 }
283283 }
284 if (*Str == '\n' || *Str == SeparatorChar)
284 if (*Str == '\n' || *Str == BaseTAI::SeparatorChar)
285285 atInsnStart = true;
286286 }
287287 free(s_copy);
1313 #ifndef ARMTARGETASMINFO_H
1414 #define ARMTARGETASMINFO_H
1515
16 #include "ARMTargetMachine.h"
1617 #include "llvm/Target/TargetAsmInfo.h"
1718 #include "llvm/Target/ELFTargetAsmInfo.h"
1819 #include "llvm/Target/DarwinTargetAsmInfo.h"
19
20 #include "ARMSubtarget.h"
20 #include "llvm/Support/Compiler.h"
2121
2222 namespace llvm {
2323
24 // Forward declaration.
25 class ARMTargetMachine;
24 extern const char *const arm_asm_table[];
2625
27 struct ARMTargetAsmInfo : public virtual TargetAsmInfo {
28 explicit ARMTargetAsmInfo(const ARMTargetMachine &TM);
26 template
27 struct ARMTargetAsmInfo : public BaseTAI {
28 explicit ARMTargetAsmInfo(const ARMTargetMachine &TM):
29 BaseTAI(TM) {
30 BaseTAI::AsmTransCBE = arm_asm_table;
31
32 BaseTAI::AlignmentIsInBytes = false;
33 BaseTAI::Data64bitsDirective = 0;
34 BaseTAI::CommentString = "@";
35 BaseTAI::ConstantPoolSection = "\t.text\n";
36 BaseTAI::COMMDirectiveTakesAlignment = false;
37 BaseTAI::InlineAsmStart = "@ InlineAsm Start";
38 BaseTAI::InlineAsmEnd = "@ InlineAsm End";
39 BaseTAI::LCOMMDirective = "\t.lcomm\t";
40 }
2941
3042 const ARMSubtarget *Subtarget;
3143
3446 unsigned countString(const char *p) const;
3547 };
3648
37 struct ARMDarwinTargetAsmInfo : public virtual ARMTargetAsmInfo,
38 public virtual DarwinTargetAsmInfo {
49 typedef ARMTargetAsmInfo ARMGenericTargetAsmInfo;
50
51 EXTERN_TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo);
52
53 struct ARMDarwinTargetAsmInfo : public ARMTargetAsmInfo {
3954 explicit ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM);
4055 };
4156
42 struct ARMELFTargetAsmInfo : public virtual ARMTargetAsmInfo,
43 public virtual ELFTargetAsmInfo {
57 struct ARMELFTargetAsmInfo : public ARMTargetAsmInfo {
4458 explicit ARMELFTargetAsmInfo(const ARMTargetMachine &TM);
4559 };
4660
119119 case ARMSubtarget::isELF:
120120 return new ARMELFTargetAsmInfo(*this);
121121 default:
122 return new ARMTargetAsmInfo(*this);
122 return new ARMGenericTargetAsmInfo(*this);
123123 }
124124 }
125125
1818 using namespace llvm;
1919 using namespace llvm::dwarf;
2020
21 PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
22 bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
23
24 ZeroDirective = "\t.space\t";
25 SetDirective = "\t.set";
26 Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
27 AlignmentIsInBytes = false;
28 LCOMMDirective = "\t.lcomm\t";
29 InlineAsmStart = "# InlineAsm Start";
30 InlineAsmEnd = "# InlineAsm End";
31 AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor();
32 }
21 TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo);
3322
3423 PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
35 PPCTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
24 PPCTargetAsmInfo(TM) {
3625 PCSymbol = ".";
3726 CommentString = ";";
3827 GlobalPrefix = "_";
10291
10392
10493 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
105 PPCTargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
94 PPCTargetAsmInfo(TM) {
10695 CommentString = "#";
10796 GlobalPrefix = "";
10897 PrivateGlobalPrefix = "";
1313 #ifndef PPCTARGETASMINFO_H
1414 #define PPCTARGETASMINFO_H
1515
16 #include "PPCTargetMachine.h"
1617 #include "llvm/Target/TargetAsmInfo.h"
1718 #include "llvm/Target/DarwinTargetAsmInfo.h"
1819 #include "llvm/Target/ELFTargetAsmInfo.h"
20 #include "llvm/Support/Compiler.h"
1921
2022 namespace llvm {
2123
22 // Forward declaration.
23 class PPCTargetMachine;
24 template
25 struct PPCTargetAsmInfo : public BaseTAI {
26 explicit PPCTargetAsmInfo(const PPCTargetMachine &TM):
27 BaseTAI(TM) {
28 const PPCSubtarget *Subtarget = &TM.getSubtarget();
29 bool isPPC64 = Subtarget->isPPC64();
2430
25 struct PPCTargetAsmInfo : public virtual TargetAsmInfo {
26 explicit PPCTargetAsmInfo(const PPCTargetMachine &TM);
31 BaseTAI::ZeroDirective = "\t.space\t";
32 BaseTAI::SetDirective = "\t.set";
33 BaseTAI::Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
34 BaseTAI::AlignmentIsInBytes = false;
35 BaseTAI::LCOMMDirective = "\t.lcomm\t";
36 BaseTAI::InlineAsmStart = "# InlineAsm Start";
37 BaseTAI::InlineAsmEnd = "# InlineAsm End";
38 BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
39 }
2740 };
2841
29 struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo,
30 public DarwinTargetAsmInfo {
42 typedef PPCTargetAsmInfo PPCGenericTargetAsmInfo;
43
44 EXTERN_TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo);
45
46 struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo {
3147 explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
3248 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
3349 bool Global) const;
3450 };
3551
36 struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo,
37 public ELFTargetAsmInfo {
52 struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo {
3853 explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
3954 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
4055 bool Global) const;
2424
2525 using namespace llvm;
2626
27 TargetAsmInfo::TargetAsmInfo() :
28 TextSection(0),
29 DataSection(0),
30 BSSSection("\t.bss"),
31 BSSSection_(0),
32 ReadOnlySection(0),
33 SmallDataSection(0),
34 SmallBSSSection(0),
35 SmallRODataSection(0),
36 TLSDataSection(0),
37 TLSBSSSection(0),
38 ZeroFillDirective(0),
39 NonexecutableStackDirective(0),
40 NeedsSet(false),
41 MaxInstLength(4),
42 PCSymbol("$"),
43 SeparatorChar(';'),
44 CommentString("#"),
45 GlobalPrefix(""),
46 PrivateGlobalPrefix("."),
47 LessPrivateGlobalPrefix(""),
48 JumpTableSpecialLabelPrefix(0),
49 GlobalVarAddrPrefix(""),
50 GlobalVarAddrSuffix(""),
51 FunctionAddrPrefix(""),
52 FunctionAddrSuffix(""),
53 PersonalityPrefix(""),
54 PersonalitySuffix(""),
55 NeedsIndirectEncoding(false),
56 InlineAsmStart("#APP"),
57 InlineAsmEnd("#NO_APP"),
58 AssemblerDialect(0),
59 StringConstantPrefix(".str"),
60 ZeroDirective("\t.zero\t"),
61 ZeroDirectiveSuffix(0),
62 AsciiDirective("\t.ascii\t"),
63 AscizDirective("\t.asciz\t"),
64 Data8bitsDirective("\t.byte\t"),
65 Data16bitsDirective("\t.short\t"),
66 Data32bitsDirective("\t.long\t"),
67 Data64bitsDirective("\t.quad\t"),
68 AlignDirective("\t.align\t"),
69 AlignmentIsInBytes(true),
70 TextAlignFillValue(0),
71 SwitchToSectionDirective("\t.section\t"),
72 TextSectionStartSuffix(""),
73 DataSectionStartSuffix(""),
74 SectionEndDirectiveSuffix(0),
75 ConstantPoolSection("\t.section .rodata"),
76 JumpTableDataSection("\t.section .rodata"),
77 JumpTableDirective(0),
78 CStringSection(0),
79 CStringSection_(0),
80 StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
81 StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
82 GlobalDirective("\t.globl\t"),
83 SetDirective(0),
84 LCOMMDirective(0),
85 COMMDirective("\t.comm\t"),
86 COMMDirectiveTakesAlignment(true),
87 HasDotTypeDotSizeDirective(true),
88 UsedDirective(0),
89 WeakRefDirective(0),
90 WeakDefDirective(0),
91 HiddenDirective("\t.hidden\t"),
92 ProtectedDirective("\t.protected\t"),
93 AbsoluteDebugSectionOffsets(false),
94 AbsoluteEHSectionOffsets(false),
95 HasLEB128(false),
96 HasDotLocAndDotFile(false),
97 SupportsDebugInformation(false),
98 SupportsExceptionHandling(false),
99 DwarfRequiresFrameSection(true),
100 GlobalEHDirective(0),
101 SupportsWeakOmittedEHFrame(true),
102 DwarfSectionOffsetDirective(0),
103 DwarfAbbrevSection(".debug_abbrev"),
104 DwarfInfoSection(".debug_info"),
105 DwarfLineSection(".debug_line"),
106 DwarfFrameSection(".debug_frame"),
107 DwarfPubNamesSection(".debug_pubnames"),
108 DwarfPubTypesSection(".debug_pubtypes"),
109 DwarfStrSection(".debug_str"),
110 DwarfLocSection(".debug_loc"),
111 DwarfARangesSection(".debug_aranges"),
112 DwarfRangesSection(".debug_ranges"),
113 DwarfMacInfoSection(".debug_macinfo"),
114 DwarfEHFrameSection(".eh_frame"),
115 DwarfExceptionSection(".gcc_except_table"),
116 AsmTransCBE(0) {
27 void TargetAsmInfo::fillDefaultValues() {
28 BSSSection = "\t.bss";
29 BSSSection_ = 0;
30 ReadOnlySection = 0;
31 SmallDataSection = 0;
32 SmallBSSSection = 0;
33 SmallRODataSection = 0;
34 TLSDataSection = 0;
35 TLSBSSSection = 0;
36 ZeroFillDirective = 0;
37 NonexecutableStackDirective = 0;
38 NeedsSet = false;
39 MaxInstLength = 4;
40 PCSymbol = "$";
41 SeparatorChar = ';';
42 CommentString = "#";
43 GlobalPrefix = "";
44 PrivateGlobalPrefix = ".";
45 LessPrivateGlobalPrefix = "";
46 JumpTableSpecialLabelPrefix = 0;
47 GlobalVarAddrPrefix = "";
48 GlobalVarAddrSuffix = "";
49 FunctionAddrPrefix = "";
50 FunctionAddrSuffix = "";
51 PersonalityPrefix = "";
52 PersonalitySuffix = "";
53 NeedsIndirectEncoding = false;
54 InlineAsmStart = "#APP";
55 InlineAsmEnd = "#NO_APP";
56 AssemblerDialect = 0;
57 StringConstantPrefix = ".str";
58 ZeroDirective = "\t.zero\t";
59 ZeroDirectiveSuffix = 0;
60 AsciiDirective = "\t.ascii\t";
61 AscizDirective = "\t.asciz\t";
62 Data8bitsDirective = "\t.byte\t";
63 Data16bitsDirective = "\t.short\t";
64 Data32bitsDirective = "\t.long\t";
65 Data64bitsDirective = "\t.quad\t";
66 AlignDirective = "\t.align\t";
67 AlignmentIsInBytes = true;
68 TextAlignFillValue = 0;
69 SwitchToSectionDirective = "\t.section\t";
70 TextSectionStartSuffix = "";
71 DataSectionStartSuffix = "";
72 SectionEndDirectiveSuffix = 0;
73 ConstantPoolSection = "\t.section .rodata";
74 JumpTableDataSection = "\t.section .rodata";
75 JumpTableDirective = 0;
76 CStringSection = 0;
77 CStringSection_ = 0;
78 // FIXME: Flags are ELFish - replace with normal section stuff.
79 StaticCtorsSection = "\t.section .ctors,\"aw\",@progbits";
80 StaticDtorsSection = "\t.section .dtors,\"aw\",@progbits";
81 GlobalDirective = "\t.globl\t";
82 SetDirective = 0;
83 LCOMMDirective = 0;
84 COMMDirective = "\t.comm\t";
85 COMMDirectiveTakesAlignment = true;
86 HasDotTypeDotSizeDirective = true;
87 UsedDirective = 0;
88 WeakRefDirective = 0;
89 WeakDefDirective = 0;
90 // FIXME: These are ELFish - move to ELFTAI.
91 HiddenDirective = "\t.hidden\t";
92 ProtectedDirective = "\t.protected\t";
93 AbsoluteDebugSectionOffsets = false;
94 AbsoluteEHSectionOffsets = false;
95 HasLEB128 = false;
96 HasDotLocAndDotFile = false;
97 SupportsDebugInformation = false;
98 SupportsExceptionHandling = false;
99 DwarfRequiresFrameSection = true;
100 GlobalEHDirective = 0;
101 SupportsWeakOmittedEHFrame = true;
102 DwarfSectionOffsetDirective = 0;
103 DwarfAbbrevSection = ".debug_abbrev";
104 DwarfInfoSection = ".debug_info";
105 DwarfLineSection = ".debug_line";
106 DwarfFrameSection = ".debug_frame";
107 DwarfPubNamesSection = ".debug_pubnames";
108 DwarfPubTypesSection = ".debug_pubtypes";
109 DwarfStrSection = ".debug_str";
110 DwarfLocSection = ".debug_loc";
111 DwarfARangesSection = ".debug_aranges";
112 DwarfRangesSection = ".debug_ranges";
113 DwarfMacInfoSection = ".debug_macinfo";
114 DwarfEHFrameSection = ".eh_frame";
115 DwarfExceptionSection = ".gcc_except_table";
116 AsmTransCBE = 0;
117117 TextSection = getUnnamedSection("\t.text", SectionFlags::Code);
118118 DataSection = getUnnamedSection("\t.data", SectionFlags::Writeable);
119 }
120
121 TargetAsmInfo::TargetAsmInfo() {
122 fillDefaultValues();
123 }
124
125 TargetAsmInfo::TargetAsmInfo(const TargetMachine &TM) {
126 fillDefaultValues();
119127 }
120128
121129 TargetAsmInfo::~TargetAsmInfo() {
2424 using namespace llvm;
2525 using namespace llvm::dwarf;
2626
27 static const char *const x86_asm_table[] = {
28 "{si}", "S",
29 "{di}", "D",
30 "{ax}", "a",
31 "{cx}", "c",
32 "{memory}", "memory",
33 "{flags}", "",
34 "{dirflag}", "",
35 "{fpsr}", "",
36 "{cc}", "cc",
37 0,0};
38
39 X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
40 const X86Subtarget *Subtarget = &TM.getSubtarget();
41
42 AsmTransCBE = x86_asm_table;
43
44 AssemblerDialect = Subtarget->getAsmFlavor();
45 }
46
47 bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const {
27 const char *const llvm::x86_asm_table[] = {
28 "{si}", "S",
29 "{di}", "D",
30 "{ax}", "a",
31 "{cx}", "c",
32 "{memory}", "memory",
33 "{flags}", "",
34 "{dirflag}", "",
35 "{fpsr}", "",
36 "{cc}", "cc",
37 0,0};
38
39 TEMPLATE_INSTANTIATION(class X86TargetAsmInfo);
40 TEMPLATE_INSTANTIATION(
41 bool X86TargetAsmInfo::ExpandInlineAsm(CallInst*) const);
42 TEMPLATE_INSTANTIATION(
43 bool X86TargetAsmInfo::LowerToBSwap(CallInst*) const);
44
45 template
46 bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const {
4847 // FIXME: this should verify that we are targetting a 486 or better. If not,
4948 // we will turn this bswap into something that will be lowered to logical ops
5049 // instead of emitting the bswap asm. For now, we don't support 486 or lower
7372 return true;
7473 }
7574
76 bool X86TargetAsmInfo::ExpandInlineAsm(CallInst *CI) const {
75 template
76 bool X86TargetAsmInfo::ExpandInlineAsm(CallInst *CI) const {
7777 InlineAsm *IA = cast(CI->getCalledValue());
7878 std::vector Constraints = IA->ParseConstraints();
7979
124124 }
125125
126126 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
127 X86TargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
127 X86TargetAsmInfo(TM) {
128128 const X86Subtarget* Subtarget = &DTM->getSubtarget();
129129 bool is64Bit = Subtarget->is64Bit();
130130
224224 }
225225
226226 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
227 X86TargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
227 X86TargetAsmInfo(TM) {
228228
229229 CStringSection = ".rodata.str";
230230 PrivateGlobalPrefix = ".L";
301301 }
302302
303303 X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM):
304 X86TargetAsmInfo(TM) {
304 X86GenericTargetAsmInfo(TM) {
305305 X86TM = &TM;
306306
307307 GlobalPrefix = "_";
407407 }
408408
409409 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
410 X86TargetAsmInfo(TM) {
410 X86GenericTargetAsmInfo(TM) {
411411 GlobalPrefix = "_";
412412 CommentString = ";";
413413
1313 #ifndef X86TARGETASMINFO_H
1414 #define X86TARGETASMINFO_H
1515
16 #include "X86TargetMachine.h"
1617 #include "llvm/Target/TargetAsmInfo.h"
1718 #include "llvm/Target/ELFTargetAsmInfo.h"
1819 #include "llvm/Target/DarwinTargetAsmInfo.h"
20 #include "llvm/Support/Compiler.h"
1921
2022 namespace llvm {
2123
22 // Forward declaration.
23 class X86TargetMachine;
24 extern const char *const x86_asm_table[];
2425
25 struct X86TargetAsmInfo : public virtual TargetAsmInfo {
26 explicit X86TargetAsmInfo(const X86TargetMachine &TM);
26 template
27 struct X86TargetAsmInfo : public BaseTAI {
28 explicit X86TargetAsmInfo(const X86TargetMachine &TM):
29 BaseTAI(TM) {
30 const X86Subtarget *Subtarget = &TM.getSubtarget();
31
32 BaseTAI::AsmTransCBE = x86_asm_table;
33 BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
34 }
2735
2836 virtual bool ExpandInlineAsm(CallInst *CI) const;
2937
3139 bool LowerToBSwap(CallInst *CI) const;
3240 };
3341
34 struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo,
35 public DarwinTargetAsmInfo {
42 typedef X86TargetAsmInfo X86GenericTargetAsmInfo;
43
44 EXTERN_TEMPLATE_INSTANTIATION(class X86TargetAsmInfo);
45
46 struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo {
3647 explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
3748 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
3849 bool Global) const;
3950 };
4051
41 struct X86ELFTargetAsmInfo : public X86TargetAsmInfo,
42 public ELFTargetAsmInfo {
52 struct X86ELFTargetAsmInfo : public X86TargetAsmInfo {
4353 explicit X86ELFTargetAsmInfo(const X86TargetMachine &TM);
4454 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
4555 bool Global) const;
4656 };
4757
48 struct X86COFFTargetAsmInfo : public X86TargetAsmInfo {
58 struct X86COFFTargetAsmInfo : public X86GenericTargetAsmInfo {
4959 explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);
5060 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
5161 bool Global) const;
5666 const X86TargetMachine *X86TM;
5767 };
5868
59 struct X86WinTargetAsmInfo : public X86TargetAsmInfo {
69 struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo {
6070 explicit X86WinTargetAsmInfo(const X86TargetMachine &TM);
6171 };
72
6273 } // namespace llvm
6374
6475 #endif
76
5353 case X86Subtarget::isWindows:
5454 return new X86WinTargetAsmInfo(*this);
5555 default:
56 return new X86TargetAsmInfo(*this);
56 return new X86GenericTargetAsmInfo(*this);
5757 }
5858 }
5959