llvm.org GIT mirror llvm / 688535e
Temporarily backing out 56585:56589 to unbreak the build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56607 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 11 years ago
12 changed file(s) with 184 addition(s) and 213 deletion(s). Raw diff Collapse all Expand all
2323 class Type;
2424 class Mangler;
2525
26 struct DarwinTargetAsmInfo: public TargetAsmInfo {
26 struct DarwinTargetAsmInfo: public virtual TargetAsmInfo {
2727 const Section* TextCoalSection;
2828 const Section* ConstDataCoalSection;
2929 const Section* ConstDataSection;
2222 class GlobalVariable;
2323 class Type;
2424
25 struct ELFTargetAsmInfo: public TargetAsmInfo {
25 struct ELFTargetAsmInfo: public virtual 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();
127126 protected:
128127 //===------------------------------------------------------------------===//
129128 // Properties to be set by the target writer, used to configure asm printer.
510509
511510 public:
512511 TargetAsmInfo();
513 TargetAsmInfo(const TargetMachine &TM);
514512 virtual ~TargetAsmInfo();
515513
516514 const Section* getNamedSection(const char *Name,
1616 #include
1717 using namespace llvm;
1818
19 const char *const llvm::arm_asm_table[] = {
19 static const char *const arm_asm_table[] = {
2020 "{r0}", "r0",
2121 "{r1}", "r1",
2222 "{r2}", "r2",
4141 "{cc}", "cc",
4242 0,0};
4343
44 TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo);
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 }
4556
4657 ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
47 ARMTargetAsmInfo(TM) {
58 ARMTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
4859 Subtarget = &DTM->getSubtarget();
4960
5061 GlobalPrefix = "_";
92103 }
93104
94105 ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMTargetMachine &TM):
95 ARMTargetAsmInfo(TM) {
106 ARMTargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
96107 Subtarget = &ETM->getSubtarget();
97108
98109 NeedsSet = false;
126137
127138 /// Count the number of comma-separated arguments.
128139 /// Do not try to detect errors.
129 template
130 unsigned ARMTargetAsmInfo::countArguments(const char* p) const {
140 unsigned ARMTargetAsmInfo::countArguments(const char* p) const {
131141 unsigned count = 0;
132142 while (*p && isspace(*p) && *p != '\n')
133143 p++;
134144 count++;
135 while (*p && *p!='\n' &&
136 strncmp(p, BaseTAI::CommentString,
137 strlen(BaseTAI::CommentString))!=0) {
145 while (*p && *p!='\n' &&
146 strncmp(p, CommentString, strlen(CommentString))!=0) {
138147 if (*p==',')
139148 count++;
140149 p++;
144153
145154 /// Count the length of a string enclosed in quote characters.
146155 /// Do not try to detect errors.
147 template
148 unsigned ARMTargetAsmInfo::countString(const char* p) const {
156 unsigned ARMTargetAsmInfo::countString(const char* p) const {
149157 unsigned count = 0;
150158 while (*p && isspace(*p) && *p!='\n')
151159 p++;
157165 }
158166
159167 /// ARM-specific version of TargetAsmInfo::getInlineAsmLength.
160 template
161 unsigned ARMTargetAsmInfo::getInlineAsmLength(const char *s) const {
168 unsigned ARMTargetAsmInfo::getInlineAsmLength(const char *s) const {
162169 // Make a lowercase-folded version of s for counting purposes.
163170 char *q, *s_copy = (char *)malloc(strlen(s) + 1);
164171 strcpy(s_copy, s);
184191 break;
185192 }
186193 // Ignore everything from comment char(s) to EOL
187 if (strncmp(Str, BaseTAI::CommentString, strlen(BaseTAI::CommentString))==-0)
194 if (strncmp(Str, CommentString, strlen(CommentString))==-0)
188195 atInsnStart = false;
189196 // FIXME do something like the following for non-Darwin
190197 else if (*Str == '.' && Subtarget->isTargetDarwin()) {
274281 Length += 4; // ARM
275282 }
276283 }
277 if (*Str == '\n' || *Str == BaseTAI::SeparatorChar)
284 if (*Str == '\n' || *Str == SeparatorChar)
278285 atInsnStart = true;
279286 }
280287 free(s_copy);
1313 #ifndef ARMTARGETASMINFO_H
1414 #define ARMTARGETASMINFO_H
1515
16 #include "ARMTargetMachine.h"
1716 #include "llvm/Target/TargetAsmInfo.h"
1817 #include "llvm/Target/ELFTargetAsmInfo.h"
1918 #include "llvm/Target/DarwinTargetAsmInfo.h"
20 #include "llvm/Support/Compiler.h"
19
20 #include "ARMSubtarget.h"
2121
2222 namespace llvm {
2323
24 extern const char *const arm_asm_table[];
24 // Forward declaration.
25 class ARMTargetMachine;
2526
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 }
27 struct ARMTargetAsmInfo : public virtual TargetAsmInfo {
28 explicit ARMTargetAsmInfo(const ARMTargetMachine &TM);
4129
4230 const ARMSubtarget *Subtarget;
4331
4634 unsigned countString(const char *p) const;
4735 };
4836
49 typedef ARMTargetAsmInfo ARMGenericTargetAsmInfo;
50
51 EXTERN_TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo);
52
53 struct ARMDarwinTargetAsmInfo : public ARMTargetAsmInfo {
37 struct ARMDarwinTargetAsmInfo : public virtual ARMTargetAsmInfo,
38 public virtual DarwinTargetAsmInfo {
5439 explicit ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM);
5540 };
5641
57 struct ARMELFTargetAsmInfo : public ARMTargetAsmInfo {
42 struct ARMELFTargetAsmInfo : public virtual ARMTargetAsmInfo,
43 public virtual ELFTargetAsmInfo {
5844 explicit ARMELFTargetAsmInfo(const ARMTargetMachine &TM);
5945 };
6046
119119 case ARMSubtarget::isELF:
120120 return new ARMELFTargetAsmInfo(*this);
121121 default:
122 return new ARMGenericTargetAsmInfo(*this);
122 return new ARMTargetAsmInfo(*this);
123123 }
124124 }
125125
1818 using namespace llvm;
1919 using namespace llvm::dwarf;
2020
21 TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo);
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 }
2233
2334 PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
24 PPCTargetAsmInfo(TM) {
35 PPCTargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
2536 PCSymbol = ".";
2637 CommentString = ";";
2738 GlobalPrefix = "_";
91102
92103
93104 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
94 PPCTargetAsmInfo(TM) {
105 PPCTargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
95106 CommentString = "#";
96107 GlobalPrefix = "";
97108 PrivateGlobalPrefix = "";
1313 #ifndef PPCTARGETASMINFO_H
1414 #define PPCTARGETASMINFO_H
1515
16 #include "PPCTargetMachine.h"
1716 #include "llvm/Target/TargetAsmInfo.h"
1817 #include "llvm/Target/DarwinTargetAsmInfo.h"
1918 #include "llvm/Target/ELFTargetAsmInfo.h"
20 #include "llvm/Support/Compiler.h"
2119
2220 namespace llvm {
2321
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();
22 // Forward declaration.
23 class PPCTargetMachine;
3024
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 }
25 struct PPCTargetAsmInfo : public virtual TargetAsmInfo {
26 explicit PPCTargetAsmInfo(const PPCTargetMachine &TM);
4027 };
4128
42 typedef PPCTargetAsmInfo PPCGenericTargetAsmInfo;
43
44 EXTERN_TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo);
45
46 struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo {
29 struct PPCDarwinTargetAsmInfo : public PPCTargetAsmInfo,
30 public DarwinTargetAsmInfo {
4731 explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
4832 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
4933 bool Global) const;
5034 };
5135
52 struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo {
36 struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo,
37 public ELFTargetAsmInfo {
5338 explicit PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM);
5439 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
5540 bool Global) const;
2424
2525 using namespace llvm;
2626
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;
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) {
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();
127119 }
128120
129121 TargetAsmInfo::~TargetAsmInfo() {
2424 using namespace llvm;
2525 using namespace llvm::dwarf;
2626
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
41 template
42 bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const {
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 {
4348 // FIXME: this should verify that we are targetting a 486 or better. If not,
4449 // we will turn this bswap into something that will be lowered to logical ops
4550 // instead of emitting the bswap asm. For now, we don't support 486 or lower
6873 return true;
6974 }
7075
71 template
72 bool X86TargetAsmInfo::ExpandInlineAsm(CallInst *CI) const {
76 bool X86TargetAsmInfo::ExpandInlineAsm(CallInst *CI) const {
7377 InlineAsm *IA = cast(CI->getCalledValue());
7478 std::vector Constraints = IA->ParseConstraints();
7579
120124 }
121125
122126 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
123 X86TargetAsmInfo(TM) {
127 X86TargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
124128 const X86Subtarget* Subtarget = &DTM->getSubtarget();
125129 bool is64Bit = Subtarget->is64Bit();
126130
220224 }
221225
222226 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
223 X86TargetAsmInfo(TM) {
227 X86TargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
224228
225229 CStringSection = ".rodata.str";
226230 PrivateGlobalPrefix = ".L";
297301 }
298302
299303 X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM):
300 X86GenericTargetAsmInfo(TM) {
304 X86TargetAsmInfo(TM) {
301305 X86TM = &TM;
302306
303307 GlobalPrefix = "_";
403407 }
404408
405409 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
406 X86GenericTargetAsmInfo(TM) {
410 X86TargetAsmInfo(TM) {
407411 GlobalPrefix = "_";
408412 CommentString = ";";
409413
1313 #ifndef X86TARGETASMINFO_H
1414 #define X86TARGETASMINFO_H
1515
16 #include "X86TargetMachine.h"
1716 #include "llvm/Target/TargetAsmInfo.h"
1817 #include "llvm/Target/ELFTargetAsmInfo.h"
1918 #include "llvm/Target/DarwinTargetAsmInfo.h"
20 #include "llvm/Support/Compiler.h"
2119
2220 namespace llvm {
2321
24 extern const char *const x86_asm_table[];
22 // Forward declaration.
23 class X86TargetMachine;
2524
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 }
25 struct X86TargetAsmInfo : public virtual TargetAsmInfo {
26 explicit X86TargetAsmInfo(const X86TargetMachine &TM);
3527
3628 virtual bool ExpandInlineAsm(CallInst *CI) const;
3729
3931 bool LowerToBSwap(CallInst *CI) const;
4032 };
4133
42 typedef X86TargetAsmInfo X86GenericTargetAsmInfo;
43
44 EXTERN_TEMPLATE_INSTANTIATION(class X86TargetAsmInfo);
45
46 struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo {
34 struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo,
35 public DarwinTargetAsmInfo {
4736 explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
4837 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
4938 bool Global) const;
5039 };
5140
52 struct X86ELFTargetAsmInfo : public X86TargetAsmInfo {
41 struct X86ELFTargetAsmInfo : public X86TargetAsmInfo,
42 public ELFTargetAsmInfo {
5343 explicit X86ELFTargetAsmInfo(const X86TargetMachine &TM);
5444 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
5545 bool Global) const;
5646 };
5747
58 struct X86COFFTargetAsmInfo : public X86GenericTargetAsmInfo {
48 struct X86COFFTargetAsmInfo : public X86TargetAsmInfo {
5949 explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);
6050 virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
6151 bool Global) const;
6656 const X86TargetMachine *X86TM;
6757 };
6858
69 struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo {
59 struct X86WinTargetAsmInfo : public X86TargetAsmInfo {
7060 explicit X86WinTargetAsmInfo(const X86TargetMachine &TM);
7161 };
72
7362 } // namespace llvm
7463
7564 #endif
76
5353 case X86Subtarget::isWindows:
5454 return new X86WinTargetAsmInfo(*this);
5555 default:
56 return new X86GenericTargetAsmInfo(*this);
56 return new X86TargetAsmInfo(*this);
5757 }
5858 }
5959