blob: 36b3d3e6ae770809ca3c9929d41f5c3bcd17438f [file] [log] [blame]
Chris Lattner72614082002-10-25 22:55:53 +00001//===-- X86/Printer.cpp - Convert X86 code to human readable rep. ---------===//
2//
3// This file contains a printer that converts from our internal representation
4// of LLVM code to a nice human readable form that is suitable for debuggging.
5//
6//===----------------------------------------------------------------------===//
7
8#include "X86.h"
Brian Gaeke6559bb92002-11-14 22:32:30 +00009#include "X86InstrInfo.h"
Brian Gaeke6559bb92002-11-14 22:32:30 +000010#include "llvm/Function.h"
Chris Lattnerb7089442003-01-13 00:35:03 +000011#include "llvm/Constant.h"
Brian Gaeke6559bb92002-11-14 22:32:30 +000012#include "llvm/Target/TargetMachine.h"
Chris Lattner0285a332002-12-28 20:25:38 +000013#include "llvm/CodeGen/MachineFunctionPass.h"
Chris Lattnerb7089442003-01-13 00:35:03 +000014#include "llvm/CodeGen/MachineConstantPool.h"
Chris Lattnerdbb61c62002-11-17 22:53:13 +000015#include "llvm/CodeGen/MachineInstr.h"
Chris Lattner233ad712002-11-21 01:33:44 +000016#include "Support/Statistic.h"
Brian Gaeke01d79ff2003-06-25 18:01:07 +000017#include "Support/hash_map"
18#include "llvm/Type.h"
19#include "llvm/Constants.h"
20#include "llvm/Assembly/Writer.h"
21#include "llvm/DerivedTypes.h"
22#include "llvm/SlotCalculator.h"
23#include "Support/StringExtras.h"
24#include "llvm/Module.h"
Chris Lattner72614082002-10-25 22:55:53 +000025
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000026namespace {
Brian Gaekebc601fe2003-06-25 22:00:39 +000027
28
29 std::set<const Value*> MangledGlobals;
Chris Lattner0285a332002-12-28 20:25:38 +000030 struct Printer : public MachineFunctionPass {
Brian Gaekebc601fe2003-06-25 22:00:39 +000031
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000032 std::ostream &O;
Chris Lattnerb7089442003-01-13 00:35:03 +000033 unsigned ConstIdx;
34 Printer(std::ostream &o) : O(o), ConstIdx(0) {}
Brian Gaeke01d79ff2003-06-25 18:01:07 +000035 const TargetData *TD;
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000036
Chris Lattnerf0eb7be2002-12-15 21:13:40 +000037 virtual const char *getPassName() const {
38 return "X86 Assembly Printer";
39 }
40
Brian Gaeke01d79ff2003-06-25 18:01:07 +000041 void printConstantPool(MachineConstantPool *MCP);
42 bool runOnMachineFunction(MachineFunction &F);
43 std::string ConstantExprToString(const ConstantExpr* CE);
44 std::string valToExprString(const Value* V);
Brian Gaeke9e474c42003-06-19 19:32:32 +000045 bool doInitialization(Module &M);
46 bool doFinalization(Module &M);
Brian Gaeke01d79ff2003-06-25 18:01:07 +000047 void PrintZeroBytesToPad(int numBytes);
48 void printConstantValueOnly(const Constant* CV, int numPadBytesAfter = 0);
49 void printSingleConstantValue(const Constant* CV);
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000050 };
Brian Gaeke01d79ff2003-06-25 18:01:07 +000051 std::map<const Value *, unsigned> NumberForBB;
Chris Lattnerb4f68ed2002-10-29 22:37:54 +000052}
53
Chris Lattnerdbb61c62002-11-17 22:53:13 +000054/// createX86CodePrinterPass - Print out the specified machine code function to
55/// the specified stream. This function should work regardless of whether or
56/// not the function is in SSA form or not.
57///
Chris Lattner0285a332002-12-28 20:25:38 +000058Pass *createX86CodePrinterPass(std::ostream &O) {
59 return new Printer(O);
Chris Lattnerdbb61c62002-11-17 22:53:13 +000060}
61
Brian Gaekebc601fe2003-06-25 22:00:39 +000062// We dont want identifier names with ., space, - in them.
63// So we replace them with _
64static std::string makeNameProper(std::string x) {
65 std::string tmp;
66 for (std::string::iterator sI = x.begin(), sEnd = x.end(); sI != sEnd; sI++)
67 switch (*sI) {
68 case '.': tmp += "d_"; break;
69 case ' ': tmp += "s_"; break;
70 case '-': tmp += "D_"; break;
71 default: tmp += *sI;
72 }
73
74 return tmp;
75}
76
77std::string getValueName(const Value *V) {
78 if (V->hasName()) { // Print out the label if it exists...
79
80 // Name mangling occurs as follows:
81 // - If V is not a global, mangling always occurs.
82 // - Otherwise, mangling occurs when any of the following are true:
83 // 1) V has internal linkage
84 // 2) V's name would collide if it is not mangled.
85 //
86
87 if(const GlobalValue* gv = dyn_cast<GlobalValue>(V)) {
88 if(!gv->hasInternalLinkage() && !MangledGlobals.count(gv)) {
89 // No internal linkage, name will not collide -> no mangling.
90 return makeNameProper(gv->getName());
91 }
92 }
93
94 // Non-global, or global with internal linkage / colliding name -> mangle.
95 return "l" + utostr(V->getType()->getUniqueID()) + "_" +
96 makeNameProper(V->getName());
97 }
98
99 static int Count = 0;
100 Count++;
101 return "ltmp_" + itostr(Count) + "_" + utostr(V->getType()->getUniqueID());
102}
103
104
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000105// valToExprString - Helper function for ConstantExprToString().
106// Appends result to argument string S.
107//
108std::string Printer::valToExprString(const Value* V) {
109 std::string S;
110 bool failed = false;
111 if (const Constant* CV = dyn_cast<Constant>(V)) { // symbolic or known
112 if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV))
113 S += std::string(CB == ConstantBool::True ? "1" : "0");
114 else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV))
115 S += itostr(CI->getValue());
116 else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
117 S += utostr(CI->getValue());
118 else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV))
119 S += ftostr(CFP->getValue());
120 else if (isa<ConstantPointerNull>(CV))
121 S += "0";
122 else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
123 S += valToExprString(CPR->getValue());
124 else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV))
125 S += ConstantExprToString(CE);
126 else
127 failed = true;
128 } else if (const GlobalValue* GV = dyn_cast<GlobalValue>(V)) {
Brian Gaekebc601fe2003-06-25 22:00:39 +0000129 S += getValueName(GV);
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000130 }
131 else
132 failed = true;
133
134 if (failed) {
135 assert(0 && "Cannot convert value to string");
136 S += "<illegal-value>";
137 }
138 return S;
139}
140
141// ConstantExprToString() - Convert a ConstantExpr to an asm expression
142// and return this as a string.
143std::string Printer::ConstantExprToString(const ConstantExpr* CE) {
144 std::string S;
145 switch(CE->getOpcode()) {
146 case Instruction::GetElementPtr:
147 { // generate a symbolic expression for the byte address
148 const Value* ptrVal = CE->getOperand(0);
149 std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
150 S += "(" + valToExprString(ptrVal) + ") + ("
151 + utostr(TD->getIndexedOffset(ptrVal->getType(),idxVec)) + ")";
152 break;
153 }
154
155 case Instruction::Cast:
156 // Support only non-converting casts for now, i.e., a no-op.
157 // This assertion is not a complete check.
158 assert(TD->getTypeSize(CE->getType()) ==
159 TD->getTypeSize(CE->getOperand(0)->getType()));
160 S += "(" + valToExprString(CE->getOperand(0)) + ")";
161 break;
162
163 case Instruction::Add:
164 S += "(" + valToExprString(CE->getOperand(0)) + ") + ("
165 + valToExprString(CE->getOperand(1)) + ")";
166 break;
167
168 default:
169 assert(0 && "Unsupported operator in ConstantExprToString()");
170 break;
171 }
172
173 return S;
174}
175
176// Print a single constant value.
177void
178Printer::printSingleConstantValue(const Constant* CV)
179{
180 assert(CV->getType() != Type::VoidTy &&
181 CV->getType() != Type::TypeTy &&
182 CV->getType() != Type::LabelTy &&
183 "Unexpected type for Constant");
184
185 assert((!isa<ConstantArray>(CV) && ! isa<ConstantStruct>(CV))
186 && "Aggregate types should be handled outside this function");
187
188 const Type *type = CV->getType();
189 O << "\t";
190 switch(type->getPrimitiveID())
191 {
192 case Type::BoolTyID: case Type::UByteTyID: case Type::SByteTyID:
193 O << ".byte";
194 break;
195 case Type::UShortTyID: case Type::ShortTyID:
196 O << ".word";
197 break;
198 case Type::UIntTyID: case Type::IntTyID: case Type::PointerTyID:
199 O << ".long";
200 break;
201 case Type::ULongTyID: case Type::LongTyID:
202 O << ".quad";
203 break;
204 case Type::FloatTyID:
205 O << ".long";
206 break;
207 case Type::DoubleTyID:
208 O << ".quad";
209 break;
210 case Type::ArrayTyID:
211 if ((cast<ArrayType>(type)->getElementType() == Type::UByteTy) ||
212 (cast<ArrayType>(type)->getElementType() == Type::SByteTy))
213 O << ".string";
214 else
215 assert (0 && "Can't handle printing this type of array");
216 break;
217 default:
218 assert (0 && "Can't handle printing this type of thing");
219 break;
220 }
221 O << "\t";
222
223 if (type->isPrimitiveType())
224 {
225 if (type->isFloatingPoint()) {
226 // FP Constants are printed as integer constants to avoid losing
227 // precision...
228 double Val = cast<ConstantFP>(CV)->getValue();
229 if (type == Type::FloatTy) {
230 float FVal = (float)Val;
231 char *ProxyPtr = (char*)&FVal; // Abide by C TBAA rules
232 O << *(unsigned int*)ProxyPtr;
233 } else if (type == Type::DoubleTy) {
234 char *ProxyPtr = (char*)&Val; // Abide by C TBAA rules
235 O << *(uint64_t*)ProxyPtr;
236 } else {
237 assert(0 && "Unknown floating point type!");
238 }
239
240 O << "\t# " << type->getDescription() << " value: " << Val << "\n";
241 } else {
242 WriteAsOperand(O, CV, false, false) << "\n";
243 }
244 }
245 else if (const ConstantPointerRef* CPR = dyn_cast<ConstantPointerRef>(CV))
246 {
247 // This is a constant address for a global variable or method.
248 // Use the name of the variable or method as the address value.
Brian Gaekebc601fe2003-06-25 22:00:39 +0000249 O << getValueName(CPR->getValue()) << "\n";
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000250 }
251 else if (isa<ConstantPointerNull>(CV))
252 {
253 // Null pointer value
254 O << "0\n";
255 }
256 else if (const ConstantExpr* CE = dyn_cast<ConstantExpr>(CV))
257 {
258 // Constant expression built from operators, constants, and
259 // symbolic addrs
260 O << ConstantExprToString(CE) << "\n";
261 }
262 else
263 {
264 assert(0 && "Unknown elementary type for constant");
265 }
266}
267
268// Can we treat the specified array as a string? Only if it is an array of
269// ubytes or non-negative sbytes.
270//
271static bool isStringCompatible(const ConstantArray *CVA) {
272 const Type *ETy = cast<ArrayType>(CVA->getType())->getElementType();
273 if (ETy == Type::UByteTy) return true;
274 if (ETy != Type::SByteTy) return false;
275
276 for (unsigned i = 0; i < CVA->getNumOperands(); ++i)
277 if (cast<ConstantSInt>(CVA->getOperand(i))->getValue() < 0)
278 return false;
279
280 return true;
281}
282
283// toOctal - Convert the low order bits of X into an octal letter
284static inline char toOctal(int X) {
285 return (X&7)+'0';
286}
287
288// getAsCString - Return the specified array as a C compatible string, only if
289// the predicate isStringCompatible is true.
290//
291static std::string getAsCString(const ConstantArray *CVA) {
292 assert(isStringCompatible(CVA) && "Array is not string compatible!");
293
294 std::string Result;
295 const Type *ETy = cast<ArrayType>(CVA->getType())->getElementType();
296 Result = "\"";
297 for (unsigned i = 0; i < CVA->getNumOperands(); ++i) {
298 unsigned char C = (ETy == Type::SByteTy) ?
299 (unsigned char)cast<ConstantSInt>(CVA->getOperand(i))->getValue() :
300 (unsigned char)cast<ConstantUInt>(CVA->getOperand(i))->getValue();
301
302 if (C == '"') {
303 Result += "\\\"";
304 } else if (C == '\\') {
305 Result += "\\\\";
306 } else if (isprint(C)) {
307 Result += C;
308 } else {
309 switch(C) {
310 case '\a': Result += "\\a"; break;
311 case '\b': Result += "\\b"; break;
312 case '\f': Result += "\\f"; break;
313 case '\n': Result += "\\n"; break;
314 case '\r': Result += "\\r"; break;
315 case '\t': Result += "\\t"; break;
316 case '\v': Result += "\\v"; break;
317 default:
318 Result += '\\';
319 Result += toOctal(C >> 6);
320 Result += toOctal(C >> 3);
321 Result += toOctal(C >> 0);
322 break;
323 }
324 }
325 }
326 Result += "\"";
327 return Result;
328}
329
330// Print a constant value or values (it may be an aggregate).
331// Uses printSingleConstantValue() to print each individual value.
332void
333Printer::printConstantValueOnly(const Constant* CV,
334 int numPadBytesAfter /* = 0 */)
335{
336 const ConstantArray *CVA = dyn_cast<ConstantArray>(CV);
337
338 if (CVA && isStringCompatible(CVA))
339 { // print the string alone and return
340 O << "\t" << ".string" << "\t" << getAsCString(CVA) << "\n";
341 }
342 else if (CVA)
343 { // Not a string. Print the values in successive locations
344 const std::vector<Use> &constValues = CVA->getValues();
345 for (unsigned i=0; i < constValues.size(); i++)
346 printConstantValueOnly(cast<Constant>(constValues[i].get()));
347 }
348 else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
349 { // Print the fields in successive locations. Pad to align if needed!
350 const StructLayout *cvsLayout =
351 TD->getStructLayout(CVS->getType());
352 const std::vector<Use>& constValues = CVS->getValues();
353 unsigned sizeSoFar = 0;
354 for (unsigned i=0, N = constValues.size(); i < N; i++)
355 {
356 const Constant* field = cast<Constant>(constValues[i].get());
357
358 // Check if padding is needed and insert one or more 0s.
359 unsigned fieldSize = TD->getTypeSize(field->getType());
360 int padSize = ((i == N-1? cvsLayout->StructSize
361 : cvsLayout->MemberOffsets[i+1])
362 - cvsLayout->MemberOffsets[i]) - fieldSize;
363 sizeSoFar += (fieldSize + padSize);
364
365 // Now print the actual field value
366 printConstantValueOnly(field, padSize);
367 }
368 assert(sizeSoFar == cvsLayout->StructSize &&
369 "Layout of constant struct may be incorrect!");
370 }
371 else
372 printSingleConstantValue(CV);
373
374 if (numPadBytesAfter) {
375 unsigned numBytes = numPadBytesAfter;
376 for ( ; numBytes >= 8; numBytes -= 8)
377 printSingleConstantValue(Constant::getNullValue(Type::ULongTy));
378 if (numBytes >= 4)
379 {
380 printSingleConstantValue(Constant::getNullValue(Type::UIntTy));
381 numBytes -= 4;
382 }
383 while (numBytes--)
384 printSingleConstantValue(Constant::getNullValue(Type::UByteTy));
385 }
386}
Chris Lattnerdbb61c62002-11-17 22:53:13 +0000387
Chris Lattnerb7089442003-01-13 00:35:03 +0000388// printConstantPool - Print out any constants which have been spilled to
389// memory...
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000390void Printer::printConstantPool(MachineConstantPool *MCP){
Chris Lattnerb7089442003-01-13 00:35:03 +0000391 const std::vector<Constant*> &CP = MCP->getConstants();
392 if (CP.empty()) return;
393
394 for (unsigned i = 0, e = CP.size(); i != e; ++i) {
395 O << "\t.section .rodata\n";
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000396 O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType()) << "\n";
Brian Gaeke3387e7f2003-06-19 19:58:32 +0000397 O << ".CPI" << i+ConstIdx << ":\t\t\t\t\t#" << *CP[i] << "\n";
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000398 printConstantValueOnly (CP[i]);
Chris Lattnerb7089442003-01-13 00:35:03 +0000399 }
400 ConstIdx += CP.size(); // Don't recycle constant pool index numbers
401}
402
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000403/// runOnMachineFunction - This uses the X86InstructionInfo::print method
Brian Gaeke6559bb92002-11-14 22:32:30 +0000404/// to print assembly for each instruction.
Chris Lattner0285a332002-12-28 20:25:38 +0000405bool Printer::runOnMachineFunction(MachineFunction &MF) {
406 static unsigned BBNumber = 0;
407 const TargetMachine &TM = MF.getTarget();
Chris Lattner3501fea2003-01-14 22:00:31 +0000408 const TargetInstrInfo &TII = TM.getInstrInfo();
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000409 TD = &TM.getTargetData();
Brian Gaeke6559bb92002-11-14 22:32:30 +0000410
Chris Lattnerb7089442003-01-13 00:35:03 +0000411 // Print out constants referenced by the function
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000412 printConstantPool(MF.getConstantPool());
Chris Lattnerb7089442003-01-13 00:35:03 +0000413
Brian Gaeke6559bb92002-11-14 22:32:30 +0000414 // Print out labels for the function.
Chris Lattnerb7089442003-01-13 00:35:03 +0000415 O << "\t.text\n";
416 O << "\t.align 16\n";
Brian Gaekebc601fe2003-06-25 22:00:39 +0000417 O << "\t.globl\t" << getValueName(MF.getFunction()) << "\n";
418 O << "\t.type\t" << getValueName(MF.getFunction()) << ", @function\n";
419 O << getValueName(MF.getFunction()) << ":\n";
Brian Gaeke6559bb92002-11-14 22:32:30 +0000420
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000421 NumberForBB.clear();
422 for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
423 I != E; ++I) {
424 NumberForBB[I->getBasicBlock()] = BBNumber++;
425 }
426
Brian Gaeke6559bb92002-11-14 22:32:30 +0000427 // Print out code for the function.
Chris Lattner0285a332002-12-28 20:25:38 +0000428 for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
429 I != E; ++I) {
430 // Print a label for the basic block.
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000431 O << ".BB" << NumberForBB[I->getBasicBlock()] << ":\t# "
432 << I->getBasicBlock()->getName() << "\n";
Chris Lattner0285a332002-12-28 20:25:38 +0000433 for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
434 II != E; ++II) {
435 // Print the assembly for the instruction.
436 O << "\t";
Chris Lattner3501fea2003-01-14 22:00:31 +0000437 TII.print(*II, O, TM);
Brian Gaeke6559bb92002-11-14 22:32:30 +0000438 }
Chris Lattner0285a332002-12-28 20:25:38 +0000439 }
Brian Gaeke6559bb92002-11-14 22:32:30 +0000440
441 // We didn't modify anything.
Chris Lattnerb4f68ed2002-10-29 22:37:54 +0000442 return false;
443}
444
Chris Lattner3d3067b2002-11-21 20:44:15 +0000445static bool isScale(const MachineOperand &MO) {
Chris Lattnerd9096832002-12-15 08:01:39 +0000446 return MO.isImmediate() &&
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000447 (MO.getImmedValue() == 1 || MO.getImmedValue() == 2 ||
448 MO.getImmedValue() == 4 || MO.getImmedValue() == 8);
Chris Lattner3d3067b2002-11-21 20:44:15 +0000449}
450
451static bool isMem(const MachineInstr *MI, unsigned Op) {
Chris Lattnerb7089442003-01-13 00:35:03 +0000452 if (MI->getOperand(Op).isFrameIndex()) return true;
453 if (MI->getOperand(Op).isConstantPoolIndex()) return true;
Chris Lattner3d3067b2002-11-21 20:44:15 +0000454 return Op+4 <= MI->getNumOperands() &&
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000455 MI->getOperand(Op ).isRegister() &&isScale(MI->getOperand(Op+1)) &&
456 MI->getOperand(Op+2).isRegister() &&MI->getOperand(Op+3).isImmediate();
Chris Lattner3d3067b2002-11-21 20:44:15 +0000457}
458
Chris Lattnerf9f60882002-11-18 06:56:51 +0000459static void printOp(std::ostream &O, const MachineOperand &MO,
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000460 const MRegisterInfo &RI, bool elideOffsetKeyword = false) {
Chris Lattnerf9f60882002-11-18 06:56:51 +0000461 switch (MO.getType()) {
462 case MachineOperand::MO_VirtualRegister:
Chris Lattnerac573f62002-12-04 17:32:52 +0000463 if (Value *V = MO.getVRegValueOrNull()) {
Chris Lattnerdbf30f72002-12-04 06:45:19 +0000464 O << "<" << V->getName() << ">";
465 return;
466 }
Chris Lattnerb7089442003-01-13 00:35:03 +0000467 // FALLTHROUGH
Misha Brukmane1f0d812002-11-20 18:56:41 +0000468 case MachineOperand::MO_MachineRegister:
Chris Lattnerf9f60882002-11-18 06:56:51 +0000469 if (MO.getReg() < MRegisterInfo::FirstVirtualRegister)
470 O << RI.get(MO.getReg()).Name;
471 else
472 O << "%reg" << MO.getReg();
473 return;
Chris Lattner77875d82002-11-21 02:00:20 +0000474
475 case MachineOperand::MO_SignExtendedImmed:
476 case MachineOperand::MO_UnextendedImmed:
477 O << (int)MO.getImmedValue();
478 return;
Chris Lattnerf8bafe82002-12-01 23:25:59 +0000479 case MachineOperand::MO_PCRelativeDisp:
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000480 O << ".BB" << NumberForBB[MO.getVRegValue()] << " # PC rel: "
481 << MO.getVRegValue()->getName();
Chris Lattnerf8bafe82002-12-01 23:25:59 +0000482 return;
Chris Lattnerb7089442003-01-13 00:35:03 +0000483 case MachineOperand::MO_GlobalAddress:
Brian Gaekebc601fe2003-06-25 22:00:39 +0000484 if (!elideOffsetKeyword) O << "OFFSET "; O << getValueName(MO.getGlobal());
Chris Lattnerb7089442003-01-13 00:35:03 +0000485 return;
486 case MachineOperand::MO_ExternalSymbol:
Brian Gaeke9e474c42003-06-19 19:32:32 +0000487 O << MO.getSymbolName();
Chris Lattnerb7089442003-01-13 00:35:03 +0000488 return;
Chris Lattnerf9f60882002-11-18 06:56:51 +0000489 default:
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000490 O << "<unknown operand type>"; return;
Chris Lattnerf9f60882002-11-18 06:56:51 +0000491 }
492}
493
Chris Lattner3501fea2003-01-14 22:00:31 +0000494static const std::string sizePtr(const TargetInstrDescriptor &Desc) {
Chris Lattnera0f38c82002-12-13 03:51:55 +0000495 switch (Desc.TSFlags & X86II::ArgMask) {
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000496 default: assert(0 && "Unknown arg size!");
497 case X86II::Arg8: return "BYTE PTR";
498 case X86II::Arg16: return "WORD PTR";
499 case X86II::Arg32: return "DWORD PTR";
500 case X86II::Arg64: return "QWORD PTR";
501 case X86II::ArgF32: return "DWORD PTR";
502 case X86II::ArgF64: return "QWORD PTR";
503 case X86II::ArgF80: return "XWORD PTR";
Brian Gaeke86764d72002-12-05 08:30:40 +0000504 }
505}
506
Chris Lattner3d3067b2002-11-21 20:44:15 +0000507static void printMemReference(std::ostream &O, const MachineInstr *MI,
508 unsigned Op, const MRegisterInfo &RI) {
509 assert(isMem(MI, Op) && "Invalid memory reference!");
Chris Lattnerb7089442003-01-13 00:35:03 +0000510
511 if (MI->getOperand(Op).isFrameIndex()) {
512 O << "[frame slot #" << MI->getOperand(Op).getFrameIndex();
513 if (MI->getOperand(Op+3).getImmedValue())
514 O << " + " << MI->getOperand(Op+3).getImmedValue();
515 O << "]";
516 return;
517 } else if (MI->getOperand(Op).isConstantPoolIndex()) {
518 O << "[.CPI" << MI->getOperand(Op).getConstantPoolIndex();
519 if (MI->getOperand(Op+3).getImmedValue())
520 O << " + " << MI->getOperand(Op+3).getImmedValue();
521 O << "]";
522 return;
523 }
524
Chris Lattner3d3067b2002-11-21 20:44:15 +0000525 const MachineOperand &BaseReg = MI->getOperand(Op);
Chris Lattner0285a332002-12-28 20:25:38 +0000526 int ScaleVal = MI->getOperand(Op+1).getImmedValue();
Chris Lattner3d3067b2002-11-21 20:44:15 +0000527 const MachineOperand &IndexReg = MI->getOperand(Op+2);
Chris Lattner0285a332002-12-28 20:25:38 +0000528 int DispVal = MI->getOperand(Op+3).getImmedValue();
Chris Lattner3d3067b2002-11-21 20:44:15 +0000529
530 O << "[";
531 bool NeedPlus = false;
532 if (BaseReg.getReg()) {
533 printOp(O, BaseReg, RI);
534 NeedPlus = true;
535 }
536
537 if (IndexReg.getReg()) {
538 if (NeedPlus) O << " + ";
Chris Lattner0285a332002-12-28 20:25:38 +0000539 if (ScaleVal != 1)
540 O << ScaleVal << "*";
Chris Lattner3d3067b2002-11-21 20:44:15 +0000541 printOp(O, IndexReg, RI);
542 NeedPlus = true;
543 }
544
Chris Lattner0285a332002-12-28 20:25:38 +0000545 if (DispVal) {
546 if (NeedPlus)
547 if (DispVal > 0)
548 O << " + ";
549 else {
550 O << " - ";
551 DispVal = -DispVal;
552 }
553 O << DispVal;
Chris Lattner3d3067b2002-11-21 20:44:15 +0000554 }
555 O << "]";
556}
557
Chris Lattnerdbb61c62002-11-17 22:53:13 +0000558// print - Print out an x86 instruction in intel syntax
Chris Lattner927dd092002-11-17 23:20:37 +0000559void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O,
560 const TargetMachine &TM) const {
Chris Lattnerf9f60882002-11-18 06:56:51 +0000561 unsigned Opcode = MI->getOpcode();
Chris Lattner3501fea2003-01-14 22:00:31 +0000562 const TargetInstrDescriptor &Desc = get(Opcode);
Chris Lattnerf9f60882002-11-18 06:56:51 +0000563
Chris Lattnereca1f632002-12-25 05:09:01 +0000564 switch (Desc.TSFlags & X86II::FormMask) {
565 case X86II::Pseudo:
Brian Gaeke9e474c42003-06-19 19:32:32 +0000566 // Print pseudo-instructions as comments; either they should have been
567 // turned into real instructions by now, or they don't need to be
568 // seen by the assembler (e.g., IMPLICIT_USEs.)
569 O << "# ";
Chris Lattnereca1f632002-12-25 05:09:01 +0000570 if (Opcode == X86::PHI) {
571 printOp(O, MI->getOperand(0), RI);
572 O << " = phi ";
573 for (unsigned i = 1, e = MI->getNumOperands(); i != e; i+=2) {
574 if (i != 1) O << ", ";
575 O << "[";
576 printOp(O, MI->getOperand(i), RI);
577 O << ", ";
578 printOp(O, MI->getOperand(i+1), RI);
579 O << "]";
580 }
581 } else {
582 unsigned i = 0;
Vikram S. Adve49cab032003-05-27 00:03:17 +0000583 if (MI->getNumOperands() && (MI->getOperand(0).opIsDefOnly() ||
584 MI->getOperand(0).opIsDefAndUse())) {
Chris Lattnereca1f632002-12-25 05:09:01 +0000585 printOp(O, MI->getOperand(0), RI);
586 O << " = ";
587 ++i;
588 }
589 O << getName(MI->getOpcode());
590
591 for (unsigned e = MI->getNumOperands(); i != e; ++i) {
592 O << " ";
Vikram S. Adve49cab032003-05-27 00:03:17 +0000593 if (MI->getOperand(i).opIsDefOnly() ||
594 MI->getOperand(i).opIsDefAndUse()) O << "*";
Chris Lattnereca1f632002-12-25 05:09:01 +0000595 printOp(O, MI->getOperand(i), RI);
Vikram S. Adve49cab032003-05-27 00:03:17 +0000596 if (MI->getOperand(i).opIsDefOnly() ||
597 MI->getOperand(i).opIsDefAndUse()) O << "*";
Chris Lattnereca1f632002-12-25 05:09:01 +0000598 }
Chris Lattner3faae2d2002-12-13 09:59:26 +0000599 }
600 O << "\n";
601 return;
Chris Lattner3faae2d2002-12-13 09:59:26 +0000602
Chris Lattnerf9f60882002-11-18 06:56:51 +0000603 case X86II::RawFrm:
Chris Lattnerf8bafe82002-12-01 23:25:59 +0000604 // The accepted forms of Raw instructions are:
605 // 1. nop - No operand required
606 // 2. jmp foo - PC relative displacement operand
Chris Lattnerb7089442003-01-13 00:35:03 +0000607 // 3. call bar - GlobalAddress Operand or External Symbol Operand
Chris Lattnerf8bafe82002-12-01 23:25:59 +0000608 //
609 assert(MI->getNumOperands() == 0 ||
Chris Lattnerb7089442003-01-13 00:35:03 +0000610 (MI->getNumOperands() == 1 &&
611 (MI->getOperand(0).isPCRelativeDisp() ||
612 MI->getOperand(0).isGlobalAddress() ||
613 MI->getOperand(0).isExternalSymbol())) &&
Chris Lattnerf8bafe82002-12-01 23:25:59 +0000614 "Illegal raw instruction!");
Chris Lattnereca1f632002-12-25 05:09:01 +0000615 O << getName(MI->getOpcode()) << " ";
Chris Lattnerf9f60882002-11-18 06:56:51 +0000616
Chris Lattnerf8bafe82002-12-01 23:25:59 +0000617 if (MI->getNumOperands() == 1) {
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000618 printOp(O, MI->getOperand(0), RI, true); // Don't print "OFFSET"...
Chris Lattnerf9f60882002-11-18 06:56:51 +0000619 }
620 O << "\n";
621 return;
622
Chris Lattner77875d82002-11-21 02:00:20 +0000623 case X86II::AddRegFrm: {
624 // There are currently two forms of acceptable AddRegFrm instructions.
625 // Either the instruction JUST takes a single register (like inc, dec, etc),
626 // or it takes a register and an immediate of the same size as the register
Chris Lattnerdbf30f72002-12-04 06:45:19 +0000627 // (move immediate f.e.). Note that this immediate value might be stored as
628 // an LLVM value, to represent, for example, loading the address of a global
Chris Lattnerfacc9fb2002-12-23 23:46:00 +0000629 // into a register. The initial register might be duplicated if this is a
630 // M_2_ADDR_REG instruction
Chris Lattner77875d82002-11-21 02:00:20 +0000631 //
Chris Lattnerd9096832002-12-15 08:01:39 +0000632 assert(MI->getOperand(0).isRegister() &&
Chris Lattner77875d82002-11-21 02:00:20 +0000633 (MI->getNumOperands() == 1 ||
Chris Lattnerdbf30f72002-12-04 06:45:19 +0000634 (MI->getNumOperands() == 2 &&
Chris Lattner6d669442002-12-04 17:28:40 +0000635 (MI->getOperand(1).getVRegValueOrNull() ||
Chris Lattnerfacc9fb2002-12-23 23:46:00 +0000636 MI->getOperand(1).isImmediate() ||
Chris Lattnerb7089442003-01-13 00:35:03 +0000637 MI->getOperand(1).isRegister() ||
638 MI->getOperand(1).isGlobalAddress() ||
639 MI->getOperand(1).isExternalSymbol()))) &&
Chris Lattner77875d82002-11-21 02:00:20 +0000640 "Illegal form for AddRegFrm instruction!");
Chris Lattnerf9f60882002-11-18 06:56:51 +0000641
Chris Lattner77875d82002-11-21 02:00:20 +0000642 unsigned Reg = MI->getOperand(0).getReg();
Chris Lattner77875d82002-11-21 02:00:20 +0000643
Chris Lattner77875d82002-11-21 02:00:20 +0000644 O << getName(MI->getOpCode()) << " ";
645 printOp(O, MI->getOperand(0), RI);
Chris Lattnerb7089442003-01-13 00:35:03 +0000646 if (MI->getNumOperands() == 2 &&
647 (!MI->getOperand(1).isRegister() ||
648 MI->getOperand(1).getVRegValueOrNull() ||
649 MI->getOperand(1).isGlobalAddress() ||
650 MI->getOperand(1).isExternalSymbol())) {
Chris Lattner77875d82002-11-21 02:00:20 +0000651 O << ", ";
Chris Lattner675dd2c2002-11-21 17:09:01 +0000652 printOp(O, MI->getOperand(1), RI);
Chris Lattner77875d82002-11-21 02:00:20 +0000653 }
654 O << "\n";
655 return;
656 }
Chris Lattner233ad712002-11-21 01:33:44 +0000657 case X86II::MRMDestReg: {
Chris Lattnerb7089442003-01-13 00:35:03 +0000658 // There are two acceptable forms of MRMDestReg instructions, those with 2,
659 // 3 and 4 operands:
660 //
661 // 2 Operands: this is for things like mov that do not read a second input
Chris Lattnerf9f60882002-11-18 06:56:51 +0000662 //
663 // 3 Operands: in this form, the first two registers (the destination, and
664 // the first operand) should be the same, post register allocation. The 3rd
665 // operand is an additional input. This should be for things like add
666 // instructions.
667 //
Chris Lattnerb7089442003-01-13 00:35:03 +0000668 // 4 Operands: This form is for instructions which are 3 operands forms, but
669 // have a constant argument as well.
Chris Lattnerf9f60882002-11-18 06:56:51 +0000670 //
Chris Lattnerb7089442003-01-13 00:35:03 +0000671 bool isTwoAddr = isTwoAddrInstr(Opcode);
Chris Lattnerd9096832002-12-15 08:01:39 +0000672 assert(MI->getOperand(0).isRegister() &&
Chris Lattnerb7089442003-01-13 00:35:03 +0000673 (MI->getNumOperands() == 2 ||
674 (isTwoAddr && MI->getOperand(1).isRegister() &&
675 MI->getOperand(0).getReg() == MI->getOperand(1).getReg() &&
676 (MI->getNumOperands() == 3 ||
677 (MI->getNumOperands() == 4 && MI->getOperand(3).isImmediate()))))
Misha Brukmane1f0d812002-11-20 18:56:41 +0000678 && "Bad format for MRMDestReg!");
Chris Lattnerf9f60882002-11-18 06:56:51 +0000679
Chris Lattnerf9f60882002-11-18 06:56:51 +0000680 O << getName(MI->getOpCode()) << " ";
681 printOp(O, MI->getOperand(0), RI);
682 O << ", ";
Chris Lattnerb7089442003-01-13 00:35:03 +0000683 printOp(O, MI->getOperand(1+isTwoAddr), RI);
684 if (MI->getNumOperands() == 4) {
685 O << ", ";
686 printOp(O, MI->getOperand(3), RI);
687 }
Chris Lattnerf9f60882002-11-18 06:56:51 +0000688 O << "\n";
689 return;
Chris Lattner233ad712002-11-21 01:33:44 +0000690 }
Chris Lattner18042332002-11-21 21:03:39 +0000691
692 case X86II::MRMDestMem: {
693 // These instructions are the same as MRMDestReg, but instead of having a
694 // register reference for the mod/rm field, it's a memory reference.
695 //
696 assert(isMem(MI, 0) && MI->getNumOperands() == 4+1 &&
Chris Lattnerd9096832002-12-15 08:01:39 +0000697 MI->getOperand(4).isRegister() && "Bad format for MRMDestMem!");
Chris Lattner18042332002-11-21 21:03:39 +0000698
Chris Lattnerb7089442003-01-13 00:35:03 +0000699 O << getName(MI->getOpCode()) << " " << sizePtr(Desc) << " ";
Chris Lattner18042332002-11-21 21:03:39 +0000700 printMemReference(O, MI, 0, RI);
701 O << ", ";
702 printOp(O, MI->getOperand(4), RI);
703 O << "\n";
704 return;
705 }
706
Chris Lattner233ad712002-11-21 01:33:44 +0000707 case X86II::MRMSrcReg: {
Chris Lattner644e1ab2002-11-21 00:30:01 +0000708 // There is a two forms that are acceptable for MRMSrcReg instructions,
709 // those with 3 and 2 operands:
710 //
711 // 3 Operands: in this form, the last register (the second input) is the
712 // ModR/M input. The first two operands should be the same, post register
713 // allocation. This is for things like: add r32, r/m32
714 //
715 // 2 Operands: this is for things like mov that do not read a second input
716 //
Chris Lattnerd9096832002-12-15 08:01:39 +0000717 assert(MI->getOperand(0).isRegister() &&
718 MI->getOperand(1).isRegister() &&
Chris Lattner644e1ab2002-11-21 00:30:01 +0000719 (MI->getNumOperands() == 2 ||
Chris Lattnerd9096832002-12-15 08:01:39 +0000720 (MI->getNumOperands() == 3 && MI->getOperand(2).isRegister()))
Chris Lattnerb7089442003-01-13 00:35:03 +0000721 && "Bad format for MRMSrcReg!");
Chris Lattner644e1ab2002-11-21 00:30:01 +0000722 if (MI->getNumOperands() == 3 &&
723 MI->getOperand(0).getReg() != MI->getOperand(1).getReg())
724 O << "**";
725
Chris Lattner644e1ab2002-11-21 00:30:01 +0000726 O << getName(MI->getOpCode()) << " ";
727 printOp(O, MI->getOperand(0), RI);
728 O << ", ";
729 printOp(O, MI->getOperand(MI->getNumOperands()-1), RI);
730 O << "\n";
731 return;
Chris Lattner233ad712002-11-21 01:33:44 +0000732 }
Chris Lattner675dd2c2002-11-21 17:09:01 +0000733
Chris Lattner3d3067b2002-11-21 20:44:15 +0000734 case X86II::MRMSrcMem: {
735 // These instructions are the same as MRMSrcReg, but instead of having a
736 // register reference for the mod/rm field, it's a memory reference.
Chris Lattner18042332002-11-21 21:03:39 +0000737 //
Chris Lattnerd9096832002-12-15 08:01:39 +0000738 assert(MI->getOperand(0).isRegister() &&
Chris Lattner3d3067b2002-11-21 20:44:15 +0000739 (MI->getNumOperands() == 1+4 && isMem(MI, 1)) ||
Chris Lattnerd9096832002-12-15 08:01:39 +0000740 (MI->getNumOperands() == 2+4 && MI->getOperand(1).isRegister() &&
Chris Lattner3d3067b2002-11-21 20:44:15 +0000741 isMem(MI, 2))
742 && "Bad format for MRMDestReg!");
743 if (MI->getNumOperands() == 2+4 &&
744 MI->getOperand(0).getReg() != MI->getOperand(1).getReg())
745 O << "**";
746
Chris Lattner3d3067b2002-11-21 20:44:15 +0000747 O << getName(MI->getOpCode()) << " ";
748 printOp(O, MI->getOperand(0), RI);
Chris Lattnerb7089442003-01-13 00:35:03 +0000749 O << ", " << sizePtr(Desc) << " ";
Chris Lattner3d3067b2002-11-21 20:44:15 +0000750 printMemReference(O, MI, MI->getNumOperands()-4, RI);
751 O << "\n";
752 return;
753 }
754
Chris Lattner675dd2c2002-11-21 17:09:01 +0000755 case X86II::MRMS0r: case X86II::MRMS1r:
756 case X86II::MRMS2r: case X86II::MRMS3r:
757 case X86II::MRMS4r: case X86II::MRMS5r:
758 case X86II::MRMS6r: case X86II::MRMS7r: {
Chris Lattner675dd2c2002-11-21 17:09:01 +0000759 // In this form, the following are valid formats:
760 // 1. sete r
Chris Lattner1d53ce42002-11-21 23:30:00 +0000761 // 2. cmp reg, immediate
Chris Lattner675dd2c2002-11-21 17:09:01 +0000762 // 2. shl rdest, rinput <implicit CL or 1>
763 // 3. sbb rdest, rinput, immediate [rdest = rinput]
764 //
765 assert(MI->getNumOperands() > 0 && MI->getNumOperands() < 4 &&
Chris Lattnerd9096832002-12-15 08:01:39 +0000766 MI->getOperand(0).isRegister() && "Bad MRMSxR format!");
Chris Lattner1d53ce42002-11-21 23:30:00 +0000767 assert((MI->getNumOperands() != 2 ||
Chris Lattnerd9096832002-12-15 08:01:39 +0000768 MI->getOperand(1).isRegister() || MI->getOperand(1).isImmediate())&&
Chris Lattner675dd2c2002-11-21 17:09:01 +0000769 "Bad MRMSxR format!");
Chris Lattner1d53ce42002-11-21 23:30:00 +0000770 assert((MI->getNumOperands() < 3 ||
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000771 (MI->getOperand(1).isRegister() && MI->getOperand(2).isImmediate())) &&
Chris Lattner675dd2c2002-11-21 17:09:01 +0000772 "Bad MRMSxR format!");
773
Chris Lattnerd9096832002-12-15 08:01:39 +0000774 if (MI->getNumOperands() > 1 && MI->getOperand(1).isRegister() &&
Chris Lattner675dd2c2002-11-21 17:09:01 +0000775 MI->getOperand(0).getReg() != MI->getOperand(1).getReg())
776 O << "**";
777
Chris Lattner675dd2c2002-11-21 17:09:01 +0000778 O << getName(MI->getOpCode()) << " ";
779 printOp(O, MI->getOperand(0), RI);
Chris Lattnerd9096832002-12-15 08:01:39 +0000780 if (MI->getOperand(MI->getNumOperands()-1).isImmediate()) {
Chris Lattner675dd2c2002-11-21 17:09:01 +0000781 O << ", ";
Chris Lattner1d53ce42002-11-21 23:30:00 +0000782 printOp(O, MI->getOperand(MI->getNumOperands()-1), RI);
Chris Lattner675dd2c2002-11-21 17:09:01 +0000783 }
784 O << "\n";
785
786 return;
787 }
788
Chris Lattnerb7089442003-01-13 00:35:03 +0000789 case X86II::MRMS0m: case X86II::MRMS1m:
790 case X86II::MRMS2m: case X86II::MRMS3m:
791 case X86II::MRMS4m: case X86II::MRMS5m:
792 case X86II::MRMS6m: case X86II::MRMS7m: {
793 // In this form, the following are valid formats:
794 // 1. sete [m]
795 // 2. cmp [m], immediate
796 // 2. shl [m], rinput <implicit CL or 1>
797 // 3. sbb [m], immediate
798 //
799 assert(MI->getNumOperands() >= 4 && MI->getNumOperands() <= 5 &&
800 isMem(MI, 0) && "Bad MRMSxM format!");
801 assert((MI->getNumOperands() != 5 || MI->getOperand(4).isImmediate()) &&
802 "Bad MRMSxM format!");
803
804 O << getName(MI->getOpCode()) << " ";
805 O << sizePtr(Desc) << " ";
806 printMemReference(O, MI, 0, RI);
807 if (MI->getNumOperands() == 5) {
808 O << ", ";
809 printOp(O, MI->getOperand(4), RI);
810 }
811 O << "\n";
812 return;
813 }
814
Chris Lattnerf9f60882002-11-18 06:56:51 +0000815 default:
Chris Lattnerb7089442003-01-13 00:35:03 +0000816 O << "\tUNKNOWN FORM:\t\t-"; MI->print(O, TM); break;
Chris Lattnerf9f60882002-11-18 06:56:51 +0000817 }
Chris Lattner72614082002-10-25 22:55:53 +0000818}
Brian Gaeke9e474c42003-06-19 19:32:32 +0000819
820bool Printer::doInitialization(Module &M)
821{
822 // Tell gas we are outputting Intel syntax (not AT&T syntax) assembly,
823 // with no % decorations on register names.
824 O << "\t.intel_syntax noprefix\n";
Brian Gaekebc601fe2003-06-25 22:00:39 +0000825
826 // Ripped from CWriter:
827 // Calculate which global values have names that will collide when we throw
828 // away type information.
829 { // Scope to delete the FoundNames set when we are done with it...
830 std::set<std::string> FoundNames;
831 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
832 if (I->hasName()) // If the global has a name...
833 if (FoundNames.count(I->getName())) // And the name is already used
834 MangledGlobals.insert(I); // Mangle the name
835 else
836 FoundNames.insert(I->getName()); // Otherwise, keep track of name
837
838 for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
839 if (I->hasName()) // If the global has a name...
840 if (FoundNames.count(I->getName())) // And the name is already used
841 MangledGlobals.insert(I); // Mangle the name
842 else
843 FoundNames.insert(I->getName()); // Otherwise, keep track of name
844 }
845
Brian Gaeke9e474c42003-06-19 19:32:32 +0000846 return false; // success
847}
848
849bool Printer::doFinalization(Module &M)
850{
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000851 // Print out module-level global variables here.
852 for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
Brian Gaekebc601fe2003-06-25 22:00:39 +0000853 std::string name(getValueName(I));
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000854 if (I->hasInitializer()) {
855 Constant *C = I->getInitializer();
856 O << "\t.data\n";
Brian Gaekebc601fe2003-06-25 22:00:39 +0000857 O << "\t.globl " << name << "\n";
858 O << "\t.type " << name << ",@object\n";
859 O << "\t.size " << name << ","
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000860 << (unsigned)TD->getTypeSize(I->getType()) << "\n";
861 O << "\t.align " << (unsigned)TD->getTypeAlignment(C->getType()) << "\n";
Brian Gaekebc601fe2003-06-25 22:00:39 +0000862 O << name << ":\t\t\t\t\t#" << *C << "\n";
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000863 printConstantValueOnly (C);
864 } else {
Brian Gaekebc601fe2003-06-25 22:00:39 +0000865 O << "\t.globl " << name << "\n";
866 O << "\t.comm " << name << ", "
Brian Gaeke01d79ff2003-06-25 18:01:07 +0000867 << (unsigned)TD->getTypeSize(I->getType()) << ", "
868 << (unsigned)TD->getTypeAlignment(I->getType()) << "\n";
869 }
870 }
Brian Gaekebc601fe2003-06-25 22:00:39 +0000871 MangledGlobals.clear();
Brian Gaeke9e474c42003-06-19 19:32:32 +0000872 return false; // success
873}