1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

Simplify MCContext::(Next|Get)Instance

- Allocate MCLabels in the context so they don't leak.
- Avoid duplicated densemap lookup.

llvm-svn: 104020
This commit is contained in:
Benjamin Kramer 2010-05-18 12:15:34 +00:00
parent 0774d14741
commit ad350eb789

View File

@ -73,33 +73,17 @@ MCSymbol *MCContext::CreateTempSymbol() {
}
unsigned MCContext::NextInstance(int64_t LocalLabelVal) {
unsigned Instance;
MCLabel *Label;
Label = Instances[LocalLabelVal];
if (Label) {
Instance = Label->incInstance();
}
else {
Instance = 1;
Label = new MCLabel(Instance);
Instances[LocalLabelVal] = Label;
}
return Instance;
MCLabel *&Label = Instances[LocalLabelVal];
if (!Label)
Label = new (*this) MCLabel(0);
return Label->incInstance();
}
unsigned MCContext::GetInstance(int64_t LocalLabelVal) {
int Instance;
MCLabel *Label;
Label = Instances[LocalLabelVal];
if (Label) {
Instance = Label->getInstance();
}
else {
Instance = 0;
Label = new MCLabel(Instance);
Instances[LocalLabelVal] = Label;
}
return Instance;
MCLabel *&Label = Instances[LocalLabelVal];
if (!Label)
Label = new (*this) MCLabel(0);
return Label->getInstance();
}
MCSymbol *MCContext::CreateDirectionalLocalSymbol(int64_t LocalLabelVal) {