blob: e3336509a766c2615b65a308c6ca1030dc0255da [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +00001//===-- X86TargetAsmInfo.cpp - X86 asm properties ---------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jim Laskey8e8de8f2006-09-07 22:05:02 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the declarations of the X86TargetAsmInfo properties.
11//
12//===----------------------------------------------------------------------===//
13
14#include "X86TargetAsmInfo.h"
15#include "X86TargetMachine.h"
16#include "X86Subtarget.h"
Reid Spencer7aa8a452007-01-12 23:22:14 +000017#include "llvm/DerivedTypes.h"
Chris Lattner625bd052006-11-29 01:14:06 +000018#include "llvm/InlineAsm.h"
19#include "llvm/Instructions.h"
Chris Lattner3e9f1d02007-04-01 20:49:36 +000020#include "llvm/Intrinsics.h"
Chris Lattner625bd052006-11-29 01:14:06 +000021#include "llvm/Module.h"
22#include "llvm/ADT/StringExtras.h"
Anton Korobeynikovcee750f2008-02-27 23:33:50 +000023#include "llvm/Support/Dwarf.h"
24
Jim Laskey8e8de8f2006-09-07 22:05:02 +000025using namespace llvm;
Anton Korobeynikovcee750f2008-02-27 23:33:50 +000026using namespace llvm::dwarf;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000027
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000028const char *const llvm::x86_asm_table[] = {
29 "{si}", "S",
30 "{di}", "D",
31 "{ax}", "a",
32 "{cx}", "c",
33 "{memory}", "memory",
34 "{flags}", "",
35 "{dirflag}", "",
36 "{fpsr}", "",
37 "{cc}", "cc",
38 0,0};
Andrew Lenharth6c0695f2006-11-28 19:52:49 +000039
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000040X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
Anton Korobeynikov32b952a2008-09-25 21:00:33 +000041 X86TargetAsmInfo<DarwinTargetAsmInfo>(TM) {
Dan Gohman8f092252008-11-03 18:22:42 +000042 const X86Subtarget* Subtarget = &TM.getSubtarget<X86Subtarget>();
Anton Korobeynikov16b7f512008-08-08 18:25:52 +000043 bool is64Bit = Subtarget->is64Bit();
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000044
45 AlignmentIsInBytes = false;
46 TextAlignFillValue = 0x90;
47 GlobalPrefix = "_";
48 if (!is64Bit)
49 Data64bitsDirective = 0; // we can't emit a 64-bit unit
50 ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
51 PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
Dale Johannesenb2dfb892008-09-09 01:21:22 +000052 LessPrivateGlobalPrefix = "l"; // Marker for some ObjC metadata
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000053 BSSSection = 0; // no BSS section.
54 ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill
Dan Gohman8f092252008-11-03 18:22:42 +000055 if (TM.getRelocationModel() != Reloc::Static)
Anton Korobeynikov7705ea32008-07-09 21:54:26 +000056 ConstantPoolSection = "\t.const_data";
57 else
58 ConstantPoolSection = "\t.const\n";
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000059 JumpTableDataSection = "\t.const\n";
60 CStringSection = "\t.cstring";
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000061 // FIXME: Why don't always use this section?
Anton Korobeynikov0d44ba82008-07-09 13:28:49 +000062 if (is64Bit) {
Anton Korobeynikov64818732008-09-24 22:18:54 +000063 SixteenByteConstantSection = getUnnamedSection("\t.literal16\n",
64 SectionFlags::Mergeable);
Anton Korobeynikov0d44ba82008-07-09 13:28:49 +000065 }
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000066 LCOMMDirective = "\t.lcomm\t";
67 SwitchToSectionDirective = "\t.section ";
68 StringConstantPrefix = "\1LC";
Anton Korobeynikov16b7f512008-08-08 18:25:52 +000069 // Leopard and above support aligned common symbols.
70 COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000071 HasDotTypeDotSizeDirective = false;
Rafael Espindola952b8392008-12-03 11:01:37 +000072 HasSingleParameterDotFile = false;
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +000073 if (TM.getRelocationModel() == Reloc::Static) {
74 StaticCtorsSection = ".constructor";
75 StaticDtorsSection = ".destructor";
76 } else {
77 StaticCtorsSection = ".mod_init_func";
78 StaticDtorsSection = ".mod_term_func";
79 }
80 if (is64Bit) {
81 PersonalityPrefix = "";
82 PersonalitySuffix = "+4@GOTPCREL";
83 } else {
84 PersonalityPrefix = "L";
85 PersonalitySuffix = "$non_lazy_ptr";
86 }
87 NeedsIndirectEncoding = true;
88 InlineAsmStart = "## InlineAsm Start";
89 InlineAsmEnd = "## InlineAsm End";
90 CommentString = "##";
91 SetDirective = "\t.set";
92 PCSymbol = ".";
93 UsedDirective = "\t.no_dead_strip\t";
94 WeakDefDirective = "\t.weak_definition ";
95 WeakRefDirective = "\t.weak_reference ";
96 HiddenDirective = "\t.private_extern ";
97 ProtectedDirective = "\t.globl\t";
98
99 // In non-PIC modes, emit a special label before jump tables so that the
100 // linker can perform more accurate dead code stripping.
101 if (TM.getRelocationModel() != Reloc::PIC_) {
102 // Emit a local label that is preserved until the linker runs.
103 JumpTableSpecialLabelPrefix = "l";
104 }
105
106 SupportsDebugInformation = true;
107 NeedsSet = true;
108 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
109 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
110 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
111 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
112 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
113 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
114 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
115 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
116 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
117 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
118 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
119
120 // Exceptions handling
121 SupportsExceptionHandling = true;
122 GlobalEHDirective = "\t.globl\t";
123 SupportsWeakOmittedEHFrame = false;
124 AbsoluteEHSectionOffsets = false;
125 DwarfEHFrameSection =
126 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
127 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
128}
129
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000130unsigned
131X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
132 bool Global) const {
133 if (Reason == DwarfEncoding::Functions && Global)
134 return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4);
135 else if (Reason == DwarfEncoding::CodeLabels || !Global)
136 return DW_EH_PE_pcrel;
137 else
138 return DW_EH_PE_absptr;
139}
140
Rafael Espindola2f6fea92008-12-19 10:55:56 +0000141const char *
142X86DarwinTargetAsmInfo::getEHGlobalPrefix() const
143{
144 const X86Subtarget* Subtarget = &TM.getSubtarget<X86Subtarget>();
145 if (Subtarget->getDarwinVers() > 9)
146 return PrivateGlobalPrefix;
147 else
148 return "";
149}
150
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000151X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
Anton Korobeynikov32b952a2008-09-25 21:00:33 +0000152 X86TargetAsmInfo<ELFTargetAsmInfo>(TM) {
Anton Korobeynikov0d44ba82008-07-09 13:28:49 +0000153
Anton Korobeynikovb20015b2008-07-09 13:25:26 +0000154 CStringSection = ".rodata.str";
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000155 PrivateGlobalPrefix = ".L";
156 WeakRefDirective = "\t.weak\t";
157 SetDirective = "\t.set\t";
158 PCSymbol = ".";
159
160 // Set up DWARF directives
161 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
162
163 // Debug Information
164 AbsoluteDebugSectionOffsets = true;
165 SupportsDebugInformation = true;
166 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
167 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
168 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
169 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
170 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
171 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
172 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
173 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
174 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
175 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
176 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
177
178 // Exceptions handling
Anton Korobeynikovc4da15a2008-09-08 21:13:08 +0000179 SupportsExceptionHandling = true;
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000180 AbsoluteEHSectionOffsets = false;
181 DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
182 DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
183
184 // On Linux we must declare when we can use a non-executable stack.
Dan Gohman8f092252008-11-03 18:22:42 +0000185 if (TM.getSubtarget<X86Subtarget>().isLinux())
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000186 NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
187}
188
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000189unsigned
190X86ELFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
191 bool Global) const {
Dan Gohman8f092252008-11-03 18:22:42 +0000192 CodeModel::Model CM = TM.getCodeModel();
193 bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit();
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000194
Dan Gohman8f092252008-11-03 18:22:42 +0000195 if (TM.getRelocationModel() == Reloc::PIC_) {
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000196 unsigned Format = 0;
197
198 if (!is64Bit)
199 // 32 bit targets always encode pointers as 4 bytes
200 Format = DW_EH_PE_sdata4;
201 else {
202 // 64 bit targets encode pointers in 4 bytes iff:
203 // - code model is small OR
204 // - code model is medium and we're emitting externally visible symbols
205 // or any code symbols
206 if (CM == CodeModel::Small ||
207 (CM == CodeModel::Medium && (Global ||
208 Reason != DwarfEncoding::Data)))
209 Format = DW_EH_PE_sdata4;
210 else
211 Format = DW_EH_PE_sdata8;
212 }
213
214 if (Global)
215 Format |= DW_EH_PE_indirect;
216
217 return (Format | DW_EH_PE_pcrel);
218 } else {
219 if (is64Bit &&
220 (CM == CodeModel::Small ||
221 (CM == CodeModel::Medium && Reason != DwarfEncoding::Data)))
222 return DW_EH_PE_udata4;
223 else
224 return DW_EH_PE_absptr;
225 }
226}
227
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000228X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM):
Anton Korobeynikov32b952a2008-09-25 21:00:33 +0000229 X86GenericTargetAsmInfo(TM) {
Anton Korobeynikov18f6ed92008-07-19 13:15:21 +0000230
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000231 GlobalPrefix = "_";
232 LCOMMDirective = "\t.lcomm\t";
233 COMMDirectiveTakesAlignment = false;
234 HasDotTypeDotSizeDirective = false;
Rafael Espindola952b8392008-12-03 11:01:37 +0000235 HasSingleParameterDotFile = false;
Anton Korobeynikov4468b7a2008-07-09 13:20:48 +0000236 StaticCtorsSection = "\t.section .ctors,\"aw\"";
237 StaticDtorsSection = "\t.section .dtors,\"aw\"";
238 HiddenDirective = NULL;
239 PrivateGlobalPrefix = "L"; // Prefix for private global symbols
240 WeakRefDirective = "\t.weak\t";
241 SetDirective = "\t.set\t";
242
243 // Set up DWARF directives
244 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
245 AbsoluteDebugSectionOffsets = true;
246 AbsoluteEHSectionOffsets = false;
247 SupportsDebugInformation = true;
248 DwarfSectionOffsetDirective = "\t.secrel32\t";
249 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\"";
250 DwarfInfoSection = "\t.section\t.debug_info,\"dr\"";
251 DwarfLineSection = "\t.section\t.debug_line,\"dr\"";
252 DwarfFrameSection = "\t.section\t.debug_frame,\"dr\"";
253 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";
254 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";
255 DwarfStrSection = "\t.section\t.debug_str,\"dr\"";
256 DwarfLocSection = "\t.section\t.debug_loc,\"dr\"";
257 DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";
258 DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\"";
259 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
260}
261
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000262unsigned
263X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
264 bool Global) const {
Dan Gohman8f092252008-11-03 18:22:42 +0000265 CodeModel::Model CM = TM.getCodeModel();
266 bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit();
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000267
Dan Gohman8f092252008-11-03 18:22:42 +0000268 if (TM.getRelocationModel() == Reloc::PIC_) {
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000269 unsigned Format = 0;
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000270
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000271 if (!is64Bit)
272 // 32 bit targets always encode pointers as 4 bytes
273 Format = DW_EH_PE_sdata4;
274 else {
275 // 64 bit targets encode pointers in 4 bytes iff:
276 // - code model is small OR
277 // - code model is medium and we're emitting externally visible symbols
278 // or any code symbols
279 if (CM == CodeModel::Small ||
280 (CM == CodeModel::Medium && (Global ||
281 Reason != DwarfEncoding::Data)))
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000282 Format = DW_EH_PE_sdata4;
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000283 else
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000284 Format = DW_EH_PE_sdata8;
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000285 }
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000286
Anton Korobeynikovb9e58ef2008-07-09 13:21:08 +0000287 if (Global)
288 Format |= DW_EH_PE_indirect;
289
290 return (Format | DW_EH_PE_pcrel);
291 } else {
292 if (is64Bit &&
293 (CM == CodeModel::Small ||
294 (CM == CodeModel::Medium && Reason != DwarfEncoding::Data)))
295 return DW_EH_PE_udata4;
296 else
297 return DW_EH_PE_absptr;
Anton Korobeynikovcee750f2008-02-27 23:33:50 +0000298 }
299}
300
Anton Korobeynikovb9a02fc2008-07-09 13:21:29 +0000301std::string
302X86COFFTargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
303 SectionKind::Kind kind) const {
304 switch (kind) {
305 case SectionKind::Text:
306 return ".text$linkonce" + GV->getName();
307 case SectionKind::Data:
308 case SectionKind::BSS:
309 case SectionKind::ThreadData:
310 case SectionKind::ThreadBSS:
311 return ".data$linkonce" + GV->getName();
312 case SectionKind::ROData:
313 case SectionKind::RODataMergeConst:
314 case SectionKind::RODataMergeStr:
315 return ".rdata$linkonce" + GV->getName();
Anton Korobeynikov29b03f72008-07-09 13:19:38 +0000316 default:
Anton Korobeynikovb9a02fc2008-07-09 13:21:29 +0000317 assert(0 && "Unknown section kind");
Anton Korobeynikov29b03f72008-07-09 13:19:38 +0000318 }
319}
320
Anton Korobeynikovd0c1e292008-08-16 12:57:07 +0000321std::string X86COFFTargetAsmInfo::printSectionFlags(unsigned flags) const {
Anton Korobeynikovf447e3d2008-07-09 13:21:49 +0000322 std::string Flags = ",\"";
323
324 if (flags & SectionFlags::Code)
325 Flags += 'x';
326 if (flags & SectionFlags::Writeable)
327 Flags += 'w';
328
329 Flags += "\"";
330
331 return Flags;
332}
333
334X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
Anton Korobeynikov32b952a2008-09-25 21:00:33 +0000335 X86GenericTargetAsmInfo(TM) {
Anton Korobeynikovf447e3d2008-07-09 13:21:49 +0000336 GlobalPrefix = "_";
337 CommentString = ";";
338
339 PrivateGlobalPrefix = "$";
340 AlignDirective = "\talign\t";
341 ZeroDirective = "\tdb\t";
342 ZeroDirectiveSuffix = " dup(0)";
343 AsciiDirective = "\tdb\t";
344 AscizDirective = 0;
345 Data8bitsDirective = "\tdb\t";
346 Data16bitsDirective = "\tdw\t";
347 Data32bitsDirective = "\tdd\t";
348 Data64bitsDirective = "\tdq\t";
349 HasDotTypeDotSizeDirective = false;
Rafael Espindola952b8392008-12-03 11:01:37 +0000350 HasSingleParameterDotFile = false;
Anton Korobeynikovf447e3d2008-07-09 13:21:49 +0000351
Anton Korobeynikovd7ca4162008-09-24 22:15:21 +0000352 TextSection = getUnnamedSection("_text", SectionFlags::Code);
Anton Korobeynikov315690e2008-09-24 22:16:16 +0000353 DataSection = getUnnamedSection("_data", SectionFlags::Writeable);
354
Anton Korobeynikovf447e3d2008-07-09 13:21:49 +0000355 JumpTableDataSection = NULL;
356 SwitchToSectionDirective = "";
357 TextSectionStartSuffix = "\tsegment 'CODE'";
358 DataSectionStartSuffix = "\tsegment 'DATA'";
359 SectionEndDirectiveSuffix = "\tends\n";
360}
Anton Korobeynikov6381a132008-10-05 08:53:29 +0000361
362template <class BaseTAI>
363bool X86TargetAsmInfo<BaseTAI>::LowerToBSwap(CallInst *CI) const {
364 // FIXME: this should verify that we are targetting a 486 or better. If not,
365 // we will turn this bswap into something that will be lowered to logical ops
366 // instead of emitting the bswap asm. For now, we don't support 486 or lower
367 // so don't worry about this.
368
369 // Verify this is a simple bswap.
370 if (CI->getNumOperands() != 2 ||
371 CI->getType() != CI->getOperand(1)->getType() ||
372 !CI->getType()->isInteger())
373 return false;
374
375 const IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
376 if (!Ty || Ty->getBitWidth() % 16 != 0)
377 return false;
378
379 // Okay, we can do this xform, do so now.
380 const Type *Tys[] = { Ty };
381 Module *M = CI->getParent()->getParent()->getParent();
382 Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
383
384 Value *Op = CI->getOperand(1);
385 Op = CallInst::Create(Int, Op, CI->getName(), CI);
386
387 CI->replaceAllUsesWith(Op);
388 CI->eraseFromParent();
389 return true;
390}
391
392template <class BaseTAI>
393bool X86TargetAsmInfo<BaseTAI>::ExpandInlineAsm(CallInst *CI) const {
394 InlineAsm *IA = cast<InlineAsm>(CI->getCalledValue());
395 std::vector<InlineAsm::ConstraintInfo> Constraints = IA->ParseConstraints();
396
397 std::string AsmStr = IA->getAsmString();
398
399 // TODO: should remove alternatives from the asmstring: "foo {a|b}" -> "foo a"
400 std::vector<std::string> AsmPieces;
401 SplitString(AsmStr, AsmPieces, "\n"); // ; as separator?
402
403 switch (AsmPieces.size()) {
404 default: return false;
405 case 1:
406 AsmStr = AsmPieces[0];
407 AsmPieces.clear();
408 SplitString(AsmStr, AsmPieces, " \t"); // Split with whitespace.
409
410 // bswap $0
411 if (AsmPieces.size() == 2 &&
412 AsmPieces[0] == "bswap" && AsmPieces[1] == "$0") {
413 // No need to check constraints, nothing other than the equivalent of
414 // "=r,0" would be valid here.
415 return LowerToBSwap(CI);
416 }
417 break;
418 case 3:
419 if (CI->getType() == Type::Int64Ty && Constraints.size() >= 2 &&
420 Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] == "A" &&
421 Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] == "0") {
422 // bswap %eax / bswap %edx / xchgl %eax, %edx -> llvm.bswap.i64
423 std::vector<std::string> Words;
424 SplitString(AsmPieces[0], Words, " \t");
425 if (Words.size() == 2 && Words[0] == "bswap" && Words[1] == "%eax") {
426 Words.clear();
427 SplitString(AsmPieces[1], Words, " \t");
428 if (Words.size() == 2 && Words[0] == "bswap" && Words[1] == "%edx") {
429 Words.clear();
430 SplitString(AsmPieces[2], Words, " \t,");
431 if (Words.size() == 3 && Words[0] == "xchgl" && Words[1] == "%eax" &&
432 Words[2] == "%edx") {
433 return LowerToBSwap(CI);
434 }
435 }
436 }
437 }
438 break;
439 }
440 return false;
441}
442
443// Instantiate default implementation.
444TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>);