1 //===-- AsmPrinter.cpp - Common AsmPrinter code ---------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the AsmPrinter class.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/CodeGen/AsmPrinter.h"
15 #include "llvm/Assembly/Writer.h"
16 #include "llvm/DerivedTypes.h"
17 #include "llvm/Constants.h"
18 #include "llvm/Module.h"
19 #include "llvm/CodeGen/MachineConstantPool.h"
20 #include "llvm/CodeGen/MachineJumpTableInfo.h"
21 #include "llvm/Support/Mangler.h"
22 #include "llvm/Support/MathExtras.h"
23 #include "llvm/Target/TargetMachine.h"
28 AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm)
29 : FunctionNumber(0), O(o), TM(tm),
32 PrivateGlobalPrefix("."),
33 GlobalVarAddrPrefix(""),
34 GlobalVarAddrSuffix(""),
35 FunctionAddrPrefix(""),
36 FunctionAddrSuffix(""),
37 InlineAsmStart("#APP"),
38 InlineAsmEnd("#NO_APP"),
39 ZeroDirective("\t.zero\t"),
40 ZeroDirectiveSuffix(0),
41 AsciiDirective("\t.ascii\t"),
42 AscizDirective("\t.asciz\t"),
43 Data8bitsDirective("\t.byte\t"),
44 Data16bitsDirective("\t.short\t"),
45 Data32bitsDirective("\t.long\t"),
46 Data64bitsDirective("\t.quad\t"),
47 AlignDirective("\t.align\t"),
48 AlignmentIsInBytes(true),
49 SwitchToSectionDirective("\t.section\t"),
51 ConstantPoolSection("\t.section .rodata\n"),
52 JumpTableSection("\t.section .rodata\n"),
53 StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
54 StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"),
56 COMMDirective("\t.comm\t"),
57 COMMDirectiveTakesAlignment(true),
58 HasDotTypeDotSizeDirective(true) {
62 /// SwitchToTextSection - Switch to the specified text section of the executable
63 /// if we are not already in it!
65 void AsmPrinter::SwitchToTextSection(const char *NewSection,
66 const GlobalValue *GV) {
68 if (GV && GV->hasSection())
69 NS = GV->getSection();
73 // If we're already in this section, we're done.
74 if (CurrentSection == NS) return;
76 // Microsoft ML/MASM has a fundamentally different approach to handling
80 if (!CurrentSection.empty())
81 O << CurrentSection << "\tends\n\n";
83 if (!CurrentSection.empty())
84 O << CurrentSection << "\tsegment 'CODE'\n";
87 if (!CurrentSection.empty())
88 O << CurrentSection << '\n';
92 /// SwitchToTextSection - Switch to the specified text section of the executable
93 /// if we are not already in it!
95 void AsmPrinter::SwitchToDataSection(const char *NewSection,
96 const GlobalValue *GV) {
98 if (GV && GV->hasSection())
99 NS = SwitchToSectionDirective + GV->getSection();
103 // If we're already in this section, we're done.
104 if (CurrentSection == NS) return;
106 // Microsoft ML/MASM has a fundamentally different approach to handling
110 if (!CurrentSection.empty())
111 O << CurrentSection << "\tends\n\n";
113 if (!CurrentSection.empty())
114 O << CurrentSection << "\tsegment 'DATA'\n";
117 if (!CurrentSection.empty())
118 O << CurrentSection << '\n';
123 bool AsmPrinter::doInitialization(Module &M) {
124 Mang = new Mangler(M, GlobalPrefix);
126 if (!M.getModuleInlineAsm().empty())
127 O << CommentString << " Start of file scope inline assembly\n"
128 << M.getModuleInlineAsm()
129 << "\n" << CommentString << " End of file scope inline assembly\n";
131 SwitchToDataSection("", 0); // Reset back to no section.
133 if (MachineDebugInfo *DebugInfo = getAnalysisToUpdate<MachineDebugInfo>()) {
134 DebugInfo->AnalyzeModule(M);
140 bool AsmPrinter::doFinalization(Module &M) {
141 delete Mang; Mang = 0;
145 void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
146 // What's my mangled name?
147 CurrentFnName = Mang->getValueName(MF.getFunction());
148 IncrementFunctionNumber();
151 /// EmitConstantPool - Print to the current output stream assembly
152 /// representations of the constants in the constant pool MCP. This is
153 /// used to print out constants which have been "spilled to memory" by
154 /// the code generator.
156 void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
157 const std::vector<MachineConstantPoolEntry> &CP = MCP->getConstants();
158 if (CP.empty()) return;
159 const TargetData *TD = TM.getTargetData();
161 SwitchToDataSection(ConstantPoolSection, 0);
162 EmitAlignment(MCP->getConstantPoolAlignment());
163 for (unsigned i = 0, e = CP.size(); i != e; ++i) {
164 O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_' << i
165 << ":\t\t\t\t\t" << CommentString << " ";
166 WriteTypeSymbolic(O, CP[i].Val->getType(), 0) << '\n';
167 EmitGlobalConstant(CP[i].Val);
169 unsigned EntSize = TM.getTargetData()->getTypeSize(CP[i].Val->getType());
170 unsigned ValEnd = CP[i].Offset + EntSize;
171 // Emit inter-object padding for alignment.
172 EmitZeros(CP[i+1].Offset-ValEnd);
177 /// EmitJumpTableInfo - Print assembly representations of the jump tables used
178 /// by the current function to the current output stream.
180 void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) {
181 const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
182 if (JT.empty()) return;
183 const TargetData *TD = TM.getTargetData();
185 // FIXME: someday we need to handle PIC jump tables
186 assert((TM.getRelocationModel() == Reloc::Static ||
187 TM.getRelocationModel() == Reloc::DynamicNoPIC) &&
188 "Unhandled relocation model emitting jump table information!");
190 SwitchToDataSection(JumpTableSection, 0);
191 EmitAlignment(Log2_32(TD->getPointerAlignment()));
192 for (unsigned i = 0, e = JT.size(); i != e; ++i) {
193 O << PrivateGlobalPrefix << "JTI" << getFunctionNumber() << '_' << i
195 const std::vector<MachineBasicBlock*> &JTBBs = JT[i].MBBs;
196 for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
197 O << Data32bitsDirective << ' ';
198 printBasicBlockLabel(JTBBs[ii]);
204 /// EmitSpecialLLVMGlobal - Check to see if the specified global is a
205 /// special global used by LLVM. If so, emit it and return true, otherwise
206 /// do nothing and return false.
207 bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
208 // Ignore debug and non-emitted data.
209 if (GV->getSection() == "llvm.metadata") return true;
211 if (!GV->hasAppendingLinkage()) return false;
213 assert(GV->hasInitializer() && "Not a special LLVM global!");
215 if (GV->getName() == "llvm.used")
216 return true; // No need to emit this at all.
218 if (GV->getName() == "llvm.global_ctors" && GV->use_empty()) {
219 SwitchToDataSection(StaticCtorsSection, 0);
221 EmitXXStructorList(GV->getInitializer());
225 if (GV->getName() == "llvm.global_dtors" && GV->use_empty()) {
226 SwitchToDataSection(StaticDtorsSection, 0);
228 EmitXXStructorList(GV->getInitializer());
235 /// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the
236 /// function pointers, ignoring the init priority.
237 void AsmPrinter::EmitXXStructorList(Constant *List) {
238 // Should be an array of '{ int, void ()* }' structs. The first value is the
239 // init priority, which we ignore.
240 if (!isa<ConstantArray>(List)) return;
241 ConstantArray *InitList = cast<ConstantArray>(List);
242 for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i)
243 if (ConstantStruct *CS = dyn_cast<ConstantStruct>(InitList->getOperand(i))){
244 if (CS->getNumOperands() != 2) return; // Not array of 2-element structs.
246 if (CS->getOperand(1)->isNullValue())
247 return; // Found a null terminator, exit printing.
248 // Emit the function pointer.
249 EmitGlobalConstant(CS->getOperand(1));
253 /// getPreferredAlignmentLog - Return the preferred alignment of the
254 /// specified global, returned in log form. This includes an explicitly
255 /// requested alignment (if the global has one).
256 unsigned AsmPrinter::getPreferredAlignmentLog(const GlobalVariable *GV) const {
257 unsigned Alignment = TM.getTargetData()->getTypeAlignmentShift(GV->getType());
258 if (GV->getAlignment() > (1U << Alignment))
259 Alignment = Log2_32(GV->getAlignment());
261 if (GV->hasInitializer()) {
262 // Always round up alignment of global doubles to 8 bytes.
263 if (GV->getType()->getElementType() == Type::DoubleTy && Alignment < 3)
266 // If the global is not external, see if it is large. If so, give it a
268 if (TM.getTargetData()->getTypeSize(GV->getType()->getElementType()) > 128)
269 Alignment = 4; // 16-byte alignment.
275 // EmitAlignment - Emit an alignment directive to the specified power of two.
276 void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
277 if (GV && GV->getAlignment())
278 NumBits = Log2_32(GV->getAlignment());
279 if (NumBits == 0) return; // No need to emit alignment.
280 if (AlignmentIsInBytes) NumBits = 1 << NumBits;
281 O << AlignDirective << NumBits << "\n";
284 /// EmitZeros - Emit a block of zeros.
286 void AsmPrinter::EmitZeros(uint64_t NumZeros) const {
289 O << ZeroDirective << NumZeros;
290 if (ZeroDirectiveSuffix)
291 O << ZeroDirectiveSuffix;
294 for (; NumZeros; --NumZeros)
295 O << Data8bitsDirective << "0\n";
300 // Print out the specified constant, without a storage class. Only the
301 // constants valid in constant expressions can occur here.
302 void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
303 if (CV->isNullValue() || isa<UndefValue>(CV))
305 else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) {
306 assert(CB == ConstantBool::True);
308 } else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV))
309 if (((CI->getValue() << 32) >> 32) == CI->getValue())
312 O << (uint64_t)CI->getValue();
313 else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
315 else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
316 // This is a constant address for a global variable or function. Use the
317 // name of the variable or function as the address value, possibly
318 // decorating it with GlobalVarAddrPrefix/Suffix or
319 // FunctionAddrPrefix/Suffix (these all default to "" )
320 if (isa<Function>(GV))
321 O << FunctionAddrPrefix << Mang->getValueName(GV) << FunctionAddrSuffix;
323 O << GlobalVarAddrPrefix << Mang->getValueName(GV) << GlobalVarAddrSuffix;
324 } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
325 const TargetData *TD = TM.getTargetData();
326 switch(CE->getOpcode()) {
327 case Instruction::GetElementPtr: {
328 // generate a symbolic expression for the byte address
329 const Constant *ptrVal = CE->getOperand(0);
330 std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
331 if (int64_t Offset = TD->getIndexedOffset(ptrVal->getType(), idxVec)) {
334 EmitConstantValueOnly(ptrVal);
336 O << ") + " << Offset;
338 O << ") - " << -Offset;
340 EmitConstantValueOnly(ptrVal);
344 case Instruction::Cast: {
345 // Support only non-converting or widening casts for now, that is, ones
346 // that do not involve a change in value. This assertion is really gross,
347 // and may not even be a complete check.
348 Constant *Op = CE->getOperand(0);
349 const Type *OpTy = Op->getType(), *Ty = CE->getType();
351 // Remember, kids, pointers can be losslessly converted back and forth
352 // into 32-bit or wider integers, regardless of signedness. :-P
353 assert(((isa<PointerType>(OpTy)
354 && (Ty == Type::LongTy || Ty == Type::ULongTy
355 || Ty == Type::IntTy || Ty == Type::UIntTy))
356 || (isa<PointerType>(Ty)
357 && (OpTy == Type::LongTy || OpTy == Type::ULongTy
358 || OpTy == Type::IntTy || OpTy == Type::UIntTy))
359 || (((TD->getTypeSize(Ty) >= TD->getTypeSize(OpTy))
360 && OpTy->isLosslesslyConvertibleTo(Ty))))
361 && "FIXME: Don't yet support this kind of constant cast expr");
362 EmitConstantValueOnly(Op);
365 case Instruction::Add:
367 EmitConstantValueOnly(CE->getOperand(0));
369 EmitConstantValueOnly(CE->getOperand(1));
373 assert(0 && "Unsupported operator!");
376 assert(0 && "Unknown constant value!");
380 /// toOctal - Convert the low order bits of X into an octal digit.
382 static inline char toOctal(int X) {
386 /// printAsCString - Print the specified array as a C compatible string, only if
387 /// the predicate isString is true.
389 static void printAsCString(std::ostream &O, const ConstantArray *CVA,
391 assert(CVA->isString() && "Array is not string compatible!");
394 for (unsigned i = 0; i != LastElt; ++i) {
396 (unsigned char)cast<ConstantInt>(CVA->getOperand(i))->getRawValue();
400 } else if (C == '\\') {
402 } else if (isprint(C)) {
406 case '\b': O << "\\b"; break;
407 case '\f': O << "\\f"; break;
408 case '\n': O << "\\n"; break;
409 case '\r': O << "\\r"; break;
410 case '\t': O << "\\t"; break;
413 O << toOctal(C >> 6);
414 O << toOctal(C >> 3);
415 O << toOctal(C >> 0);
423 /// EmitString - Emit a zero-byte-terminated string constant.
425 void AsmPrinter::EmitString(const ConstantArray *CVA) const {
426 unsigned NumElts = CVA->getNumOperands();
427 if (AscizDirective && NumElts &&
428 cast<ConstantInt>(CVA->getOperand(NumElts-1))->getRawValue() == 0) {
430 printAsCString(O, CVA, NumElts-1);
433 printAsCString(O, CVA, NumElts);
438 /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
440 void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
441 const TargetData *TD = TM.getTargetData();
443 if (CV->isNullValue() || isa<UndefValue>(CV)) {
444 EmitZeros(TD->getTypeSize(CV->getType()));
446 } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
447 if (CVA->isString()) {
449 } else { // Not a string. Print the values in successive locations
450 for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i)
451 EmitGlobalConstant(CVA->getOperand(i));
454 } else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV)) {
455 // Print the fields in successive locations. Pad to align if needed!
456 const StructLayout *cvsLayout = TD->getStructLayout(CVS->getType());
457 uint64_t sizeSoFar = 0;
458 for (unsigned i = 0, e = CVS->getNumOperands(); i != e; ++i) {
459 const Constant* field = CVS->getOperand(i);
461 // Check if padding is needed and insert one or more 0s.
462 uint64_t fieldSize = TD->getTypeSize(field->getType());
463 uint64_t padSize = ((i == e-1? cvsLayout->StructSize
464 : cvsLayout->MemberOffsets[i+1])
465 - cvsLayout->MemberOffsets[i]) - fieldSize;
466 sizeSoFar += fieldSize + padSize;
468 // Now print the actual field value
469 EmitGlobalConstant(field);
471 // Insert the field padding unless it's zero bytes...
474 assert(sizeSoFar == cvsLayout->StructSize &&
475 "Layout of constant struct may be incorrect!");
477 } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
478 // FP Constants are printed as integer constants to avoid losing
480 double Val = CFP->getValue();
481 if (CFP->getType() == Type::DoubleTy) {
482 if (Data64bitsDirective)
483 O << Data64bitsDirective << DoubleToBits(Val) << "\t" << CommentString
484 << " double value: " << Val << "\n";
485 else if (TD->isBigEndian()) {
486 O << Data32bitsDirective << unsigned(DoubleToBits(Val) >> 32)
487 << "\t" << CommentString << " double most significant word "
489 O << Data32bitsDirective << unsigned(DoubleToBits(Val))
490 << "\t" << CommentString << " double least significant word "
493 O << Data32bitsDirective << unsigned(DoubleToBits(Val))
494 << "\t" << CommentString << " double least significant word " << Val
496 O << Data32bitsDirective << unsigned(DoubleToBits(Val) >> 32)
497 << "\t" << CommentString << " double most significant word " << Val
502 O << Data32bitsDirective << FloatToBits(Val) << "\t" << CommentString
503 << " float " << Val << "\n";
506 } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) {
507 if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
508 uint64_t Val = CI->getRawValue();
510 if (Data64bitsDirective)
511 O << Data64bitsDirective << Val << "\n";
512 else if (TD->isBigEndian()) {
513 O << Data32bitsDirective << unsigned(Val >> 32)
514 << "\t" << CommentString << " Double-word most significant word "
516 O << Data32bitsDirective << unsigned(Val)
517 << "\t" << CommentString << " Double-word least significant word "
520 O << Data32bitsDirective << unsigned(Val)
521 << "\t" << CommentString << " Double-word least significant word "
523 O << Data32bitsDirective << unsigned(Val >> 32)
524 << "\t" << CommentString << " Double-word most significant word "
529 } else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CV)) {
530 const PackedType *PTy = CP->getType();
532 for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++I)
533 EmitGlobalConstant(CP->getOperand(I));
538 const Type *type = CV->getType();
539 switch (type->getTypeID()) {
541 case Type::UByteTyID: case Type::SByteTyID:
542 O << Data8bitsDirective;
544 case Type::UShortTyID: case Type::ShortTyID:
545 O << Data16bitsDirective;
547 case Type::PointerTyID:
548 if (TD->getPointerSize() == 8) {
549 O << Data64bitsDirective;
552 //Fall through for pointer size == int size
553 case Type::UIntTyID: case Type::IntTyID:
554 O << Data32bitsDirective;
556 case Type::ULongTyID: case Type::LongTyID:
557 assert(Data64bitsDirective &&"Target cannot handle 64-bit constant exprs!");
558 O << Data64bitsDirective;
560 case Type::FloatTyID: case Type::DoubleTyID:
561 assert (0 && "Should have already output floating point constant.");
563 assert (0 && "Can't handle printing this type of thing");
566 EmitConstantValueOnly(CV);
570 /// printInlineAsm - This method formats and prints the specified machine
571 /// instruction that is an inline asm.
572 void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
573 O << InlineAsmStart << "\n\t";
574 unsigned NumOperands = MI->getNumOperands();
576 // Count the number of register definitions.
577 unsigned NumDefs = 0;
578 for (; MI->getOperand(NumDefs).isDef(); ++NumDefs)
579 assert(NumDefs != NumOperands-1 && "No asm string?");
581 assert(MI->getOperand(NumDefs).isExternalSymbol() && "No asm string?");
583 // Disassemble the AsmStr, printing out the literal pieces, the operands, etc.
584 const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
586 // The variant of the current asmprinter: FIXME: change.
587 int AsmPrinterVariant = 0;
589 int CurVariant = -1; // The number of the {.|.|.} region we are in.
590 const char *LastEmitted = AsmStr; // One past the last character emitted.
592 while (*LastEmitted) {
593 switch (*LastEmitted) {
595 // Not a special case, emit the string section literally.
596 const char *LiteralEnd = LastEmitted+1;
597 while (*LiteralEnd && *LiteralEnd != '{' && *LiteralEnd != '|' &&
598 *LiteralEnd != '}' && *LiteralEnd != '$' && *LiteralEnd != '\n')
600 if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
601 O.write(LastEmitted, LiteralEnd-LastEmitted);
602 LastEmitted = LiteralEnd;
606 ++LastEmitted; // Consume newline character.
607 O << "\n\t"; // Indent code with newline.
610 ++LastEmitted; // Consume '$' character.
611 if (*LastEmitted == '$') { // $$ -> $
612 if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
614 ++LastEmitted; // Consume second '$' character.
618 bool HasCurlyBraces = false;
619 if (*LastEmitted == '{') { // ${variable}
620 ++LastEmitted; // Consume '{' character.
621 HasCurlyBraces = true;
624 const char *IDStart = LastEmitted;
626 long Val = strtol(IDStart, &IDEnd, 10); // We only accept numbers for IDs.
627 if (!isdigit(*IDStart) || (Val == 0 && errno == EINVAL)) {
628 std::cerr << "Bad $ operand number in inline asm string: '"
634 char Modifier[2] = { 0, 0 };
636 if (HasCurlyBraces) {
637 // If we have curly braces, check for a modifier character. This
638 // supports syntax like ${0:u}, which correspond to "%u0" in GCC asm.
639 if (*LastEmitted == ':') {
640 ++LastEmitted; // Consume ':' character.
641 if (*LastEmitted == 0) {
642 std::cerr << "Bad ${:} expression in inline asm string: '"
647 Modifier[0] = *LastEmitted;
648 ++LastEmitted; // Consume modifier character.
651 if (*LastEmitted != '}') {
652 std::cerr << "Bad ${} expression in inline asm string: '"
656 ++LastEmitted; // Consume '}' character.
659 if ((unsigned)Val >= NumOperands-1) {
660 std::cerr << "Invalid $ operand number in inline asm string: '"
665 // Okay, we finally have a value number. Ask the target to print this
667 if (CurVariant == -1 || CurVariant == AsmPrinterVariant) {
670 // Scan to find the machine operand number for the operand.
672 unsigned OpFlags = MI->getOperand(OpNo).getImmedValue();
673 OpNo += (OpFlags >> 3) + 1;
676 unsigned OpFlags = MI->getOperand(OpNo).getImmedValue();
677 ++OpNo; // Skip over the ID number.
680 AsmPrinter *AP = const_cast<AsmPrinter*>(this);
681 if ((OpFlags & 7) == 4 /*ADDR MODE*/) {
682 Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
683 Modifier[0] ? Modifier : 0);
685 Error = AP->PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
686 Modifier[0] ? Modifier : 0);
689 std::cerr << "Invalid operand found in inline asm: '"
698 ++LastEmitted; // Consume '{' character.
699 if (CurVariant != -1) {
700 std::cerr << "Nested variants found in inline asm string: '"
704 CurVariant = 0; // We're in the first variant now.
707 ++LastEmitted; // consume '|' character.
708 if (CurVariant == -1) {
709 std::cerr << "Found '|' character outside of variant in inline asm "
710 << "string: '" << AsmStr << "'\n";
713 ++CurVariant; // We're in the next variant.
716 ++LastEmitted; // consume '}' character.
717 if (CurVariant == -1) {
718 std::cerr << "Found '}' character outside of variant in inline asm "
719 << "string: '" << AsmStr << "'\n";
726 O << "\n\t" << InlineAsmEnd << "\n";
729 /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
730 /// instruction, using the specified assembler variant. Targets should
731 /// overried this to format as appropriate.
732 bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
733 unsigned AsmVariant, const char *ExtraCode) {
734 // Target doesn't support this yet!
738 bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
740 const char *ExtraCode) {
741 // Target doesn't support this yet!
745 /// printBasicBlockLabel - This method prints the label for the specified
746 /// MachineBasicBlock
747 void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
749 bool printComment) const {
750 O << PrivateGlobalPrefix << "BB" << FunctionNumber << "_"
755 O << '\t' << CommentString << MBB->getBasicBlock()->getName();