Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 1 | //===-- IA64AsmPrinter.cpp - Print out IA64 LLVM as assembly --------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Duraid Madina and is distributed under the |
| 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains a printer that converts from our internal representation |
| 11 | // of machine-dependent LLVM code to assembly accepted by the GNU binutils 'gas' |
| 12 | // assembler. The Intel 'ias' and HP-UX 'as' assemblers *may* choke on this |
| 13 | // output, but if so that's a bug I'd like to hear about: please file a bug |
| 14 | // report in bugzilla. FYI, the excellent 'ias' assembler is bundled with |
| 15 | // the Intel C/C++ compiler for Itanium Linux. |
| 16 | // |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
| 19 | #include "IA64.h" |
| 20 | #include "IA64TargetMachine.h" |
| 21 | #include "llvm/Module.h" |
Chris Lattner | 3c61f70 | 2005-03-24 05:12:48 +0000 | [diff] [blame] | 22 | #include "llvm/Type.h" |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 23 | #include "llvm/Assembly/Writer.h" |
| 24 | #include "llvm/CodeGen/AsmPrinter.h" |
| 25 | #include "llvm/CodeGen/MachineConstantPool.h" |
| 26 | #include "llvm/CodeGen/MachineFunctionPass.h" |
| 27 | #include "llvm/CodeGen/ValueTypes.h" |
| 28 | #include "llvm/Target/TargetMachine.h" |
| 29 | #include "llvm/Support/Mangler.h" |
| 30 | #include "llvm/ADT/Statistic.h" |
| 31 | #include "llvm/Support/CommandLine.h" |
| 32 | using namespace llvm; |
| 33 | |
| 34 | namespace { |
| 35 | Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); |
| 36 | |
| 37 | struct IA64SharedAsmPrinter : public AsmPrinter { |
| 38 | |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 39 | std::set<std::string> ExternalFunctionNames, ExternalObjectNames; |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 40 | |
| 41 | IA64SharedAsmPrinter(std::ostream &O, TargetMachine &TM) |
| 42 | : AsmPrinter(O, TM) { } |
| 43 | |
| 44 | void printConstantPool(MachineConstantPool *MCP); |
| 45 | bool doFinalization(Module &M); |
| 46 | }; |
| 47 | } |
| 48 | |
| 49 | static bool isScale(const MachineOperand &MO) { |
| 50 | return MO.isImmediate() && |
| 51 | (MO.getImmedValue() == 1 || MO.getImmedValue() == 2 || |
| 52 | MO.getImmedValue() == 4 || MO.getImmedValue() == 8); |
| 53 | } |
| 54 | |
| 55 | static bool isMem(const MachineInstr *MI, unsigned Op) { |
| 56 | if (MI->getOperand(Op).isFrameIndex()) return true; |
| 57 | if (MI->getOperand(Op).isConstantPoolIndex()) return true; |
| 58 | return Op+4 <= MI->getNumOperands() && |
| 59 | MI->getOperand(Op ).isRegister() && isScale(MI->getOperand(Op+1)) && |
| 60 | MI->getOperand(Op+2).isRegister() && (MI->getOperand(Op+3).isImmediate() || |
| 61 | MI->getOperand(Op+3).isGlobalAddress()); |
| 62 | } |
| 63 | |
| 64 | // SwitchSection - Switch to the specified section of the executable if we are |
| 65 | // not already in it! |
| 66 | // |
| 67 | static void SwitchSection(std::ostream &OS, std::string &CurSection, |
| 68 | const char *NewSection) { |
| 69 | if (CurSection != NewSection) { |
| 70 | CurSection = NewSection; |
| 71 | if (!CurSection.empty()) |
| 72 | OS << "\t" << NewSection << "\n"; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /// printConstantPool - Print to the current output stream assembly |
| 77 | /// representations of the constants in the constant pool MCP. This is |
| 78 | /// used to print out constants which have been "spilled to memory" by |
| 79 | /// the code generator. |
| 80 | /// |
| 81 | void IA64SharedAsmPrinter::printConstantPool(MachineConstantPool *MCP) { |
| 82 | const std::vector<Constant*> &CP = MCP->getConstants(); |
| 83 | const TargetData &TD = TM.getTargetData(); |
| 84 | |
| 85 | if (CP.empty()) return; |
| 86 | |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 87 | O << "\n\t.section .data, \"aw\", \"progbits\"\n"; |
| 88 | // FIXME: would be nice to have rodata (no 'w') when appropriate? |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 89 | for (unsigned i = 0, e = CP.size(); i != e; ++i) { |
| 90 | emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType())); |
| 91 | O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString |
| 92 | << *CP[i] << "\n"; |
| 93 | emitGlobalConstant(CP[i]); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | bool IA64SharedAsmPrinter::doFinalization(Module &M) { |
| 98 | const TargetData &TD = TM.getTargetData(); |
| 99 | std::string CurSection; |
| 100 | |
| 101 | // Print out module-level global variables here. |
Alkis Evlogimenos | 12cf385 | 2005-03-19 09:22:17 +0000 | [diff] [blame] | 102 | for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); |
| 103 | I != E; ++I) |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 104 | if (I->hasInitializer()) { // External global require no code |
| 105 | O << "\n\n"; |
| 106 | std::string name = Mang->getValueName(I); |
| 107 | Constant *C = I->getInitializer(); |
| 108 | unsigned Size = TD.getTypeSize(C->getType()); |
| 109 | unsigned Align = TD.getTypeAlignmentShift(C->getType()); |
| 110 | |
| 111 | if (C->isNullValue() && |
| 112 | (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || |
| 113 | I->hasWeakLinkage() /* FIXME: Verify correct */)) { |
| 114 | SwitchSection(O, CurSection, ".data"); |
Duraid Madina | 1f867b1 | 2005-03-31 07:40:24 +0000 | [diff] [blame] | 115 | if (I->hasInternalLinkage()) { |
| 116 | O << "\t.lcomm " << name << "," << TD.getTypeSize(C->getType()) |
| 117 | << "," << (1 << Align); |
| 118 | O << "\t\t// "; |
| 119 | } else { |
| 120 | O << "\t.common " << name << "," << TD.getTypeSize(C->getType()) |
| 121 | << "," << (1 << Align); |
| 122 | O << "\t\t// "; |
| 123 | } |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 124 | WriteAsOperand(O, I, true, true, &M); |
| 125 | O << "\n"; |
| 126 | } else { |
| 127 | switch (I->getLinkage()) { |
| 128 | case GlobalValue::LinkOnceLinkage: |
| 129 | case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak. |
| 130 | // Nonnull linkonce -> weak |
| 131 | O << "\t.weak " << name << "\n"; |
| 132 | SwitchSection(O, CurSection, ""); |
| 133 | O << "\t.section\t.llvm.linkonce.d." << name |
| 134 | << ", \"aw\", \"progbits\"\n"; |
| 135 | break; |
| 136 | case GlobalValue::AppendingLinkage: |
| 137 | // FIXME: appending linkage variables should go into a section of |
| 138 | // their name or something. For now, just emit them as external. |
| 139 | case GlobalValue::ExternalLinkage: |
| 140 | // If external or appending, declare as a global symbol |
| 141 | O << "\t.global " << name << "\n"; |
| 142 | // FALL THROUGH |
| 143 | case GlobalValue::InternalLinkage: |
| 144 | if (C->isNullValue()) |
Duraid Madina | 32c46f3 | 2005-04-02 12:30:47 +0000 | [diff] [blame] | 145 | SwitchSection(O, CurSection, ".bss"); |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 146 | else |
| 147 | SwitchSection(O, CurSection, ".data"); |
| 148 | break; |
| 149 | case GlobalValue::GhostLinkage: |
| 150 | std::cerr << "GhostLinkage cannot appear in IA64AsmPrinter!\n"; |
| 151 | abort(); |
| 152 | } |
| 153 | |
| 154 | emitAlignment(Align); |
| 155 | O << "\t.type " << name << ",@object\n"; |
| 156 | O << "\t.size " << name << "," << Size << "\n"; |
| 157 | O << name << ":\t\t\t\t// "; |
| 158 | WriteAsOperand(O, I, true, true, &M); |
| 159 | O << " = "; |
| 160 | WriteAsOperand(O, C, false, false, &M); |
| 161 | O << "\n"; |
| 162 | emitGlobalConstant(C); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | // we print out ".global X \n .type X, @function" for each external function |
| 167 | O << "\n\n// br.call targets referenced (and not defined) above: \n"; |
| 168 | for (std::set<std::string>::iterator i = ExternalFunctionNames.begin(), |
| 169 | e = ExternalFunctionNames.end(); i!=e; ++i) { |
| 170 | O << "\t.global " << *i << "\n\t.type " << *i << ", @function\n"; |
| 171 | } |
| 172 | O << "\n\n"; |
| 173 | |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 174 | // we print out ".global X \n .type X, @object" for each external object |
| 175 | O << "\n\n// (external) symbols referenced (and not defined) above: \n"; |
| 176 | for (std::set<std::string>::iterator i = ExternalObjectNames.begin(), |
| 177 | e = ExternalObjectNames.end(); i!=e; ++i) { |
| 178 | O << "\t.global " << *i << "\n\t.type " << *i << ", @object\n"; |
| 179 | } |
| 180 | O << "\n\n"; |
| 181 | |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 182 | AsmPrinter::doFinalization(M); |
| 183 | return false; // success |
| 184 | } |
| 185 | |
| 186 | namespace { |
| 187 | struct IA64AsmPrinter : public IA64SharedAsmPrinter { |
| 188 | IA64AsmPrinter(std::ostream &O, TargetMachine &TM) |
| 189 | : IA64SharedAsmPrinter(O, TM) { |
| 190 | |
| 191 | CommentString = "//"; |
Duraid Madina | 32c46f3 | 2005-04-02 12:30:47 +0000 | [diff] [blame] | 192 | Data8bitsDirective = "\tdata1\t"; // FIXME: check that we are |
| 193 | Data16bitsDirective = "\tdata2.ua\t"; // disabling auto-alignment |
| 194 | Data32bitsDirective = "\tdata4.ua\t"; // properly |
| 195 | Data64bitsDirective = "\tdata8.ua\t"; |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 196 | ZeroDirective = "\t.skip\t"; |
| 197 | AsciiDirective = "\tstring\t"; |
| 198 | |
Duraid Madina | 32c46f3 | 2005-04-02 12:30:47 +0000 | [diff] [blame] | 199 | GlobalVarAddrPrefix=""; |
| 200 | GlobalVarAddrSuffix=""; |
| 201 | FunctionAddrPrefix="@fptr("; |
| 202 | FunctionAddrSuffix=")"; |
| 203 | |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | virtual const char *getPassName() const { |
| 207 | return "IA64 Assembly Printer"; |
| 208 | } |
| 209 | |
| 210 | /// printInstruction - This method is automatically generated by tablegen |
| 211 | /// from the instruction set description. This method returns true if the |
| 212 | /// machine instruction was sufficiently described to print it, otherwise it |
| 213 | /// returns false. |
| 214 | bool printInstruction(const MachineInstr *MI); |
| 215 | |
| 216 | // This method is used by the tablegen'erated instruction printer. |
| 217 | void printOperand(const MachineInstr *MI, unsigned OpNo, MVT::ValueType VT){ |
| 218 | const MachineOperand &MO = MI->getOperand(OpNo); |
| 219 | if (MO.getType() == MachineOperand::MO_MachineRegister) { |
| 220 | assert(MRegisterInfo::isPhysicalRegister(MO.getReg())&&"Not physref??"); |
| 221 | //XXX Bug Workaround: See note in Printer::doInitialization about %. |
| 222 | O << TM.getRegisterInfo()->get(MO.getReg()).Name; |
| 223 | } else { |
| 224 | printOp(MO); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | void printS16ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 229 | MVT::ValueType VT) { |
| 230 | O << (short)MI->getOperand(OpNo).getImmedValue(); |
| 231 | } |
| 232 | void printU16ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 233 | MVT::ValueType VT) { |
| 234 | O << (unsigned short)MI->getOperand(OpNo).getImmedValue(); |
| 235 | } |
Duraid Madina | e6a0b6c | 2005-04-07 12:34:36 +0000 | [diff] [blame^] | 236 | void printS8ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 237 | MVT::ValueType VT) { |
| 238 | int val=(unsigned int)MI->getOperand(OpNo).getImmedValue(); |
| 239 | if(val>=128) val=val-256; // if negative, flip sign |
| 240 | O << val; |
| 241 | } |
| 242 | void printS14ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 243 | MVT::ValueType VT) { |
| 244 | int val=(unsigned int)MI->getOperand(OpNo).getImmedValue(); |
| 245 | if(val>=8192) val=val-16384; // if negative, flip sign |
| 246 | O << val; |
| 247 | } |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 248 | void printS21ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 249 | MVT::ValueType VT) { |
| 250 | O << (int)MI->getOperand(OpNo).getImmedValue(); // FIXME (21, not 32!) |
| 251 | } |
| 252 | void printS32ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 253 | MVT::ValueType VT) { |
| 254 | O << (int)MI->getOperand(OpNo).getImmedValue(); |
| 255 | } |
| 256 | void printU32ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 257 | MVT::ValueType VT) { |
| 258 | O << (unsigned int)MI->getOperand(OpNo).getImmedValue(); |
| 259 | } |
| 260 | void printU64ImmOperand(const MachineInstr *MI, unsigned OpNo, |
| 261 | MVT::ValueType VT) { |
| 262 | O << (uint64_t)MI->getOperand(OpNo).getImmedValue(); |
| 263 | } |
| 264 | |
| 265 | void printCallOperand(const MachineInstr *MI, unsigned OpNo, |
| 266 | MVT::ValueType VT) { |
| 267 | printOp(MI->getOperand(OpNo), true); // this is a br.call instruction |
| 268 | } |
| 269 | |
| 270 | void printMachineInstruction(const MachineInstr *MI); |
| 271 | void printOp(const MachineOperand &MO, bool isBRCALLinsn= false); |
| 272 | bool runOnMachineFunction(MachineFunction &F); |
| 273 | bool doInitialization(Module &M); |
| 274 | }; |
| 275 | } // end of anonymous namespace |
| 276 | |
| 277 | |
| 278 | // Include the auto-generated portion of the assembly writer. |
| 279 | #include "IA64GenAsmWriter.inc" |
| 280 | |
| 281 | |
| 282 | /// runOnMachineFunction - This uses the printMachineInstruction() |
| 283 | /// method to print assembly for each instruction. |
| 284 | /// |
| 285 | bool IA64AsmPrinter::runOnMachineFunction(MachineFunction &MF) { |
| 286 | setupMachineFunction(MF); |
| 287 | O << "\n\n"; |
| 288 | |
| 289 | // Print out constants referenced by the function |
| 290 | printConstantPool(MF.getConstantPool()); |
| 291 | |
| 292 | // Print out labels for the function. |
| 293 | O << "\n\t.section .text, \"ax\", \"progbits\"\n"; |
| 294 | // ^^ means "Allocated instruXions in mem, initialized" |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 295 | emitAlignment(5); |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 296 | O << "\t.global\t" << CurrentFnName << "\n"; |
| 297 | O << "\t.type\t" << CurrentFnName << ", @function\n"; |
| 298 | O << CurrentFnName << ":\n"; |
| 299 | |
| 300 | // Print out code for the function. |
| 301 | for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); |
| 302 | I != E; ++I) { |
| 303 | // Print a label for the basic block if there are any predecessors. |
| 304 | if (I->pred_begin() != I->pred_end()) |
| 305 | O << ".LBB" << CurrentFnName << "_" << I->getNumber() << ":\t" |
| 306 | << CommentString << " " << I->getBasicBlock()->getName() << "\n"; |
| 307 | for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); |
| 308 | II != E; ++II) { |
| 309 | // Print the assembly for the instruction. |
| 310 | O << "\t"; |
| 311 | printMachineInstruction(II); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | // We didn't modify anything. |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | void IA64AsmPrinter::printOp(const MachineOperand &MO, |
| 320 | bool isBRCALLinsn /* = false */) { |
| 321 | const MRegisterInfo &RI = *TM.getRegisterInfo(); |
| 322 | switch (MO.getType()) { |
| 323 | case MachineOperand::MO_VirtualRegister: |
| 324 | if (Value *V = MO.getVRegValueOrNull()) { |
| 325 | O << "<" << V->getName() << ">"; |
| 326 | return; |
| 327 | } |
| 328 | // FALLTHROUGH |
| 329 | case MachineOperand::MO_MachineRegister: |
| 330 | case MachineOperand::MO_CCRegister: { |
| 331 | O << RI.get(MO.getReg()).Name; |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | case MachineOperand::MO_SignExtendedImmed: |
| 336 | case MachineOperand::MO_UnextendedImmed: |
| 337 | O << /*(unsigned int)*/MO.getImmedValue(); |
| 338 | return; |
| 339 | case MachineOperand::MO_MachineBasicBlock: { |
| 340 | MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); |
| 341 | O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) |
| 342 | << "_" << MBBOp->getNumber () << "\t// " |
| 343 | << MBBOp->getBasicBlock ()->getName (); |
| 344 | return; |
| 345 | } |
| 346 | case MachineOperand::MO_PCRelativeDisp: |
| 347 | std::cerr << "Shouldn't use addPCDisp() when building IA64 MachineInstrs"; |
| 348 | abort (); |
| 349 | return; |
| 350 | |
| 351 | case MachineOperand::MO_ConstantPoolIndex: { |
| 352 | O << "@gprel(.CPI" << CurrentFnName << "_" |
| 353 | << MO.getConstantPoolIndex() << ")"; |
| 354 | return; |
| 355 | } |
| 356 | |
| 357 | case MachineOperand::MO_GlobalAddress: { |
| 358 | |
| 359 | // functions need @ltoff(@fptr(fn_name)) form |
| 360 | GlobalValue *GV = MO.getGlobal(); |
| 361 | Function *F = dyn_cast<Function>(GV); |
| 362 | |
| 363 | bool Needfptr=false; // if we're computing an address @ltoff(X), do |
| 364 | // we need to decorate it so it becomes |
| 365 | // @ltoff(@fptr(X)) ? |
Duraid Madina | 1f867b1 | 2005-03-31 07:40:24 +0000 | [diff] [blame] | 366 | if(F && !isBRCALLinsn /*&& F->isExternal()*/) |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 367 | Needfptr=true; |
| 368 | |
| 369 | // if this is the target of a call instruction, we should define |
| 370 | // the function somewhere (GNU gas has no problem without this, but |
| 371 | // Intel ias rightly complains of an 'undefined symbol') |
| 372 | |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 373 | if(F /*&& isBRCALLinsn*/ && F->isExternal()) |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 374 | ExternalFunctionNames.insert(Mang->getValueName(MO.getGlobal())); |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 375 | else |
| 376 | if(GV->isExternal()) // e.g. stuff like 'stdin' |
| 377 | ExternalObjectNames.insert(Mang->getValueName(MO.getGlobal())); |
| 378 | |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 379 | if (!isBRCALLinsn) |
| 380 | O << "@ltoff("; |
| 381 | if (Needfptr) |
| 382 | O << "@fptr("; |
| 383 | O << Mang->getValueName(MO.getGlobal()); |
| 384 | if (Needfptr) |
| 385 | O << ")"; // close fptr( |
| 386 | if (!isBRCALLinsn) |
| 387 | O << ")"; // close ltoff( |
| 388 | int Offset = MO.getOffset(); |
| 389 | if (Offset > 0) |
| 390 | O << " + " << Offset; |
| 391 | else if (Offset < 0) |
| 392 | O << " - " << -Offset; |
| 393 | return; |
| 394 | } |
| 395 | case MachineOperand::MO_ExternalSymbol: |
| 396 | O << MO.getSymbolName(); |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 397 | ExternalFunctionNames.insert(MO.getSymbolName()); |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 398 | return; |
| 399 | default: |
| 400 | O << "<AsmPrinter: unknown operand type: " << MO.getType() << " >"; return; |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | /// printMachineInstruction -- Print out a single IA64 LLVM instruction |
| 405 | /// MI to the current output stream. |
| 406 | /// |
| 407 | void IA64AsmPrinter::printMachineInstruction(const MachineInstr *MI) { |
| 408 | |
| 409 | ++EmittedInsts; |
| 410 | |
| 411 | // Call the autogenerated instruction printer routines. |
| 412 | printInstruction(MI); |
| 413 | } |
| 414 | |
| 415 | bool IA64AsmPrinter::doInitialization(Module &M) { |
| 416 | AsmPrinter::doInitialization(M); |
| 417 | |
Duraid Madina | ae8bd73 | 2005-03-28 15:21:43 +0000 | [diff] [blame] | 418 | O << "\n.ident \"LLVM-ia64\"\n\n" |
| 419 | << "\t.psr lsb\n" // should be "msb" on HP-UX, for starters |
Duraid Madina | 9b9d45f | 2005-03-17 18:17:03 +0000 | [diff] [blame] | 420 | << "\t.radix C\n" |
| 421 | << "\t.psr abi64\n"; // we only support 64 bits for now |
| 422 | return false; |
| 423 | } |
| 424 | |
| 425 | /// createIA64CodePrinterPass - Returns a pass that prints the IA64 |
| 426 | /// assembly code for a MachineFunction to the given output stream, using |
| 427 | /// the given target machine description. |
| 428 | /// |
| 429 | FunctionPass *llvm::createIA64CodePrinterPass(std::ostream &o,TargetMachine &tm){ |
| 430 | return new IA64AsmPrinter(o, tm); |
| 431 | } |
| 432 | |
| 433 | |