Hi all,
I would like someone to review this patch for PR1095. This gives us a
"dialect" for the assembler code if we're given something like:
__asm__("{cntlz|cntlzw} ...
Before, we were defaulting to the first one. But there are some
platforms which need the second form.
Here's the patch. Lemme know what you think!
-bw
Index: include/llvm/Target/TargetAsmInfo.h
===================================================================
RCS file: /var/cvs/llvm/llvm/include/llvm/Target/TargetAsmInfo.h,v
retrieving revision 1.18
diff -a -u -r1.18 TargetAsmInfo.h
--- include/llvm/Target/TargetAsmInfo.h 21 Dec 2006 21:24:35 -0000 1.18
+++ include/llvm/Target/TargetAsmInfo.h 9 Jan 2007 08:21:25 -0000
@@ -27,6 +27,11 @@
/// properties and features specific to the target.
class TargetAsmInfo {
protected:
+ enum AsmDialect {
+ ASM_ATT,
+ ASM_INTEL
+ };
+
//===------------------------------------------------------------------===//
// Properties to be set by the target writer, used to configure asm
printer.
//
@@ -128,6 +133,11 @@
/// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
/// boundary.
bool AlignmentIsInBytes; // Defaults to true
+
+ //===--- Assembler Dialect Information
--------------------------------===//
+
+ /// AssemblerDialect - Which dialect of an assembler variant to use.
+ AsmDialect AssemblerDialect; // Defaults to ASM_ATT
//===--- Section Switching Directives
---------------------------------===//
@@ -372,6 +382,9 @@
bool getAlignmentIsInBytes() const {
return AlignmentIsInBytes;
}
+ AsmDialect getAssemblerDialect() const {
+ return AssemblerDialect;
+ }
const char *getSwitchToSectionDirective() const {
return SwitchToSectionDirective;
}
Index: lib/CodeGen/AsmPrinter.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/CodeGen/AsmPrinter.cpp,v
retrieving revision 1.129
diff -a -u -r1.129 AsmPrinter.cpp
--- lib/CodeGen/AsmPrinter.cpp 31 Dec 2006 05:55:36 -0000 1.129
+++ lib/CodeGen/AsmPrinter.cpp 9 Jan 2007 08:21:30 -0000
@@ -701,9 +701,9 @@
O << TAI->getInlineAsmStart() << "\n\t";
- // The variant of the current asmprinter: FIXME: change.
- int AsmPrinterVariant = 0;
-
+ // The variant of the current asmprinter.
+ int AsmPrinterVariant = TAI->getAssemblerDialect();
+
int CurVariant = -1; // The number of the {.|.|.} region we are
in.
const char *LastEmitted = AsmStr; // One past the last character emitted.
Index: lib/Target/TargetAsmInfo.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/Target/TargetAsmInfo.cpp,v
retrieving revision 1.11
diff -a -u -r1.11 TargetAsmInfo.cpp
--- lib/Target/TargetAsmInfo.cpp 1 Dec 2006 20:47:11 -0000 1.11
+++ lib/Target/TargetAsmInfo.cpp 9 Jan 2007 08:21:30 -0000
@@ -42,6 +42,7 @@
Data64bitsDirective("\t.quad\t"),
AlignDirective("\t.align\t"),
AlignmentIsInBytes(true),
+ AssemblerDialect(ASM_ATT),
SwitchToSectionDirective("\t.section\t"),
TextSectionStartSuffix(""),
DataSectionStartSuffix(""),
Index: lib/Target/PowerPC/PPCTargetAsmInfo.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp,v
retrieving revision 1.10
diff -a -u -r1.10 PPCTargetAsmInfo.cpp
--- lib/Target/PowerPC/PPCTargetAsmInfo.cpp 21 Dec 2006 20:26:09 -0000
1.10
+++ lib/Target/PowerPC/PPCTargetAsmInfo.cpp 9 Jan 2007 08:21:32 -0000
@@ -23,6 +23,7 @@
SetDirective = "\t.set";
Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
AlignmentIsInBytes = false;
+ AssemblerDialect = ASM_INTEL;
LCOMMDirective = "\t.lcomm\t";
InlineAsmStart = "# InlineAsm Start";
InlineAsmEnd = "# InlineAsm End";
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits