summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-06 22:17:23 +0000
committerChris Lattner <sabre@nondot.org>2006-02-06 22:17:23 +0000
commit34f74c180a0a9e167f1c68e7968dd8751bc1ac1b (patch)
tree7282ae37d0df4763f2f1cb0931b5806094536e37 /llvm/lib/CodeGen/AsmPrinter.cpp
parentf1eac134b907de6558de1c005d88d2c895cbbc78 (diff)
downloadbcm5719-llvm-34f74c180a0a9e167f1c68e7968dd8751bc1ac1b.tar.gz
bcm5719-llvm-34f74c180a0a9e167f1c68e7968dd8751bc1ac1b.zip
Add support for modifier characters to operand printers
llvm-svn: 26021
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index 48dd2975301..6fa66235508 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter.cpp
@@ -538,7 +538,23 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
}
LastEmitted = IDEnd;
+ char Modifier[2] = { 0, 0 };
+
if (HasCurlyBraces) {
+ // If we have curly braces, check for a modifier character. This
+ // supports syntax like ${0:u}, which correspond to "%u0" in GCC asm.
+ if (*LastEmitted == ':') {
+ ++LastEmitted; // Consume ':' character.
+ if (*LastEmitted == 0) {
+ std::cerr << "Bad ${:} expression in inline asm string: '"
+ << AsmStr << "'\n";
+ exit(1);
+ }
+
+ Modifier[0] = *LastEmitted;
+ ++LastEmitted; // Consume modifier character.
+ }
+
if (*LastEmitted != '}') {
std::cerr << "Bad ${} expression in inline asm string: '"
<< AsmStr << "'\n";
@@ -553,11 +569,14 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
exit(1);
}
+ char ExtraCode = 0; // FIXME:
+
// Okay, we finally have an operand number. Ask the target to print this
// operand!
if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
if (const_cast<AsmPrinter*>(this)->
- PrintAsmOperand(MI, Val+1, AsmPrinterVariant)) {
+ PrintAsmOperand(MI, Val+1, AsmPrinterVariant,
+ Modifier[0] ? Modifier : 0)) {
std::cerr << "Invalid operand found in inline asm: '"
<< AsmStr << "'\n";
MI->dump();
@@ -601,7 +620,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
/// instruction, using the specified assembler variant. Targets should
/// overried this to format as appropriate.
bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
- unsigned AsmVariant) {
+ unsigned AsmVariant, const char *ExtraCode) {
// Target doesn't support this yet!
return true;
}
OpenPOWER on IntegriCloud