Andrew Lenharth | 0126952 | 2005-01-24 18:37:48 +0000 | [diff] [blame] | 1 | //===-- AlphaAsmPrinter.cpp - Alpha LLVM assembly writer ------------------===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 2 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 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. |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 7 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains a printer that converts from our internal representation |
| 11 | // of machine-dependent LLVM code to GAS-format Alpha assembly language. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Chris Lattner | 95b2c7d | 2006-12-19 22:59:26 +0000 | [diff] [blame] | 15 | #define DEBUG_TYPE "asm-printer" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 16 | #include "Alpha.h" |
| 17 | #include "AlphaInstrInfo.h" |
Andrew Lenharth | 120ab48 | 2005-09-29 22:54:56 +0000 | [diff] [blame] | 18 | #include "AlphaTargetMachine.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 19 | #include "llvm/Module.h" |
Chris Lattner | 5b3a455 | 2005-03-17 15:38:16 +0000 | [diff] [blame] | 20 | #include "llvm/Type.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 21 | #include "llvm/Assembly/Writer.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/AsmPrinter.h" |
Jim Laskey | 563321a | 2006-09-06 18:34:40 +0000 | [diff] [blame] | 23 | #include "llvm/Target/TargetAsmInfo.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 24 | #include "llvm/Target/TargetMachine.h" |
Chris Lattner | 11fd2f1 | 2006-12-06 18:19:53 +0000 | [diff] [blame] | 25 | #include "llvm/Support/Compiler.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 26 | #include "llvm/Support/Mangler.h" |
| 27 | #include "llvm/ADT/Statistic.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 28 | using namespace llvm; |
| 29 | |
Chris Lattner | 95b2c7d | 2006-12-19 22:59:26 +0000 | [diff] [blame] | 30 | STATISTIC(EmittedInsts, "Number of machine instrs printed"); |
| 31 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 32 | namespace { |
Jim Laskey | 563321a | 2006-09-06 18:34:40 +0000 | [diff] [blame] | 33 | struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter { |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 34 | |
| 35 | /// Unique incrementer for label values for referencing Global values. |
| 36 | /// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 37 | |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 38 | AlphaAsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T) |
Andrew Lenharth | 0fb2590 | 2006-12-07 23:55:55 +0000 | [diff] [blame] | 39 | : AsmPrinter(o, tm, T) { |
Andrew Lenharth | 440e688 | 2005-02-04 14:09:38 +0000 | [diff] [blame] | 40 | } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 41 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 42 | virtual const char *getPassName() const { |
| 43 | return "Alpha Assembly Printer"; |
| 44 | } |
| 45 | bool printInstruction(const MachineInstr *MI); |
| 46 | void printOp(const MachineOperand &MO, bool IsCallOp = false); |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 47 | void printOperand(const MachineInstr *MI, int opNum); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 48 | void printBaseOffsetPair (const MachineInstr *MI, int i, bool brackets=true); |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 49 | bool runOnMachineFunction(MachineFunction &F); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 50 | bool doInitialization(Module &M); |
| 51 | bool doFinalization(Module &M); |
Chris Lattner | 6e79629 | 2006-10-05 02:47:13 +0000 | [diff] [blame] | 52 | |
Andrew Lenharth | 1725599 | 2006-06-21 13:37:27 +0000 | [diff] [blame] | 53 | bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
| 54 | unsigned AsmVariant, const char *ExtraCode); |
Andrew Lenharth | df97cc6 | 2006-06-21 15:42:36 +0000 | [diff] [blame] | 55 | bool PrintAsmMemoryOperand(const MachineInstr *MI, |
Anton Korobeynikov | bed2946 | 2007-04-16 18:10:23 +0000 | [diff] [blame] | 56 | unsigned OpNo, |
| 57 | unsigned AsmVariant, |
| 58 | const char *ExtraCode); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 59 | }; |
| 60 | } // end of anonymous namespace |
| 61 | |
| 62 | /// createAlphaCodePrinterPass - Returns a pass that prints the Alpha |
| 63 | /// assembly code for a MachineFunction to the given output stream, |
| 64 | /// using the given target machine description. This should work |
| 65 | /// regardless of whether the function is in SSA form. |
| 66 | /// |
Chris Lattner | 6e79629 | 2006-10-05 02:47:13 +0000 | [diff] [blame] | 67 | FunctionPass *llvm::createAlphaCodePrinterPass(std::ostream &o, |
| 68 | TargetMachine &tm) { |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 69 | return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo()); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | #include "AlphaGenAsmWriter.inc" |
| 73 | |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 74 | void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum) |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 75 | { |
| 76 | const MachineOperand &MO = MI->getOperand(opNum); |
Chris Lattner | 2d90ac7 | 2006-05-04 18:05:43 +0000 | [diff] [blame] | 77 | if (MO.getType() == MachineOperand::MO_Register) { |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 78 | assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physreg??"); |
Andrew Lenharth | 0126952 | 2005-01-24 18:37:48 +0000 | [diff] [blame] | 79 | O << TM.getRegisterInfo()->get(MO.getReg()).Name; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 80 | } else if (MO.isImmediate()) { |
| 81 | O << MO.getImmedValue(); |
Andrew Lenharth | 3aa92e4 | 2006-05-17 19:24:31 +0000 | [diff] [blame] | 82 | assert(MO.getImmedValue() < (1 << 30)); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 83 | } else { |
| 84 | printOp(MO); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | |
| 89 | void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) { |
| 90 | const MRegisterInfo &RI = *TM.getRegisterInfo(); |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 91 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 92 | switch (MO.getType()) { |
Chris Lattner | 2d90ac7 | 2006-05-04 18:05:43 +0000 | [diff] [blame] | 93 | case MachineOperand::MO_Register: |
Andrew Lenharth | 0126952 | 2005-01-24 18:37:48 +0000 | [diff] [blame] | 94 | O << RI.get(MO.getReg()).Name; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 95 | return; |
| 96 | |
Chris Lattner | 63b3d71 | 2006-05-04 17:21:20 +0000 | [diff] [blame] | 97 | case MachineOperand::MO_Immediate: |
Bill Wendling | f5da133 | 2006-12-07 22:21:48 +0000 | [diff] [blame] | 98 | cerr << "printOp() does not handle immediate values\n"; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 99 | abort(); |
| 100 | return; |
| 101 | |
Nate Begeman | 37efe67 | 2006-04-22 18:53:45 +0000 | [diff] [blame] | 102 | case MachineOperand::MO_MachineBasicBlock: |
| 103 | printBasicBlockLabel(MO.getMachineBasicBlock()); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 104 | return; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 105 | |
| 106 | case MachineOperand::MO_ConstantPoolIndex: |
Evan Cheng | 347d39f | 2007-10-14 05:57:21 +0000 | [diff] [blame] | 107 | O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_" |
| 108 | << MO.getConstantPoolIndex(); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 109 | return; |
| 110 | |
| 111 | case MachineOperand::MO_ExternalSymbol: |
| 112 | O << MO.getSymbolName(); |
| 113 | return; |
| 114 | |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 115 | case MachineOperand::MO_GlobalAddress: { |
| 116 | GlobalValue *GV = MO.getGlobal(); |
| 117 | O << Mang->getValueName(GV); |
| 118 | if (GV->isDeclaration() && GV->hasExternalWeakLinkage()) |
| 119 | ExtWeakSymbols.insert(GV); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 120 | return; |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 121 | } |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 122 | |
Andrew Lenharth | ea4f9d5 | 2006-09-18 18:01:03 +0000 | [diff] [blame] | 123 | case MachineOperand::MO_JumpTableIndex: |
Evan Cheng | 347d39f | 2007-10-14 05:57:21 +0000 | [diff] [blame] | 124 | O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() |
| 125 | << '_' << MO.getJumpTableIndex(); |
Andrew Lenharth | ea4f9d5 | 2006-09-18 18:01:03 +0000 | [diff] [blame] | 126 | return; |
| 127 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 128 | default: |
| 129 | O << "<unknown operand type: " << MO.getType() << ">"; |
| 130 | return; |
| 131 | } |
| 132 | } |
| 133 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 134 | /// runOnMachineFunction - This uses the printMachineInstruction() |
| 135 | /// method to print assembly for each instruction. |
| 136 | /// |
| 137 | bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { |
Chris Lattner | 8b8b951 | 2005-11-21 07:51:23 +0000 | [diff] [blame] | 138 | SetupMachineFunction(MF); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 139 | O << "\n\n"; |
| 140 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 141 | // Print out constants referenced by the function |
Chris Lattner | 6053010 | 2005-11-21 08:29:17 +0000 | [diff] [blame] | 142 | EmitConstantPool(MF.getConstantPool()); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 143 | |
Andrew Lenharth | ea4f9d5 | 2006-09-18 18:01:03 +0000 | [diff] [blame] | 144 | // Print out jump tables referenced by the function |
Chris Lattner | 1da31ee | 2006-10-05 03:01:21 +0000 | [diff] [blame] | 145 | EmitJumpTableInfo(MF.getJumpTableInfo(), MF); |
Andrew Lenharth | ea4f9d5 | 2006-09-18 18:01:03 +0000 | [diff] [blame] | 146 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 147 | // Print out labels for the function. |
Andrew Lenharth | fd89543 | 2006-02-04 19:13:09 +0000 | [diff] [blame] | 148 | const Function *F = MF.getFunction(); |
Chris Lattner | 6e79629 | 2006-10-05 02:47:13 +0000 | [diff] [blame] | 149 | SwitchToTextSection(getSectionForFunction(*F).c_str(), F); |
| 150 | |
Andrew Lenharth | fd89543 | 2006-02-04 19:13:09 +0000 | [diff] [blame] | 151 | EmitAlignment(4, F); |
| 152 | switch (F->getLinkage()) { |
| 153 | default: assert(0 && "Unknown linkage type!"); |
| 154 | case Function::InternalLinkage: // Symbols default to internal. |
| 155 | break; |
| 156 | case Function::ExternalLinkage: |
| 157 | O << "\t.globl " << CurrentFnName << "\n"; |
| 158 | break; |
| 159 | case Function::WeakLinkage: |
| 160 | case Function::LinkOnceLinkage: |
Andrew Lenharth | 0fb2590 | 2006-12-07 23:55:55 +0000 | [diff] [blame] | 161 | O << TAI->getWeakRefDirective() << CurrentFnName << "\n"; |
Andrew Lenharth | fd89543 | 2006-02-04 19:13:09 +0000 | [diff] [blame] | 162 | break; |
| 163 | } |
| 164 | |
Andrew Lenharth | 044f31f | 2005-05-27 03:39:30 +0000 | [diff] [blame] | 165 | O << "\t.ent " << CurrentFnName << "\n"; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 166 | |
| 167 | O << CurrentFnName << ":\n"; |
| 168 | |
| 169 | // Print out code for the function. |
| 170 | for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); |
| 171 | I != E; ++I) { |
Andrew Lenharth | 0fb2590 | 2006-12-07 23:55:55 +0000 | [diff] [blame] | 172 | if (I != MF.begin()) { |
| 173 | printBasicBlockLabel(I, true); |
| 174 | O << '\n'; |
| 175 | } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 176 | for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); |
| 177 | II != E; ++II) { |
| 178 | // Print the assembly for the instruction. |
Andrew Lenharth | 0fb2590 | 2006-12-07 23:55:55 +0000 | [diff] [blame] | 179 | ++EmittedInsts; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 180 | O << "\t"; |
Andrew Lenharth | 0fb2590 | 2006-12-07 23:55:55 +0000 | [diff] [blame] | 181 | if (!printInstruction(II)) { |
| 182 | assert(0 && "Unhandled instruction in asm writer!"); |
| 183 | abort(); |
| 184 | } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 185 | } |
| 186 | } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 187 | |
Andrew Lenharth | 2b6c4f5 | 2005-02-25 22:55:15 +0000 | [diff] [blame] | 188 | O << "\t.end " << CurrentFnName << "\n"; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 189 | |
| 190 | // We didn't modify anything. |
| 191 | return false; |
| 192 | } |
| 193 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 194 | bool AlphaAsmPrinter::doInitialization(Module &M) |
| 195 | { |
Andrew Lenharth | 3553d86 | 2007-01-24 21:09:16 +0000 | [diff] [blame] | 196 | if(TM.getSubtarget<AlphaSubtarget>().hasCT()) |
| 197 | O << "\t.arch ev6\n"; //This might need to be ev67, so leave this test here |
Andrew Lenharth | 3ae1829 | 2005-04-14 16:24:00 +0000 | [diff] [blame] | 198 | else |
Andrew Lenharth | 3553d86 | 2007-01-24 21:09:16 +0000 | [diff] [blame] | 199 | O << "\t.arch ev6\n"; |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 200 | O << "\t.set noat\n"; |
Dan Gohman | b8275a3 | 2007-07-25 19:33:14 +0000 | [diff] [blame] | 201 | return AsmPrinter::doInitialization(M); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 202 | } |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 203 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 204 | bool AlphaAsmPrinter::doFinalization(Module &M) { |
Owen Anderson | a69571c | 2006-05-03 01:29:57 +0000 | [diff] [blame] | 205 | const TargetData *TD = TM.getTargetData(); |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 206 | |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 207 | for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 208 | |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 209 | if (!I->hasInitializer()) continue; // External global require no code |
| 210 | |
| 211 | // Check to see if this is a special global used by LLVM, if so, emit it. |
| 212 | if (EmitSpecialLLVMGlobal(I)) |
| 213 | continue; |
| 214 | |
| 215 | std::string name = Mang->getValueName(I); |
| 216 | Constant *C = I->getInitializer(); |
Duncan Sands | ca0ed74 | 2007-11-05 00:04:43 +0000 | [diff] [blame^] | 217 | unsigned Size = TD->getABITypeSize(C->getType()); |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 218 | unsigned Align = TD->getPreferredAlignmentLog(I); |
| 219 | |
| 220 | //1: hidden? |
| 221 | if (I->hasHiddenVisibility()) |
| 222 | O << TAI->getHiddenDirective() << name << "\n"; |
| 223 | |
| 224 | //2: kind |
| 225 | switch (I->getLinkage()) { |
| 226 | case GlobalValue::LinkOnceLinkage: |
| 227 | case GlobalValue::WeakLinkage: |
| 228 | O << TAI->getWeakRefDirective() << name << '\n'; |
| 229 | break; |
| 230 | case GlobalValue::AppendingLinkage: |
| 231 | case GlobalValue::ExternalLinkage: |
| 232 | O << "\t.globl " << name << "\n"; |
| 233 | break; |
| 234 | case GlobalValue::InternalLinkage: |
| 235 | break; |
| 236 | default: |
| 237 | assert(0 && "Unknown linkage type!"); |
| 238 | cerr << "Unknown linkage type!\n"; |
| 239 | abort(); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 240 | } |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 241 | |
| 242 | //3: Section (if changed) |
| 243 | if (I->hasSection() && |
| 244 | (I->getSection() == ".ctors" || |
| 245 | I->getSection() == ".dtors")) { |
| 246 | std::string SectionName = ".section\t" + I->getSection() |
| 247 | + ",\"aw\",@progbits"; |
| 248 | SwitchToDataSection(SectionName.c_str()); |
| 249 | } else { |
| 250 | if (C->isNullValue()) |
| 251 | SwitchToDataSection("\t.section\t.bss", I); |
| 252 | else |
| 253 | SwitchToDataSection("\t.section\t.data", I); |
Andrew Lenharth | 913ab05 | 2006-12-07 17:39:14 +0000 | [diff] [blame] | 254 | } |
Andrew Lenharth | 921a83a | 2007-02-13 23:41:16 +0000 | [diff] [blame] | 255 | |
| 256 | //4: Type, Size, Align |
| 257 | O << "\t.type\t" << name << ", @object\n"; |
| 258 | O << "\t.size\t" << name << ", " << Size << "\n"; |
| 259 | EmitAlignment(Align, I); |
| 260 | |
| 261 | O << name << ":\n"; |
| 262 | |
| 263 | // If the initializer is a extern weak symbol, remember to emit the weak |
| 264 | // reference! |
| 265 | if (const GlobalValue *GV = dyn_cast<GlobalValue>(C)) |
| 266 | if (GV->hasExternalWeakLinkage()) |
| 267 | ExtWeakSymbols.insert(GV); |
| 268 | |
| 269 | EmitGlobalConstant(C); |
| 270 | O << '\n'; |
| 271 | } |
Andrew Lenharth | 913ab05 | 2006-12-07 17:39:14 +0000 | [diff] [blame] | 272 | |
Dan Gohman | b8275a3 | 2007-07-25 19:33:14 +0000 | [diff] [blame] | 273 | return AsmPrinter::doFinalization(M); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 274 | } |
Andrew Lenharth | 1725599 | 2006-06-21 13:37:27 +0000 | [diff] [blame] | 275 | |
| 276 | /// PrintAsmOperand - Print out an operand for an inline asm expression. |
| 277 | /// |
| 278 | bool AlphaAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, |
Anton Korobeynikov | bed2946 | 2007-04-16 18:10:23 +0000 | [diff] [blame] | 279 | unsigned AsmVariant, |
| 280 | const char *ExtraCode) { |
Andrew Lenharth | 1725599 | 2006-06-21 13:37:27 +0000 | [diff] [blame] | 281 | printOperand(MI, OpNo); |
| 282 | return false; |
| 283 | } |
Andrew Lenharth | df97cc6 | 2006-06-21 15:42:36 +0000 | [diff] [blame] | 284 | |
| 285 | bool AlphaAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, |
Anton Korobeynikov | bed2946 | 2007-04-16 18:10:23 +0000 | [diff] [blame] | 286 | unsigned OpNo, |
| 287 | unsigned AsmVariant, |
| 288 | const char *ExtraCode) { |
Andrew Lenharth | df97cc6 | 2006-06-21 15:42:36 +0000 | [diff] [blame] | 289 | if (ExtraCode && ExtraCode[0]) |
| 290 | return true; // Unknown modifier. |
Andrew Lenharth | 78c252c | 2006-07-03 17:57:34 +0000 | [diff] [blame] | 291 | O << "0("; |
Andrew Lenharth | df97cc6 | 2006-06-21 15:42:36 +0000 | [diff] [blame] | 292 | printOperand(MI, OpNo); |
Andrew Lenharth | 78c252c | 2006-07-03 17:57:34 +0000 | [diff] [blame] | 293 | O << ")"; |
Andrew Lenharth | df97cc6 | 2006-06-21 15:42:36 +0000 | [diff] [blame] | 294 | return false; |
| 295 | } |