Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1775253003: Cache common constants before lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/IceTargetLoweringARM32.cpp ('K') | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 0b5423efa6a43f2fa476cef5cc75360875c784a7..f0fcf8126758805d6f68bbcbe328d227f789f024 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -6209,7 +6209,7 @@ template <typename TraitsType>
void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
uint32_t StackArgumentsSize = 0;
if (auto *Arith = llvm::dyn_cast<InstArithmetic>(Instr)) {
- const char *HelperName = nullptr;
+ RuntimeHelperFuncID HelperID = H_Num;
Variable *Dest = Arith->getDest();
Type DestTy = Dest->getType();
if (!Traits::Is64Bit && DestTy == IceType_i64) {
@@ -6217,16 +6217,16 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
default:
return;
case InstArithmetic::Udiv:
- HelperName = H_udiv_i64;
+ HelperID = H_udiv_i64;
break;
case InstArithmetic::Sdiv:
- HelperName = H_sdiv_i64;
+ HelperID = H_sdiv_i64;
break;
case InstArithmetic::Urem:
- HelperName = H_urem_i64;
+ HelperID = H_urem_i64;
break;
case InstArithmetic::Srem:
- HelperName = H_srem_i64;
+ HelperID = H_srem_i64;
break;
}
} else if (isVectorType(DestTy)) {
@@ -6260,13 +6260,13 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
return;
case InstArithmetic::Frem:
if (isFloat32Asserting32Or64(DestTy))
- HelperName = H_frem_f32;
+ HelperID = H_frem_f32;
else
- HelperName = H_frem_f64;
+ HelperID = H_frem_f64;
}
}
constexpr SizeT MaxSrcs = 2;
- InstCall *Call = makeHelperCall(HelperName, Dest, MaxSrcs);
+ InstCall *Call = makeHelperCall(HelperID, Dest, MaxSrcs);
Call->addArg(Arith->getSrc(0));
Call->addArg(Arith->getSrc(1));
StackArgumentsSize = getCallStackArgumentsSizeBytes(Call);
@@ -6278,15 +6278,15 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
const Type SrcType = Src0->getType();
Variable *Dest = Cast->getDest();
const Type DestTy = Dest->getType();
- const char *HelperName = nullptr;
+ RuntimeHelperFuncID HelperID = H_Num;
Variable *CallDest = Dest;
switch (CastKind) {
default:
return;
case InstCast::Fptosi:
if (!Traits::Is64Bit && DestTy == IceType_i64) {
- HelperName = isFloat32Asserting32Or64(SrcType) ? H_fptosi_f32_i64
- : H_fptosi_f64_i64;
+ HelperID = isFloat32Asserting32Or64(SrcType) ? H_fptosi_f32_i64
+ : H_fptosi_f64_i64;
} else {
return;
}
@@ -6294,18 +6294,18 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
case InstCast::Fptoui:
if (isVectorType(DestTy)) {
assert(DestTy == IceType_v4i32 && SrcType == IceType_v4f32);
- HelperName = H_fptoui_4xi32_f32;
+ HelperID = H_fptoui_4xi32_f32;
} else if (DestTy == IceType_i64 ||
(!Traits::Is64Bit && DestTy == IceType_i32)) {
if (Traits::Is64Bit) {
- HelperName = isFloat32Asserting32Or64(SrcType) ? H_fptoui_f32_i64
- : H_fptoui_f64_i64;
+ HelperID = isFloat32Asserting32Or64(SrcType) ? H_fptoui_f32_i64
+ : H_fptoui_f64_i64;
} else if (isInt32Asserting32Or64(DestTy)) {
- HelperName = isFloat32Asserting32Or64(SrcType) ? H_fptoui_f32_i32
- : H_fptoui_f64_i32;
+ HelperID = isFloat32Asserting32Or64(SrcType) ? H_fptoui_f32_i32
+ : H_fptoui_f64_i32;
} else {
- HelperName = isFloat32Asserting32Or64(SrcType) ? H_fptoui_f32_i64
- : H_fptoui_f64_i64;
+ HelperID = isFloat32Asserting32Or64(SrcType) ? H_fptoui_f32_i64
+ : H_fptoui_f64_i64;
}
} else {
return;
@@ -6313,8 +6313,8 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
break;
case InstCast::Sitofp:
if (!Traits::Is64Bit && SrcType == IceType_i64) {
- HelperName = isFloat32Asserting32Or64(DestTy) ? H_sitofp_i64_f32
- : H_sitofp_i64_f64;
+ HelperID = isFloat32Asserting32Or64(DestTy) ? H_sitofp_i64_f32
+ : H_sitofp_i64_f64;
} else {
return;
}
@@ -6322,15 +6322,15 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
case InstCast::Uitofp:
if (isVectorType(SrcType)) {
assert(DestTy == IceType_v4f32 && SrcType == IceType_v4i32);
- HelperName = H_uitofp_4xi32_4xf32;
+ HelperID = H_uitofp_4xi32_4xf32;
} else if (SrcType == IceType_i64 ||
(!Traits::Is64Bit && SrcType == IceType_i32)) {
if (isInt32Asserting32Or64(SrcType)) {
- HelperName = isFloat32Asserting32Or64(DestTy) ? H_uitofp_i32_f32
- : H_uitofp_i32_f64;
+ HelperID = isFloat32Asserting32Or64(DestTy) ? H_uitofp_i32_f32
+ : H_uitofp_i32_f64;
} else {
- HelperName = isFloat32Asserting32Or64(DestTy) ? H_uitofp_i64_f32
- : H_uitofp_i64_f64;
+ HelperID = isFloat32Asserting32Or64(DestTy) ? H_uitofp_i64_f32
+ : H_uitofp_i64_f64;
}
} else {
return;
@@ -6344,17 +6344,17 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
return;
case IceType_i8:
assert(Src0->getType() == IceType_v8i1);
- HelperName = H_bitcast_8xi1_i8;
+ HelperID = H_bitcast_8xi1_i8;
CallDest = Func->makeVariable(IceType_i32);
break;
case IceType_i16:
assert(Src0->getType() == IceType_v16i1);
- HelperName = H_bitcast_16xi1_i16;
+ HelperID = H_bitcast_16xi1_i16;
CallDest = Func->makeVariable(IceType_i32);
break;
case IceType_v8i1: {
assert(Src0->getType() == IceType_i8);
- HelperName = H_bitcast_i8_8xi1;
+ HelperID = H_bitcast_i8_8xi1;
Variable *Src0AsI32 = Func->makeVariable(stackSlotType());
// Arguments to functions are required to be at least 32 bits wide.
Context.insert<InstCast>(InstCast::Zext, Src0AsI32, Src0);
@@ -6362,7 +6362,7 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
} break;
case IceType_v16i1: {
assert(Src0->getType() == IceType_i16);
- HelperName = H_bitcast_i16_16xi1;
+ HelperID = H_bitcast_i16_16xi1;
Variable *Src0AsI32 = Func->makeVariable(stackSlotType());
// Arguments to functions are required to be at least 32 bits wide.
Context.insert<InstCast>(InstCast::Zext, Src0AsI32, Src0);
@@ -6372,7 +6372,7 @@ void TargetX86Base<TraitsType>::genTargetHelperCallFor(Inst *Instr) {
} break;
}
constexpr SizeT MaxSrcs = 1;
- InstCall *Call = makeHelperCall(HelperName, CallDest, MaxSrcs);
+ InstCall *Call = makeHelperCall(HelperID, CallDest, MaxSrcs);
Call->addArg(Src0);
StackArgumentsSize = getCallStackArgumentsSizeBytes(Call);
Context.insert(Call);
« src/IceTargetLoweringARM32.cpp ('K') | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698