• Home
  • Raw
  • Download

Lines Matching refs:Ice

71   explicit LLVM2ICEConverter(Ice::Converter &Converter)  in LLVM2ICEConverter()
75 Ice::Converter &getConverter() const { return Converter; } in getConverter()
78 Ice::Converter &Converter;
79 Ice::GlobalContext *Ctx;
80 const Ice::TypeConverter TypeConverter;
95 explicit LLVM2ICEFunctionConverter(Ice::Converter &Converter) in LLVM2ICEFunctionConverter()
99 Func = Ice::Cfg::create(Ctx, Converter.getNextSequenceNumber()); in convertFunction()
101 Ice::CfgLocalAllocatorScope _(Func.get()); in convertFunction()
106 Ctx->getGlobalString(Ice::mangleName(F->getName()))); in convertFunction()
109 Ice::TimerMarker T(Ice::TimerStack::TT_llvmConvert, Func.get()); in convertFunction()
132 Ice::Constant *convertConstant(const Constant *Const) { in convertConstant()
134 Ice::GlobalDeclaration *Decl = getConverter().getGlobalDeclaration(GV); in convertConstant()
136 if (const auto *Func = llvm::dyn_cast<Ice::FunctionDeclaration>(Decl)) in convertConstant()
138 else if (const auto *Var = llvm::dyn_cast<Ice::VariableDeclaration>(Decl)) in convertConstant()
145 const Ice::RelocOffsetT Offset = 0; in convertConstant()
150 Ice::Type Ty = convertToIceType(CI->getType()); in convertConstant()
153 Ice::Type Type = convertToIceType(CFP->getType()); in convertConstant()
154 if (Type == Ice::IceType_f32) in convertConstant()
156 else if (Type == Ice::IceType_f64) in convertConstant()
172 Ice::Variable *mapValueToIceVar(const Value *V, Ice::Type IceTy) { in mapValueToIceVar()
173 if (IceTy == Ice::IceType_void) in mapValueToIceVar()
177 if (Ice::BuildDefs::dump()) in mapValueToIceVar()
183 Ice::Variable *mapValueToIceVar(const Value *V) { in mapValueToIceVar()
187 Ice::CfgNode *mapBasicBlockToNode(const BasicBlock *BB) { in mapBasicBlockToNode()
190 if (Ice::BuildDefs::dump()) in mapBasicBlockToNode()
196 Ice::Type convertToIceType(Type *LLVMTy) const { in convertToIceType()
197 Ice::Type IceTy = TypeConverter.convertToIceType(LLVMTy); in convertToIceType()
198 if (IceTy == Ice::IceType_NUM) in convertToIceType()
206 Ice::Operand *convertOperand(const Instruction *Instr, unsigned OpNum) { in convertOperand()
214 Ice::Operand *convertValue(const Value *Op) { in convertValue()
224 Ice::Inst *convertInstruction(const Instruction *Instr) { in convertInstruction()
249 return convertCastInstruction(cast<ZExtInst>(Instr), Ice::InstCast::Zext); in convertInstruction()
251 return convertCastInstruction(cast<SExtInst>(Instr), Ice::InstCast::Sext); in convertInstruction()
254 Ice::InstCast::Trunc); in convertInstruction()
257 Ice::InstCast::Fptrunc); in convertInstruction()
260 Ice::InstCast::Fpext); in convertInstruction()
263 Ice::InstCast::Fptosi); in convertInstruction()
266 Ice::InstCast::Fptoui); in convertInstruction()
269 Ice::InstCast::Sitofp); in convertInstruction()
272 Ice::InstCast::Uitofp); in convertInstruction()
275 Ice::InstCast::Bitcast); in convertInstruction()
277 return convertArithInstruction(Instr, Ice::InstArithmetic::Add); in convertInstruction()
279 return convertArithInstruction(Instr, Ice::InstArithmetic::Sub); in convertInstruction()
281 return convertArithInstruction(Instr, Ice::InstArithmetic::Mul); in convertInstruction()
283 return convertArithInstruction(Instr, Ice::InstArithmetic::Udiv); in convertInstruction()
285 return convertArithInstruction(Instr, Ice::InstArithmetic::Sdiv); in convertInstruction()
287 return convertArithInstruction(Instr, Ice::InstArithmetic::Urem); in convertInstruction()
289 return convertArithInstruction(Instr, Ice::InstArithmetic::Srem); in convertInstruction()
291 return convertArithInstruction(Instr, Ice::InstArithmetic::Shl); in convertInstruction()
293 return convertArithInstruction(Instr, Ice::InstArithmetic::Lshr); in convertInstruction()
295 return convertArithInstruction(Instr, Ice::InstArithmetic::Ashr); in convertInstruction()
297 return convertArithInstruction(Instr, Ice::InstArithmetic::Fadd); in convertInstruction()
299 return convertArithInstruction(Instr, Ice::InstArithmetic::Fsub); in convertInstruction()
301 return convertArithInstruction(Instr, Ice::InstArithmetic::Fmul); in convertInstruction()
303 return convertArithInstruction(Instr, Ice::InstArithmetic::Fdiv); in convertInstruction()
305 return convertArithInstruction(Instr, Ice::InstArithmetic::Frem); in convertInstruction()
307 return convertArithInstruction(Instr, Ice::InstArithmetic::And); in convertInstruction()
309 return convertArithInstruction(Instr, Ice::InstArithmetic::Or); in convertInstruction()
311 return convertArithInstruction(Instr, Ice::InstArithmetic::Xor); in convertInstruction()
331 Ice::Inst *convertLoadInstruction(const LoadInst *Instr) { in convertLoadInstruction()
332 Ice::Operand *Src = convertOperand(Instr, 0); in convertLoadInstruction()
333 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertLoadInstruction()
334 return Ice::InstLoad::create(Func.get(), Dest, Src); in convertLoadInstruction()
337 Ice::Inst *convertStoreInstruction(const StoreInst *Instr) { in convertStoreInstruction()
338 Ice::Operand *Addr = convertOperand(Instr, 1); in convertStoreInstruction()
339 Ice::Operand *Val = convertOperand(Instr, 0); in convertStoreInstruction()
340 return Ice::InstStore::create(Func.get(), Val, Addr); in convertStoreInstruction()
343 Ice::Inst *convertArithInstruction(const Instruction *Instr, in convertArithInstruction()
344 Ice::InstArithmetic::OpKind Opcode) { in convertArithInstruction()
346 Ice::Operand *Src0 = convertOperand(Instr, 0); in convertArithInstruction()
347 Ice::Operand *Src1 = convertOperand(Instr, 1); in convertArithInstruction()
348 Ice::Variable *Dest = mapValueToIceVar(BinOp); in convertArithInstruction()
349 return Ice::InstArithmetic::create(Func.get(), Opcode, Dest, Src0, Src1); in convertArithInstruction()
352 Ice::Inst *convertPHINodeInstruction(const PHINode *Instr) { in convertPHINodeInstruction()
354 Ice::InstPhi *IcePhi = in convertPHINodeInstruction()
355 Ice::InstPhi::create(Func.get(), NumValues, mapValueToIceVar(Instr)); in convertPHINodeInstruction()
363 Ice::Inst *convertBrInstruction(const BranchInst *Instr) { in convertBrInstruction()
365 Ice::Operand *Src = convertOperand(Instr, 0); in convertBrInstruction()
368 Ice::CfgNode *NodeThen = mapBasicBlockToNode(BBThen); in convertBrInstruction()
369 Ice::CfgNode *NodeElse = mapBasicBlockToNode(BBElse); in convertBrInstruction()
370 return Ice::InstBr::create(Func.get(), Src, NodeThen, NodeElse); in convertBrInstruction()
373 return Ice::InstBr::create(Func.get(), mapBasicBlockToNode(BBSucc)); in convertBrInstruction()
377 Ice::Inst *convertIntToPtrInstruction(const IntToPtrInst *Instr) { in convertIntToPtrInstruction()
378 Ice::Operand *Src = convertOperand(Instr, 0); in convertIntToPtrInstruction()
379 Ice::Variable *Dest = mapValueToIceVar(Instr, Ice::getPointerType()); in convertIntToPtrInstruction()
380 return Ice::InstAssign::create(Func.get(), Dest, Src); in convertIntToPtrInstruction()
383 Ice::Inst *convertPtrToIntInstruction(const PtrToIntInst *Instr) { in convertPtrToIntInstruction()
384 Ice::Operand *Src = convertOperand(Instr, 0); in convertPtrToIntInstruction()
385 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertPtrToIntInstruction()
386 return Ice::InstAssign::create(Func.get(), Dest, Src); in convertPtrToIntInstruction()
389 Ice::Inst *convertRetInstruction(const ReturnInst *Instr) { in convertRetInstruction()
390 Ice::Operand *RetOperand = convertOperand(Instr, 0); in convertRetInstruction()
392 return Ice::InstRet::create(Func.get(), RetOperand); in convertRetInstruction()
394 return Ice::InstRet::create(Func.get()); in convertRetInstruction()
398 Ice::Inst *convertCastInstruction(const Instruction *Instr, in convertCastInstruction()
399 Ice::InstCast::OpKind CastKind) { in convertCastInstruction()
400 Ice::Operand *Src = convertOperand(Instr, 0); in convertCastInstruction()
401 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertCastInstruction()
402 return Ice::InstCast::create(Func.get(), CastKind, Dest, Src); in convertCastInstruction()
405 Ice::Inst *convertICmpInstruction(const ICmpInst *Instr) { in convertICmpInstruction()
406 Ice::Operand *Src0 = convertOperand(Instr, 0); in convertICmpInstruction()
407 Ice::Operand *Src1 = convertOperand(Instr, 1); in convertICmpInstruction()
408 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertICmpInstruction()
410 Ice::InstIcmp::ICond Cond; in convertICmpInstruction()
415 Cond = Ice::InstIcmp::Eq; in convertICmpInstruction()
418 Cond = Ice::InstIcmp::Ne; in convertICmpInstruction()
421 Cond = Ice::InstIcmp::Ugt; in convertICmpInstruction()
424 Cond = Ice::InstIcmp::Uge; in convertICmpInstruction()
427 Cond = Ice::InstIcmp::Ult; in convertICmpInstruction()
430 Cond = Ice::InstIcmp::Ule; in convertICmpInstruction()
433 Cond = Ice::InstIcmp::Sgt; in convertICmpInstruction()
436 Cond = Ice::InstIcmp::Sge; in convertICmpInstruction()
439 Cond = Ice::InstIcmp::Slt; in convertICmpInstruction()
442 Cond = Ice::InstIcmp::Sle; in convertICmpInstruction()
446 return Ice::InstIcmp::create(Func.get(), Cond, Dest, Src0, Src1); in convertICmpInstruction()
449 Ice::Inst *convertFCmpInstruction(const FCmpInst *Instr) { in convertFCmpInstruction()
450 Ice::Operand *Src0 = convertOperand(Instr, 0); in convertFCmpInstruction()
451 Ice::Operand *Src1 = convertOperand(Instr, 1); in convertFCmpInstruction()
452 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertFCmpInstruction()
454 Ice::InstFcmp::FCond Cond; in convertFCmpInstruction()
461 Cond = Ice::InstFcmp::False; in convertFCmpInstruction()
464 Cond = Ice::InstFcmp::Oeq; in convertFCmpInstruction()
467 Cond = Ice::InstFcmp::Ogt; in convertFCmpInstruction()
470 Cond = Ice::InstFcmp::Oge; in convertFCmpInstruction()
473 Cond = Ice::InstFcmp::Olt; in convertFCmpInstruction()
476 Cond = Ice::InstFcmp::Ole; in convertFCmpInstruction()
479 Cond = Ice::InstFcmp::One; in convertFCmpInstruction()
482 Cond = Ice::InstFcmp::Ord; in convertFCmpInstruction()
485 Cond = Ice::InstFcmp::Ueq; in convertFCmpInstruction()
488 Cond = Ice::InstFcmp::Ugt; in convertFCmpInstruction()
491 Cond = Ice::InstFcmp::Uge; in convertFCmpInstruction()
494 Cond = Ice::InstFcmp::Ult; in convertFCmpInstruction()
497 Cond = Ice::InstFcmp::Ule; in convertFCmpInstruction()
500 Cond = Ice::InstFcmp::Une; in convertFCmpInstruction()
503 Cond = Ice::InstFcmp::Uno; in convertFCmpInstruction()
506 Cond = Ice::InstFcmp::True; in convertFCmpInstruction()
510 return Ice::InstFcmp::create(Func.get(), Cond, Dest, Src0, Src1); in convertFCmpInstruction()
513 Ice::Inst *convertExtractElementInstruction(const ExtractElementInst *Instr) { in convertExtractElementInstruction()
514 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertExtractElementInstruction()
515 Ice::Operand *Source1 = convertValue(Instr->getOperand(0)); in convertExtractElementInstruction()
516 Ice::Operand *Source2 = convertValue(Instr->getOperand(1)); in convertExtractElementInstruction()
517 return Ice::InstExtractElement::create(Func.get(), Dest, Source1, Source2); in convertExtractElementInstruction()
520 Ice::Inst *convertInsertElementInstruction(const InsertElementInst *Instr) { in convertInsertElementInstruction()
521 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertInsertElementInstruction()
522 Ice::Operand *Source1 = convertValue(Instr->getOperand(0)); in convertInsertElementInstruction()
523 Ice::Operand *Source2 = convertValue(Instr->getOperand(1)); in convertInsertElementInstruction()
524 Ice::Operand *Source3 = convertValue(Instr->getOperand(2)); in convertInsertElementInstruction()
525 return Ice::InstInsertElement::create(Func.get(), Dest, Source1, Source2, in convertInsertElementInstruction()
529 Ice::Inst *convertSelectInstruction(const SelectInst *Instr) { in convertSelectInstruction()
530 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertSelectInstruction()
531 Ice::Operand *Cond = convertValue(Instr->getCondition()); in convertSelectInstruction()
532 Ice::Operand *Source1 = convertValue(Instr->getTrueValue()); in convertSelectInstruction()
533 Ice::Operand *Source2 = convertValue(Instr->getFalseValue()); in convertSelectInstruction()
534 return Ice::InstSelect::create(Func.get(), Dest, Cond, Source1, Source2); in convertSelectInstruction()
537 Ice::Inst *convertSwitchInstruction(const SwitchInst *Instr) { in convertSwitchInstruction()
538 Ice::Operand *Source = convertValue(Instr->getCondition()); in convertSwitchInstruction()
539 Ice::CfgNode *LabelDefault = mapBasicBlockToNode(Instr->getDefaultDest()); in convertSwitchInstruction()
541 Ice::InstSwitch *Switch = in convertSwitchInstruction()
542 Ice::InstSwitch::create(Func.get(), NumCases, Source, LabelDefault); in convertSwitchInstruction()
547 Ice::CfgNode *CaseSuccessor = mapBasicBlockToNode(I.getCaseSuccessor()); in convertSwitchInstruction()
553 Ice::Inst *convertCallInstruction(const CallInst *Instr) { in convertCallInstruction()
554 Ice::Variable *Dest = mapValueToIceVar(Instr); in convertCallInstruction()
555 Ice::Operand *CallTarget = convertValue(Instr->getCalledValue()); in convertCallInstruction()
558 if (const auto Target = dyn_cast<Ice::ConstantRelocatable>(CallTarget)) { in convertCallInstruction()
561 const Ice::Intrinsics::FullIntrinsicInfo *Info = in convertCallInstruction()
568 Ice::InstIntrinsic *Intrinsic = Ice::InstIntrinsic::create( in convertCallInstruction()
582 Ice::InstCall *Call = Ice::InstCall::create( in convertCallInstruction()
591 Ice::Inst *convertAllocaInstruction(const AllocaInst *Instr) { in convertAllocaInstruction()
593 Ice::Operand *ByteCount = convertValue(Instr->getArraySize()); in convertAllocaInstruction()
595 Ice::Variable *Dest = mapValueToIceVar(Instr, Ice::getPointerType()); in convertAllocaInstruction()
597 return Ice::InstAlloca::create(Func.get(), Dest, ByteCount, Align); in convertAllocaInstruction()
600 Ice::Inst *convertUnreachableInstruction(const UnreachableInst * /*Instr*/) { in convertUnreachableInstruction()
601 return Ice::InstUnreachable::create(Func.get()); in convertUnreachableInstruction()
604 Ice::CfgNode *convertBasicBlock(const BasicBlock *BB) { in convertBasicBlock()
605 Ice::CfgNode *Node = mapBasicBlockToNode(BB); in convertBasicBlock()
607 Ice::Inst *Instr = convertInstruction(&II); in convertBasicBlock()
613 void validateIntrinsic(const Ice::InstIntrinsic *Intrinsic, in validateIntrinsic()
614 const Ice::Intrinsics::FullIntrinsicInfo *I) { in validateIntrinsic()
615 Ice::SizeT ArgIndex = 0; in validateIntrinsic()
617 case Ice::Intrinsics::IsValidCall: in validateIntrinsic()
619 case Ice::Intrinsics::BadReturnType: { in validateIntrinsic()
627 case Ice::Intrinsics::WrongNumOfArgs: { in validateIntrinsic()
635 case Ice::Intrinsics::WrongCallArgType: { in validateIntrinsic()
649 std::unique_ptr<Ice::Cfg> Func;
650 std::map<const Value *, Ice::Variable *> VarMap;
651 std::map<const BasicBlock *, Ice::CfgNode *> NodeMap;
666 explicit LLVM2ICEGlobalsConverter(Ice::Converter &Converter, in LLVM2ICEGlobalsConverter()
667 Ice::VariableDeclarationList *G) in LLVM2ICEGlobalsConverter()
677 void addGlobalInitializer(Ice::VariableDeclaration &Global, in addGlobalInitializer()
680 constexpr Ice::RelocOffsetT Offset = 0; in addGlobalInitializer()
687 void addGlobalInitializer(Ice::VariableDeclaration &Global,
689 Ice::RelocOffsetT Offset);
693 Ice::RelocOffsetT getIntegerLiteralConstant(const Value *C) { in getIntegerLiteralConstant()
705 Ice::VariableDeclarationList *GlobalPool;
715 Ice::GlobalDeclaration *Var = getConverter().getGlobalDeclaration(GV); in convertGlobalsToIce()
716 auto *VarDecl = cast<Ice::VariableDeclaration>(Var); in convertGlobalsToIce()
727 if (Ice::getFlags().getAllowUninitializedGlobals()) in convertGlobalsToIce()
753 Ice::VariableDeclaration &Global, const Constant *Initializer, in addGlobalInitializer()
754 bool HasOffset, Ice::RelocOffsetT Offset) { in addGlobalInitializer()
761 Global.addInitializer(Ice::VariableDeclaration::DataInitializer::create( in addGlobalInitializer()
770 Global.addInitializer(Ice::VariableDeclaration::ZeroInitializer::create( in addGlobalInitializer()
787 Ice::getPointerType()); in addGlobalInitializer()
790 const Ice::GlobalDeclaration *Addr = in addGlobalInitializer()
792 Global.addInitializer(Ice::VariableDeclaration::RelocInitializer::create( in addGlobalInitializer()
793 GlobalPool, Addr, {Ice::RelocOffset::create(Ctx, Offset)})); in addGlobalInitializer()
809 namespace Ice { namespace