Chromium Code Reviews| Index: src/IceTargetLowering.cpp |
| diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp |
| index 468883b02f53fc24c388c807ecc169d700e0229e..8c71f4fd67737eb5e6ff2a1d74a187acd4667c5d 100644 |
| --- a/src/IceTargetLowering.cpp |
| +++ b/src/IceTargetLowering.cpp |
| @@ -17,6 +17,7 @@ |
| //===----------------------------------------------------------------------===// |
| #include "IceTargetLowering.h" |
| +#include "IceTargetLowering.def" |
| #include "IceBitVector.h" |
| #include "IceCfg.h" // setError() |
| @@ -259,6 +260,20 @@ TargetLowering::createLowering(TargetArch Target, Cfg *Func) { |
| void TargetLowering::staticInit(GlobalContext *Ctx) { |
| const TargetArch Target = Ctx->getFlags().getTargetArch(); |
| + // Define zero constants used in translation. |
| + { |
| +#define X(Ty) \ |
|
John
2016/03/09 23:26:56
This looks dangerous in the context of the browser
Karl
2016/03/16 22:50:52
Done.
|
| + ConstZeroForType[IceType_##Ty] = Ctx->getConstantZero(IceType_##Ty); |
|
John
2016/03/09 23:26:56
It would be better if this used ICETYPE_TABLE... Y
Karl
2016/03/16 22:50:52
Since I moved the caching within method getConstan
|
| + CONSTANT_ZERO_BY_TYPE_TABLE |
| +#undef X |
| + } |
| + // Define runtime helper functions. |
|
Karl
2016/03/16 22:50:52
Moved initialization of helper function names to g
|
| + { |
| +#define X(Tag, Name) \ |
| + RuntimeHelperFunc[H_##Tag] = Ctx->getConstantExternSym(Name); |
| + RUNTIME_HELPER_FUNCTIONS_TABLE |
| +#undef X |
| + } |
| // Call the specified target's static initializer. |
| switch (Target) { |
| default: |
| @@ -289,6 +304,18 @@ TargetLowering::determineSandboxTypeFromFlags(const ClFlags &Flags) { |
| return TargetLowering::ST_None; |
| } |
| +Constant *TargetLowering::ConstZeroForType[IceType_NUM] = { |
|
Karl
2016/03/16 22:50:52
Removed these initializations and moved to the con
|
| +#define X(tag, sizeLog2, align, elts, elty, str, rcstr) nullptr, |
| + ICETYPE_TABLE |
| +#undef X |
| +}; |
| + |
| +Constant *TargetLowering::RuntimeHelperFunc[H_Num] = { |
| +#define X(Tag, Name) nullptr, |
| + RUNTIME_HELPER_FUNCTIONS_TABLE |
| +#undef X |
| +}; |
| + |
| TargetLowering::TargetLowering(Cfg *Func) |
| : Func(Func), Ctx(Func->getContext()), |
| SandboxingType(determineSandboxTypeFromFlags(Ctx->getFlags())) {} |
| @@ -694,10 +721,10 @@ void TargetLowering::assignVarStackSlots(VarList &SortedSpilledVariables, |
| } |
| } |
| -InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, |
| - SizeT MaxSrcs) { |
| +InstCall *TargetLowering::makeHelperCall(RuntimeHelperFuncKind Target, |
| + Variable *Dest, SizeT MaxSrcs) { |
| constexpr bool HasTailCall = false; |
| - Constant *CallTarget = Ctx->getConstantExternSym(Name); |
| + Operand *CallTarget = getRuntimeHelperFunc(Target); |
| InstCall *Call = |
| InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); |
| return Call; |