| Index: src/PNaClTranslator.cpp
|
| diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
|
| index 0f4feacafe5d2768bd8edae99a2ab2f6c5a65087..fa8e990b4f9a09d3ace4d4c884ef9525a45eaba7 100644
|
| --- a/src/PNaClTranslator.cpp
|
| +++ b/src/PNaClTranslator.cpp
|
| @@ -325,8 +325,8 @@ public:
|
| SuppressMangling = false;
|
| }
|
| const Ice::RelocOffsetT Offset = 0;
|
| - C = getTranslator().getContext()->getConstantSym(
|
| - getIcePointerType(), Offset, Name, SuppressMangling);
|
| + C = getTranslator().getContext()->getConstantSym(Offset, Name,
|
| + SuppressMangling);
|
| ValueIDConstants[ID] = C;
|
| return C;
|
| }
|
| @@ -1440,7 +1440,7 @@ private:
|
| const auto *C = dyn_cast<Ice::ConstantInteger32>(Index);
|
| if (C == nullptr)
|
| return VectorIndexNotConstant;
|
| - if (C->getValue() >= typeNumElements(VecType))
|
| + if ((unsigned)C->getValue() >= typeNumElements(VecType))
|
| return VectorIndexNotInRange;
|
| if (Index->getType() != Ice::IceType_i32)
|
| return VectorIndexNotI32;
|
| @@ -2499,13 +2499,31 @@ void ConstantsParser::ProcessRecord() {
|
| if (IntegerType *IType = dyn_cast<IntegerType>(
|
| Context->convertToLLVMType(NextConstantType))) {
|
| APInt Value(IType->getBitWidth(), NaClDecodeSignRotatedValue(Values[0]));
|
| - Ice::Constant *C = (NextConstantType == Ice::IceType_i64)
|
| - ? getContext()->getConstantInt64(
|
| - NextConstantType, Value.getSExtValue())
|
| - : getContext()->getConstantInt32(
|
| - NextConstantType, Value.getSExtValue());
|
| - FuncParser->setNextConstantID(C);
|
| - return;
|
| + Ice::Constant *C = nullptr;
|
| + switch (NextConstantType) {
|
| + default:
|
| + assert(0);
|
| + break;
|
| + case Ice::IceType_i1:
|
| + C = getContext()->getConstantInt1(Value.getSExtValue());
|
| + break;
|
| + case Ice::IceType_i8:
|
| + C = getContext()->getConstantInt8(Value.getSExtValue());
|
| + break;
|
| + case Ice::IceType_i16:
|
| + C = getContext()->getConstantInt16(Value.getSExtValue());
|
| + break;
|
| + case Ice::IceType_i32:
|
| + C = getContext()->getConstantInt32(Value.getSExtValue());
|
| + break;
|
| + case Ice::IceType_i64:
|
| + C = getContext()->getConstantInt64(Value.getSExtValue());
|
| + break;
|
| + }
|
| + if (C) {
|
| + FuncParser->setNextConstantID(C);
|
| + return;
|
| + }
|
| }
|
| std::string Buffer;
|
| raw_string_ostream StrBuf(Buffer);
|
|
|