mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
Simplify MCContext::(Next|Get)Instance
- Allocate MCLabels in the context so they don't leak. - Avoid duplicated densemap lookup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104020 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
853197557c
commit
47f9a49560
@ -73,33 +73,17 @@ MCSymbol *MCContext::CreateTempSymbol() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned MCContext::NextInstance(int64_t LocalLabelVal) {
|
unsigned MCContext::NextInstance(int64_t LocalLabelVal) {
|
||||||
unsigned Instance;
|
MCLabel *&Label = Instances[LocalLabelVal];
|
||||||
MCLabel *Label;
|
if (!Label)
|
||||||
Label = Instances[LocalLabelVal];
|
Label = new (*this) MCLabel(0);
|
||||||
if (Label) {
|
return Label->incInstance();
|
||||||
Instance = Label->incInstance();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Instance = 1;
|
|
||||||
Label = new MCLabel(Instance);
|
|
||||||
Instances[LocalLabelVal] = Label;
|
|
||||||
}
|
|
||||||
return Instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MCContext::GetInstance(int64_t LocalLabelVal) {
|
unsigned MCContext::GetInstance(int64_t LocalLabelVal) {
|
||||||
int Instance;
|
MCLabel *&Label = Instances[LocalLabelVal];
|
||||||
MCLabel *Label;
|
if (!Label)
|
||||||
Label = Instances[LocalLabelVal];
|
Label = new (*this) MCLabel(0);
|
||||||
if (Label) {
|
return Label->getInstance();
|
||||||
Instance = Label->getInstance();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Instance = 0;
|
|
||||||
Label = new MCLabel(Instance);
|
|
||||||
Instances[LocalLabelVal] = Label;
|
|
||||||
}
|
|
||||||
return Instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *MCContext::CreateDirectionalLocalSymbol(int64_t LocalLabelVal) {
|
MCSymbol *MCContext::CreateDirectionalLocalSymbol(int64_t LocalLabelVal) {
|
||||||
|
Loading…
Reference in New Issue
Block a user