Commit ac3dedc2 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Switch some more things to DenseMap

parent 7fd78399
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#ifndef PYSTON_ANALYSIS_SCOPINGANALYSIS_H #ifndef PYSTON_ANALYSIS_SCOPINGANALYSIS_H
#define PYSTON_ANALYSIS_SCOPINGANALYSIS_H #define PYSTON_ANALYSIS_SCOPINGANALYSIS_H
#include "llvm/ADT/DenseMap.h"
#include "core/common.h" #include "core/common.h"
#include "core/stringpool.h" #include "core/stringpool.h"
...@@ -146,14 +148,14 @@ public: ...@@ -146,14 +148,14 @@ public:
class ScopingAnalysis { class ScopingAnalysis {
public: public:
struct ScopeNameUsage; struct ScopeNameUsage;
typedef std::unordered_map<AST*, ScopeNameUsage*> NameUsageMap; typedef llvm::DenseMap<AST*, ScopeNameUsage*> NameUsageMap;
private: private:
std::unordered_map<AST*, ScopeInfo*> scopes; llvm::DenseMap<AST*, ScopeInfo*> scopes;
AST_Module* parent_module; AST_Module* parent_module;
InternedStringPool* interned_strings; InternedStringPool* interned_strings;
std::unordered_map<AST*, AST*> scope_replacements; llvm::DenseMap<AST*, AST*> scope_replacements;
ScopeInfo* analyzeSubtree(AST* node); ScopeInfo* analyzeSubtree(AST* node);
void processNameUsages(NameUsageMap* usages); void processNameUsages(NameUsageMap* usages);
......
...@@ -186,8 +186,9 @@ void Rewriter::ConstLoader::moveImmediate(uint64_t val, assembler::Register dst_ ...@@ -186,8 +186,9 @@ void Rewriter::ConstLoader::moveImmediate(uint64_t val, assembler::Register dst_
assembler::Register Rewriter::ConstLoader::findConst(uint64_t val, bool& found_value) { assembler::Register Rewriter::ConstLoader::findConst(uint64_t val, bool& found_value) {
assert(rewriter->phase_emitting); assert(rewriter->phase_emitting);
if (constToVar.count(val) > 0) { auto it = constToVar.find(val);
RewriterVar* var = constToVar[val]; if (it != constToVar.end()) {
RewriterVar* var = it->second;
for (Location l : var->locations) { for (Location l : var->locations) {
if (l.type == Location::Register) { if (l.type == Location::Register) {
found_value = true; found_value = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment