• Home
  • Raw
  • Download

Lines Matching refs:Ice

79   void dump(Ice::Ostream &Stream) const;
82 void setAsSimpleType(Ice::Type Ty) { in setAsSimpleType()
97 Ice::FuncSigType Signature;
103 Ice::Ostream &operator<<(Ice::Ostream &Stream, const ExtendedType &Ty) { in operator <<()
104 if (!Ice::BuildDefs::dump()) in operator <<()
110 Ice::Ostream &operator<<(Ice::Ostream &Stream, ExtendedType::TypeKind Kind) { in operator <<()
111 if (!Ice::BuildDefs::dump()) in operator <<()
135 Ice::Type getType() const { return Signature.getReturnType(); } in getType()
149 const Ice::FuncSigType &getSignature() const { return Signature; } in getSignature()
150 void setReturnType(Ice::Type ReturnType) { in setReturnType()
153 void appendArgType(Ice::Type ArgType) { Signature.appendArgType(ArgType); } in appendArgType()
159 void ExtendedType::dump(Ice::Ostream &Stream) const { in dump()
160 if (!Ice::BuildDefs::dump()) in dump()
184 BitcodeInt(Ice::SizeT Bits, uint64_t Val) : BitWidth(Bits), Val(Val) { in BitcodeInt()
201 return Ice::Utils::bitCopy<FpType>(V); in convertToFp()
206 static const Ice::SizeT BITS_PER_WORD = sizeof(uint64_t) * CHAR_BIT;
231 TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor, in TopLevelParser()
232 Ice::ErrorCode &ErrorStatus) in TopLevelParser()
235 VariableDeclarations(new Ice::VariableDeclarationList()) {} in TopLevelParser()
239 Ice::Translator &getTranslator() const { return Translator; } in getTranslator()
255 Ice::VariableDeclarationList *getGlobalVariablesPool() { in getGlobalVariablesPool()
277 Ice::Utils::reserveAndResize(TypeIDValues, ID + 1); in getTypeByIDForDefining()
283 Ice::Type getSimpleTypeByID(NaClBcIndexSize_t ID) { in getSimpleTypeByID()
287 return Ice::IceType_void; in getSimpleTypeByID()
292 const Ice::FuncSigType &getFuncSigTypeByID(NaClBcIndexSize_t ID) { in getFuncSigTypeByID()
301 void setNextFunctionID(Ice::FunctionDeclaration *Fcn) { in setNextFunctionID()
319 Ice::FunctionDeclaration *getFunctionByID(NaClBcIndexSize_t ID) { in getFunctionByID()
326 Ice::Constant *getGlobalConstantByID(NaClBcIndexSize_t ID) { in getGlobalConstantByID()
365 void addGlobalDeclaration(Ice::VariableDeclaration *Decl) { in addGlobalDeclaration()
371 Ice::VariableDeclaration *getGlobalVariableByID(NaClBcIndexSize_t Index) { in getGlobalVariableByID()
380 Ice::GlobalDeclaration *getGlobalDeclarationByID(NaClBcIndexSize_t Index) { in getGlobalDeclarationByID()
395 std::unique_ptr<Ice::VariableDeclarationList> getGlobalVariables() { in getGlobalVariables()
424 Ice::Translator &Translator;
427 Ice::GlobalLockType ErrorReportingLock;
429 Ice::ErrorCode &ErrorStatus;
434 Ice::FunctionDeclarationList FunctionDeclarations;
442 std::unique_ptr<Ice::VariableDeclarationList> VariableDeclarations;
444 Ice::ConstantList ValueIDConstants;
446 Ice::FuncSigType UndefinedFuncSigType;
473 void installDeclarationName(Ice::GlobalDeclaration *Decl, in installDeclarationName()
480 Ice::GlobalContext *Ctx = Translator.getContext(); in installDeclarationName()
486 if (Ice::BuildDefs::dump() || !Decl->isInternal() || in installDeclarationName()
487 Ice::RangeSpec::hasNames() || Ice::getFlags().getTimeEachFunction()) { in installDeclarationName()
499 const std::string &GlobalPrefix = Ice::getFlags().getDefaultGlobalPrefix(); in installGlobalVarNames()
502 for (Ice::VariableDeclaration *Var : *VariableDeclarations) { in installGlobalVarNames()
511 Ice::getFlags().getDefaultFunctionPrefix(); in installFunctionNames()
514 for (Ice::FunctionDeclaration *Func : FunctionDeclarations) { in installFunctionNames()
522 Ice::Constant *getConstantSym(Ice::GlobalString Name, bool IsExternal) const { in getConstantSym()
523 Ice::GlobalContext *Ctx = getTranslator().getContext(); in getConstantSym()
527 const Ice::RelocOffsetT Offset = 0; in getConstantSym()
533 const Ice::GlobalDeclaration &Decl) { in reportLinkageError()
545 Ice::GlobalContext *Ctx = getTranslator().getContext(); in createValueIDsForFunctions()
546 for (const Ice::FunctionDeclaration *Func : FunctionDeclarations) { in createValueIDsForFunctions()
549 Ice::Constant *C = getConstantSym(Func->getName(), Func->isProto()); in createValueIDsForFunctions()
556 for (const Ice::VariableDeclaration *Decl : *VariableDeclarations) { in createValueIDsForGlobalVars()
559 Ice::Constant *C = in createValueIDsForGlobalVars()
571 Ice::FunctionDeclaration *reportGetFunctionByIDError(NaClBcIndexSize_t ID);
575 Ice::VariableDeclaration *
580 Ice::Type convertToIceTypeError(Type *LLVMTy);
585 Ice::GlobalContext *Context = Translator.getContext(); in ErrorAt()
587 std::unique_lock<Ice::GlobalLockType> _(ErrorReportingLock); in ErrorAt()
588 ErrorStatus.assign(Ice::EC_Bitcode); in ErrorAt()
591 Ice::OstreamLocker L(Context); in ErrorAt()
596 if (Level >= naclbitc::Error && !Ice::getFlags().getAllowErrorRecovery()) in ErrorAt()
614 Ice::FunctionDeclaration *
627 Ice::VariableDeclaration *
640 Ice::Type TopLevelParser::convertToIceTypeError(Type *LLVMTy) { in convertToIceTypeError()
645 return Ice::IceType_void; in convertToIceTypeError()
649 const Ice::GlobalContext *Ctx = getTranslator().getContext(); in verifyFunctionTypeSignatures()
650 for (Ice::FunctionDeclaration *FuncDecl : FunctionDeclarations) { in verifyFunctionTypeSignatures()
698 Ice::Translator &getTranslator() const { return Context->getTranslator(); } in getTranslator()
775 if (Ice::getFlags().getGenerateUnitTestMessages()) { in ErrorAt()
835 Timer(Ice::TimerStack::TT_parseTypes, getTranslator().getContext()) {} in TypesParser()
848 Ice::TimerMarker Timer;
860 void setNextTypeIDAsSimpleType(Ice::Type Ty) { in setNextTypeIDAsSimpleType()
894 setNextTypeIDAsSimpleType(Ice::IceType_void); in ProcessRecord()
900 setNextTypeIDAsSimpleType(Ice::IceType_f32); in ProcessRecord()
906 setNextTypeIDAsSimpleType(Ice::IceType_f64); in ProcessRecord()
914 setNextTypeIDAsSimpleType(Ice::IceType_i1); in ProcessRecord()
917 setNextTypeIDAsSimpleType(Ice::IceType_i8); in ProcessRecord()
920 setNextTypeIDAsSimpleType(Ice::IceType_i16); in ProcessRecord()
923 setNextTypeIDAsSimpleType(Ice::IceType_i32); in ProcessRecord()
926 setNextTypeIDAsSimpleType(Ice::IceType_i64); in ProcessRecord()
942 Ice::Type BaseTy = Context->getSimpleTypeByID(Values[1]); in ProcessRecord()
943 Ice::SizeT Size = Values[0]; in ProcessRecord()
945 case Ice::IceType_i1: in ProcessRecord()
948 setNextTypeIDAsSimpleType(Ice::IceType_v4i1); in ProcessRecord()
951 setNextTypeIDAsSimpleType(Ice::IceType_v8i1); in ProcessRecord()
954 setNextTypeIDAsSimpleType(Ice::IceType_v16i1); in ProcessRecord()
960 case Ice::IceType_i8: in ProcessRecord()
962 setNextTypeIDAsSimpleType(Ice::IceType_v16i8); in ProcessRecord()
966 case Ice::IceType_i16: in ProcessRecord()
968 setNextTypeIDAsSimpleType(Ice::IceType_v8i16); in ProcessRecord()
972 case Ice::IceType_i32: in ProcessRecord()
974 setNextTypeIDAsSimpleType(Ice::IceType_v4i32); in ProcessRecord()
978 case Ice::IceType_f32: in ProcessRecord()
980 setNextTypeIDAsSimpleType(Ice::IceType_v4f32); in ProcessRecord()
1010 Ice::Type ArgTy = Context->getSimpleTypeByID(Values[i]); in ProcessRecord()
1011 if (ArgTy == Ice::IceType_void) { in ProcessRecord()
1016 ArgTy = Ice::IceType_i32; in ProcessRecord()
1039 Timer(Ice::TimerStack::TT_parseGlobals, getTranslator().getContext()), in GlobalsParser()
1041 DummyGlobalVar(Ice::VariableDeclaration::create( in GlobalsParser()
1053 std::unordered_map<NaClBcIndexSize_t, Ice::VariableDeclaration *>;
1055 Ice::TimerMarker Timer;
1076 Ice::VariableDeclaration *DummyGlobalVar;
1079 Ice::VariableDeclaration *CurGlobalVar;
1082 Ice::VariableDeclaration *getGlobalVarByID(NaClBcIndexSize_t Index) { in getGlobalVarByID()
1083 Ice::VariableDeclaration *&Decl = GlobalVarsMap[Index]; in getGlobalVarByID()
1086 Ice::VariableDeclaration::create(Context->getGlobalVariablesPool()); in getGlobalVarByID()
1091 Ice::GlobalDeclaration *getGlobalDeclByID(NaClBcIndexSize_t Index) { in getGlobalDeclByID()
1198 Ice::VariableDeclaration::ZeroInitializer::create(Pool, Values[0])); in ProcessRecord()
1207 Ice::VariableDeclaration::DataInitializer::create(Pool, Values)); in ProcessRecord()
1234 Ice::GlobalContext *Ctx = getTranslator().getContext(); in ProcessRecord()
1236 Ice::VariableDeclaration::RelocInitializer::create( in ProcessRecord()
1238 {Ice::RelocOffset::create(Ctx, Offset)})); in ProcessRecord()
1360 Timer(Ice::TimerStack::TT_parseFunctions, getTranslator().getContext()), in FunctionParser()
1368 Timer(Ice::TimerStack::TT_parseFunctions, getTranslator().getContext()), in FunctionParser()
1373 std::unique_ptr<Ice::Cfg> parseFunction(uint32_t SeqNumber) { in parseFunction()
1375 Ice::GlobalContext *Ctx = getTranslator().getContext(); in parseFunction()
1377 Ice::TimerMarker T(Ctx, FuncDecl->getName().toStringOrEmpty()); in parseFunction()
1380 Ice::GlobalContext *Ctx = getTranslator().getContext(); in parseFunction()
1381 Func = Ice::Cfg::create(Ctx, SeqNumber); in parseFunction()
1383 Ice::CfgLocalAllocatorScope _(Func.get()); in parseFunction()
1386 const Ice::FuncSigType &Signature = FuncDecl->getSignature(); in parseFunction()
1393 for (Ice::Type ArgType : Signature.getArgList()) { in parseFunction()
1410 Ice::Cfg *getFunc() const { return Func.get(); } in getFunc()
1414 void setNextLocalInstIndex(Ice::Operand *Op) { in setNextLocalInstIndex()
1419 void setNextConstantID(Ice::Constant *C) { setNextLocalInstIndex(C); } in setNextConstantID()
1422 Ice::Operand *getOperand(NaClBcIndexSize_t Index) { in getOperand()
1429 Ice::Operand *Op = LocalOperands[LocalIndex]; in getOperand()
1436 Ice::TimerMarker Timer;
1443 std::unique_ptr<Ice::Cfg> Func;
1449 Ice::CfgNode *CurrentNode = nullptr;
1451 Ice::FunctionDeclaration *FuncDecl;
1456 Ice::OperandList LocalOperands;
1477 Ice::CfgNode *installNextBasicBlock() { in installNextBasicBlock()
1478 Ice::CfgNode *Node = Func->makeNode(); in installNextBasicBlock()
1483 Ice::CfgNode *getBasicBlock(NaClBcIndexSize_t Index) { in getBasicBlock()
1498 Ice::CfgNode *getBranchBasicBlock(NaClBcIndexSize_t Index) { in getBranchBasicBlock()
1506 Ice::Variable *createInstVar(Ice::Type Ty) { in createInstVar()
1507 if (Ty == Ice::IceType_void) { in createInstVar()
1510 Ty = Ice::IceType_i32; in createInstVar()
1516 Ice::Variable *getNextInstVar(Ice::Type Ty) { in getNextInstVar()
1521 Ice::Operand *Op = LocalOperands[LocalIndex]; in getNextInstVar()
1523 if (auto *Var = dyn_cast<Ice::Variable>(Op)) { in getNextInstVar()
1538 Ice::Variable *Var = createInstVar(Ty); in getNextInstVar()
1558 void setOperand(NaClBcIndexSize_t Index, Ice::Operand *Op) { in setOperand()
1579 Ice::Utils::reserveAndResize(LocalOperands, LocalIndex + 1); in setOperand()
1583 Ice::Operand *OldOp = LocalOperands[LocalIndex]; in setOperand()
1604 Ice::Operand *getRelativeOperand(NaClBcIndexSize_t Index, in getRelativeOperand()
1614 void reportInvalidBinaryOp(Ice::InstArithmetic::OpKind Op, Ice::Type OpTy);
1618 bool isValidIntegerLogicalOp(Ice::InstArithmetic::OpKind Op, Ice::Type OpTy) { in isValidIntegerLogicalOp()
1619 if (Ice::isIntegerType(OpTy)) in isValidIntegerLogicalOp()
1628 bool isValidIntegerArithOp(Ice::InstArithmetic::OpKind Op, Ice::Type OpTy) { in isValidIntegerArithOp()
1629 if (Ice::isIntegerArithmeticType(OpTy)) in isValidIntegerArithOp()
1637 bool isValidFloatingArithOp(Ice::InstArithmetic::OpKind Op, Ice::Type OpTy) { in isValidFloatingArithOp()
1638 if (Ice::isFloatingType(OpTy)) in isValidFloatingArithOp()
1647 bool isValidPointerType(Ice::Operand *Op, const char *InstructionName) { in isValidPointerType()
1648 Ice::Type PtrType = Ice::getPointerType(); in isValidPointerType()
1661 bool isValidLoadStoreType(Ice::Type Ty, const char *InstructionName) { in isValidLoadStoreType()
1673 bool isValidLoadStoreAlignment(size_t Alignment, Ice::Type Ty, in isValidLoadStoreAlignment()
1690 bool isAllowedAlignment(size_t Alignment, Ice::Type Ty) const { in isAllowedAlignment()
1707 if (!Ice::BuildDefs::dump()) in dumpVectorIndexCheckValue()
1720 Stream << "Vector index not of type " << Ice::IceType_i32; in dumpVectorIndexCheckValue()
1730 VectorIndexCheckValue validateVectorIndex(const Ice::Operand *Vec, in validateVectorIndex()
1731 const Ice::Operand *Index) const { in validateVectorIndex()
1732 Ice::Type VecType = Vec->getType(); in validateVectorIndex()
1733 if (!Ice::isVectorType(VecType)) in validateVectorIndex()
1735 const auto *C = dyn_cast<Ice::ConstantInteger32>(Index); in validateVectorIndex()
1740 if (Index->getType() != Ice::IceType_i32) in validateVectorIndex()
1748 bool convertBinopOpcode(unsigned Opcode, Ice::Type Ty, in convertBinopOpcode()
1749 Ice::InstArithmetic::OpKind &Op) { in convertBinopOpcode()
1756 Op = Ice::InstArithmetic::Add; in convertBinopOpcode()
1760 if (Ice::isIntegerType(Ty)) { in convertBinopOpcode()
1761 Op = Ice::InstArithmetic::Add; in convertBinopOpcode()
1764 Op = Ice::InstArithmetic::Fadd; in convertBinopOpcode()
1768 if (Ice::isIntegerType(Ty)) { in convertBinopOpcode()
1769 Op = Ice::InstArithmetic::Sub; in convertBinopOpcode()
1772 Op = Ice::InstArithmetic::Fsub; in convertBinopOpcode()
1776 if (Ice::isIntegerType(Ty)) { in convertBinopOpcode()
1777 Op = Ice::InstArithmetic::Mul; in convertBinopOpcode()
1780 Op = Ice::InstArithmetic::Fmul; in convertBinopOpcode()
1784 Op = Ice::InstArithmetic::Udiv; in convertBinopOpcode()
1787 if (Ice::isIntegerType(Ty)) { in convertBinopOpcode()
1788 Op = Ice::InstArithmetic::Sdiv; in convertBinopOpcode()
1791 Op = Ice::InstArithmetic::Fdiv; in convertBinopOpcode()
1795 Op = Ice::InstArithmetic::Urem; in convertBinopOpcode()
1798 if (Ice::isIntegerType(Ty)) { in convertBinopOpcode()
1799 Op = Ice::InstArithmetic::Srem; in convertBinopOpcode()
1802 Op = Ice::InstArithmetic::Frem; in convertBinopOpcode()
1806 Op = Ice::InstArithmetic::Shl; in convertBinopOpcode()
1809 Op = Ice::InstArithmetic::Lshr; in convertBinopOpcode()
1812 Op = Ice::InstArithmetic::Ashr; in convertBinopOpcode()
1815 Op = Ice::InstArithmetic::And; in convertBinopOpcode()
1818 Op = Ice::InstArithmetic::Or; in convertBinopOpcode()
1821 Op = Ice::InstArithmetic::Xor; in convertBinopOpcode()
1829 static bool simplifyOutCommonVectorType(Ice::Type &Type1, Ice::Type &Type2) { in simplifyOutCommonVectorType()
1845 static bool isIntTruncCastValid(Ice::Type SourceType, Ice::Type TargetType) { in isIntTruncCastValid()
1846 return Ice::isIntegerType(SourceType) && Ice::isIntegerType(TargetType) && in isIntTruncCastValid()
1853 static bool isFloatTruncCastValid(Ice::Type SourceType, in isFloatTruncCastValid()
1854 Ice::Type TargetType) { in isFloatTruncCastValid()
1856 SourceType == Ice::IceType_f64 && TargetType == Ice::IceType_f32; in isFloatTruncCastValid()
1861 static bool isIntExtCastValid(Ice::Type SourceType, Ice::Type TargetType) { in isIntExtCastValid()
1867 static bool isFloatExtCastValid(Ice::Type SourceType, Ice::Type TargetType) { in isFloatExtCastValid()
1873 static bool isFloatToIntCastValid(Ice::Type SourceType, in isFloatToIntCastValid()
1874 Ice::Type TargetType) { in isFloatToIntCastValid()
1875 if (!(Ice::isFloatingType(SourceType) && Ice::isIntegerType(TargetType))) in isFloatToIntCastValid()
1889 static bool isIntToFloatCastValid(Ice::Type SourceType, in isIntToFloatCastValid()
1890 Ice::Type TargetType) { in isIntToFloatCastValid()
1896 static Ice::SizeT bitcastSizeInBits(Ice::Type Ty) { in bitcastSizeInBits()
1897 if (Ice::isVectorType(Ty)) in bitcastSizeInBits()
1898 return Ice::typeNumElements(Ty) * in bitcastSizeInBits()
1899 bitcastSizeInBits(Ice::typeElementType(Ty)); in bitcastSizeInBits()
1900 if (Ty == Ice::IceType_i1) in bitcastSizeInBits()
1902 return Ice::typeWidthInBytes(Ty) * CHAR_BIT; in bitcastSizeInBits()
1906 static bool isBitcastValid(Ice::Type SourceType, Ice::Type TargetType) { in isBitcastValid()
1914 bool convertCastOpToIceOp(uint64_t Opcode, Ice::Type SourceType, in convertCastOpToIceOp()
1915 Ice::Type TargetType, in convertCastOpToIceOp()
1916 Ice::InstCast::OpKind &CastKind) { in convertCastOpToIceOp()
1924 CastKind = Ice::InstCast::Bitcast; in convertCastOpToIceOp()
1928 CastKind = Ice::InstCast::Trunc; in convertCastOpToIceOp()
1932 CastKind = Ice::InstCast::Zext; in convertCastOpToIceOp()
1936 CastKind = Ice::InstCast::Sext; in convertCastOpToIceOp()
1940 CastKind = Ice::InstCast::Fptoui; in convertCastOpToIceOp()
1944 CastKind = Ice::InstCast::Fptosi; in convertCastOpToIceOp()
1948 CastKind = Ice::InstCast::Uitofp; in convertCastOpToIceOp()
1952 CastKind = Ice::InstCast::Sitofp; in convertCastOpToIceOp()
1956 CastKind = Ice::InstCast::Fptrunc; in convertCastOpToIceOp()
1960 CastKind = Ice::InstCast::Fpext; in convertCastOpToIceOp()
1964 CastKind = Ice::InstCast::Bitcast; in convertCastOpToIceOp()
1971 StrBuf << "Illegal cast: " << Ice::InstCast::getCastName(CastKind) << " " in convertCastOpToIceOp()
1981 Ice::InstIcmp::ICond &Cond) const { in convertNaClBitcICmpOpToIce()
1984 Cond = Ice::InstIcmp::Eq; in convertNaClBitcICmpOpToIce()
1987 Cond = Ice::InstIcmp::Ne; in convertNaClBitcICmpOpToIce()
1990 Cond = Ice::InstIcmp::Ugt; in convertNaClBitcICmpOpToIce()
1993 Cond = Ice::InstIcmp::Uge; in convertNaClBitcICmpOpToIce()
1996 Cond = Ice::InstIcmp::Ult; in convertNaClBitcICmpOpToIce()
1999 Cond = Ice::InstIcmp::Ule; in convertNaClBitcICmpOpToIce()
2002 Cond = Ice::InstIcmp::Sgt; in convertNaClBitcICmpOpToIce()
2005 Cond = Ice::InstIcmp::Sge; in convertNaClBitcICmpOpToIce()
2008 Cond = Ice::InstIcmp::Slt; in convertNaClBitcICmpOpToIce()
2011 Cond = Ice::InstIcmp::Sle; in convertNaClBitcICmpOpToIce()
2015 Cond = static_cast<Ice::InstIcmp::ICond>(0); in convertNaClBitcICmpOpToIce()
2023 Ice::InstFcmp::FCond &Cond) const { in convertNaClBitcFCompOpToIce()
2026 Cond = Ice::InstFcmp::False; in convertNaClBitcFCompOpToIce()
2029 Cond = Ice::InstFcmp::Oeq; in convertNaClBitcFCompOpToIce()
2032 Cond = Ice::InstFcmp::Ogt; in convertNaClBitcFCompOpToIce()
2035 Cond = Ice::InstFcmp::Oge; in convertNaClBitcFCompOpToIce()
2038 Cond = Ice::InstFcmp::Olt; in convertNaClBitcFCompOpToIce()
2041 Cond = Ice::InstFcmp::Ole; in convertNaClBitcFCompOpToIce()
2044 Cond = Ice::InstFcmp::One; in convertNaClBitcFCompOpToIce()
2047 Cond = Ice::InstFcmp::Ord; in convertNaClBitcFCompOpToIce()
2050 Cond = Ice::InstFcmp::Uno; in convertNaClBitcFCompOpToIce()
2053 Cond = Ice::InstFcmp::Ueq; in convertNaClBitcFCompOpToIce()
2056 Cond = Ice::InstFcmp::Ugt; in convertNaClBitcFCompOpToIce()
2059 Cond = Ice::InstFcmp::Uge; in convertNaClBitcFCompOpToIce()
2062 Cond = Ice::InstFcmp::Ult; in convertNaClBitcFCompOpToIce()
2065 Cond = Ice::InstFcmp::Ule; in convertNaClBitcFCompOpToIce()
2068 Cond = Ice::InstFcmp::Une; in convertNaClBitcFCompOpToIce()
2071 Cond = Ice::InstFcmp::True; in convertNaClBitcFCompOpToIce()
2075 Cond = static_cast<Ice::InstFcmp::FCond>(0); in convertNaClBitcFCompOpToIce()
2085 void appendErrorInstruction(Ice::Type Ty) { in appendErrorInstruction()
2088 if (Ty == Ice::IceType_void) in appendErrorInstruction()
2090 Ice::Variable *Var = getNextInstVar(Ty); in appendErrorInstruction()
2091 CurrentNode->appendInst(Ice::InstAssign::create(Func.get(), Var, Var)); in appendErrorInstruction()
2094 Ice::Operand *reportGetOperandUndefined(NaClBcIndexSize_t Index) { in reportGetOperandUndefined()
2105 void verifyCallArgTypeMatches(Ice::FunctionDeclaration *Fcn, Ice::SizeT Index, in verifyCallArgTypeMatches()
2106 Ice::Type ArgType, Ice::Type ParamType) { in verifyCallArgTypeMatches()
2116 const std::string printName(Ice::FunctionDeclaration *Fcn) { in printName()
2128 CurrentNode->appendInst(Ice::InstUnreachable::create(Func.get())); in ExitBlock()
2141 for (Ice::CfgNode *Node : Func->getNodes()) { in ExitBlock()
2147 Node->appendInst(Ice::InstUnreachable::create(Func.get())); in ExitBlock()
2154 void FunctionParser::reportInvalidBinaryOp(Ice::InstArithmetic::OpKind Op, in reportInvalidBinaryOp()
2155 Ice::Type OpTy) { in reportInvalidBinaryOp()
2158 StrBuf << "Invalid operator type for " << Ice::InstArithmetic::getOpName(Op) in reportInvalidBinaryOp()
2219 Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2220 Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2221 Ice::Type Type1 = Op1->getType(); in ProcessRecord()
2222 Ice::Type Type2 = Op2->getType(); in ProcessRecord()
2232 Ice::InstArithmetic::OpKind Opcode; in ProcessRecord()
2237 CurrentNode->appendInst(Ice::InstArithmetic::create( in ProcessRecord()
2245 Ice::Operand *Src = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2246 Ice::Type CastType = Context->getSimpleTypeByID(Values[1]); in ProcessRecord()
2247 Ice::InstCast::OpKind CastKind; in ProcessRecord()
2252 CurrentNode->appendInst(Ice::InstCast::create( in ProcessRecord()
2260 Ice::Operand *ThenVal = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2261 Ice::Operand *ElseVal = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2262 Ice::Operand *CondVal = getRelativeOperand(Values[2], BaseIndex); in ProcessRecord()
2263 Ice::Type ThenType = ThenVal->getType(); in ProcessRecord()
2264 Ice::Type ElseType = ElseVal->getType(); in ProcessRecord()
2274 Ice::Type CondType = CondVal->getType(); in ProcessRecord()
2277 typeElementType(CondType) != Ice::IceType_i1 || in ProcessRecord()
2287 } else if (CondVal->getType() != Ice::IceType_i1) { in ProcessRecord()
2296 CurrentNode->appendInst(Ice::InstSelect::create( in ProcessRecord()
2304 Ice::Operand *Vec = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2305 Ice::Operand *Index = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2306 Ice::Type VecType = Vec->getType(); in ProcessRecord()
2318 CurrentNode->appendInst(Ice::InstExtractElement::create( in ProcessRecord()
2326 Ice::Operand *Vec = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2327 Ice::Operand *Elt = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2328 Ice::Operand *Index = getRelativeOperand(Values[2], BaseIndex); in ProcessRecord()
2329 Ice::Type VecType = Vec->getType(); in ProcessRecord()
2342 if (Ice::typeElementType(VecType) != Elt->getType()) { in ProcessRecord()
2346 << Ice::typeString(Elt->getType()) << " doesn't match vector type " in ProcessRecord()
2347 << Ice::typeString(VecType); in ProcessRecord()
2352 CurrentNode->appendInst(Ice::InstInsertElement::create( in ProcessRecord()
2360 Ice::Operand *Op1 = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2361 Ice::Operand *Op2 = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2362 Ice::Type Op1Type = Op1->getType(); in ProcessRecord()
2363 Ice::Type Op2Type = Op2->getType(); in ProcessRecord()
2364 Ice::Type DestType = getCompareResultType(Op1Type); in ProcessRecord()
2374 if (DestType == Ice::IceType_void) { in ProcessRecord()
2381 Ice::Variable *Dest = getNextInstVar(DestType); in ProcessRecord()
2383 Ice::InstIcmp::ICond Cond; in ProcessRecord()
2393 Ice::InstIcmp::create(Func.get(), Cond, Dest, Op1, Op2)); in ProcessRecord()
2395 Ice::InstFcmp::FCond Cond; in ProcessRecord()
2405 Ice::InstFcmp::create(Func.get(), Cond, Dest, Op1, Op2)); in ProcessRecord()
2423 CurrentNode->appendInst(Ice::InstRet::create(Func.get())); in ProcessRecord()
2425 Ice::Operand *RetVal = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2426 CurrentNode->appendInst(Ice::InstRet::create(Func.get(), RetVal)); in ProcessRecord()
2434 Ice::CfgNode *Block = getBranchBasicBlock(Values[0]); in ProcessRecord()
2437 CurrentNode->appendInst(Ice::InstBr::create(Func.get(), Block)); in ProcessRecord()
2442 Ice::Operand *Cond = getRelativeOperand(Values[2], BaseIndex); in ProcessRecord()
2443 if (Cond->getType() != Ice::IceType_i1) { in ProcessRecord()
2451 Ice::CfgNode *ThenBlock = getBranchBasicBlock(Values[0]); in ProcessRecord()
2452 Ice::CfgNode *ElseBlock = getBranchBasicBlock(Values[1]); in ProcessRecord()
2456 Ice::InstBr::create(Func.get(), Cond, ThenBlock, ElseBlock)); in ProcessRecord()
2472 Ice::Type CondTy = Context->getSimpleTypeByID(Values[0]); in ProcessRecord()
2473 if (!Ice::isScalarIntegerType(CondTy)) { in ProcessRecord()
2480 Ice::SizeT BitWidth = Ice::getScalarIntBitWidth(CondTy); in ProcessRecord()
2481 Ice::Operand *Cond = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2491 Ice::CfgNode *DefaultLabel = getBranchBasicBlock(Values[2]); in ProcessRecord()
2507 std::unique_ptr<Ice::InstSwitch> Switch( in ProcessRecord()
2508 Ice::InstSwitch::create(Func.get(), NumCases, Cond, DefaultLabel)); in ProcessRecord()
2522 Ice::CfgNode *Label = getBranchBasicBlock(Values[ValCaseIndex + 3]); in ProcessRecord()
2535 CurrentNode->appendInst(Ice::InstUnreachable::create(Func.get())); in ProcessRecord()
2542 Ice::Type Ty = Context->getSimpleTypeByID(Values[0]); in ProcessRecord()
2552 if (Ty == Ice::IceType_void) { in ProcessRecord()
2556 Ice::Variable *Dest = getNextInstVar(Ty); in ProcessRecord()
2557 Ice::InstPhi *Phi = in ProcessRecord()
2558 Ice::InstPhi::create(Func.get(), Values.size() >> 1, Dest); in ProcessRecord()
2560 Ice::Operand *Op = in ProcessRecord()
2580 Ice::Operand *ByteCount = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2582 Ice::Type PtrTy = Ice::getPointerType(); in ProcessRecord()
2583 if (ByteCount->getType() != Ice::IceType_i32) { in ProcessRecord()
2591 CurrentNode->appendInst(Ice::InstAlloca::create( in ProcessRecord()
2599 Ice::Operand *Address = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2600 Ice::Type Ty = Context->getSimpleTypeByID(Values[2]); in ProcessRecord()
2610 CurrentNode->appendInst(Ice::InstLoad::create( in ProcessRecord()
2618 Ice::Operand *Address = getRelativeOperand(Values[0], BaseIndex); in ProcessRecord()
2619 Ice::Operand *Value = getRelativeOperand(Values[1], BaseIndex); in ProcessRecord()
2626 Ice::InstStore::create(Func.get(), Value, Address, Alignment)); in ProcessRecord()
2640 Ice::SizeT ParamsStartIndex = 2; in ProcessRecord()
2651 Ice::Operand *Callee = getOperand(CalleeIndex); in ProcessRecord()
2654 Ice::FunctionDeclaration *Fcn = nullptr; in ProcessRecord()
2655 const Ice::FuncSigType *Signature = nullptr; in ProcessRecord()
2656 Ice::Type ReturnType = Ice::IceType_void; in ProcessRecord()
2657 const Ice::Intrinsics::FullIntrinsicInfo *IntrinsicInfo = nullptr; in ProcessRecord()
2662 Ice::SizeT NumParams = Values.size() - ParamsStartIndex; in ProcessRecord()
2669 if (ReturnType != Ice::IceType_void) in ProcessRecord()
2682 if (ReturnType != Ice::IceType_void) in ProcessRecord()
2697 SmallVector<Ice::Operand *, 8> Params; in ProcessRecord()
2698 for (Ice::SizeT Index = ParamsStartIndex; Index < Values.size(); ++Index) { in ProcessRecord()
2699 Ice::Operand *Op = getRelativeOperand(Values[Index], BaseIndex); in ProcessRecord()
2706 if (ReturnType != Ice::IceType_void) in ProcessRecord()
2720 ReturnType = Ice::IceType_i32; in ProcessRecord()
2724 for (Ice::SizeT Index = 0; Index < Params.size(); ++Index) { in ProcessRecord()
2725 Ice::Operand *Op = Params[Index]; in ProcessRecord()
2726 Ice::Type OpType = Op->getType(); in ProcessRecord()
2756 Ice::Variable *Dest = (ReturnType == Ice::IceType_void) in ProcessRecord()
2759 std::unique_ptr<Ice::InstCall> Instr; in ProcessRecord()
2761 Instr.reset(Ice::InstIntrinsicCall::create( in ProcessRecord()
2764 Instr.reset(Ice::InstCall::create(Func.get(), Params.size(), Dest, Callee, in ProcessRecord()
2767 for (Ice::Operand *Param : Params) in ProcessRecord()
2776 Ice::Type OpType = Context->getSimpleTypeByID(Values[1]); in ProcessRecord()
2796 Timer(Ice::TimerStack::TT_parseConstants, getTranslator().getContext()), in ConstantsParser()
2804 Ice::TimerMarker Timer;
2808 Ice::Type NextConstantType = Ice::IceType_void;
2812 Ice::GlobalContext *getContext() { return getTranslator().getContext(); } in getContext()
2817 if (NextConstantType != Ice::IceType_void) in isValidNextConstantType()
2832 if (NextConstantType == Ice::IceType_void) in ProcessRecord()
2852 if (Ice::isScalarIntegerType(NextConstantType)) { in ProcessRecord()
2853 BitcodeInt Value(Ice::getScalarIntBitWidth(NextConstantType), in ProcessRecord()
2855 if (Ice::Constant *C = getContext()->getConstantInt( in ProcessRecord()
2875 case Ice::IceType_f32: { in ProcessRecord()
2881 case Ice::IceType_f64: { in ProcessRecord()
2913 Timer(Ice::TimerStack::TT_parseFunctionValuesymtabs, in FunctionValuesymtabParser()
2917 Ice::TimerMarker Timer;
2948 Ice::Operand *Op = getFunctionParser()->getOperand(Index); in setValueName()
2949 if (auto *V = dyn_cast<Ice::Variable>(Op)) { in setValueName()
2950 if (Ice::BuildDefs::dump()) { in setValueName()
2961 if (!Ice::BuildDefs::dump()) in setBbName()
2968 if (Ice::BuildDefs::dump()) in setBbName()
3003 Timer(Ice::TimerStack::TT_parseModule, in ModuleParser()
3005 IsParseParallel(Ice::getFlags().isParseParallel()) {} in ModuleParser()
3011 Ice::TimerMarker Timer;
3028 std::unique_ptr<Ice::VariableDeclarationList> Globals = in installGlobalNamesAndGlobalVarInitializers()
3053 Timer(Ice::TimerStack::TT_parseModuleValuesymtabs, in ModuleValuesymtabParser()
3059 Ice::TimerMarker Timer;
3067 Ice::GlobalDeclaration *Decl = Context->getGlobalDeclarationByID(Index); in setValueName()
3068 if (llvm::isa<Ice::VariableDeclaration>(Decl) && in setValueName()
3090 class CfgParserWorkItem final : public Ice::OptWorkItem {
3102 std::unique_ptr<Ice::Cfg> getParsedCfg() override;
3118 std::unique_ptr<Ice::Cfg> CfgParserWorkItem::getParsedCfg() { in getParsedCfg()
3157 Ice::GlobalContext *Ctx = Context->getTranslator().getContext(); in ParseBlock()
3177 Ctx->optQueueBlockingPush(Ice::makeUnique<CfgParserWorkItem>( in ParseBlock()
3183 std::unique_ptr<Ice::Cfg> Func = Parser.parseFunction(SeqNumber); in ParseBlock()
3186 return Failed && !Ice::getFlags().getAllowErrorRecovery(); in ParseBlock()
3214 const Ice::FuncSigType &Signature = Context->getFuncSigTypeByID(Values[0]); in ProcessRecord()
3233 auto *Func = Ice::FunctionDeclaration::create( in ProcessRecord()
3261 namespace Ice { namespace