diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 14 | ||||
-rw-r--r-- | lib/CodeGen/ELFWriter.cpp | 13 | ||||
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 2 |
3 files changed, 17 insertions, 12 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 7e83473..5006939 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1006,7 +1006,7 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, // precision... LLVMContext &Context = CFP->getContext(); const TargetData *TD = TM.getTargetData(); - if (CFP->getType() == Type::getDoubleTy(Context)) { + if (CFP->getType()->isDoubleTy()) { double Val = CFP->getValueAPF().convertToDouble(); // for comment only uint64_t i = CFP->getValueAPF().bitcastToAPInt().getZExtValue(); if (MAI->getData64bitsDirective(AddrSpace)) { @@ -1048,7 +1048,9 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, O << '\n'; } return; - } else if (CFP->getType() == Type::getFloatTy(Context)) { + } + + if (CFP->getType()->isFloatTy()) { float Val = CFP->getValueAPF().convertToFloat(); // for comment only O << MAI->getData32bitsDirective(AddrSpace) << CFP->getValueAPF().bitcastToAPInt().getZExtValue(); @@ -1058,7 +1060,9 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, } O << '\n'; return; - } else if (CFP->getType() == Type::getX86_FP80Ty(Context)) { + } + + if (CFP->getType()->isX86_FP80Ty()) { // all long double variants are printed as hex // api needed to prevent premature destruction APInt api = CFP->getValueAPF().bitcastToAPInt(); @@ -1143,7 +1147,9 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, EmitZeros(TD->getTypeAllocSize(Type::getX86_FP80Ty(Context)) - TD->getTypeStoreSize(Type::getX86_FP80Ty(Context)), AddrSpace); return; - } else if (CFP->getType() == Type::getPPC_FP128Ty(Context)) { + } + + if (CFP->getType()->isPPC_FP128Ty()) { // all long double variants are printed as hex // api needed to prevent premature destruction APInt api = CFP->getValueAPF().bitcastToAPInt(); diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index 55a2f70..3e1ee11 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -457,16 +457,15 @@ void ELFWriter::EmitGlobalConstant(const Constant *CV, ELFSection &GblS) { return; } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) { APInt Val = CFP->getValueAPF().bitcastToAPInt(); - if (CFP->getType() == Type::getDoubleTy(CV->getContext())) + if (CFP->getType()->isDoubleTy()) GblS.emitWord64(Val.getZExtValue()); - else if (CFP->getType() == Type::getFloatTy(CV->getContext())) + else if (CFP->getType()->isFloatTy()) GblS.emitWord32(Val.getZExtValue()); - else if (CFP->getType() == Type::getX86_FP80Ty(CV->getContext())) { - unsigned PadSize = - TD->getTypeAllocSize(Type::getX86_FP80Ty(CV->getContext()))- - TD->getTypeStoreSize(Type::getX86_FP80Ty(CV->getContext())); + else if (CFP->getType()->isX86_FP80Ty()) { + unsigned PadSize = TD->getTypeAllocSize(CFP->getType())- + TD->getTypeStoreSize(CFP->getType()); GblS.emitWordFP80(Val.getRawData(), PadSize); - } else if (CFP->getType() == Type::getPPC_FP128Ty(CV->getContext())) + } else if (CFP->getType()->isPPC_FP128Ty()) llvm_unreachable("PPC_FP128Ty global emission not implemented"); return; } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 3d1c221..a3560a7 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -239,7 +239,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const { OS << getImm(); break; case MachineOperand::MO_FPImmediate: - if (getFPImm()->getType() == Type::getFloatTy(getFPImm()->getContext())) + if (getFPImm()->getType()->isFloatTy()) OS << getFPImm()->getValueAPF().convertToFloat(); else OS << getFPImm()->getValueAPF().convertToDouble(); |