llvm.org GIT mirror llvm / c4b94e0
Rewrite FP constant handling in DEBUG_VALUE yet again, so it more or less handles long double. Restore \n removed in latest MC frenzy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95271 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 10 years ago
1 changed file(s) with 17 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2424 #include "llvm/Target/Mangler.h"
2525 #include "llvm/Support/FormattedStream.h"
2626 #include "llvm/ADT/SmallString.h"
27 #include "llvm/Type.h"
2728 using namespace llvm;
2829
2930
429430 if (MI->getOperand(0).getType()==MachineOperand::MO_Register &&
430431 MI->getOperand(0).getReg()==0) {
431432 // Suppress offset in this case, it is not meaningful.
432 O << "undef";
433 O << "undef\n";
433434 return;
434435 } else if (MI->getOperand(0).getType()==MachineOperand::MO_FPImmediate) {
435436 // This is more naturally done in printOperand, but since the only use
436 // of such an operand is in this comment and that is temporary, we
437 // prefer to keep this localized.
438 O << '$';
439 MI->getOperand(0).print(O, &TM);
437 // of such an operand is in this comment and that is temporary (and it's
438 // ugly), we prefer to keep this localized.
439 // The include of Type.h may be removable when this code is.
440 if (MI->getOperand(0).getFPImm()->getType()->isFloatTy() ||
441 MI->getOperand(0).getFPImm()->getType()->isDoubleTy())
442 MI->getOperand(0).print(O, &TM);
443 else {
444 // There is no good way to print long double. Convert a copy to
445 // double. Ah well, it's only a comment.
446 bool ignored;
447 APFloat APF = APFloat(MI->getOperand(0).getFPImm()->getValueAPF());
448 APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
449 &ignored);
450 O << "(long double) " << APF.convertToDouble();
451 }
440452 } else
441453 printOperand(MI, 0);
442454 } else {