[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h X86IntelAsmPrinter.cpp X86IntelAsmPrinter.h
Evan Cheng
evan.cheng at apple.com
Fri Apr 28 14:19:18 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.34 -> 1.35
X86ATTAsmPrinter.h updated: 1.10 -> 1.11
X86IntelAsmPrinter.cpp updated: 1.27 -> 1.28
X86IntelAsmPrinter.h updated: 1.11 -> 1.12
---
Log message:
Bare-bone X86 inline asm printer support.
---
Diffs of the changes: (+66 -2)
X86ATTAsmPrinter.cpp | 28 ++++++++++++++++++++++++++++
X86ATTAsmPrinter.h | 6 +++++-
X86IntelAsmPrinter.cpp | 28 ++++++++++++++++++++++++++++
X86IntelAsmPrinter.h | 6 +++++-
4 files changed, 66 insertions(+), 2 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.34 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.35
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.34 Sat Apr 22 13:53:45 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Fri Apr 28 16:19:05 2006
@@ -264,6 +264,34 @@
O << "\"L" << getFunctionNumber() << "$pb\":";
}
+/// PrintAsmOperand - Print out an operand for an inline asm expression.
+///
+bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant,
+ const char *ExtraCode) {
+ // Does this asm operand have a single letter operand modifier?
+ if (ExtraCode && ExtraCode[0]) {
+ if (ExtraCode[1] != 0) return true; // Unknown modifier.
+
+ switch (ExtraCode[0]) {
+ default: return true; // Unknown modifier.
+ }
+ }
+
+ printOperand(MI, OpNo);
+ return false;
+}
+
+bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
+ unsigned OpNo,
+ unsigned AsmVariant,
+ const char *ExtraCode) {
+ if (ExtraCode && ExtraCode[0])
+ return true; // Unknown modifier.
+ printMemReference(MI, OpNo);
+ return false;
+}
+
/// printMachineInstruction -- Print out a single X86 LLVM instruction
/// MI in Intel syntax to the current output stream.
///
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.h
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.10 llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.11
--- llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.10 Mon Mar 13 17:20:37 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.h Fri Apr 28 16:19:05 2006
@@ -61,7 +61,11 @@
printMemReference(MI, OpNo);
}
- void printMachineInstruction(const MachineInstr *MI);
+ bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant, const char *ExtraCode);
+ bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant, const char *ExtraCode);
+ void printMachineInstruction(const MachineInstr *MI);
void printSSECC(const MachineInstr *MI, unsigned Op);
void printMemReference(const MachineInstr *MI, unsigned Op);
void printPICLabel(const MachineInstr *MI, unsigned Op);
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.27 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.28
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.27 Sat Apr 22 13:53:45 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Fri Apr 28 16:19:05 2006
@@ -242,6 +242,34 @@
O << "\"L" << getFunctionNumber() << "$pb\":";
}
+/// PrintAsmOperand - Print out an operand for an inline asm expression.
+///
+bool X86IntelAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant,
+ const char *ExtraCode) {
+ // Does this asm operand have a single letter operand modifier?
+ if (ExtraCode && ExtraCode[0]) {
+ if (ExtraCode[1] != 0) return true; // Unknown modifier.
+
+ switch (ExtraCode[0]) {
+ default: return true; // Unknown modifier.
+ }
+ }
+
+ printOperand(MI, OpNo);
+ return false;
+}
+
+bool X86IntelAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
+ unsigned OpNo,
+ unsigned AsmVariant,
+ const char *ExtraCode) {
+ if (ExtraCode && ExtraCode[0])
+ return true; // Unknown modifier.
+ printMemReference(MI, OpNo);
+ return false;
+}
+
/// printMachineInstruction -- Print out a single X86 LLVM instruction
/// MI in Intel syntax to the current output stream.
///
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.h
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.11 llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.12
--- llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.11 Mon Mar 13 17:20:37 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.h Fri Apr 28 16:19:05 2006
@@ -80,7 +80,11 @@
printMemReference(MI, OpNo);
}
- void printMachineInstruction(const MachineInstr *MI);
+ bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant, const char *ExtraCode);
+ bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant, const char *ExtraCode);
+ void printMachineInstruction(const MachineInstr *MI);
void printOp(const MachineOperand &MO, const char *Modifier = 0);
void printSSECC(const MachineInstr *MI, unsigned Op);
void printMemReference(const MachineInstr *MI, unsigned Op);
More information about the llvm-commits
mailing list