Ostream &Str = Ctx->getStrDump();
for (CfgNode *Node : Nodes) {
Inst *FirstInst = nullptr;
- for (Inst &Inst : Node->getInsts()) {
- if (Inst.isDeleted())
+ for (Inst &Instr : Node->getInsts()) {
+ if (Instr.isDeleted())
continue;
if (FirstInst == nullptr)
- FirstInst = &Inst;
- InstNumberT InstNumber = Inst.getNumber();
- if (Variable *Dest = Inst.getDest()) {
+ FirstInst = &Instr;
+ InstNumberT InstNumber = Instr.getNumber();
+ if (Variable *Dest = Instr.getDest()) {
if (!Dest->getIgnoreLiveness()) {
bool Invalid = false;
constexpr bool IsDest = true;
// of the block, because a Phi temporary may be live at the end of
// the previous block, and if it is also assigned in the first
// instruction of this block, the adjacent live ranges get merged.
- if (static_cast<class Inst *>(&Inst) != FirstInst &&
- !Inst.isDestRedefined() &&
+ if (static_cast<class Inst *>(&Instr) != FirstInst &&
+ !Instr.isDestRedefined() &&
Dest->getLiveRange().containsValue(InstNumber - 1, IsDest))
Invalid = true;
if (Invalid) {
Valid = false;
- Str << "Liveness error: inst " << Inst.getNumber() << " dest ";
+ Str << "Liveness error: inst " << Instr.getNumber() << " dest ";
Dest->dump(this);
Str << " live range " << Dest->getLiveRange() << "\n";
}
}
}
- FOREACH_VAR_IN_INST(Var, Inst) {
+ FOREACH_VAR_IN_INST(Var, Instr) {
static constexpr bool IsDest = false;
if (!Var->getIgnoreLiveness() &&
!Var->getLiveRange().containsValue(InstNumber, IsDest)) {
Valid = false;
- Str << "Liveness error: inst " << Inst.getNumber() << " var ";
+ Str << "Liveness error: inst " << Instr.getNumber() << " var ";
Var->dump(this);
Str << " live range " << Var->getLiveRange() << "\n";
}
// Adds an instruction to either the Phi list or the regular instruction list.
// Validates that all Phis are added before all regular instructions.
-void CfgNode::appendInst(Inst *Inst) {
+void CfgNode::appendInst(Inst *Instr) {
++InstCountEstimate;
- if (auto *Phi = llvm::dyn_cast<InstPhi>(Inst)) {
+ if (auto *Phi = llvm::dyn_cast<InstPhi>(Instr)) {
if (!Insts.empty()) {
Func->setError("Phi instruction added to the middle of a block");
return;
}
Phis.push_back(Phi);
} else {
- Insts.push_back(Inst);
+ Insts.push_back(Instr);
}
}
Constant *OrderAcquireRelease =
Context->getConstantInt32(Intrinsics::MemoryOrderAcquireRelease);
- auto *Inst = InstIntrinsicCall::create(
+ auto *Instr = InstIntrinsicCall::create(
Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
- Inst->addArg(AtomicRMWOp);
- Inst->addArg(Counter);
- Inst->addArg(One);
- Inst->addArg(OrderAcquireRelease);
- Insts.push_front(Inst);
+ Instr->addArg(AtomicRMWOp);
+ Instr->addArg(Counter);
+ Instr->addArg(One);
+ Instr->addArg(OrderAcquireRelease);
+ Insts.push_front(Instr);
}
} // end of namespace Ice
/// @{
InstList &getInsts() { return Insts; }
PhiList &getPhis() { return Phis; }
- void appendInst(Inst *Inst);
+ void appendInst(Inst *Instr);
void renumberInstructions();
/// Rough and generally conservative estimate of the number of instructions in
/// the block. It is updated when an instruction is added, but not when
// Given an LLVM instruction and an operand number, produce the Ice::Operand
// this refers to. If there's no such operand, return nullptr.
- Ice::Operand *convertOperand(const Instruction *Inst, unsigned OpNum) {
- if (OpNum >= Inst->getNumOperands()) {
+ Ice::Operand *convertOperand(const Instruction *Instr, unsigned OpNum) {
+ if (OpNum >= Instr->getNumOperands()) {
return nullptr;
}
- const Value *Op = Inst->getOperand(OpNum);
+ const Value *Op = Instr->getOperand(OpNum);
return convertValue(Op);
}
// Note: this currently assumes a 1x1 mapping between LLVM IR and Ice
// instructions.
- Ice::Inst *convertInstruction(const Instruction *Inst) {
- switch (Inst->getOpcode()) {
+ Ice::Inst *convertInstruction(const Instruction *Instr) {
+ switch (Instr->getOpcode()) {
case Instruction::PHI:
- return convertPHINodeInstruction(cast<PHINode>(Inst));
+ return convertPHINodeInstruction(cast<PHINode>(Instr));
case Instruction::Br:
- return convertBrInstruction(cast<BranchInst>(Inst));
+ return convertBrInstruction(cast<BranchInst>(Instr));
case Instruction::Ret:
- return convertRetInstruction(cast<ReturnInst>(Inst));
+ return convertRetInstruction(cast<ReturnInst>(Instr));
case Instruction::IntToPtr:
- return convertIntToPtrInstruction(cast<IntToPtrInst>(Inst));
+ return convertIntToPtrInstruction(cast<IntToPtrInst>(Instr));
case Instruction::PtrToInt:
- return convertPtrToIntInstruction(cast<PtrToIntInst>(Inst));
+ return convertPtrToIntInstruction(cast<PtrToIntInst>(Instr));
case Instruction::ICmp:
- return convertICmpInstruction(cast<ICmpInst>(Inst));
+ return convertICmpInstruction(cast<ICmpInst>(Instr));
case Instruction::FCmp:
- return convertFCmpInstruction(cast<FCmpInst>(Inst));
+ return convertFCmpInstruction(cast<FCmpInst>(Instr));
case Instruction::Select:
- return convertSelectInstruction(cast<SelectInst>(Inst));
+ return convertSelectInstruction(cast<SelectInst>(Instr));
case Instruction::Switch:
- return convertSwitchInstruction(cast<SwitchInst>(Inst));
+ return convertSwitchInstruction(cast<SwitchInst>(Instr));
case Instruction::Load:
- return convertLoadInstruction(cast<LoadInst>(Inst));
+ return convertLoadInstruction(cast<LoadInst>(Instr));
case Instruction::Store:
- return convertStoreInstruction(cast<StoreInst>(Inst));
+ return convertStoreInstruction(cast<StoreInst>(Instr));
case Instruction::ZExt:
- return convertCastInstruction(cast<ZExtInst>(Inst), Ice::InstCast::Zext);
+ return convertCastInstruction(cast<ZExtInst>(Instr), Ice::InstCast::Zext);
case Instruction::SExt:
- return convertCastInstruction(cast<SExtInst>(Inst), Ice::InstCast::Sext);
+ return convertCastInstruction(cast<SExtInst>(Instr), Ice::InstCast::Sext);
case Instruction::Trunc:
- return convertCastInstruction(cast<TruncInst>(Inst),
+ return convertCastInstruction(cast<TruncInst>(Instr),
Ice::InstCast::Trunc);
case Instruction::FPTrunc:
- return convertCastInstruction(cast<FPTruncInst>(Inst),
+ return convertCastInstruction(cast<FPTruncInst>(Instr),
Ice::InstCast::Fptrunc);
case Instruction::FPExt:
- return convertCastInstruction(cast<FPExtInst>(Inst),
+ return convertCastInstruction(cast<FPExtInst>(Instr),
Ice::InstCast::Fpext);
case Instruction::FPToSI:
- return convertCastInstruction(cast<FPToSIInst>(Inst),
+ return convertCastInstruction(cast<FPToSIInst>(Instr),
Ice::InstCast::Fptosi);
case Instruction::FPToUI:
- return convertCastInstruction(cast<FPToUIInst>(Inst),
+ return convertCastInstruction(cast<FPToUIInst>(Instr),
Ice::InstCast::Fptoui);
case Instruction::SIToFP:
- return convertCastInstruction(cast<SIToFPInst>(Inst),
+ return convertCastInstruction(cast<SIToFPInst>(Instr),
Ice::InstCast::Sitofp);
case Instruction::UIToFP:
- return convertCastInstruction(cast<UIToFPInst>(Inst),
+ return convertCastInstruction(cast<UIToFPInst>(Instr),
Ice::InstCast::Uitofp);
case Instruction::BitCast:
- return convertCastInstruction(cast<BitCastInst>(Inst),
+ return convertCastInstruction(cast<BitCastInst>(Instr),
Ice::InstCast::Bitcast);
case Instruction::Add:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Add);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Add);
case Instruction::Sub:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Sub);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Sub);
case Instruction::Mul:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Mul);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Mul);
case Instruction::UDiv:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Udiv);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Udiv);
case Instruction::SDiv:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Sdiv);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Sdiv);
case Instruction::URem:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Urem);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Urem);
case Instruction::SRem:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Srem);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Srem);
case Instruction::Shl:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Shl);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Shl);
case Instruction::LShr:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Lshr);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Lshr);
case Instruction::AShr:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Ashr);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Ashr);
case Instruction::FAdd:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Fadd);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Fadd);
case Instruction::FSub:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Fsub);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Fsub);
case Instruction::FMul:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Fmul);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Fmul);
case Instruction::FDiv:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Fdiv);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Fdiv);
case Instruction::FRem:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Frem);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Frem);
case Instruction::And:
- return convertArithInstruction(Inst, Ice::InstArithmetic::And);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::And);
case Instruction::Or:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Or);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Or);
case Instruction::Xor:
- return convertArithInstruction(Inst, Ice::InstArithmetic::Xor);
+ return convertArithInstruction(Instr, Ice::InstArithmetic::Xor);
case Instruction::ExtractElement:
- return convertExtractElementInstruction(cast<ExtractElementInst>(Inst));
+ return convertExtractElementInstruction(cast<ExtractElementInst>(Instr));
case Instruction::InsertElement:
- return convertInsertElementInstruction(cast<InsertElementInst>(Inst));
+ return convertInsertElementInstruction(cast<InsertElementInst>(Instr));
case Instruction::Call:
- return convertCallInstruction(cast<CallInst>(Inst));
+ return convertCallInstruction(cast<CallInst>(Instr));
case Instruction::Alloca:
- return convertAllocaInstruction(cast<AllocaInst>(Inst));
+ return convertAllocaInstruction(cast<AllocaInst>(Instr));
case Instruction::Unreachable:
- return convertUnreachableInstruction(cast<UnreachableInst>(Inst));
+ return convertUnreachableInstruction(cast<UnreachableInst>(Instr));
default:
report_fatal_error(std::string("Invalid PNaCl instruction: ") +
- LLVMObjectAsString(Inst));
+ LLVMObjectAsString(Instr));
}
llvm_unreachable("convertInstruction");
return nullptr;
}
- Ice::Inst *convertLoadInstruction(const LoadInst *Inst) {
- Ice::Operand *Src = convertOperand(Inst, 0);
- Ice::Variable *Dest = mapValueToIceVar(Inst);
+ Ice::Inst *convertLoadInstruction(const LoadInst *Instr) {
+ Ice::Operand *Src = convertOperand(Instr, 0);
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
return Ice::InstLoad::create(Func.get(), Dest, Src);
}
- Ice::Inst *convertStoreInstruction(const StoreInst *Inst) {
- Ice::Operand *Addr = convertOperand(Inst, 1);
- Ice::Operand *Val = convertOperand(Inst, 0);
+ Ice::Inst *convertStoreInstruction(const StoreInst *Instr) {
+ Ice::Operand *Addr = convertOperand(Instr, 1);
+ Ice::Operand *Val = convertOperand(Instr, 0);
return Ice::InstStore::create(Func.get(), Val, Addr);
}
- Ice::Inst *convertArithInstruction(const Instruction *Inst,
+ Ice::Inst *convertArithInstruction(const Instruction *Instr,
Ice::InstArithmetic::OpKind Opcode) {
- const auto BinOp = cast<BinaryOperator>(Inst);
- Ice::Operand *Src0 = convertOperand(Inst, 0);
- Ice::Operand *Src1 = convertOperand(Inst, 1);
+ const auto BinOp = cast<BinaryOperator>(Instr);
+ Ice::Operand *Src0 = convertOperand(Instr, 0);
+ Ice::Operand *Src1 = convertOperand(Instr, 1);
Ice::Variable *Dest = mapValueToIceVar(BinOp);
return Ice::InstArithmetic::create(Func.get(), Opcode, Dest, Src0, Src1);
}
- Ice::Inst *convertPHINodeInstruction(const PHINode *Inst) {
- unsigned NumValues = Inst->getNumIncomingValues();
+ Ice::Inst *convertPHINodeInstruction(const PHINode *Instr) {
+ unsigned NumValues = Instr->getNumIncomingValues();
Ice::InstPhi *IcePhi =
- Ice::InstPhi::create(Func.get(), NumValues, mapValueToIceVar(Inst));
+ Ice::InstPhi::create(Func.get(), NumValues, mapValueToIceVar(Instr));
for (unsigned N = 0, E = NumValues; N != E; ++N) {
- IcePhi->addArgument(convertOperand(Inst, N),
- mapBasicBlockToNode(Inst->getIncomingBlock(N)));
+ IcePhi->addArgument(convertOperand(Instr, N),
+ mapBasicBlockToNode(Instr->getIncomingBlock(N)));
}
return IcePhi;
}
- Ice::Inst *convertBrInstruction(const BranchInst *Inst) {
- if (Inst->isConditional()) {
- Ice::Operand *Src = convertOperand(Inst, 0);
- BasicBlock *BBThen = Inst->getSuccessor(0);
- BasicBlock *BBElse = Inst->getSuccessor(1);
+ Ice::Inst *convertBrInstruction(const BranchInst *Instr) {
+ if (Instr->isConditional()) {
+ Ice::Operand *Src = convertOperand(Instr, 0);
+ BasicBlock *BBThen = Instr->getSuccessor(0);
+ BasicBlock *BBElse = Instr->getSuccessor(1);
Ice::CfgNode *NodeThen = mapBasicBlockToNode(BBThen);
Ice::CfgNode *NodeElse = mapBasicBlockToNode(BBElse);
return Ice::InstBr::create(Func.get(), Src, NodeThen, NodeElse);
} else {
- BasicBlock *BBSucc = Inst->getSuccessor(0);
+ BasicBlock *BBSucc = Instr->getSuccessor(0);
return Ice::InstBr::create(Func.get(), mapBasicBlockToNode(BBSucc));
}
}
- Ice::Inst *convertIntToPtrInstruction(const IntToPtrInst *Inst) {
- Ice::Operand *Src = convertOperand(Inst, 0);
- Ice::Variable *Dest = mapValueToIceVar(Inst, Ice::getPointerType());
+ Ice::Inst *convertIntToPtrInstruction(const IntToPtrInst *Instr) {
+ Ice::Operand *Src = convertOperand(Instr, 0);
+ Ice::Variable *Dest = mapValueToIceVar(Instr, Ice::getPointerType());
return Ice::InstAssign::create(Func.get(), Dest, Src);
}
- Ice::Inst *convertPtrToIntInstruction(const PtrToIntInst *Inst) {
- Ice::Operand *Src = convertOperand(Inst, 0);
- Ice::Variable *Dest = mapValueToIceVar(Inst);
+ Ice::Inst *convertPtrToIntInstruction(const PtrToIntInst *Instr) {
+ Ice::Operand *Src = convertOperand(Instr, 0);
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
return Ice::InstAssign::create(Func.get(), Dest, Src);
}
- Ice::Inst *convertRetInstruction(const ReturnInst *Inst) {
- Ice::Operand *RetOperand = convertOperand(Inst, 0);
+ Ice::Inst *convertRetInstruction(const ReturnInst *Instr) {
+ Ice::Operand *RetOperand = convertOperand(Instr, 0);
if (RetOperand) {
return Ice::InstRet::create(Func.get(), RetOperand);
} else {
}
}
- Ice::Inst *convertCastInstruction(const Instruction *Inst,
+ Ice::Inst *convertCastInstruction(const Instruction *Instr,
Ice::InstCast::OpKind CastKind) {
- Ice::Operand *Src = convertOperand(Inst, 0);
- Ice::Variable *Dest = mapValueToIceVar(Inst);
+ Ice::Operand *Src = convertOperand(Instr, 0);
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
return Ice::InstCast::create(Func.get(), CastKind, Dest, Src);
}
- Ice::Inst *convertICmpInstruction(const ICmpInst *Inst) {
- Ice::Operand *Src0 = convertOperand(Inst, 0);
- Ice::Operand *Src1 = convertOperand(Inst, 1);
- Ice::Variable *Dest = mapValueToIceVar(Inst);
+ Ice::Inst *convertICmpInstruction(const ICmpInst *Instr) {
+ Ice::Operand *Src0 = convertOperand(Instr, 0);
+ Ice::Operand *Src1 = convertOperand(Instr, 1);
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
Ice::InstIcmp::ICond Cond;
- switch (Inst->getPredicate()) {
+ switch (Instr->getPredicate()) {
default:
llvm_unreachable("ICmpInst predicate");
case CmpInst::ICMP_EQ:
return Ice::InstIcmp::create(Func.get(), Cond, Dest, Src0, Src1);
}
- Ice::Inst *convertFCmpInstruction(const FCmpInst *Inst) {
- Ice::Operand *Src0 = convertOperand(Inst, 0);
- Ice::Operand *Src1 = convertOperand(Inst, 1);
- Ice::Variable *Dest = mapValueToIceVar(Inst);
+ Ice::Inst *convertFCmpInstruction(const FCmpInst *Instr) {
+ Ice::Operand *Src0 = convertOperand(Instr, 0);
+ Ice::Operand *Src1 = convertOperand(Instr, 1);
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
Ice::InstFcmp::FCond Cond;
- switch (Inst->getPredicate()) {
+ switch (Instr->getPredicate()) {
default:
llvm_unreachable("FCmpInst predicate");
return Ice::InstFcmp::create(Func.get(), Cond, Dest, Src0, Src1);
}
- Ice::Inst *convertExtractElementInstruction(const ExtractElementInst *Inst) {
- Ice::Variable *Dest = mapValueToIceVar(Inst);
- Ice::Operand *Source1 = convertValue(Inst->getOperand(0));
- Ice::Operand *Source2 = convertValue(Inst->getOperand(1));
+ Ice::Inst *convertExtractElementInstruction(const ExtractElementInst *Instr) {
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
+ Ice::Operand *Source1 = convertValue(Instr->getOperand(0));
+ Ice::Operand *Source2 = convertValue(Instr->getOperand(1));
return Ice::InstExtractElement::create(Func.get(), Dest, Source1, Source2);
}
- Ice::Inst *convertInsertElementInstruction(const InsertElementInst *Inst) {
- Ice::Variable *Dest = mapValueToIceVar(Inst);
- Ice::Operand *Source1 = convertValue(Inst->getOperand(0));
- Ice::Operand *Source2 = convertValue(Inst->getOperand(1));
- Ice::Operand *Source3 = convertValue(Inst->getOperand(2));
+ Ice::Inst *convertInsertElementInstruction(const InsertElementInst *Instr) {
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
+ Ice::Operand *Source1 = convertValue(Instr->getOperand(0));
+ Ice::Operand *Source2 = convertValue(Instr->getOperand(1));
+ Ice::Operand *Source3 = convertValue(Instr->getOperand(2));
return Ice::InstInsertElement::create(Func.get(), Dest, Source1, Source2,
Source3);
}
- Ice::Inst *convertSelectInstruction(const SelectInst *Inst) {
- Ice::Variable *Dest = mapValueToIceVar(Inst);
- Ice::Operand *Cond = convertValue(Inst->getCondition());
- Ice::Operand *Source1 = convertValue(Inst->getTrueValue());
- Ice::Operand *Source2 = convertValue(Inst->getFalseValue());
+ Ice::Inst *convertSelectInstruction(const SelectInst *Instr) {
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
+ Ice::Operand *Cond = convertValue(Instr->getCondition());
+ Ice::Operand *Source1 = convertValue(Instr->getTrueValue());
+ Ice::Operand *Source2 = convertValue(Instr->getFalseValue());
return Ice::InstSelect::create(Func.get(), Dest, Cond, Source1, Source2);
}
- Ice::Inst *convertSwitchInstruction(const SwitchInst *Inst) {
- Ice::Operand *Source = convertValue(Inst->getCondition());
- Ice::CfgNode *LabelDefault = mapBasicBlockToNode(Inst->getDefaultDest());
- unsigned NumCases = Inst->getNumCases();
+ Ice::Inst *convertSwitchInstruction(const SwitchInst *Instr) {
+ Ice::Operand *Source = convertValue(Instr->getCondition());
+ Ice::CfgNode *LabelDefault = mapBasicBlockToNode(Instr->getDefaultDest());
+ unsigned NumCases = Instr->getNumCases();
Ice::InstSwitch *Switch =
Ice::InstSwitch::create(Func.get(), NumCases, Source, LabelDefault);
unsigned CurrentCase = 0;
- for (SwitchInst::ConstCaseIt I = Inst->case_begin(), E = Inst->case_end();
+ for (SwitchInst::ConstCaseIt I = Instr->case_begin(), E = Instr->case_end();
I != E; ++I, ++CurrentCase) {
uint64_t CaseValue = I.getCaseValue()->getSExtValue();
Ice::CfgNode *CaseSuccessor = mapBasicBlockToNode(I.getCaseSuccessor());
return Switch;
}
- Ice::Inst *convertCallInstruction(const CallInst *Inst) {
- Ice::Variable *Dest = mapValueToIceVar(Inst);
- Ice::Operand *CallTarget = convertValue(Inst->getCalledValue());
- unsigned NumArgs = Inst->getNumArgOperands();
+ Ice::Inst *convertCallInstruction(const CallInst *Instr) {
+ Ice::Variable *Dest = mapValueToIceVar(Instr);
+ Ice::Operand *CallTarget = convertValue(Instr->getCalledValue());
+ unsigned NumArgs = Instr->getNumArgOperands();
// Note: Subzero doesn't (yet) do anything special with the Tail flag in
// the bitcode, i.e. CallInst::isTailCall().
Ice::InstCall *NewInst = nullptr;
Info = Ctx->getIntrinsicsInfo().find(Target->getName(), BadIntrinsic);
if (BadIntrinsic) {
report_fatal_error(std::string("Invalid PNaCl intrinsic call: ") +
- LLVMObjectAsString(Inst));
+ LLVMObjectAsString(Instr));
}
if (Info)
NewInst = Ice::InstIntrinsicCall::create(Func.get(), NumArgs, Dest,
// Not an intrinsic call.
if (NewInst == nullptr) {
NewInst = Ice::InstCall::create(Func.get(), NumArgs, Dest, CallTarget,
- Inst->isTailCall());
+ Instr->isTailCall());
}
for (unsigned i = 0; i < NumArgs; ++i) {
- NewInst->addArg(convertOperand(Inst, i));
+ NewInst->addArg(convertOperand(Instr, i));
}
if (Info) {
validateIntrinsicCall(NewInst, Info);
return NewInst;
}
- Ice::Inst *convertAllocaInstruction(const AllocaInst *Inst) {
+ Ice::Inst *convertAllocaInstruction(const AllocaInst *Instr) {
// PNaCl bitcode only contains allocas of byte-granular objects.
- Ice::Operand *ByteCount = convertValue(Inst->getArraySize());
- uint32_t Align = Inst->getAlignment();
- Ice::Variable *Dest = mapValueToIceVar(Inst, Ice::getPointerType());
+ Ice::Operand *ByteCount = convertValue(Instr->getArraySize());
+ uint32_t Align = Instr->getAlignment();
+ Ice::Variable *Dest = mapValueToIceVar(Instr, Ice::getPointerType());
return Ice::InstAlloca::create(Func.get(), Dest, ByteCount, Align);
}
- Ice::Inst *convertUnreachableInstruction(const UnreachableInst * /*Inst*/) {
+ Ice::Inst *convertUnreachableInstruction(const UnreachableInst * /*Instr*/) {
return Ice::InstUnreachable::create(Func.get());
}
Ice::CfgNode *convertBasicBlock(const BasicBlock *BB) {
Ice::CfgNode *Node = mapBasicBlockToNode(BB);
for (const Instruction &II : *BB) {
- Ice::Inst *Inst = convertInstruction(&II);
- Node->appendInst(Inst);
+ Ice::Inst *Instr = convertInstruction(&II);
+ Node->appendInst(Instr);
}
return Node;
}
bool getKnownFrameOffset() const { return KnownFrameOffset; }
void setKnownFrameOffset() { KnownFrameOffset = true; }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Alloca; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Alloca; }
private:
InstAlloca(Cfg *Func, Variable *Dest, Operand *ByteCount,
static const char *getOpName(OpKind Op);
bool isCommutative() const;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == Arithmetic;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == Arithmetic;
}
private:
}
bool isVarAssign() const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Assign; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Assign; }
private:
InstAssign(Cfg *Func, Variable *Dest, Operand *Source);
bool isUnconditionalBranch() const override { return isUnconditional(); }
bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Br; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Br; }
private:
/// Conditional branch
bool isTailcall() const { return HasTailCall; }
bool isTargetHelperCall() const { return IsTargetHelperCall; }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Call; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Call; }
Type getReturnType() const;
protected:
}
OpKind getCastKind() const { return CastKind; }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Cast; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Cast; }
private:
InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source);
}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == ExtractElement;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == ExtractElement;
}
private:
}
FCond getCondition() const { return Condition; }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Fcmp; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Fcmp; }
private:
InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1,
}
ICond getCondition() const { return Condition; }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Icmp; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Icmp; }
private:
InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1,
}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == InsertElement;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == InsertElement;
}
private:
return new (Func->allocate<InstIntrinsicCall>())
InstIntrinsicCall(Func, NumArgs, Dest, CallTarget, Info);
}
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == IntrinsicCall;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == IntrinsicCall;
}
Intrinsics::IntrinsicInfo getIntrinsicInfo() const { return Info; }
}
Operand *getSourceAddress() const { return getSrc(0); }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Load; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Load; }
private:
InstLoad(Cfg *Func, Variable *Dest, Operand *SourceAddr);
Liveness *Liveness);
Inst *lower(Cfg *Func);
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Phi; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Phi; }
private:
InstPhi(Cfg *Func, SizeT MaxSrcs, Variable *Dest);
}
NodeList getTerminatorEdges() const override { return NodeList(); }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Ret; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Ret; }
private:
InstRet(Cfg *Func, Operand *RetValue);
Operand *getTrueOperand() const { return getSrc(1); }
Operand *getFalseOperand() const { return getSrc(2); }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Select; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Select; }
private:
InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, Operand *Source1,
Variable *getRmwBeacon() const;
void setRmwBeacon(Variable *Beacon);
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Store; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Store; }
private:
InstStore(Cfg *Func, Operand *Data, Operand *Addr);
NodeList getTerminatorEdges() const override;
bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == Switch; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == Switch; }
private:
InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, CfgNode *LabelDefault);
}
NodeList getTerminatorEdges() const override { return NodeList(); }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == Unreachable;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == Unreachable;
}
private:
void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override;
Option getOption() const { return BundleOption; }
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == BundleLock;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == BundleLock;
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return Inst->getKind() == BundleUnlock;
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == BundleUnlock;
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == FakeDef; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == FakeDef; }
private:
InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src);
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == FakeUse; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() == FakeUse; }
private:
InstFakeUse(Cfg *Func, Variable *Src, uint32_t Weight);
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg * /* Func */) const override {}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == FakeKill; }
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == FakeKill;
+ }
private:
InstFakeKill(Cfg *Func, const Inst *Linked);
return Targets[I];
}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() == JumpTable; }
+ static bool classof(const Inst *Instr) {
+ return Instr->getKind() == JumpTable;
+ }
static IceString makeName(const IceString &FuncName, SizeT Id) {
return ".L" + FuncName + "$jumptable$__" + std::to_string(Id);
public:
uint32_t getEmitInstCount() const override { return 1; }
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return Inst->getKind() >= Target; }
+ static bool classof(const Inst *Instr) { return Instr->getKind() >= Target; }
protected:
InstTarget(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest)
void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); }
void InstARM32Pred::emitUnaryopGPR(const char *Opcode,
- const InstARM32Pred *Inst, const Cfg *Func,
+ const InstARM32Pred *Instr, const Cfg *Func,
bool NeedsWidthSuffix) {
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 1);
- Type SrcTy = Inst->getSrc(0)->getType();
+ assert(Instr->getSrcSize() == 1);
+ Type SrcTy = Instr->getSrc(0)->getType();
Str << "\t" << Opcode;
if (NeedsWidthSuffix)
Str << getWidthString(SrcTy);
- Str << Inst->getPredicate() << "\t";
- Inst->getDest()->emit(Func);
+ Str << Instr->getPredicate() << "\t";
+ Instr->getDest()->emit(Func);
Str << ", ";
- Inst->getSrc(0)->emit(Func);
+ Instr->getSrc(0)->emit(Func);
}
-void InstARM32Pred::emitUnaryopFP(const char *Opcode, const InstARM32Pred *Inst,
- const Cfg *Func) {
+void InstARM32Pred::emitUnaryopFP(const char *Opcode,
+ const InstARM32Pred *Instr, const Cfg *Func) {
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 1);
- Type SrcTy = Inst->getSrc(0)->getType();
- Str << "\t" << Opcode << Inst->getPredicate() << getVecWidthString(SrcTy)
+ assert(Instr->getSrcSize() == 1);
+ Type SrcTy = Instr->getSrc(0)->getType();
+ Str << "\t" << Opcode << Instr->getPredicate() << getVecWidthString(SrcTy)
<< "\t";
- Inst->getDest()->emit(Func);
+ Instr->getDest()->emit(Func);
Str << ", ";
- Inst->getSrc(0)->emit(Func);
+ Instr->getSrc(0)->emit(Func);
}
-void InstARM32Pred::emitTwoAddr(const char *Opcode, const InstARM32Pred *Inst,
+void InstARM32Pred::emitTwoAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 2);
- Variable *Dest = Inst->getDest();
- assert(Dest == Inst->getSrc(0));
- Str << "\t" << Opcode << Inst->getPredicate() << "\t";
+ assert(Instr->getSrcSize() == 2);
+ Variable *Dest = Instr->getDest();
+ assert(Dest == Instr->getSrc(0));
+ Str << "\t" << Opcode << Instr->getPredicate() << "\t";
Dest->emit(Func);
Str << ", ";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
}
-void InstARM32Pred::emitThreeAddr(const char *Opcode, const InstARM32Pred *Inst,
- const Cfg *Func, bool SetFlags) {
+void InstARM32Pred::emitThreeAddr(const char *Opcode,
+ const InstARM32Pred *Instr, const Cfg *Func,
+ bool SetFlags) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 2);
- Str << "\t" << Opcode << (SetFlags ? "s" : "") << Inst->getPredicate()
+ assert(Instr->getSrcSize() == 2);
+ Str << "\t" << Opcode << (SetFlags ? "s" : "") << Instr->getPredicate()
<< "\t";
- Inst->getDest()->emit(Func);
+ Instr->getDest()->emit(Func);
Str << ", ";
- Inst->getSrc(0)->emit(Func);
+ Instr->getSrc(0)->emit(Func);
Str << ", ";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
}
-void InstARM32::emitThreeAddrFP(const char *Opcode, const InstARM32 *Inst,
+void InstARM32::emitThreeAddrFP(const char *Opcode, const InstARM32 *Instr,
const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 2);
- Str << "\t" << Opcode << getVecWidthString(Inst->getDest()->getType())
+ assert(Instr->getSrcSize() == 2);
+ Str << "\t" << Opcode << getVecWidthString(Instr->getDest()->getType())
<< "\t";
- Inst->getDest()->emit(Func);
+ Instr->getDest()->emit(Func);
Str << ", ";
- Inst->getSrc(0)->emit(Func);
+ Instr->getSrc(0)->emit(Func);
Str << ", ";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
}
-void InstARM32::emitFourAddrFP(const char *Opcode, const InstARM32 *Inst,
+void InstARM32::emitFourAddrFP(const char *Opcode, const InstARM32 *Instr,
const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 3);
- assert(Inst->getSrc(0) == Inst->getDest());
- Str << "\t" << Opcode << getVecWidthString(Inst->getDest()->getType())
+ assert(Instr->getSrcSize() == 3);
+ assert(Instr->getSrc(0) == Instr->getDest());
+ Str << "\t" << Opcode << getVecWidthString(Instr->getDest()->getType())
<< "\t";
- Inst->getDest()->emit(Func);
+ Instr->getDest()->emit(Func);
Str << ", ";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
Str << ", ";
- Inst->getSrc(2)->emit(Func);
+ Instr->getSrc(2)->emit(Func);
}
-void InstARM32Pred::emitFourAddr(const char *Opcode, const InstARM32Pred *Inst,
+void InstARM32Pred::emitFourAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 3);
- Str << "\t" << Opcode << Inst->getPredicate() << "\t";
- Inst->getDest()->emit(Func);
+ assert(Instr->getSrcSize() == 3);
+ Str << "\t" << Opcode << Instr->getPredicate() << "\t";
+ Instr->getDest()->emit(Func);
Str << ", ";
- Inst->getSrc(0)->emit(Func);
+ Instr->getSrc(0)->emit(Func);
Str << ", ";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
Str << ", ";
- Inst->getSrc(2)->emit(Func);
+ Instr->getSrc(2)->emit(Func);
}
template <InstARM32::InstKindARM32 K>
emitUsingTextFixup(Func);
}
-void InstARM32Pred::emitCmpLike(const char *Opcode, const InstARM32Pred *Inst,
+void InstARM32Pred::emitCmpLike(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 2);
- Str << "\t" << Opcode << Inst->getPredicate() << "\t";
- Inst->getSrc(0)->emit(Func);
+ assert(Instr->getSrcSize() == 2);
+ Str << "\t" << Opcode << Instr->getPredicate() << "\t";
+ Instr->getSrc(0)->emit(Func);
Str << ", ";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
}
OperandARM32Mem::OperandARM32Mem(Cfg * /* Func */, Type Ty, Variable *Base,
void startNextInst(const Cfg *Func) const;
/// Shared emit routines for common forms of instructions.
- static void emitThreeAddrFP(const char *Opcode, const InstARM32 *Inst,
+ static void emitThreeAddrFP(const char *Opcode, const InstARM32 *Instr,
const Cfg *Func);
- static void emitFourAddrFP(const char *Opcode, const InstARM32 *Inst,
+ static void emitFourAddrFP(const char *Opcode, const InstARM32 *Instr,
const Cfg *Func);
void dump(const Cfg *Func) const override;
InstARM32(Cfg *Func, InstKindARM32 Kind, SizeT Maxsrcs, Variable *Dest)
: InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
- static bool isClassof(const Inst *Inst, InstKindARM32 MyKind) {
- return Inst->getKind() == static_cast<InstKind>(MyKind);
+ static bool isClassof(const Inst *Instr, InstKindARM32 MyKind) {
+ return Instr->getKind() == static_cast<InstKind>(MyKind);
}
// Generates text of assembly instruction using method emit(), and then adds
void dumpOpcodePred(Ostream &Str, const char *Opcode, Type Ty) const;
/// Shared emit routines for common forms of instructions.
- static void emitUnaryopGPR(const char *Opcode, const InstARM32Pred *Inst,
+ static void emitUnaryopGPR(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func, bool NeedsWidthSuffix);
- static void emitUnaryopFP(const char *Opcode, const InstARM32Pred *Inst,
+ static void emitUnaryopFP(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func);
- static void emitTwoAddr(const char *Opcode, const InstARM32Pred *Inst,
+ static void emitTwoAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func);
- static void emitThreeAddr(const char *Opcode, const InstARM32Pred *Inst,
+ static void emitThreeAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func, bool SetFlags);
- static void emitFourAddr(const char *Opcode, const InstARM32Pred *Inst,
+ static void emitFourAddr(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func);
- static void emitCmpLike(const char *Opcode, const InstARM32Pred *Inst,
+ static void emitCmpLike(const char *Opcode, const InstARM32Pred *Instr,
const Cfg *Func);
protected:
Str << " ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32UnaryopGPR(Cfg *Func, Variable *Dest, Operand *Src,
Str << " ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32UnaryopFP(Cfg *Func, Variable *Dest, Operand *Src,
Str << " ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32TwoAddrGPR(Cfg *Func, Variable *Dest, Operand *Src,
Str << ", ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32LoadBase(Cfg *Func, Variable *Dest, Operand *Source,
Str << (SetFlags ? ".s " : " ");
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32ThreeAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0,
Str << Opcode << "." << getDest()->getType() << " ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32ThreeAddrFP(Cfg *Func, Variable *Dest, Variable *Src0,
Str << " ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32FourAddrGPR(Cfg *Func, Variable *Dest, Variable *Src0,
Str << ", ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32FourAddrFP(Cfg *Func, Variable *Dest, Variable *Src0, Variable *Src1)
Str << " ";
dumpSources(Func);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, K); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, K); }
private:
InstARM32CmpLike(Cfg *Func, Variable *Src0, Operand *Src1,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Br); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Br); }
private:
InstARM32Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Call); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Call); }
private:
InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget);
static InstARM32Pop *create(Cfg *Func, const VarList &Dests) {
return new (Func->allocate<InstARM32Pop>()) InstARM32Pop(Func, Dests);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, Pop); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Pop); }
private:
InstARM32Pop(Cfg *Func, const VarList &Dests);
static InstARM32Push *create(Cfg *Func, const VarList &Srcs) {
return new (Func->allocate<InstARM32Push>()) InstARM32Push(Func, Srcs);
}
- static bool classof(const Inst *Inst) { return isClassof(Inst, Push); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Push); }
private:
InstARM32Push(Cfg *Func, const VarList &Srcs);
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Ret); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Ret); }
private:
InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source);
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Str); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Str); }
private:
InstARM32Str(Cfg *Func, Variable *Value, OperandARM32Mem *Mem,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Strex); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Strex); }
private:
InstARM32Strex(Cfg *Func, Variable *Dest, Variable *Value,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Trap); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Trap); }
private:
explicit InstARM32Trap(Cfg *Func);
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Umull); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Umull); }
private:
InstARM32Umull(Cfg *Func, Variable *DestLo, Variable *DestHi, Variable *Src0,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Vcvt); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Vcvt); }
private:
InstARM32Vcvt(Cfg *Func, Variable *Dest, Variable *Src, VcvtVariant Variant,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Mov); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Mov); }
bool isMultiDest() const { return DestHi != nullptr; }
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Vcmp); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Vcmp); }
private:
InstARM32Vcmp(Cfg *Func, Variable *Src0, Operand *Src1,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Vmrs); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Vmrs); }
private:
InstARM32Vmrs(Cfg *Func, CondARM32::Cond Predicate);
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Vabs); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Vabs); }
private:
InstARM32Vabs(Cfg *Func, Variable *Dest, Variable *Src,
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) { return isClassof(Inst, Dmb); }
+ static bool classof(const Inst *Instr) { return isClassof(Instr, Dmb); }
private:
explicit InstARM32Dmb(Cfg *Func);
InstX86Base(Cfg *Func, InstKindX86 Kind, SizeT Maxsrcs, Variable *Dest)
: InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
- static bool isClassof(const Inst *Inst, InstKindX86 MyKind) {
- return Inst->getKind() == static_cast<InstKind>(MyKind);
+ static bool isClassof(const Inst *Instr, InstKindX86 MyKind) {
+ return Instr->getKind() == static_cast<InstKind>(MyKind);
}
// Most instructions that operate on vector arguments require vector memory
// operands to be fully aligned (16-byte alignment for PNaCl vector types).
return llvm::cast<Variable>(this->getSrc(2));
}
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::FakeRMW);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::FakeRMW);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::GetIP);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::GetIP);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Br);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Br);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Jmp);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Jmp);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Call);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Call);
}
private:
const Operand *Src,
const XmmEmitterMovOps Emitter);
- static void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
+ static void emitVariableBlendInst(const char *Opcode, const Inst *Instr,
const Cfg *Func);
- static void emitIASVariableBlendInst(const Inst *Inst, const Cfg *Func,
+ static void emitIASVariableBlendInst(const Inst *Instr, const Cfg *Func,
const XmmEmitterRegOp &Emitter);
static void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var,
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getSrc(0)->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << Opcode << "." << this->getSrc(0)->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
Str << ", ";
this->dumpSources(Func);
}
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::K);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::K);
}
protected:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Mul);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Mul);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Shld);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Shld);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Shrd);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Shrd);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Cmov);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Cmov);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Cmpps);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Cmpps);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Cmpxchg);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Cmpxchg);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Cmpxchg8b);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Cmpxchg8b);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Cvt);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Cvt);
}
bool isTruncating() const { return Variant == Tss2si || Variant == Tps2dq; }
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Icmp);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Icmp);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Ucomiss);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Ucomiss);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::UD2);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::UD2);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Test);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Test);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Mfence);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Mfence);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Store);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Store);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::StoreP);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::StoreP);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::StoreQ);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::StoreQ);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Nop);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Nop);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Fld);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Fld);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Fstp);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Fstp);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Pop);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Pop);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Push);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Push);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Ret);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Ret);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Setcc);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Setcc);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Xadd);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Xadd);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::Xchg);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::Xchg);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::IacaStart);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::IacaStart);
}
private:
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
- static bool classof(const Inst *Inst) {
- return InstX86Base::isClassof(Inst, InstX86Base::IacaEnd);
+ static bool classof(const Inst *Instr) {
+ return InstX86Base::isClassof(Instr, InstX86Base::IacaEnd);
}
private:
// pblendvb and blendvps take xmm0 as a final implicit argument.
template <typename TraitsType>
void InstImpl<TraitsType>::emitVariableBlendInst(const char *Opcode,
- const Inst *Inst,
+ const Inst *Instr,
const Cfg *Func) {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- assert(Inst->getSrcSize() == 3);
- assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() ==
+ assert(Instr->getSrcSize() == 3);
+ assert(llvm::cast<Variable>(Instr->getSrc(2))->getRegNum() ==
RegisterSet::Reg_xmm0);
Str << "\t" << Opcode << "\t";
- Inst->getSrc(1)->emit(Func);
+ Instr->getSrc(1)->emit(Func);
Str << ", ";
- Inst->getDest()->emit(Func);
+ Instr->getDest()->emit(Func);
}
template <typename TraitsType>
void InstImpl<TraitsType>::emitIASVariableBlendInst(
- const Inst *Inst, const Cfg *Func, const XmmEmitterRegOp &Emitter) {
- assert(Inst->getSrcSize() == 3);
- assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() ==
+ const Inst *Instr, const Cfg *Func, const XmmEmitterRegOp &Emitter) {
+ assert(Instr->getSrcSize() == 3);
+ assert(llvm::cast<Variable>(Instr->getSrc(2))->getRegNum() ==
RegisterSet::Reg_xmm0);
- const Variable *Dest = Inst->getDest();
- const Operand *Src = Inst->getSrc(1);
+ const Variable *Dest = Instr->getDest();
+ const Operand *Src = Instr->getSrc(1);
emitIASRegOpTyXMM(Func, Dest->getType(), Dest, Src, Emitter);
}
CfgVector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel);
DefUseErrorList DefsWithoutUses, UsesBeforeDefs;
for (CfgNode *Node : Func->getNodes()) {
- for (Inst &Inst : Node->getInsts()) {
- if (Inst.isDeleted())
+ for (Inst &Instr : Node->getInsts()) {
+ if (Instr.isDeleted())
continue;
- FOREACH_VAR_IN_INST(Var, Inst) {
+ FOREACH_VAR_IN_INST(Var, Instr) {
if (Var->isRematerializable())
continue;
if (Var->getIgnoreLiveness())
continue;
if (Var->hasReg() || Var->mustHaveReg()) {
SizeT VarNum = Var->getIndex();
- LREnd[VarNum] = Inst.getNumber();
+ LREnd[VarNum] = Instr.getNumber();
if (!Var->getIsArg() && LRBegin[VarNum] == Inst::NumberSentinel)
UsesBeforeDefs.push_back(VarNum);
}
}
- if (const Variable *Var = Inst.getDest()) {
+ if (const Variable *Var = Instr.getDest()) {
if (!Var->isRematerializable() && !Var->getIgnoreLiveness() &&
(Var->hasReg() || Var->mustHaveReg())) {
if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
- LRBegin[Var->getIndex()] = Inst.getNumber();
+ LRBegin[Var->getIndex()] = Instr.getNumber();
++NumVars;
}
}
namespace Ice {
CaseClusterArray CaseCluster::clusterizeSwitch(Cfg *Func,
- const InstSwitch *Inst) {
+ const InstSwitch *Instr) {
CaseClusterArray CaseClusters;
// Load the cases
- SizeT NumCases = Inst->getNumCases();
+ SizeT NumCases = Instr->getNumCases();
CaseClusters.reserve(NumCases);
for (SizeT I = 0; I < NumCases; ++I)
- CaseClusters.emplace_back(Inst->getValue(I), Inst->getLabel(I));
+ CaseClusters.emplace_back(Instr->getValue(I), Instr->getLabel(I));
// Sort the cases
std::sort(CaseClusters.begin(), CaseClusters.end(),
// Replace everything with a jump table
InstJumpTable *JumpTable =
- InstJumpTable::create(Func, TotalRange, Inst->getLabelDefault());
+ InstJumpTable::create(Func, TotalRange, Instr->getLabelDefault());
for (const CaseCluster &Case : CaseClusters) {
// Case.High could be UINT64_MAX which makes the loop awkward. Unwrap the
// last iteration to avoid wrap around problems.
/// Discover cases which can be clustered together and return the clusters
/// ordered by case value.
- static CaseClusterArray clusterizeSwitch(Cfg *Func, const InstSwitch *Inst);
+ static CaseClusterArray clusterizeSwitch(Cfg *Func, const InstSwitch *Instr);
private:
CaseClusterKind Kind;
availabilityReset();
}
-void LoweringContext::insert(Inst *Inst) {
- getNode()->getInsts().insert(Next, Inst);
- LastInserted = Inst;
+void LoweringContext::insert(Inst *Instr) {
+ getNode()->getInsts().insert(Next, Instr);
+ LastInserted = Instr;
}
void LoweringContext::skipDeleted(InstList::iterator &I) const {
// should delete any additional instructions it consumes.
void TargetLowering::lower() {
assert(!Context.atEnd());
- Inst *Inst = Context.getCur();
- Inst->deleteIfDead();
- if (!Inst->isDeleted() && !llvm::isa<InstFakeDef>(Inst) &&
- !llvm::isa<InstFakeUse>(Inst)) {
+ Inst *Instr = Context.getCur();
+ Instr->deleteIfDead();
+ if (!Instr->isDeleted() && !llvm::isa<InstFakeDef>(Instr) &&
+ !llvm::isa<InstFakeUse>(Instr)) {
// Mark the current instruction as deleted before lowering, otherwise the
// Dest variable will likely get marked as non-SSA. See
// Variable::setDefinition(). However, just pass-through FakeDef and
// FakeUse instructions that might have been inserted prior to lowering.
- Inst->setDeleted();
- switch (Inst->getKind()) {
+ Instr->setDeleted();
+ switch (Instr->getKind()) {
case Inst::Alloca:
- lowerAlloca(llvm::cast<InstAlloca>(Inst));
+ lowerAlloca(llvm::cast<InstAlloca>(Instr));
break;
case Inst::Arithmetic:
- lowerArithmetic(llvm::cast<InstArithmetic>(Inst));
+ lowerArithmetic(llvm::cast<InstArithmetic>(Instr));
break;
case Inst::Assign:
- lowerAssign(llvm::cast<InstAssign>(Inst));
+ lowerAssign(llvm::cast<InstAssign>(Instr));
break;
case Inst::Br:
- lowerBr(llvm::cast<InstBr>(Inst));
+ lowerBr(llvm::cast<InstBr>(Instr));
break;
case Inst::Call:
- lowerCall(llvm::cast<InstCall>(Inst));
+ lowerCall(llvm::cast<InstCall>(Instr));
break;
case Inst::Cast:
- lowerCast(llvm::cast<InstCast>(Inst));
+ lowerCast(llvm::cast<InstCast>(Instr));
break;
case Inst::ExtractElement:
- lowerExtractElement(llvm::cast<InstExtractElement>(Inst));
+ lowerExtractElement(llvm::cast<InstExtractElement>(Instr));
break;
case Inst::Fcmp:
- lowerFcmp(llvm::cast<InstFcmp>(Inst));
+ lowerFcmp(llvm::cast<InstFcmp>(Instr));
break;
case Inst::Icmp:
- lowerIcmp(llvm::cast<InstIcmp>(Inst));
+ lowerIcmp(llvm::cast<InstIcmp>(Instr));
break;
case Inst::InsertElement:
- lowerInsertElement(llvm::cast<InstInsertElement>(Inst));
+ lowerInsertElement(llvm::cast<InstInsertElement>(Instr));
break;
case Inst::IntrinsicCall: {
- auto *Call = llvm::cast<InstIntrinsicCall>(Inst);
+ auto *Call = llvm::cast<InstIntrinsicCall>(Instr);
if (Call->getIntrinsicInfo().ReturnsTwice)
setCallsReturnsTwice(true);
lowerIntrinsicCall(Call);
break;
}
case Inst::Load:
- lowerLoad(llvm::cast<InstLoad>(Inst));
+ lowerLoad(llvm::cast<InstLoad>(Instr));
break;
case Inst::Phi:
- lowerPhi(llvm::cast<InstPhi>(Inst));
+ lowerPhi(llvm::cast<InstPhi>(Instr));
break;
case Inst::Ret:
- lowerRet(llvm::cast<InstRet>(Inst));
+ lowerRet(llvm::cast<InstRet>(Instr));
break;
case Inst::Select:
- lowerSelect(llvm::cast<InstSelect>(Inst));
+ lowerSelect(llvm::cast<InstSelect>(Instr));
break;
case Inst::Store:
- lowerStore(llvm::cast<InstStore>(Inst));
+ lowerStore(llvm::cast<InstStore>(Instr));
break;
case Inst::Switch:
- lowerSwitch(llvm::cast<InstSwitch>(Inst));
+ lowerSwitch(llvm::cast<InstSwitch>(Instr));
break;
case Inst::Unreachable:
- lowerUnreachable(llvm::cast<InstUnreachable>(Inst));
+ lowerUnreachable(llvm::cast<InstUnreachable>(Instr));
break;
default:
- lowerOther(Inst);
+ lowerOther(Instr);
break;
}
// Find (non-SSA) instructions where the Dest variable appears in some source
// operand, and set the IsDestRedefined flag to keep liveness analysis
// consistent.
- for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) {
- if (Inst->isDeleted())
+ for (auto Instr = Context.getCur(), E = Context.getNext(); Instr != E;
+ ++Instr) {
+ if (Instr->isDeleted())
continue;
- Variable *Dest = Inst->getDest();
+ Variable *Dest = Instr->getDest();
if (Dest == nullptr)
continue;
- FOREACH_VAR_IN_INST(Var, *Inst) {
+ FOREACH_VAR_IN_INST(Var, *Instr) {
if (Var == Dest) {
- Inst->setDestRedefined();
+ Instr->setDestRedefined();
break;
}
}
const VariablesMetadata *VMetadata = Func->getVMetadata();
llvm::BitVector IsVarReferenced(Func->getNumVariables());
for (CfgNode *Node : Func->getNodes()) {
- for (Inst &Inst : Node->getInsts()) {
- if (Inst.isDeleted())
+ for (Inst &Instr : Node->getInsts()) {
+ if (Instr.isDeleted())
continue;
- if (const Variable *Var = Inst.getDest())
+ if (const Variable *Var = Instr.getDest())
IsVarReferenced[Var->getIndex()] = true;
- FOREACH_VAR_IN_INST(Var, Inst) {
+ FOREACH_VAR_IN_INST(Var, Instr) {
IsVarReferenced[Var->getIndex()] = true;
}
}
InstList::iterator getCur() const { return Cur; }
InstList::iterator getNext() const { return Next; }
InstList::iterator getEnd() const { return End; }
- void insert(Inst *Inst);
+ void insert(Inst *Instr);
template <typename Inst, typename... Args> Inst *insert(Args &&... A) {
auto *New = Inst::create(Node->getCfg(), std::forward<Args>(A)...);
insert(New);
size_t TypeToRegisterSetSize,
std::function<IceString(int32_t)> getRegName,
std::function<IceString(RegClass)> getRegClassName);
- virtual void lowerAlloca(const InstAlloca *Inst) = 0;
- virtual void lowerArithmetic(const InstArithmetic *Inst) = 0;
- virtual void lowerAssign(const InstAssign *Inst) = 0;
- virtual void lowerBr(const InstBr *Inst) = 0;
- virtual void lowerCall(const InstCall *Inst) = 0;
- virtual void lowerCast(const InstCast *Inst) = 0;
- virtual void lowerFcmp(const InstFcmp *Inst) = 0;
- virtual void lowerExtractElement(const InstExtractElement *Inst) = 0;
- virtual void lowerIcmp(const InstIcmp *Inst) = 0;
- virtual void lowerInsertElement(const InstInsertElement *Inst) = 0;
- virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst) = 0;
- virtual void lowerLoad(const InstLoad *Inst) = 0;
- virtual void lowerPhi(const InstPhi *Inst) = 0;
- virtual void lowerRet(const InstRet *Inst) = 0;
- virtual void lowerSelect(const InstSelect *Inst) = 0;
- virtual void lowerStore(const InstStore *Inst) = 0;
- virtual void lowerSwitch(const InstSwitch *Inst) = 0;
- virtual void lowerUnreachable(const InstUnreachable *Inst) = 0;
+ virtual void lowerAlloca(const InstAlloca *Instr) = 0;
+ virtual void lowerArithmetic(const InstArithmetic *Instr) = 0;
+ virtual void lowerAssign(const InstAssign *Instr) = 0;
+ virtual void lowerBr(const InstBr *Instr) = 0;
+ virtual void lowerCall(const InstCall *Instr) = 0;
+ virtual void lowerCast(const InstCast *Instr) = 0;
+ virtual void lowerFcmp(const InstFcmp *Instr) = 0;
+ virtual void lowerExtractElement(const InstExtractElement *Instr) = 0;
+ virtual void lowerIcmp(const InstIcmp *Instr) = 0;
+ virtual void lowerInsertElement(const InstInsertElement *Instr) = 0;
+ virtual void lowerIntrinsicCall(const InstIntrinsicCall *Instr) = 0;
+ virtual void lowerLoad(const InstLoad *Instr) = 0;
+ virtual void lowerPhi(const InstPhi *Instr) = 0;
+ virtual void lowerRet(const InstRet *Instr) = 0;
+ virtual void lowerSelect(const InstSelect *Instr) = 0;
+ virtual void lowerStore(const InstStore *Instr) = 0;
+ virtual void lowerSwitch(const InstSwitch *Instr) = 0;
+ virtual void lowerUnreachable(const InstUnreachable *Instr) = 0;
virtual void lowerOther(const Inst *Instr);
virtual void genTargetHelperCallFor(Inst *Instr) = 0;
return Registers;
}
-void TargetARM32::lowerAlloca(const InstAlloca *Inst) {
+void TargetARM32::lowerAlloca(const InstAlloca *Instr) {
// Conservatively require the stack to be aligned. Some stack adjustment
// operations implemented below assume that the stack is aligned before the
// alloca. All the alloca code ensures that the stack alignment is preserved
// For default align=0, set it to the real value 1, to avoid any
// bit-manipulation problems below.
- const uint32_t AlignmentParam = std::max(1u, Inst->getAlignInBytes());
+ const uint32_t AlignmentParam = std::max(1u, Instr->getAlignInBytes());
// LLVM enforces power of 2 alignment.
assert(llvm::isPowerOf2_32(AlignmentParam));
std::max(AlignmentParam, ARM32_STACK_ALIGNMENT_BYTES);
const bool OverAligned = Alignment > ARM32_STACK_ALIGNMENT_BYTES;
const bool OptM1 = Ctx->getFlags().getOptLevel() == Opt_m1;
- const bool AllocaWithKnownOffset = Inst->getKnownFrameOffset();
+ const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset();
const bool UseFramePointer =
hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1;
Sandboxer(this).align_sp(Alignment);
}
- Variable *Dest = Inst->getDest();
- Operand *TotalSize = Inst->getSizeInBytes();
+ Variable *Dest = Instr->getDest();
+ Operand *TotalSize = Instr->getSizeInBytes();
if (const auto *ConstantTotalSize =
llvm::dyn_cast<ConstantInteger32>(TotalSize)) {
}
TargetARM32::SafeBoolChain
-TargetARM32::lowerInt1Arithmetic(const InstArithmetic *Inst) {
- Variable *Dest = Inst->getDest();
+TargetARM32::lowerInt1Arithmetic(const InstArithmetic *Instr) {
+ Variable *Dest = Instr->getDest();
assert(Dest->getType() == IceType_i1);
- // So folding didn't work for Inst. Not a problem: We just need to
+ // So folding didn't work for Instr. Not a problem: We just need to
// materialize the Sources, and perform the operation. We create regular
// Variables (and not infinite-weight ones) because this call might recurse a
// lot, and we might end up with tons of infinite weight temporaries.
- assert(Inst->getSrcSize() == 2);
+ assert(Instr->getSrcSize() == 2);
Variable *Src0 = Func->makeVariable(IceType_i1);
- SafeBoolChain Src0Safe = lowerInt1(Src0, Inst->getSrc(0));
+ SafeBoolChain Src0Safe = lowerInt1(Src0, Instr->getSrc(0));
- Operand *Src1 = Inst->getSrc(1);
+ Operand *Src1 = Instr->getSrc(1);
SafeBoolChain Src1Safe = SBC_Yes;
if (!llvm::isa<Constant>(Src1)) {
Variable *T = makeReg(IceType_i1);
Src0 = legalizeToReg(Src0);
Operand *Src1RF = legalize(Src1, Legal_Reg | Legal_Flex);
- switch (Inst->getOp()) {
+ switch (Instr->getOp()) {
default:
// If this Unreachable is ever executed, add the offending operation to
// the list of valid consumers.
}
}
-void TargetARM32::lowerAssign(const InstAssign *Inst) {
- Variable *Dest = Inst->getDest();
+void TargetARM32::lowerAssign(const InstAssign *Instr) {
+ Variable *Dest = Instr->getDest();
if (Dest->isRematerializable()) {
Context.insert<InstFakeDef>(Dest);
return;
}
- Operand *Src0 = Inst->getSrc(0);
+ Operand *Src0 = Instr->getSrc(0);
assert(Dest->getType() == Src0->getType());
if (Dest->getType() == IceType_i64) {
Src0 = legalizeUndef(Src0);
}
} // end of anonymous namespace
-void TargetARM32::lowerCast(const InstCast *Inst) {
- InstCast::OpKind CastKind = Inst->getCastKind();
- Variable *Dest = Inst->getDest();
- Operand *Src0 = legalizeUndef(Inst->getSrc(0));
+void TargetARM32::lowerCast(const InstCast *Instr) {
+ InstCast::OpKind CastKind = Instr->getCastKind();
+ Variable *Dest = Instr->getDest();
+ Operand *Src0 = legalizeUndef(Instr->getSrc(0));
switch (CastKind) {
default:
Func->setError("Cast type not supported");
return;
case InstCast::Sext: {
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
} else if (Dest->getType() == IceType_i64) {
// t1=sxtb src; t2= mov t1 asr #31; dst.lo=t1; dst.hi=t2
Constant *ShiftAmt = Ctx->getConstantInt32(31);
}
case InstCast::Zext: {
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
} else if (Dest->getType() == IceType_i64) {
// t1=uxtb src; dst.lo=t1; dst.hi=0
Operand *_0 =
}
case InstCast::Trunc: {
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
} else {
if (Src0->getType() == IceType_i64)
Src0 = loOperand(Src0);
// fpext: dest.f64 = fptrunc src0.fp32
const bool IsTrunc = CastKind == InstCast::Fptrunc;
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
}
assert(Dest->getType() == (IsTrunc ? IceType_f32 : IceType_f64));
case InstCast::Fptosi:
case InstCast::Fptoui: {
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
}
case InstCast::Sitofp:
case InstCast::Uitofp: {
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
}
const bool SourceIsSigned = CastKind == InstCast::Sitofp;
break;
}
case InstCast::Bitcast: {
- Operand *Src0 = Inst->getSrc(0);
+ Operand *Src0 = Instr->getSrc(0);
if (Dest->getType() == Src0->getType()) {
auto *Assign = InstAssign::create(Func, Dest, Src0);
lowerAssign(Assign);
case IceType_void:
llvm::report_fatal_error("Unexpected bitcast.");
case IceType_i1:
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
case IceType_i8:
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
case IceType_i16:
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
case IceType_i32:
case IceType_f32: {
case IceType_v16i8:
case IceType_v4f32:
case IceType_v4i32: {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
break;
}
}
}
}
-void TargetARM32::lowerExtractElement(const InstExtractElement *Inst) {
- UnimplementedLoweringError(this, Inst);
+void TargetARM32::lowerExtractElement(const InstExtractElement *Instr) {
+ UnimplementedLoweringError(this, Instr);
}
namespace {
return CondWhenTrue(getIcmp32Mapping(Condition));
}
-TargetARM32::CondWhenTrue TargetARM32::lowerIcmpCond(const InstIcmp *Inst) {
- assert(Inst->getSrc(0)->getType() != IceType_i1);
- assert(Inst->getSrc(1)->getType() != IceType_i1);
+TargetARM32::CondWhenTrue TargetARM32::lowerIcmpCond(const InstIcmp *Instr) {
+ assert(Instr->getSrc(0)->getType() != IceType_i1);
+ assert(Instr->getSrc(1)->getType() != IceType_i1);
- Operand *Src0 = legalizeUndef(Inst->getSrc(0));
- Operand *Src1 = legalizeUndef(Inst->getSrc(1));
+ Operand *Src0 = legalizeUndef(Instr->getSrc(0));
+ Operand *Src1 = legalizeUndef(Instr->getSrc(1));
- const InstIcmp::ICond Condition = Inst->getCondition();
+ const InstIcmp::ICond Condition = Instr->getCondition();
// a=icmp cond b, c ==>
// GCC does:
// <u/s>xtb tb, b
}
}
-void TargetARM32::lowerIcmp(const InstIcmp *Inst) {
- Variable *Dest = Inst->getDest();
+void TargetARM32::lowerIcmp(const InstIcmp *Instr) {
+ Variable *Dest = Instr->getDest();
if (isVectorType(Dest->getType())) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
return;
}
Variable *T = makeReg(IceType_i1);
_mov(T, _0);
- CondWhenTrue Cond = lowerIcmpCond(Inst);
+ CondWhenTrue Cond = lowerIcmpCond(Instr);
_mov_redefined(T, _1, Cond.WhenTrue0);
_mov(Dest, T);
return;
}
-void TargetARM32::lowerInsertElement(const InstInsertElement *Inst) {
- UnimplementedLoweringError(this, Inst);
+void TargetARM32::lowerInsertElement(const InstInsertElement *Instr) {
+ UnimplementedLoweringError(this, Instr);
}
namespace {
return Optimized;
}
-bool isAddOrSub(const Inst *Inst, InstArithmetic::OpKind *Kind) {
- if (const auto *Arith = llvm::dyn_cast<InstArithmetic>(Inst)) {
+bool isAddOrSub(const Inst *Instr, InstArithmetic::OpKind *Kind) {
+ if (const auto *Arith = llvm::dyn_cast<InstArithmetic>(Instr)) {
switch (Arith->getOp()) {
default:
return false;
}
}
-void TargetARM32::lowerPhi(const InstPhi * /*Inst*/) {
+void TargetARM32::lowerPhi(const InstPhi * /*Instr*/) {
Func->setError("Phi found in regular instruction list");
}
-void TargetARM32::lowerRet(const InstRet *Inst) {
+void TargetARM32::lowerRet(const InstRet *Instr) {
Variable *Reg = nullptr;
- if (Inst->hasRetValue()) {
- Operand *Src0 = Inst->getRetValue();
+ if (Instr->hasRetValue()) {
+ Operand *Src0 = Instr->getRetValue();
Type Ty = Src0->getType();
if (Ty == IceType_i64) {
Src0 = legalizeUndef(Src0);
Context.insert<InstFakeUse>(SP);
}
-void TargetARM32::lowerSelect(const InstSelect *Inst) {
- Variable *Dest = Inst->getDest();
+void TargetARM32::lowerSelect(const InstSelect *Instr) {
+ Variable *Dest = Instr->getDest();
Type DestTy = Dest->getType();
- Operand *SrcT = Inst->getTrueOperand();
- Operand *SrcF = Inst->getFalseOperand();
- Operand *Condition = Inst->getCondition();
+ Operand *SrcT = Instr->getTrueOperand();
+ Operand *SrcF = Instr->getFalseOperand();
+ Operand *Condition = Instr->getCondition();
if (isVectorType(DestTy)) {
- UnimplementedLoweringError(this, Inst);
+ UnimplementedLoweringError(this, Instr);
return;
}
lowerInt1ForSelect(Dest, Condition, legalizeUndef(SrcT), legalizeUndef(SrcF));
}
-void TargetARM32::lowerStore(const InstStore *Inst) {
- Operand *Value = Inst->getData();
- Operand *Addr = Inst->getAddr();
+void TargetARM32::lowerStore(const InstStore *Instr) {
+ Operand *Value = Instr->getData();
+ Operand *Addr = Instr->getAddr();
OperandARM32Mem *NewAddr = formMemoryOperand(Addr, Value->getType());
Type Ty = NewAddr->getType();
}
}
-void TargetARM32::lowerSwitch(const InstSwitch *Inst) {
+void TargetARM32::lowerSwitch(const InstSwitch *Instr) {
// This implements the most naive possible lowering.
// cmp a,val[0]; jeq label[0]; cmp a,val[1]; jeq label[1]; ... jmp default
- Operand *Src0 = Inst->getComparison();
- SizeT NumCases = Inst->getNumCases();
+ Operand *Src0 = Instr->getComparison();
+ SizeT NumCases = Instr->getNumCases();
if (Src0->getType() == IceType_i64) {
Src0 = legalizeUndef(Src0);
Variable *Src0Lo = legalizeToReg(loOperand(Src0));
Variable *Src0Hi = legalizeToReg(hiOperand(Src0));
for (SizeT I = 0; I < NumCases; ++I) {
- Operand *ValueLo = Ctx->getConstantInt32(Inst->getValue(I));
- Operand *ValueHi = Ctx->getConstantInt32(Inst->getValue(I) >> 32);
+ Operand *ValueLo = Ctx->getConstantInt32(Instr->getValue(I));
+ Operand *ValueHi = Ctx->getConstantInt32(Instr->getValue(I) >> 32);
ValueLo = legalize(ValueLo, Legal_Reg | Legal_Flex);
ValueHi = legalize(ValueHi, Legal_Reg | Legal_Flex);
_cmp(Src0Lo, ValueLo);
_cmp(Src0Hi, ValueHi, CondARM32::EQ);
- _br(Inst->getLabel(I), CondARM32::EQ);
+ _br(Instr->getLabel(I), CondARM32::EQ);
}
- _br(Inst->getLabelDefault());
+ _br(Instr->getLabelDefault());
return;
}
}
for (SizeT I = 0; I < NumCases; ++I) {
- Operand *Value = Ctx->getConstantInt32(Inst->getValue(I) << ShiftAmt);
+ Operand *Value = Ctx->getConstantInt32(Instr->getValue(I) << ShiftAmt);
Value = legalize(Value, Legal_Reg | Legal_Flex);
_cmp(Src0Var, Value);
- _br(Inst->getLabel(I), CondARM32::EQ);
+ _br(Instr->getLabel(I), CondARM32::EQ);
}
- _br(Inst->getLabelDefault());
+ _br(Instr->getLabelDefault());
}
-void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) {
+void TargetARM32::lowerUnreachable(const InstUnreachable * /*Instr*/) {
_trap();
}
SBC_Yes,
};
- void lowerAlloca(const InstAlloca *Inst) override;
- SafeBoolChain lowerInt1Arithmetic(const InstArithmetic *Inst);
+ void lowerAlloca(const InstAlloca *Instr) override;
+ SafeBoolChain lowerInt1Arithmetic(const InstArithmetic *Instr);
void lowerInt64Arithmetic(InstArithmetic::OpKind Op, Variable *Dest,
Operand *Src0, Operand *Src1);
- void lowerArithmetic(const InstArithmetic *Inst) override;
- void lowerAssign(const InstAssign *Inst) override;
- void lowerBr(const InstBr *Inst) override;
- void lowerCall(const InstCall *Inst) override;
- void lowerCast(const InstCast *Inst) override;
- void lowerExtractElement(const InstExtractElement *Inst) override;
+ void lowerArithmetic(const InstArithmetic *Instr) override;
+ void lowerAssign(const InstAssign *Instr) override;
+ void lowerBr(const InstBr *Instr) override;
+ void lowerCall(const InstCall *Instr) override;
+ void lowerCast(const InstCast *Instr) override;
+ void lowerExtractElement(const InstExtractElement *Instr) override;
/// CondWhenTrue is a helper type returned by every method in the lowering
/// that emits code to set the condition codes.
void lowerIcmp(const InstIcmp *Instr) override;
void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
Operand *Val);
- void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
- void lowerInsertElement(const InstInsertElement *Inst) override;
- void lowerLoad(const InstLoad *Inst) override;
- void lowerPhi(const InstPhi *Inst) override;
- void lowerRet(const InstRet *Inst) override;
- void lowerSelect(const InstSelect *Inst) override;
- void lowerStore(const InstStore *Inst) override;
- void lowerSwitch(const InstSwitch *Inst) override;
- void lowerUnreachable(const InstUnreachable *Inst) override;
+ void lowerIntrinsicCall(const InstIntrinsicCall *Instr) override;
+ void lowerInsertElement(const InstInsertElement *Instr) override;
+ void lowerLoad(const InstLoad *Instr) override;
+ void lowerPhi(const InstPhi *Instr) override;
+ void lowerRet(const InstRet *Instr) override;
+ void lowerSelect(const InstSelect *Instr) override;
+ void lowerStore(const InstStore *Instr) override;
+ void lowerSwitch(const InstSwitch *Instr) override;
+ void lowerUnreachable(const InstUnreachable *Instr) override;
void prelowerPhis() override;
uint32_t getCallStackArgumentsSizeBytes(const InstCall *Instr) override;
void genTargetHelperCallFor(Inst *Instr) override;
void postambleCtpop64(const InstCall *Instr);
void preambleDivRem(const InstCall *Instr);
- std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Inst)>
+ std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Instr)>
ARM32HelpersPreamble;
- std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Inst)>
+ std::unordered_map<Operand *, void (TargetARM32::*)(const InstCall *Instr)>
ARM32HelpersPostamble;
class ComputationTracker {
dispatchToConcrete(&Traits::ConcreteTarget::initSandbox);
}
- void lowerAlloca(const InstAlloca *Inst) override;
+ void lowerAlloca(const InstAlloca *Instr) override;
void lowerArguments() override;
- void lowerArithmetic(const InstArithmetic *Inst) override;
- void lowerAssign(const InstAssign *Inst) override;
- void lowerBr(const InstBr *Inst) override;
- void lowerCall(const InstCall *Inst) override;
- void lowerCast(const InstCast *Inst) override;
- void lowerExtractElement(const InstExtractElement *Inst) override;
- void lowerFcmp(const InstFcmp *Inst) override;
- void lowerIcmp(const InstIcmp *Inst) override;
-
- void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
- void lowerInsertElement(const InstInsertElement *Inst) override;
- void lowerLoad(const InstLoad *Inst) override;
- void lowerPhi(const InstPhi *Inst) override;
- void lowerRet(const InstRet *Inst) override;
- void lowerSelect(const InstSelect *Inst) override;
- void lowerStore(const InstStore *Inst) override;
- void lowerSwitch(const InstSwitch *Inst) override;
- void lowerUnreachable(const InstUnreachable *Inst) override;
+ void lowerArithmetic(const InstArithmetic *Instr) override;
+ void lowerAssign(const InstAssign *Instr) override;
+ void lowerBr(const InstBr *Instr) override;
+ void lowerCall(const InstCall *Instr) override;
+ void lowerCast(const InstCast *Instr) override;
+ void lowerExtractElement(const InstExtractElement *Instr) override;
+ void lowerFcmp(const InstFcmp *Instr) override;
+ void lowerIcmp(const InstIcmp *Instr) override;
+
+ void lowerIntrinsicCall(const InstIntrinsicCall *Instr) override;
+ void lowerInsertElement(const InstInsertElement *Instr) override;
+ void lowerLoad(const InstLoad *Instr) override;
+ void lowerPhi(const InstPhi *Instr) override;
+ void lowerRet(const InstRet *Instr) override;
+ void lowerSelect(const InstSelect *Instr) override;
+ void lowerStore(const InstStore *Instr) override;
+ void lowerSwitch(const InstSwitch *Instr) override;
+ void lowerUnreachable(const InstUnreachable *Instr) override;
void lowerOther(const Inst *Instr) override;
void lowerRMW(const InstX86FakeRMW *RMW);
void prelowerPhis() override;
/// Emit the code for instructions with a vector type.
void lowerIcmpVector(const InstIcmp *Icmp);
void lowerFcmpVector(const InstFcmp *Icmp);
- void lowerSelectVector(const InstSelect *Inst);
+ void lowerSelectVector(const InstSelect *Instr);
/// Helpers for select lowering.
void lowerSelectMove(Variable *Dest, BrCond Cond, Operand *SrcT,
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerAlloca(const InstAlloca *Inst) {
+void TargetX86Base<TraitsType>::lowerAlloca(const InstAlloca *Instr) {
// Conservatively require the stack to be aligned. Some stack adjustment
// operations implemented below assume that the stack is aligned before the
// alloca. All the alloca code ensures that the stack alignment is preserved
// For default align=0, set it to the real value 1, to avoid any
// bit-manipulation problems below.
- const uint32_t AlignmentParam = std::max(1u, Inst->getAlignInBytes());
+ const uint32_t AlignmentParam = std::max(1u, Instr->getAlignInBytes());
// LLVM enforces power of 2 alignment.
assert(llvm::isPowerOf2_32(AlignmentParam));
std::max(AlignmentParam, Traits::X86_STACK_ALIGNMENT_BYTES);
const bool OverAligned = Alignment > Traits::X86_STACK_ALIGNMENT_BYTES;
const bool OptM1 = Ctx->getFlags().getOptLevel() == Opt_m1;
- const bool AllocaWithKnownOffset = Inst->getKnownFrameOffset();
+ const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset();
const bool UseFramePointer =
hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1;
_and(esp, Ctx->getConstantInt32(-Alignment));
}
- Variable *Dest = Inst->getDest();
- Operand *TotalSize = legalize(Inst->getSizeInBytes());
+ Variable *Dest = Instr->getDest();
+ Operand *TotalSize = legalize(Instr->getSizeInBytes());
if (const auto *ConstantTotalSize =
llvm::dyn_cast<ConstantInteger32>(TotalSize)) {
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerArithmetic(const InstArithmetic *Inst) {
- Variable *Dest = Inst->getDest();
+void TargetX86Base<TraitsType>::lowerArithmetic(const InstArithmetic *Instr) {
+ Variable *Dest = Instr->getDest();
if (Dest->isRematerializable()) {
Context.insert<InstFakeDef>(Dest);
return;
}
Type Ty = Dest->getType();
- Operand *Src0 = legalize(Inst->getSrc(0));
- Operand *Src1 = legalize(Inst->getSrc(1));
- if (Inst->isCommutative()) {
+ Operand *Src0 = legalize(Instr->getSrc(0));
+ Operand *Src1 = legalize(Instr->getSrc(1));
+ if (Instr->isCommutative()) {
uint32_t SwapCount = 0;
if (!llvm::isa<Variable>(Src0) && llvm::isa<Variable>(Src1)) {
std::swap(Src0, Src1);
}
// Improve two-address code patterns by avoiding a copy to the dest
// register when one of the source operands ends its lifetime here.
- if (!Inst->isLastUse(Src0) && Inst->isLastUse(Src1)) {
+ if (!Instr->isLastUse(Src0) && Instr->isLastUse(Src1)) {
std::swap(Src0, Src1);
++SwapCount;
}
// instructions will fail liveness analysis under -Om1 setting. And,
// actually these arguments do not need to be processed with loOperand()
// and hiOperand() to be used.
- switch (Inst->getOp()) {
+ switch (Instr->getOp()) {
case InstArithmetic::Udiv:
case InstArithmetic::Sdiv:
case InstArithmetic::Urem:
Operand *Src1Lo = loOperand(Src1);
Operand *Src1Hi = hiOperand(Src1);
Variable *T_Lo = nullptr, *T_Hi = nullptr;
- switch (Inst->getOp()) {
+ switch (Instr->getOp()) {
case InstArithmetic::_num:
llvm_unreachable("Unknown arithmetic operator");
break;
case InstArithmetic::Shl:
case InstArithmetic::Lshr:
case InstArithmetic::Ashr:
- lowerShift64(Inst->getOp(), Src0Lo, Src0Hi, Src1Lo, DestLo, DestHi);
+ lowerShift64(Instr->getOp(), Src0Lo, Src0Hi, Src1Lo, DestLo, DestHi);
break;
case InstArithmetic::Fadd:
case InstArithmetic::Fsub:
// https://code.google.com/p/nativeclient/issues/detail?id=3899
if (llvm::isa<X86OperandMem>(Src1))
Src1 = legalizeToReg(Src1);
- switch (Inst->getOp()) {
+ switch (Instr->getOp()) {
case InstArithmetic::_num:
llvm_unreachable("Unknown arithmetic operator");
break;
}
Variable *T_edx = nullptr;
Variable *T = nullptr;
- switch (Inst->getOp()) {
+ switch (Instr->getOp()) {
case InstArithmetic::_num:
llvm_unreachable("Unknown arithmetic operator");
break;
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerAssign(const InstAssign *Inst) {
- Variable *Dest = Inst->getDest();
+void TargetX86Base<TraitsType>::lowerAssign(const InstAssign *Instr) {
+ Variable *Dest = Instr->getDest();
if (Dest->isRematerializable()) {
Context.insert<InstFakeDef>(Dest);
return;
}
- Operand *Src = Inst->getSrc(0);
+ Operand *Src = Instr->getSrc(0);
assert(Dest->getType() == Src->getType());
lowerMove(Dest, Src, false);
}
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerCast(const InstCast *Inst) {
+void TargetX86Base<TraitsType>::lowerCast(const InstCast *Instr) {
// a = cast(b) ==> t=cast(b); a=t; (link t->b, link a->t, no overlap)
- InstCast::OpKind CastKind = Inst->getCastKind();
- Variable *Dest = Inst->getDest();
+ InstCast::OpKind CastKind = Instr->getCastKind();
+ Variable *Dest = Instr->getDest();
Type DestTy = Dest->getType();
switch (CastKind) {
default:
// consider computing the strength-reduced result at translation time, but
// we're unlikely to see something like that in the bitcode that the
// optimizer wouldn't have already taken care of.
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
if (isVectorType(DestTy)) {
if (DestTy == IceType_v16i8) {
// onemask = materialize(1,1,...); dst = (src & onemask) > 0
break;
}
case InstCast::Zext: {
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
if (isVectorType(DestTy)) {
// onemask = materialize(1,1,...); dest = onemask & src
Variable *OneMask = makeVectorOfOnes(DestTy);
case InstCast::Trunc: {
if (isVectorType(DestTy)) {
// onemask = materialize(1,1,...); dst = src & onemask
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
Type Src0Ty = Src0RM->getType();
Variable *OneMask = makeVectorOfOnes(Src0Ty);
Variable *T = makeReg(DestTy);
_movp(Dest, T);
} else if (DestTy == IceType_i1 || DestTy == IceType_i8) {
// Make sure we truncate from and into valid registers.
- Operand *Src0 = legalizeUndef(Inst->getSrc(0));
+ Operand *Src0 = legalizeUndef(Instr->getSrc(0));
if (!Traits::Is64Bit && Src0->getType() == IceType_i64)
Src0 = loOperand(Src0);
Operand *Src0RM = legalize(Src0, Legal_Reg | Legal_Mem);
_and(T, Ctx->getConstantInt1(1));
_mov(Dest, T);
} else {
- Operand *Src0 = legalizeUndef(Inst->getSrc(0));
+ Operand *Src0 = legalizeUndef(Instr->getSrc(0));
if (!Traits::Is64Bit && Src0->getType() == IceType_i64)
Src0 = loOperand(Src0);
Operand *Src0RM = legalize(Src0, Legal_Reg | Legal_Mem);
}
case InstCast::Fptrunc:
case InstCast::Fpext: {
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
// t1 = cvt Src0RM; Dest = t1
Variable *T = makeReg(DestTy);
_cvt(T, Src0RM, Traits::Insts::Cvt::Float2float);
case InstCast::Fptosi:
if (isVectorType(DestTy)) {
assert(DestTy == IceType_v4i32 &&
- Inst->getSrc(0)->getType() == IceType_v4f32);
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Instr->getSrc(0)->getType() == IceType_v4f32);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
if (llvm::isa<X86OperandMem>(Src0RM))
Src0RM = legalizeToReg(Src0RM);
Variable *T = makeReg(DestTy);
} else if (!Traits::Is64Bit && DestTy == IceType_i64) {
llvm::report_fatal_error("Helper call was expected");
} else {
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
// t1.i32 = cvt Src0RM; t2.dest_type = t1; Dest = t2.dest_type
Variable *T_1 = nullptr;
if (Traits::Is64Bit && DestTy == IceType_i64) {
(!Traits::Is64Bit && DestTy == IceType_i32)) {
llvm::report_fatal_error("Helper call was expected");
} else {
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
// t1.i32 = cvt Src0RM; t2.dest_type = t1; Dest = t2.dest_type
assert(DestTy != IceType_i64);
Variable *T_1 = nullptr;
case InstCast::Sitofp:
if (isVectorType(DestTy)) {
assert(DestTy == IceType_v4f32 &&
- Inst->getSrc(0)->getType() == IceType_v4i32);
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Instr->getSrc(0)->getType() == IceType_v4i32);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
if (llvm::isa<X86OperandMem>(Src0RM))
Src0RM = legalizeToReg(Src0RM);
Variable *T = makeReg(DestTy);
_cvt(T, Src0RM, Traits::Insts::Cvt::Dq2ps);
_movp(Dest, T);
- } else if (!Traits::Is64Bit && Inst->getSrc(0)->getType() == IceType_i64) {
+ } else if (!Traits::Is64Bit && Instr->getSrc(0)->getType() == IceType_i64) {
llvm::report_fatal_error("Helper call was expected");
} else {
- Operand *Src0RM = legalize(Inst->getSrc(0), Legal_Reg | Legal_Mem);
+ Operand *Src0RM = legalize(Instr->getSrc(0), Legal_Reg | Legal_Mem);
// Sign-extend the operand.
// t1.i32 = movsx Src0RM; t2 = Cvt t1.i32; Dest = t2
Variable *T_1 = nullptr;
}
break;
case InstCast::Uitofp: {
- Operand *Src0 = Inst->getSrc(0);
+ Operand *Src0 = Instr->getSrc(0);
if (isVectorType(Src0->getType())) {
llvm::report_fatal_error("Helper call was expected");
} else if (Src0->getType() == IceType_i64 ||
break;
}
case InstCast::Bitcast: {
- Operand *Src0 = Inst->getSrc(0);
+ Operand *Src0 = Instr->getSrc(0);
if (DestTy == Src0->getType()) {
auto *Assign = InstAssign::create(Func, Dest, Src0);
lowerAssign(Assign);
template <typename TraitsType>
void TargetX86Base<TraitsType>::lowerExtractElement(
- const InstExtractElement *Inst) {
- Operand *SourceVectNotLegalized = Inst->getSrc(0);
+ const InstExtractElement *Instr) {
+ Operand *SourceVectNotLegalized = Instr->getSrc(0);
ConstantInteger32 *ElementIndex =
- llvm::dyn_cast<ConstantInteger32>(Inst->getSrc(1));
+ llvm::dyn_cast<ConstantInteger32>(Instr->getSrc(1));
// Only constant indices are allowed in PNaCl IR.
assert(ElementIndex);
}
// Copy the element to the destination.
- Variable *Dest = Inst->getDest();
+ Variable *Dest = Instr->getDest();
_mov(Dest, ExtractedElementR);
}
template <typename TraitsType>
void TargetX86Base<TraitsType>::lowerInsertElement(
- const InstInsertElement *Inst) {
- Operand *SourceVectNotLegalized = Inst->getSrc(0);
- Operand *ElementToInsertNotLegalized = Inst->getSrc(1);
+ const InstInsertElement *Instr) {
+ Operand *SourceVectNotLegalized = Instr->getSrc(0);
+ Operand *ElementToInsertNotLegalized = Instr->getSrc(1);
ConstantInteger32 *ElementIndex =
- llvm::dyn_cast<ConstantInteger32>(Inst->getSrc(2));
+ llvm::dyn_cast<ConstantInteger32>(Instr->getSrc(2));
// Only constant indices are allowed in PNaCl IR.
assert(ElementIndex);
unsigned Index = ElementIndex->getValue();
}
_pinsr(T, ElementRM, Ctx->getConstantInt32(Index));
}
- _movp(Inst->getDest(), T);
+ _movp(Instr->getDest(), T);
} else if (Ty == IceType_v4i32 || Ty == IceType_v4f32 || Ty == IceType_v4i1) {
// Use shufps or movss.
Variable *ElementR = nullptr;
Variable *T = makeReg(Ty);
_movp(T, SourceVectRM);
_movss(T, ElementR);
- _movp(Inst->getDest(), T);
+ _movp(Instr->getDest(), T);
return;
}
if (Index == 1) {
_shufps(ElementR, SourceVectRM, Mask1Constant);
_shufps(ElementR, SourceVectRM, Mask2Constant);
- _movp(Inst->getDest(), ElementR);
+ _movp(Instr->getDest(), ElementR);
} else {
Variable *T = makeReg(Ty);
_movp(T, SourceVectRM);
_shufps(ElementR, T, Mask1Constant);
_shufps(T, ElementR, Mask2Constant);
- _movp(Inst->getDest(), T);
+ _movp(Instr->getDest(), T);
}
} else {
assert(Ty == IceType_v16i8 || Ty == IceType_v16i1);
Variable *T = makeReg(Ty);
_movp(T, Slot);
- _movp(Inst->getDest(), T);
+ _movp(Instr->getDest(), T);
}
}
const Cfg *const Func;
const VariablesMetadata *const VMetadata;
- static bool isAdd(const Inst *Inst) {
- if (auto *Arith = llvm::dyn_cast_or_null<const InstArithmetic>(Inst)) {
+ static bool isAdd(const Inst *Instr) {
+ if (auto *Arith = llvm::dyn_cast_or_null<const InstArithmetic>(Instr)) {
return (Arith->getOp() == InstArithmetic::Add);
}
return false;
template <typename TraitsType>
void TargetX86Base<TraitsType>::doAddressOptLoad() {
- Inst *Inst = Context.getCur();
- Operand *Addr = Inst->getSrc(0);
- Variable *Dest = Inst->getDest();
- if (auto *OptAddr = computeAddressOpt(Inst, Dest->getType(), Addr)) {
- Inst->setDeleted();
+ Inst *Instr = Context.getCur();
+ Operand *Addr = Instr->getSrc(0);
+ Variable *Dest = Instr->getDest();
+ if (auto *OptAddr = computeAddressOpt(Instr, Dest->getType(), Addr)) {
+ Instr->setDeleted();
Context.insert<InstLoad>(Dest, OptAddr);
}
}
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerPhi(const InstPhi * /*Inst*/) {
+void TargetX86Base<TraitsType>::lowerPhi(const InstPhi * /*Instr*/) {
Func->setError("Phi found in regular instruction list");
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerRet(const InstRet *Inst) {
+void TargetX86Base<TraitsType>::lowerRet(const InstRet *Instr) {
Variable *Reg = nullptr;
- if (Inst->hasRetValue()) {
- Operand *RetValue = legalize(Inst->getRetValue());
+ if (Instr->hasRetValue()) {
+ Operand *RetValue = legalize(Instr->getRetValue());
const Type ReturnType = RetValue->getType();
assert(isVectorType(ReturnType) || isScalarFloatingType(ReturnType) ||
(ReturnType == IceType_i32) || (ReturnType == IceType_i64));
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerSelectVector(const InstSelect *Inst) {
- Variable *Dest = Inst->getDest();
+void TargetX86Base<TraitsType>::lowerSelectVector(const InstSelect *Instr) {
+ Variable *Dest = Instr->getDest();
Type DestTy = Dest->getType();
- Operand *SrcT = Inst->getTrueOperand();
- Operand *SrcF = Inst->getFalseOperand();
- Operand *Condition = Inst->getCondition();
+ Operand *SrcT = Instr->getTrueOperand();
+ Operand *SrcF = Instr->getFalseOperand();
+ Operand *Condition = Instr->getCondition();
if (!isVectorType(DestTy))
llvm::report_fatal_error("Expected a vector select");
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerStore(const InstStore *Inst) {
- Operand *Value = Inst->getData();
- Operand *Addr = Inst->getAddr();
+void TargetX86Base<TraitsType>::lowerStore(const InstStore *Instr) {
+ Operand *Value = Instr->getData();
+ Operand *Addr = Instr->getAddr();
X86OperandMem *NewAddr = formMemoryOperand(Addr, Value->getType());
doMockBoundsCheck(NewAddr);
Type Ty = NewAddr->getType();
template <typename TraitsType>
void TargetX86Base<TraitsType>::doAddressOptStore() {
- auto *Inst = llvm::cast<InstStore>(Context.getCur());
- Operand *Addr = Inst->getAddr();
- Operand *Data = Inst->getData();
- if (auto *OptAddr = computeAddressOpt(Inst, Data->getType(), Addr)) {
- Inst->setDeleted();
+ auto *Instr = llvm::cast<InstStore>(Context.getCur());
+ Operand *Addr = Instr->getAddr();
+ Operand *Data = Instr->getData();
+ if (auto *OptAddr = computeAddressOpt(Instr, Data->getType(), Addr)) {
+ Instr->setDeleted();
auto *NewStore = Context.insert<InstStore>(Data, OptAddr);
- if (Inst->getDest())
- NewStore->setRmwBeacon(Inst->getRmwBeacon());
+ if (Instr->getDest())
+ NewStore->setRmwBeacon(Instr->getRmwBeacon());
}
}
}
template <typename TraitsType>
-void TargetX86Base<TraitsType>::lowerSwitch(const InstSwitch *Inst) {
+void TargetX86Base<TraitsType>::lowerSwitch(const InstSwitch *Instr) {
// Group cases together and navigate through them with a binary search
- CaseClusterArray CaseClusters = CaseCluster::clusterizeSwitch(Func, Inst);
- Operand *Src0 = Inst->getComparison();
- CfgNode *DefaultTarget = Inst->getLabelDefault();
+ CaseClusterArray CaseClusters = CaseCluster::clusterizeSwitch(Func, Instr);
+ Operand *Src0 = Instr->getComparison();
+ CfgNode *DefaultTarget = Instr->getLabelDefault();
assert(CaseClusters.size() != 0); // Should always be at least one
if (CaseClusters.back().getHigh() > UINT32_MAX) {
// TODO(ascull): handle 64-bit case properly (currently naive version)
// This might be handled by a higher level lowering of switches.
- SizeT NumCases = Inst->getNumCases();
+ SizeT NumCases = Instr->getNumCases();
if (NumCases >= 2) {
Src0Lo = legalizeToReg(Src0Lo);
Src0Hi = legalizeToReg(Src0Hi);
Src0Hi = legalize(Src0Hi, Legal_Reg | Legal_Mem);
}
for (SizeT I = 0; I < NumCases; ++I) {
- Constant *ValueLo = Ctx->getConstantInt32(Inst->getValue(I));
- Constant *ValueHi = Ctx->getConstantInt32(Inst->getValue(I) >> 32);
+ Constant *ValueLo = Ctx->getConstantInt32(Instr->getValue(I));
+ Constant *ValueHi = Ctx->getConstantInt32(Instr->getValue(I) >> 32);
InstX86Label *Label = InstX86Label::create(Func, this);
_cmp(Src0Lo, ValueLo);
_br(Traits::Cond::Br_ne, Label);
_cmp(Src0Hi, ValueHi);
- _br(Traits::Cond::Br_e, Inst->getLabel(I));
+ _br(Traits::Cond::Br_e, Instr->getLabel(I));
Context.insert(Label);
}
- _br(Inst->getLabelDefault());
+ _br(Instr->getLabelDefault());
return;
} else {
// All the values are 32-bit so just check the operand is too and then
template <typename TraitsType>
void TargetX86Base<TraitsType>::lowerUnreachable(
- const InstUnreachable * /*Inst*/) {
+ const InstUnreachable * /*Instr*/) {
_ud2();
// Add a fake use of esp to make sure esp adjustments after the unreachable
// do not get dead-code eliminated.
Ice::Variable *Dest = (ReturnType == Ice::IceType_void)
? nullptr
: getNextInstVar(ReturnType);
- std::unique_ptr<Ice::InstCall> Inst;
+ std::unique_ptr<Ice::InstCall> Instr;
if (IntrinsicInfo) {
- Inst.reset(Ice::InstIntrinsicCall::create(Func.get(), Params.size(), Dest,
- Callee, IntrinsicInfo->Info));
+ Instr.reset(Ice::InstIntrinsicCall::create(
+ Func.get(), Params.size(), Dest, Callee, IntrinsicInfo->Info));
} else {
- Inst.reset(Ice::InstCall::create(Func.get(), Params.size(), Dest, Callee,
- IsTailCall));
+ Instr.reset(Ice::InstCall::create(Func.get(), Params.size(), Dest, Callee,
+ IsTailCall));
}
for (Ice::Operand *Param : Params)
- Inst->addArg(Param);
- CurrentNode->appendInst(Inst.release());
+ Instr->addArg(Param);
+ CurrentNode->appendInst(Instr.release());
return;
}
case naclbitc::FUNC_CODE_INST_FORWARDTYPEREF: {