Add APInt interfaces to APFloat (allows directly

access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen
2007-09-11 18:32:33 +00:00
parent 6320260e06
commit 3f6eb7419d
16 changed files with 309 additions and 100 deletions

View File

@ -622,23 +622,24 @@ bool BitcodeReader::ParseConstants() {
NumWords, &Words[0]));
break;
}
case bitc::CST_CODE_FLOAT: // FLOAT: [fpval]
case bitc::CST_CODE_FLOAT: { // FLOAT: [fpval]
if (Record.empty())
return Error("Invalid FLOAT record");
if (CurTy == Type::FloatTy)
V = ConstantFP::get(CurTy, APFloat(BitsToFloat(Record[0])));
V = ConstantFP::get(CurTy, APFloat(APInt(32, (uint32_t)Record[0])));
else if (CurTy == Type::DoubleTy)
V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
V = ConstantFP::get(CurTy, APFloat(APInt(64, Record[0])));
// FIXME: Make long double constants work. BitsToDouble does not make it.
else if (CurTy == Type::X86_FP80Ty)
V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
V = ConstantFP::get(CurTy, APFloat(APInt(80, 2, &Record[0])));
else if (CurTy == Type::FP128Ty)
V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
V = ConstantFP::get(CurTy, APFloat(APInt(128, 2, &Record[0])));
else if (CurTy == Type::PPC_FP128Ty)
assert(0 && "PowerPC long double constants not handled yet.");
else
V = UndefValue::get(CurTy);
break;
}
case bitc::CST_CODE_AGGREGATE: {// AGGREGATE: [n x value number]
if (Record.empty())