mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
The ModuleLevel vector is often quite sparse. Switch it to a DenseMap. This
speeds up bcwriting of 447.dealII by 40%, from 4.63s to 3.32s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#ifndef LLVM_ANALYSIS_SLOTCALCULATOR_H
|
||||
#define LLVM_ANALYSIS_SLOTCALCULATOR_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
@@ -34,6 +35,14 @@ class TypeSymbolTable;
|
||||
class ValueSymbolTable;
|
||||
class ConstantArray;
|
||||
|
||||
struct ModuleLevelDenseMapKeyInfo {
|
||||
static inline unsigned getEmptyKey() { return ~0U; }
|
||||
static inline unsigned getTombstoneKey() { return ~1U; }
|
||||
static unsigned getHashValue(unsigned Val) { return Val ^ Val >> 4; }
|
||||
static bool isPod() { return true; }
|
||||
};
|
||||
|
||||
|
||||
class SlotCalculator {
|
||||
const Module *TheModule;
|
||||
|
||||
@@ -54,8 +63,8 @@ class SlotCalculator {
|
||||
/// ModuleLevel - Used to keep track of which values belong to the module,
|
||||
/// and which values belong to the currently incorporated function.
|
||||
///
|
||||
std::vector<int> ModuleLevel;
|
||||
unsigned ModuleTypeLevel;
|
||||
DenseMap<unsigned,unsigned,ModuleLevelDenseMapKeyInfo> ModuleLevel;
|
||||
unsigned NumModuleTypes;
|
||||
|
||||
SlotCalculator(const SlotCalculator &); // DO NOT IMPLEMENT
|
||||
void operator=(const SlotCalculator &); // DO NOT IMPLEMENT
|
||||
|
||||
Reference in New Issue
Block a user