Commit 04bca5a5 by Reed Kotler Committed by Jim Stichnoth

Following the newer convention enhances readability and in addition this is a…

Following the newer convention enhances readability and in addition this is a prelude to some macro changes in unimplemented I would like to make in order to simplify that code. BUG= R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1667553002 . Patch from Reed Kotler <rkotlerimgtec@gmail.com>.
parent 341158aa
...@@ -271,8 +271,8 @@ void TargetMIPS32::translateOm1() { ...@@ -271,8 +271,8 @@ void TargetMIPS32::translateOm1() {
} }
} }
bool TargetMIPS32::doBranchOpt(Inst *I, const CfgNode *NextNode) { bool TargetMIPS32::doBranchOpt(Inst *Instr, const CfgNode *NextNode) {
(void)I; (void)Instr;
(void)NextNode; (void)NextNode;
UnimplementedError(Func->getContext()->getFlags()); UnimplementedError(Func->getContext()->getFlags());
return false; return false;
...@@ -560,7 +560,7 @@ llvm::SmallBitVector TargetMIPS32::getRegisterSet(RegSetMask Include, ...@@ -560,7 +560,7 @@ llvm::SmallBitVector TargetMIPS32::getRegisterSet(RegSetMask Include,
return Registers; return Registers;
} }
void TargetMIPS32::lowerAlloca(const InstAlloca *Inst) { void TargetMIPS32::lowerAlloca(const InstAlloca *Instr) {
UsesFramePointer = true; UsesFramePointer = true;
// Conservatively require the stack to be aligned. Some stack adjustment // Conservatively require the stack to be aligned. Some stack adjustment
// operations implemented below assume that the stack is aligned before the // operations implemented below assume that the stack is aligned before the
...@@ -568,13 +568,13 @@ void TargetMIPS32::lowerAlloca(const InstAlloca *Inst) { ...@@ -568,13 +568,13 @@ void TargetMIPS32::lowerAlloca(const InstAlloca *Inst) {
// after the alloca. The stack alignment restriction can be relaxed in some // after the alloca. The stack alignment restriction can be relaxed in some
// cases. // cases.
NeedsStackAlignment = true; NeedsStackAlignment = true;
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerInt64Arithmetic(const InstArithmetic *Inst, void TargetMIPS32::lowerInt64Arithmetic(const InstArithmetic *Instr,
Variable *Dest, Operand *Src0, Variable *Dest, Operand *Src0,
Operand *Src1) { Operand *Src1) {
InstArithmetic::OpKind Op = Inst->getOp(); InstArithmetic::OpKind Op = Instr->getOp();
switch (Op) { switch (Op) {
case InstArithmetic::Add: case InstArithmetic::Add:
case InstArithmetic::And: case InstArithmetic::And:
...@@ -583,7 +583,7 @@ void TargetMIPS32::lowerInt64Arithmetic(const InstArithmetic *Inst, ...@@ -583,7 +583,7 @@ void TargetMIPS32::lowerInt64Arithmetic(const InstArithmetic *Inst,
case InstArithmetic::Xor: case InstArithmetic::Xor:
break; break;
default: default:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
return; return;
} }
auto *DestLo = llvm::cast<Variable>(loOperand(Dest)); auto *DestLo = llvm::cast<Variable>(loOperand(Dest));
...@@ -651,28 +651,28 @@ void TargetMIPS32::lowerInt64Arithmetic(const InstArithmetic *Inst, ...@@ -651,28 +651,28 @@ void TargetMIPS32::lowerInt64Arithmetic(const InstArithmetic *Inst,
return; return;
} }
default: default:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
return; return;
} }
} }
void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { void TargetMIPS32::lowerArithmetic(const InstArithmetic *Instr) {
Variable *Dest = Inst->getDest(); Variable *Dest = Instr->getDest();
// We need to signal all the UnimplementedLoweringError errors before any // We need to signal all the UnimplementedLoweringError errors before any
// legalization into new variables, otherwise Om1 register allocation may fail // legalization into new variables, otherwise Om1 register allocation may fail
// when it sees variables that are defined but not used. // when it sees variables that are defined but not used.
Type DestTy = Dest->getType(); Type DestTy = Dest->getType();
Operand *Src0 = legalizeUndef(Inst->getSrc(0)); Operand *Src0 = legalizeUndef(Instr->getSrc(0));
Operand *Src1 = legalizeUndef(Inst->getSrc(1)); Operand *Src1 = legalizeUndef(Instr->getSrc(1));
if (DestTy == IceType_i64) { if (DestTy == IceType_i64) {
lowerInt64Arithmetic(Inst, Inst->getDest(), Src0, Src1); lowerInt64Arithmetic(Instr, Instr->getDest(), Src0, Src1);
return; return;
} }
if (isVectorType(Dest->getType())) { if (isVectorType(Dest->getType())) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
return; return;
} }
switch (Inst->getOp()) { switch (Instr->getOp()) {
default: default:
break; break;
case InstArithmetic::Shl: case InstArithmetic::Shl:
...@@ -687,7 +687,7 @@ void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { ...@@ -687,7 +687,7 @@ void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) {
case InstArithmetic::Fmul: case InstArithmetic::Fmul:
case InstArithmetic::Fdiv: case InstArithmetic::Fdiv:
case InstArithmetic::Frem: case InstArithmetic::Frem:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
return; return;
} }
...@@ -697,7 +697,7 @@ void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { ...@@ -697,7 +697,7 @@ void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) {
Variable *Src0R = legalizeToReg(Src0); Variable *Src0R = legalizeToReg(Src0);
Variable *Src1R = legalizeToReg(Src1); Variable *Src1R = legalizeToReg(Src1);
switch (Inst->getOp()) { switch (Instr->getOp()) {
case InstArithmetic::_num: case InstArithmetic::_num:
break; break;
case InstArithmetic::Add: case InstArithmetic::Add:
...@@ -750,12 +750,12 @@ void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) { ...@@ -750,12 +750,12 @@ void TargetMIPS32::lowerArithmetic(const InstArithmetic *Inst) {
case InstArithmetic::Frem: case InstArithmetic::Frem:
break; break;
} }
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerAssign(const InstAssign *Inst) { void TargetMIPS32::lowerAssign(const InstAssign *Instr) {
Variable *Dest = Inst->getDest(); Variable *Dest = Instr->getDest();
Operand *Src0 = Inst->getSrc(0); Operand *Src0 = Instr->getSrc(0);
assert(Dest->getType() == Src0->getType()); assert(Dest->getType() == Src0->getType());
if (Dest->getType() == IceType_i64) { if (Dest->getType() == IceType_i64) {
Src0 = legalizeUndef(Src0); Src0 = legalizeUndef(Src0);
...@@ -784,15 +784,15 @@ void TargetMIPS32::lowerAssign(const InstAssign *Inst) { ...@@ -784,15 +784,15 @@ void TargetMIPS32::lowerAssign(const InstAssign *Inst) {
SrcR = legalize(Src0, Legal_Reg); SrcR = legalize(Src0, Legal_Reg);
} }
if (isVectorType(Dest->getType())) { if (isVectorType(Dest->getType())) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} else { } else {
_mov(Dest, SrcR); _mov(Dest, SrcR);
} }
} }
} }
void TargetMIPS32::lowerBr(const InstBr *Inst) { void TargetMIPS32::lowerBr(const InstBr *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerCall(const InstCall *Instr) { void TargetMIPS32::lowerCall(const InstCall *Instr) {
...@@ -882,65 +882,65 @@ void TargetMIPS32::lowerCall(const InstCall *Instr) { ...@@ -882,65 +882,65 @@ void TargetMIPS32::lowerCall(const InstCall *Instr) {
} }
} }
void TargetMIPS32::lowerCast(const InstCast *Inst) { void TargetMIPS32::lowerCast(const InstCast *Instr) {
InstCast::OpKind CastKind = Inst->getCastKind(); InstCast::OpKind CastKind = Instr->getCastKind();
switch (CastKind) { switch (CastKind) {
default: default:
Func->setError("Cast type not supported"); Func->setError("Cast type not supported");
return; return;
case InstCast::Sext: { case InstCast::Sext: {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
} }
case InstCast::Zext: { case InstCast::Zext: {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
} }
case InstCast::Trunc: { case InstCast::Trunc: {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
} }
case InstCast::Fptrunc: case InstCast::Fptrunc:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
case InstCast::Fpext: { case InstCast::Fpext: {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
} }
case InstCast::Fptosi: case InstCast::Fptosi:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
case InstCast::Fptoui: case InstCast::Fptoui:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
case InstCast::Sitofp: case InstCast::Sitofp:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
case InstCast::Uitofp: { case InstCast::Uitofp: {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
} }
case InstCast::Bitcast: { case InstCast::Bitcast: {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
break; break;
} }
} }
} }
void TargetMIPS32::lowerExtractElement(const InstExtractElement *Inst) { void TargetMIPS32::lowerExtractElement(const InstExtractElement *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerFcmp(const InstFcmp *Inst) { void TargetMIPS32::lowerFcmp(const InstFcmp *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerIcmp(const InstIcmp *Inst) { void TargetMIPS32::lowerIcmp(const InstIcmp *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerInsertElement(const InstInsertElement *Inst) { void TargetMIPS32::lowerInsertElement(const InstInsertElement *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
...@@ -1069,8 +1069,8 @@ void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { ...@@ -1069,8 +1069,8 @@ void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
return; return;
} }
void TargetMIPS32::lowerLoad(const InstLoad *Inst) { void TargetMIPS32::lowerLoad(const InstLoad *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::doAddressOptLoad() { void TargetMIPS32::doAddressOptLoad() {
...@@ -1085,14 +1085,14 @@ void TargetMIPS32::randomlyInsertNop(float Probability, ...@@ -1085,14 +1085,14 @@ void TargetMIPS32::randomlyInsertNop(float Probability,
} }
} }
void TargetMIPS32::lowerPhi(const InstPhi * /*Inst*/) { void TargetMIPS32::lowerPhi(const InstPhi * /*Instr*/) {
Func->setError("Phi found in regular instruction list"); Func->setError("Phi found in regular instruction list");
} }
void TargetMIPS32::lowerRet(const InstRet *Inst) { void TargetMIPS32::lowerRet(const InstRet *Instr) {
Variable *Reg = nullptr; Variable *Reg = nullptr;
if (Inst->hasRetValue()) { if (Instr->hasRetValue()) {
Operand *Src0 = Inst->getRetValue(); Operand *Src0 = Instr->getRetValue();
switch (Src0->getType()) { switch (Src0->getType()) {
case IceType_i1: case IceType_i1:
case IceType_i8: case IceType_i8:
...@@ -1114,30 +1114,30 @@ void TargetMIPS32::lowerRet(const InstRet *Inst) { ...@@ -1114,30 +1114,30 @@ void TargetMIPS32::lowerRet(const InstRet *Inst) {
} }
default: default:
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
} }
_ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg); _ret(getPhysicalRegister(RegMIPS32::Reg_RA), Reg);
} }
void TargetMIPS32::lowerSelect(const InstSelect *Inst) { void TargetMIPS32::lowerSelect(const InstSelect *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerStore(const InstStore *Inst) { void TargetMIPS32::lowerStore(const InstStore *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::doAddressOptStore() { void TargetMIPS32::doAddressOptStore() {
UnimplementedError(Func->getContext()->getFlags()); UnimplementedError(Func->getContext()->getFlags());
} }
void TargetMIPS32::lowerSwitch(const InstSwitch *Inst) { void TargetMIPS32::lowerSwitch(const InstSwitch *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
void TargetMIPS32::lowerUnreachable(const InstUnreachable *Inst) { void TargetMIPS32::lowerUnreachable(const InstUnreachable *Instr) {
UnimplementedLoweringError(this, Inst); UnimplementedLoweringError(this, Instr);
} }
// Turn an i64 Phi instruction into a pair of i32 Phi instructions, to preserve // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to preserve
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
void translateOm1() override; void translateOm1() override;
void translateO2() override; void translateO2() override;
bool doBranchOpt(Inst *I, const CfgNode *NextNode) override; bool doBranchOpt(Inst *Instr, const CfgNode *NextNode) override;
SizeT getNumRegisters() const override { return RegMIPS32::Reg_NUM; } SizeT getNumRegisters() const override { return RegMIPS32::Reg_NUM; }
Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override;
...@@ -245,26 +245,26 @@ protected: ...@@ -245,26 +245,26 @@ protected:
void postLower() override; void postLower() override;
void lowerAlloca(const InstAlloca *Inst) override; void lowerAlloca(const InstAlloca *Instr) override;
void lowerArithmetic(const InstArithmetic *Inst) override; void lowerArithmetic(const InstArithmetic *Instr) override;
void lowerInt64Arithmetic(const InstArithmetic *Inst, Variable *Dest, void lowerInt64Arithmetic(const InstArithmetic *Instr, Variable *Dest,
Operand *Src0, Operand *Src1); Operand *Src0, Operand *Src1);
void lowerAssign(const InstAssign *Inst) override; void lowerAssign(const InstAssign *Instr) override;
void lowerBr(const InstBr *Inst) override; void lowerBr(const InstBr *Instr) override;
void lowerCall(const InstCall *Inst) override; void lowerCall(const InstCall *Instr) override;
void lowerCast(const InstCast *Inst) override; void lowerCast(const InstCast *Instr) override;
void lowerExtractElement(const InstExtractElement *Inst) override; void lowerExtractElement(const InstExtractElement *Instr) override;
void lowerFcmp(const InstFcmp *Inst) override; void lowerFcmp(const InstFcmp *Instr) override;
void lowerIcmp(const InstIcmp *Inst) override; void lowerIcmp(const InstIcmp *Instr) override;
void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; void lowerIntrinsicCall(const InstIntrinsicCall *Instr) override;
void lowerInsertElement(const InstInsertElement *Inst) override; void lowerInsertElement(const InstInsertElement *Instr) override;
void lowerLoad(const InstLoad *Inst) override; void lowerLoad(const InstLoad *Instr) override;
void lowerPhi(const InstPhi *Inst) override; void lowerPhi(const InstPhi *Instr) override;
void lowerRet(const InstRet *Inst) override; void lowerRet(const InstRet *Instr) override;
void lowerSelect(const InstSelect *Inst) override; void lowerSelect(const InstSelect *Instr) override;
void lowerStore(const InstStore *Inst) override; void lowerStore(const InstStore *Instr) override;
void lowerSwitch(const InstSwitch *Inst) override; void lowerSwitch(const InstSwitch *Instr) override;
void lowerUnreachable(const InstUnreachable *Inst) override; void lowerUnreachable(const InstUnreachable *Instr) override;
void prelowerPhis() override; void prelowerPhis() override;
uint32_t getCallStackArgumentsSizeBytes(const InstCall *Instr) override { uint32_t getCallStackArgumentsSizeBytes(const InstCall *Instr) override {
(void)Instr; (void)Instr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment