Chromium Code Reviews| Index: src/IceCfg.cpp |
| diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
| index a328d21fccf4202e449fe5a7620fa0dacbb78eab..59723ec277ddd86570058ff0194a0a2f210f5993 100644 |
| --- a/src/IceCfg.cpp |
| +++ b/src/IceCfg.cpp |
| @@ -23,11 +23,17 @@ |
| namespace Ice { |
| +thread_local const Cfg *Cfg::CurrentCfg = NULL; |
|
JF
2014/12/18 06:36:53
nullptr
Jim Stichnoth
2014/12/18 23:39:55
I was planning to make a global NULL-->nullptr pas
|
| + |
| +ArenaAllocator *getCurrentCfgAllocator() { |
| + return Cfg::getCurrentCfgAllocator(); |
| +} |
|
JF
2014/12/18 06:36:53
Why have this method as well as Cfg::getCurrentCfg
Jim Stichnoth
2014/12/18 23:39:55
The CfgLocalAllocator struct uses this function, a
|
| + |
| Cfg::Cfg(GlobalContext *Ctx) |
| : Ctx(Ctx), FunctionName(""), ReturnType(IceType_void), |
| IsInternalLinkage(false), HasError(false), FocusedTiming(false), |
| ErrorMessage(""), Entry(NULL), NextInstNumber(Inst::NumberInitial), |
| - Live(nullptr), |
| + Allocator(new ArenaAllocator()), Live(nullptr), |
| Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)), |
| VMetadata(new VariablesMetadata(this)), |
| TargetAssembler( |
| @@ -37,7 +43,13 @@ Cfg::Cfg(GlobalContext *Ctx) |
| "Attempt to build cfg when IR generation disabled"); |
| } |
| -Cfg::~Cfg() {} |
| +Cfg::~Cfg() { |
| + // TODO(stichnot,kschimpf): Set CurrentCfg=NULL in the dtor for |
|
JF
2014/12/18 06:36:53
nullptr
|
| + // safety. This can't be done currently because the translator |
| + // manages the Cfg by creating a new Cfg (which sets CurrentCfg to |
| + // the new value), then deleting the old Cfg (which would then reset |
| + // CurrentCfg to NULL). |
|
JF
2014/12/18 06:36:53
nullptr
|
| +} |
| void Cfg::setError(const IceString &Message) { |
| HasError = true; |