diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-08-28 17:22:24 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-08-28 17:22:24 -0700 |
commit | ba45e4b2c5051b7093a6d5ccd8a2d0a8ac53c45b (patch) | |
tree | 3fb4d922f584d4043728c1b1a70e63e9e200e845 /lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | |
parent | e9eafe8abb2e303c8185d83780183c342e9ca08f (diff) |
PNaCl bitcode: Remove handling of unsupported floating point types
The only FP types that PNaCl currently supports are float and double.
Clean up error reporting:
* Convert an assert() to a report_fatal_error().
* Return an error rather than an "undef" value.
* Report the type code value when it is unknown.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/23191009
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp')
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp index 31b7c1e917..f72f383c39 100644 --- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp @@ -267,14 +267,9 @@ static void WriteTypeTable(const NaClValueEnumerator &VE, switch (T->getTypeID()) { default: llvm_unreachable("Unknown type!"); case Type::VoidTyID: Code = naclbitc::TYPE_CODE_VOID; break; - case Type::HalfTyID: Code = naclbitc::TYPE_CODE_HALF; break; case Type::FloatTyID: Code = naclbitc::TYPE_CODE_FLOAT; break; case Type::DoubleTyID: Code = naclbitc::TYPE_CODE_DOUBLE; break; - case Type::X86_FP80TyID: Code = naclbitc::TYPE_CODE_X86_FP80; break; - case Type::FP128TyID: Code = naclbitc::TYPE_CODE_FP128; break; - case Type::PPC_FP128TyID: Code = naclbitc::TYPE_CODE_PPC_FP128; break; case Type::LabelTyID: Code = naclbitc::TYPE_CODE_LABEL; break; - case Type::X86_MMXTyID: Code = naclbitc::TYPE_CODE_X86_MMX; break; case Type::IntegerTyID: // INTEGER: [width] Code = naclbitc::TYPE_CODE_INTEGER; @@ -631,22 +626,10 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C)) { Code = naclbitc::CST_CODE_FLOAT; Type *Ty = CFP->getType(); - if (Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy()) { + if (Ty->isFloatTy() || Ty->isDoubleTy()) { Record.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue()); - } else if (Ty->isX86_FP80Ty()) { - // api needed to prevent premature destruction - // bits are not in the same order as a normal i80 APInt, compensate. - APInt api = CFP->getValueAPF().bitcastToAPInt(); - const uint64_t *p = api.getRawData(); - Record.push_back((p[1] << 48) | (p[0] >> 16)); - Record.push_back(p[0] & 0xffffLL); - } else if (Ty->isFP128Ty() || Ty->isPPC_FP128Ty()) { - APInt api = CFP->getValueAPF().bitcastToAPInt(); - const uint64_t *p = api.getRawData(); - Record.push_back(p[0]); - Record.push_back(p[1]); } else { - assert (0 && "Unknown FP type!"); + report_fatal_error("Unknown FP type"); } } else if (const ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(C)) { |