1 //===-- PPC32AsmPrinter.cpp - Print machine instrs to PowerPC assembly ----===//
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 contains a printer that converts from our internal representation
11 // of machine-dependent LLVM code to PowerPC assembly language. This printer is
12 // the output mechanism used by `llc'.
14 // Documentation at http://developer.apple.com/documentation/DeveloperTools/
15 // Reference/Assembler/ASMIntroduction/chapter_1_section_1.html
17 //===----------------------------------------------------------------------===//
19 #define DEBUG_TYPE "asmprinter"
21 #include "PowerPCInstrInfo.h"
22 #include "PowerPCTargetMachine.h"
23 #include "llvm/Constants.h"
24 #include "llvm/DerivedTypes.h"
25 #include "llvm/Module.h"
26 #include "llvm/Assembly/Writer.h"
27 #include "llvm/CodeGen/MachineConstantPool.h"
28 #include "llvm/CodeGen/MachineFunctionPass.h"
29 #include "llvm/CodeGen/MachineInstr.h"
30 #include "llvm/CodeGen/ValueTypes.h"
31 #include "llvm/Target/TargetMachine.h"
32 #include "llvm/Support/Mangler.h"
33 #include "Support/CommandLine.h"
34 #include "Support/Debug.h"
35 #include "Support/Statistic.h"
36 #include "Support/StringExtras.h"
42 Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
44 struct PowerPCAsmPrinter : public MachineFunctionPass {
45 /// Output stream on which we're printing assembly code.
49 /// Target machine description which we query for reg. names, data
52 PowerPCTargetMachine &TM;
54 /// Name-mangler for global names.
57 std::set<std::string> FnStubs, GVStubs, LinkOnceStubs;
58 std::set<std::string> Strings;
60 PowerPCAsmPrinter(std::ostream &o, TargetMachine &tm) : O(o),
61 TM(reinterpret_cast<PowerPCTargetMachine&>(tm)), LabelNumber(0) {}
63 /// Cache of mangled name for current function. This is
64 /// recalculated at the beginning of each call to
65 /// runOnMachineFunction().
67 std::string CurrentFnName;
69 /// Unique incrementer for label values for referencing Global values.
73 virtual const char *getPassName() const {
74 return "PowerPC Assembly Printer";
77 /// printInstruction - This method is automatically generated by tablegen
78 /// from the instruction set description. This method returns true if the
79 /// machine instruction was sufficiently described to print it, otherwise it
81 bool printInstruction(const MachineInstr *MI);
83 void printMachineInstruction(const MachineInstr *MI);
84 void printOp(const MachineOperand &MO, bool LoadAddrOp = false);
85 void printImmOp(const MachineOperand &MO, unsigned ArgType);
87 void printOperand(const MachineInstr *MI, unsigned OpNo, MVT::ValueType VT){
88 const MachineOperand &MO = MI->getOperand(OpNo);
89 if (MO.getType() == MachineOperand::MO_MachineRegister) {
90 assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physreg??");
91 O << LowercaseString(TM.getRegisterInfo()->get(MO.getReg()).Name);
97 void printConstantPool(MachineConstantPool *MCP);
98 bool runOnMachineFunction(MachineFunction &F);
99 bool doInitialization(Module &M);
100 bool doFinalization(Module &M);
101 void emitGlobalConstant(const Constant* CV);
102 void emitConstantValueOnly(const Constant *CV);
104 } // end of anonymous namespace
106 /// createPPC32AsmPrinterPass - Returns a pass that prints the PPC
107 /// assembly code for a MachineFunction to the given output stream,
108 /// using the given target machine description. This should work
109 /// regardless of whether the function is in SSA form or not.
111 FunctionPass *createPPCAsmPrinter(std::ostream &o,TargetMachine &tm) {
112 return new PowerPCAsmPrinter(o, tm);
115 // Include the auto-generated portion of the assembly writer
116 #include "PowerPCGenAsmWriter.inc"
118 /// isStringCompatible - Can we treat the specified array as a string?
119 /// Only if it is an array of ubytes or non-negative sbytes.
121 static bool isStringCompatible(const ConstantArray *CVA) {
122 const Type *ETy = cast<ArrayType>(CVA->getType())->getElementType();
123 if (ETy == Type::UByteTy) return true;
124 if (ETy != Type::SByteTy) return false;
126 for (unsigned i = 0; i < CVA->getNumOperands(); ++i)
127 if (cast<ConstantSInt>(CVA->getOperand(i))->getValue() < 0)
133 /// toOctal - Convert the low order bits of X into an octal digit.
135 static inline char toOctal(int X) {
139 /// getAsCString - Return the specified array as a C compatible
140 /// string, only if the predicate isStringCompatible is true.
142 static void printAsCString(std::ostream &O, const ConstantArray *CVA) {
143 assert(isStringCompatible(CVA) && "Array is not string compatible!");
146 for (unsigned i = 0; i < CVA->getNumOperands(); ++i) {
147 unsigned char C = cast<ConstantInt>(CVA->getOperand(i))->getRawValue();
151 } else if (C == '\\') {
153 } else if (isprint(C)) {
157 case '\b': O << "\\b"; break;
158 case '\f': O << "\\f"; break;
159 case '\n': O << "\\n"; break;
160 case '\r': O << "\\r"; break;
161 case '\t': O << "\\t"; break;
164 O << toOctal(C >> 6);
165 O << toOctal(C >> 3);
166 O << toOctal(C >> 0);
174 // Print out the specified constant, without a storage class. Only the
175 // constants valid in constant expressions can occur here.
176 void PowerPCAsmPrinter::emitConstantValueOnly(const Constant *CV) {
177 if (CV->isNullValue())
179 else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) {
180 assert(CB == ConstantBool::True);
182 } else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV))
184 else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
186 else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
187 // This is a constant address for a global variable or function. Use the
188 // name of the variable or function as the address value.
189 O << Mang->getValueName(GV);
190 else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
191 const TargetData &TD = TM.getTargetData();
192 switch (CE->getOpcode()) {
193 case Instruction::GetElementPtr: {
194 // generate a symbolic expression for the byte address
195 const Constant *ptrVal = CE->getOperand(0);
196 std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
197 if (unsigned Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
199 emitConstantValueOnly(ptrVal);
200 O << ") + " << Offset;
202 emitConstantValueOnly(ptrVal);
206 case Instruction::Cast: {
207 // Support only non-converting or widening casts for now, that is, ones
208 // that do not involve a change in value. This assertion is really gross,
209 // and may not even be a complete check.
210 Constant *Op = CE->getOperand(0);
211 const Type *OpTy = Op->getType(), *Ty = CE->getType();
213 // Remember, kids, pointers on x86 can be losslessly converted back and
214 // forth into 32-bit or wider integers, regardless of signedness. :-P
215 assert(((isa<PointerType>(OpTy)
216 && (Ty == Type::LongTy || Ty == Type::ULongTy
217 || Ty == Type::IntTy || Ty == Type::UIntTy))
218 || (isa<PointerType>(Ty)
219 && (OpTy == Type::LongTy || OpTy == Type::ULongTy
220 || OpTy == Type::IntTy || OpTy == Type::UIntTy))
221 || (((TD.getTypeSize(Ty) >= TD.getTypeSize(OpTy))
222 && OpTy->isLosslesslyConvertibleTo(Ty))))
223 && "FIXME: Don't yet support this kind of constant cast expr");
225 emitConstantValueOnly(Op);
229 case Instruction::Add:
231 emitConstantValueOnly(CE->getOperand(0));
233 emitConstantValueOnly(CE->getOperand(1));
237 assert(0 && "Unsupported operator!");
240 assert(0 && "Unknown constant value!");
244 // Print a constant value or values, with the appropriate storage class as a
246 void PowerPCAsmPrinter::emitGlobalConstant(const Constant *CV) {
247 const TargetData &TD = TM.getTargetData();
249 if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) {
250 if (isStringCompatible(CVA)) {
252 printAsCString(O, CVA);
254 } else { // Not a string. Print the values in successive locations
255 for (unsigned i=0, e = CVA->getNumOperands(); i != e; i++)
256 emitGlobalConstant(CVA->getOperand(i));
259 } else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV)) {
260 // Print the fields in successive locations. Pad to align if needed!
261 const StructLayout *cvsLayout = TD.getStructLayout(CVS->getType());
262 unsigned sizeSoFar = 0;
263 for (unsigned i = 0, e = CVS->getNumOperands(); i != e; i++) {
264 const Constant* field = CVS->getOperand(i);
266 // Check if padding is needed and insert one or more 0s.
267 unsigned fieldSize = TD.getTypeSize(field->getType());
268 unsigned padSize = ((i == e-1? cvsLayout->StructSize
269 : cvsLayout->MemberOffsets[i+1])
270 - cvsLayout->MemberOffsets[i]) - fieldSize;
271 sizeSoFar += fieldSize + padSize;
273 // Now print the actual field value
274 emitGlobalConstant(field);
276 // Insert the field padding unless it's zero bytes...
278 O << "\t.space\t " << padSize << "\n";
280 assert(sizeSoFar == cvsLayout->StructSize &&
281 "Layout of constant struct may be incorrect!");
283 } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
284 // FP Constants are printed as integer constants to avoid losing
286 double Val = CFP->getValue();
287 union DU { // Abide by C TBAA rules
297 O << ".long\t" << U.T.MSWord << "\t; double most significant word "
299 O << ".long\t" << U.T.LSWord << "\t; double least significant word "
302 } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) {
303 if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
304 union DU { // Abide by C TBAA rules
311 U.UVal = CI->getRawValue();
313 O << ".long\t" << U.T.MSWord << "\t; Double-word most significant word "
315 O << ".long\t" << U.T.LSWord << "\t; Double-word least significant word "
321 const Type *type = CV->getType();
323 switch (type->getTypeID()) {
324 case Type::UByteTyID: case Type::SByteTyID:
327 case Type::UShortTyID: case Type::ShortTyID:
331 case Type::PointerTyID:
332 case Type::UIntTyID: case Type::IntTyID:
335 case Type::ULongTyID: case Type::LongTyID:
336 assert (0 && "Should have already output double-word constant.");
337 case Type::FloatTyID: case Type::DoubleTyID:
338 assert (0 && "Should have already output floating point constant.");
340 if (CV == Constant::getNullValue(type)) { // Zero initializer?
341 O << ".space\t" << TD.getTypeSize(type) << "\n";
344 std::cerr << "Can't handle printing: " << *CV;
349 emitConstantValueOnly(CV);
353 /// printConstantPool - Print to the current output stream assembly
354 /// representations of the constants in the constant pool MCP. This is
355 /// used to print out constants which have been "spilled to memory" by
356 /// the code generator.
358 void PowerPCAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
359 const std::vector<Constant*> &CP = MCP->getConstants();
360 const TargetData &TD = TM.getTargetData();
362 if (CP.empty()) return;
364 for (unsigned i = 0, e = CP.size(); i != e; ++i) {
366 O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
368 O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t;"
370 emitGlobalConstant(CP[i]);
374 /// runOnMachineFunction - This uses the printMachineInstruction()
375 /// method to print assembly for each instruction.
377 bool PowerPCAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
379 // What's my mangled name?
380 CurrentFnName = Mang->getValueName(MF.getFunction());
382 // Print out constants referenced by the function
383 printConstantPool(MF.getConstantPool());
385 // Print out labels for the function.
387 O << "\t.globl\t" << CurrentFnName << "\n";
389 O << CurrentFnName << ":\n";
391 // Print out code for the function.
392 for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
394 // Print a label for the basic block.
395 O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t; "
396 << I->getBasicBlock()->getName() << "\n";
397 for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
399 // Print the assembly for the instruction.
401 printMachineInstruction(II);
406 // We didn't modify anything.
410 void PowerPCAsmPrinter::printOp(const MachineOperand &MO,
411 bool LoadAddrOp /* = false */) {
412 const MRegisterInfo &RI = *TM.getRegisterInfo();
415 switch (MO.getType()) {
416 case MachineOperand::MO_VirtualRegister:
417 if (Value *V = MO.getVRegValueOrNull()) {
418 O << "<" << V->getName() << ">";
422 case MachineOperand::MO_MachineRegister:
423 case MachineOperand::MO_CCRegister:
424 O << LowercaseString(RI.get(MO.getReg()).Name);
427 case MachineOperand::MO_SignExtendedImmed:
428 case MachineOperand::MO_UnextendedImmed:
429 std::cerr << "printOp() does not handle immediate values\n";
433 case MachineOperand::MO_PCRelativeDisp:
434 std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs";
438 case MachineOperand::MO_MachineBasicBlock: {
439 MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
440 O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction())
441 << "_" << MBBOp->getNumber() << "\t; "
442 << MBBOp->getBasicBlock()->getName();
446 case MachineOperand::MO_ConstantPoolIndex:
447 O << ".CPI" << CurrentFnName << "_" << MO.getConstantPoolIndex();
450 case MachineOperand::MO_ExternalSymbol:
451 O << MO.getSymbolName();
454 case MachineOperand::MO_GlobalAddress: {
455 GlobalValue *GV = MO.getGlobal();
456 std::string Name = Mang->getValueName(GV);
458 // Dynamically-resolved functions need a stub for the function. Be
459 // wary however not to output $stub for external functions whose addresses
460 // are taken. Those should be emitted as $non_lazy_ptr below.
461 Function *F = dyn_cast<Function>(GV);
462 if (F && F->isExternal() && !LoadAddrOp &&
463 TM.CalledFunctions.find(F) != TM.CalledFunctions.end()) {
464 FnStubs.insert(Name);
465 O << "L" << Name << "$stub";
469 // External global variables need a non-lazily-resolved stub
470 if (GV->isExternal() && TM.AddressTaken.find(GV) != TM.AddressTaken.end()) {
471 GVStubs.insert(Name);
472 O << "L" << Name << "$non_lazy_ptr";
476 if (F && LoadAddrOp && TM.AddressTaken.find(GV) != TM.AddressTaken.end()) {
477 LinkOnceStubs.insert(Name);
478 O << "L" << Name << "$non_lazy_ptr";
482 O << Mang->getValueName(GV);
487 O << "<unknown operand type: " << MO.getType() << ">";
492 void PowerPCAsmPrinter::printImmOp(const MachineOperand &MO, unsigned ArgType) {
493 int Imm = MO.getImmedValue();
494 if (ArgType == PPCII::Simm16 || ArgType == PPCII::Disimm16) {
496 } else if (ArgType == PPCII::Zimm16) {
497 O << (unsigned short)Imm;
503 /// printMachineInstruction -- Print out a single PowerPC MI in Darwin syntax to
504 /// the current output stream.
506 void PowerPCAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
508 if (printInstruction(MI))
509 return; // Printer was automatically generated
511 unsigned Opcode = MI->getOpcode();
512 const TargetInstrInfo &TII = *TM.getInstrInfo();
513 const TargetInstrDescriptor &Desc = TII.get(Opcode);
516 unsigned ArgCount = MI->getNumOperands();
517 unsigned ArgType[] = {
518 (Desc.TSFlags >> PPCII::Arg0TypeShift) & PPCII::ArgTypeMask,
519 (Desc.TSFlags >> PPCII::Arg1TypeShift) & PPCII::ArgTypeMask,
520 (Desc.TSFlags >> PPCII::Arg2TypeShift) & PPCII::ArgTypeMask,
521 (Desc.TSFlags >> PPCII::Arg3TypeShift) & PPCII::ArgTypeMask,
522 (Desc.TSFlags >> PPCII::Arg4TypeShift) & PPCII::ArgTypeMask
524 assert(((Desc.TSFlags & PPCII::VMX) == 0) &&
525 "Instruction requires VMX support");
526 assert(((Desc.TSFlags & PPCII::PPC64) == 0) &&
527 "Instruction requires 64 bit support");
529 // CALLpcrel and CALLindirect are handled specially here to print only the
530 // appropriate number of args that the assembler expects. This is because
531 // may have many arguments appended to record the uses of registers that are
532 // holding arguments to the called function.
533 if (Opcode == PPC::COND_BRANCH) {
534 std::cerr << "Error: untranslated conditional branch psuedo instruction!\n";
536 } else if (Opcode == PPC::IMPLICIT_DEF) {
537 O << "; IMPLICIT DEF ";
538 printOp(MI->getOperand(0));
541 } else if (Opcode == PPC::CALLpcrel) {
542 O << TII.getName(Opcode) << " ";
543 printOp(MI->getOperand(0));
546 } else if (Opcode == PPC::CALLindirect) {
547 O << TII.getName(Opcode) << " ";
548 printImmOp(MI->getOperand(0), ArgType[0]);
550 printImmOp(MI->getOperand(1), ArgType[0]);
553 } else if (Opcode == PPC::MovePCtoLR) {
554 // FIXME: should probably be converted to cout.width and cout.fill
555 O << "bl \"L0000" << LabelNumber << "$pb\"\n";
556 O << "\"L0000" << LabelNumber << "$pb\":\n";
558 printOp(MI->getOperand(0));
563 O << TII.getName(Opcode) << " ";
564 if (Opcode == PPC::LOADLoDirect || Opcode == PPC::LOADLoIndirect) {
565 printOp(MI->getOperand(0));
567 printOp(MI->getOperand(2), true /* LoadAddrOp */);
568 O << "-\"L0000" << LabelNumber << "$pb\")";
570 if (MI->getOperand(1).getReg() == PPC::R0)
573 printOp(MI->getOperand(1));
575 } else if (Opcode == PPC::LOADHiAddr) {
576 printOp(MI->getOperand(0));
578 if (MI->getOperand(1).getReg() == PPC::R0)
581 printOp(MI->getOperand(1));
583 printOp(MI->getOperand(2), true /* LoadAddrOp */);
584 O << "-\"L0000" << LabelNumber << "$pb\")\n";
585 } else if (ArgCount == 3 && ArgType[1] == PPCII::Disimm16) {
586 printOp(MI->getOperand(0));
588 printImmOp(MI->getOperand(1), ArgType[1]);
590 if (MI->getOperand(2).hasAllocatedReg() &&
591 MI->getOperand(2).getReg() == PPC::R0)
594 printOp(MI->getOperand(2));
597 for (i = 0; i < ArgCount; ++i) {
599 if (i == 1 && ArgCount == 3 && ArgType[2] == PPCII::Simm16 &&
600 MI->getOperand(1).hasAllocatedReg() &&
601 MI->getOperand(1).getReg() == PPC::R0) {
603 // for long branch support, bc $+8
604 } else if (i == 1 && ArgCount == 2 && MI->getOperand(1).isImmediate() &&
605 TII.isBranch(MI->getOpcode())) {
607 assert(8 == MI->getOperand(i).getImmedValue()
608 && "branch off PC not to pc+8?");
609 //printOp(MI->getOperand(i));
610 } else if (MI->getOperand(i).isImmediate()) {
611 printImmOp(MI->getOperand(i), ArgType[i]);
613 printOp(MI->getOperand(i));
615 if (ArgCount - 1 == i)
624 bool PowerPCAsmPrinter::doInitialization(Module &M) {
625 Mang = new Mangler(M, true);
626 return false; // success
629 // SwitchSection - Switch to the specified section of the executable if we are
630 // not already in it!
632 static void SwitchSection(std::ostream &OS, std::string &CurSection,
633 const char *NewSection) {
634 if (CurSection != NewSection) {
635 CurSection = NewSection;
636 if (!CurSection.empty())
637 OS << "\t" << NewSection << "\n";
641 bool PowerPCAsmPrinter::doFinalization(Module &M) {
642 const TargetData &TD = TM.getTargetData();
643 std::string CurSection;
645 // Print out module-level global variables here.
646 for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
647 if (I->hasInitializer()) { // External global require no code
649 std::string name = Mang->getValueName(I);
650 Constant *C = I->getInitializer();
651 unsigned Size = TD.getTypeSize(C->getType());
652 unsigned Align = TD.getTypeAlignment(C->getType());
654 if (C->isNullValue() && /* FIXME: Verify correct */
655 (I->hasInternalLinkage() || I->hasWeakLinkage())) {
656 SwitchSection(O, CurSection, ".data");
657 if (I->hasInternalLinkage())
658 O << ".lcomm " << name << "," << TD.getTypeSize(C->getType())
659 << "," << (unsigned)TD.getTypeAlignment(C->getType());
661 O << ".comm " << name << "," << TD.getTypeSize(C->getType());
663 WriteAsOperand(O, I, true, true, &M);
666 switch (I->getLinkage()) {
667 case GlobalValue::LinkOnceLinkage:
668 O << ".section __TEXT,__textcoal_nt,coalesced,no_toc\n"
669 << ".weak_definition " << name << '\n'
670 << ".private_extern " << name << '\n'
671 << ".section __DATA,__datacoal_nt,coalesced,no_toc\n";
672 LinkOnceStubs.insert(name);
674 case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak.
675 // Nonnull linkonce -> weak
676 O << "\t.weak " << name << "\n";
677 SwitchSection(O, CurSection, "");
678 O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n";
680 case GlobalValue::AppendingLinkage:
681 // FIXME: appending linkage variables should go into a section of
682 // their name or something. For now, just emit them as external.
683 case GlobalValue::ExternalLinkage:
684 // If external or appending, declare as a global symbol
685 O << "\t.globl " << name << "\n";
687 case GlobalValue::InternalLinkage:
688 SwitchSection(O, CurSection, ".data");
692 O << "\t.align " << Align << "\n";
693 O << name << ":\t\t\t\t; ";
694 WriteAsOperand(O, I, true, true, &M);
696 WriteAsOperand(O, C, false, false, &M);
698 emitGlobalConstant(C);
702 // Output stubs for dynamically-linked functions
703 for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
707 O << ".section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32\n";
709 O << "L" << *i << "$stub:\n";
710 O << "\t.indirect_symbol " << *i << "\n";
712 O << "\tbcl 20,31,L0$" << *i << "\n";
713 O << "L0$" << *i << ":\n";
715 O << "\taddis r11,r11,ha16(L" << *i << "$lazy_ptr-L0$" << *i << ")\n";
717 O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr-L0$" << *i << ")(r11)\n";
718 O << "\tmtctr r12\n";
721 O << ".lazy_symbol_pointer\n";
722 O << "L" << *i << "$lazy_ptr:\n";
723 O << "\t.indirect_symbol " << *i << "\n";
724 O << "\t.long dyld_stub_binding_helper\n";
729 // Output stubs for external global variables
730 if (GVStubs.begin() != GVStubs.end())
731 O << ".data\n.non_lazy_symbol_pointer\n";
732 for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end();
734 O << "L" << *i << "$non_lazy_ptr:\n";
735 O << "\t.indirect_symbol " << *i << "\n";
739 // Output stubs for link-once variables
740 if (LinkOnceStubs.begin() != LinkOnceStubs.end())
741 O << ".data\n.align 2\n";
742 for (std::set<std::string>::iterator i = LinkOnceStubs.begin(),
743 e = LinkOnceStubs.end(); i != e; ++i) {
744 O << "L" << *i << "$non_lazy_ptr:\n"
745 << "\t.long\t" << *i << '\n';
749 return false; // success
752 } // End llvm namespace