mirror of
https://github.com/intel/intel-graphics-compiler.git
synced 2025-11-04 08:21:06 +08:00
Remove unnecessary placement new for small objects
For small (<=8 byte), read-only class objects, there is no reason to dynamically allocate them as it only adds extra time/space overhead. Remove the placement new operator from such classes and store them by value in the containers. For mutable objects we can still avoid dynamic allocation if there is only one reference to the object throughout its lifetime, though this is somewhat hard to prove as unique_ptr is seldomly used in existing code. Also remove placement new operators that are never used from their classes.
This commit is contained in:
@ -53,8 +53,7 @@ private:
|
||||
unsigned int globalLRSize = 0;
|
||||
bool doSplitLLR = false;
|
||||
Mem_Manager &mem;
|
||||
std::list<InputLiveRange *, std_arena_based_allocator<InputLiveRange *>>
|
||||
inputIntervals;
|
||||
std::list<InputLiveRange> inputIntervals;
|
||||
BankConflictPass &bc;
|
||||
GlobalRA &gra;
|
||||
bool doBCR = false;
|
||||
@ -242,8 +241,6 @@ public:
|
||||
InputLiveRange(unsigned int regId, unsigned int endId)
|
||||
: regWordIdx(regId), lrEndIdx(endId) {}
|
||||
|
||||
void *operator new(size_t sz, Mem_Manager &m) { return m.alloc(sz); }
|
||||
|
||||
unsigned int getRegWordIdx() { return regWordIdx; }
|
||||
unsigned int getLrEndIdx() { return lrEndIdx; }
|
||||
};
|
||||
@ -308,8 +305,6 @@ public:
|
||||
(int)builder.getOptions()->getuInt32Option(vISA_LraFFWindowSize);
|
||||
}
|
||||
|
||||
void *operator new(size_t sz, Mem_Manager &m) { return m.alloc(sz); }
|
||||
|
||||
void findRegisterCandiateWithAlignForward(int &i, BankAlign align,
|
||||
bool evenAlign);
|
||||
|
||||
@ -489,8 +484,7 @@ private:
|
||||
PhyRegsManager &pregManager;
|
||||
PhyRegsLocalRA &initPregs;
|
||||
std::vector<LocalLiveRange *> &liveIntervals;
|
||||
std::list<InputLiveRange *, std_arena_based_allocator<InputLiveRange *>>
|
||||
&inputIntervals;
|
||||
std::list<InputLiveRange> &inputIntervals;
|
||||
std::list<LocalLiveRange *> active;
|
||||
PhyRegSummary *summary;
|
||||
|
||||
@ -524,14 +518,12 @@ private:
|
||||
bool doSplitLLR;
|
||||
|
||||
public:
|
||||
LinearScan(
|
||||
GlobalRA &g, std::vector<LocalLiveRange *> &localLiveIntervals,
|
||||
std::list<InputLiveRange *, std_arena_based_allocator<InputLiveRange *>>
|
||||
&inputLivelIntervals,
|
||||
PhyRegsManager &pregMgr, PhyRegsLocalRA &pregs, Mem_Manager &memmgr,
|
||||
PhyRegSummary *s, unsigned int numReg, unsigned int glrs, bool roundRobin,
|
||||
bool bankConflict, bool internalConflict, bool splitLLR,
|
||||
unsigned int simdS);
|
||||
LinearScan(GlobalRA &g, std::vector<LocalLiveRange *> &localLiveIntervals,
|
||||
std::list<InputLiveRange> &inputLivelIntervals,
|
||||
PhyRegsManager &pregMgr, PhyRegsLocalRA &pregs,
|
||||
Mem_Manager &memmgr, PhyRegSummary *s, unsigned int numReg,
|
||||
unsigned int glrs, bool roundRobin, bool bankConflict,
|
||||
bool internalConflict, bool splitLLR, unsigned int simdS);
|
||||
|
||||
void run(G4_BB *bb, IR_Builder &builder, LLR_USE_MAP &LLRUseMap);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user