MCPcopy Create free account
hub / github.com/GJDuck/e9patch / getTrampolinePrologueStart

Function getTrampolinePrologueStart

src/e9patch/e9optimize.cpp:135–159  ·  view source on GitHub ↗

* Calculate the start of the trampoline prologue. */

Source from the content-addressed store, hash-verified

133 * Calculate the start of the trampoline prologue.
134 */
135const Instr *getTrampolinePrologueStart(const EntrySet &Es, const Instr *I)
136{
137 if (!option_Opeephole)
138 return nullptr;
139 auto i = Es.find(I->addr);
140 if (i == Es.end())
141 return nullptr;
142 const EntryPoint &E = i->second;
143 if (E.I != I)
144 return nullptr;
145
146 auto j = Es.begin();
147 const Instr *J = I, *K = nullptr;
148 while (i != j)
149 {
150 J = J->prev();
151 i--;
152 const EntryPoint &F = i->second;
153 if (F.I != E.I)
154 break;
155 if (F.target32 || F.target8)
156 K = J;
157 }
158 return K;
159}
160
161/*
162 * Get the corresponding trampoline entry if it exists, else INTPTR_MIN.

Callers 1

buildPrologueFunction · 0.85

Calls 4

beginMethod · 0.80
prevMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected