llvm-mc: Stop uniqueing string tokens, nothing actually uses this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77287 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar
2009-07-28 00:58:50 +00:00
parent 04d5544034
commit 825e385ffe
2 changed files with 4 additions and 20 deletions

View File

@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "AsmLexer.h" #include "AsmLexer.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Config/config.h" // for strtoull. #include "llvm/Config/config.h" // for strtoull.
@@ -21,21 +20,14 @@
#include <cstdlib> #include <cstdlib>
using namespace llvm; using namespace llvm;
static StringSet<> &getSS(void *TheSS) {
return *(StringSet<>*)TheSS;
}
AsmLexer::AsmLexer(SourceMgr &SM) : SrcMgr(SM) { AsmLexer::AsmLexer(SourceMgr &SM) : SrcMgr(SM) {
CurBuffer = 0; CurBuffer = 0;
CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
CurPtr = CurBuf->getBufferStart(); CurPtr = CurBuf->getBufferStart();
TokStart = 0; TokStart = 0;
TheStringSet = new StringSet<>();
} }
AsmLexer::~AsmLexer() { AsmLexer::~AsmLexer() {
delete &getSS(TheStringSet);
} }
SMLoc AsmLexer::getLoc() const { SMLoc AsmLexer::getLoc() const {
@@ -107,9 +99,7 @@ asmtok::TokKind AsmLexer::LexIdentifier() {
*CurPtr == '.' || *CurPtr == '@') *CurPtr == '.' || *CurPtr == '@')
++CurPtr; ++CurPtr;
// Unique string. // Unique string.
CurStrVal = getSS(TheStringSet).GetOrCreateValue(StringRef(TokStart, CurStrVal = StringRef(TokStart, CurPtr - TokStart);
CurPtr - TokStart),
0).getKeyData();
return asmtok::Identifier; return asmtok::Identifier;
} }
@@ -122,9 +112,7 @@ asmtok::TokKind AsmLexer::LexPercent() {
++CurPtr; ++CurPtr;
// Unique string. // Unique string.
CurStrVal = getSS(TheStringSet).GetOrCreateValue(StringRef(TokStart, CurStrVal = StringRef(TokStart, CurPtr - TokStart);
CurPtr - TokStart),
0).getKeyData();
return asmtok::Register; return asmtok::Register;
} }
@@ -251,9 +239,7 @@ asmtok::TokKind AsmLexer::LexQuote() {
} }
// Unique string, include quotes for now. // Unique string, include quotes for now.
CurStrVal = getSS(TheStringSet).GetOrCreateValue(StringRef(TokStart, CurStrVal = StringRef(TokStart, CurPtr - TokStart);
CurPtr - TokStart),
0).getKeyData();
return asmtok::String; return asmtok::String;
} }

View File

@@ -59,13 +59,11 @@ class AsmLexer : public MCAsmLexer {
const char *CurPtr; const char *CurPtr;
const MemoryBuffer *CurBuf; const MemoryBuffer *CurBuf;
// A llvm::StringSet<>, which provides uniqued and null-terminated strings.
void *TheStringSet;
// Information about the current token. // Information about the current token.
const char *TokStart; const char *TokStart;
asmtok::TokKind CurKind; asmtok::TokKind CurKind;
const char *CurStrVal; // This is valid for Identifier. StringRef CurStrVal; // This is valid for Identifier.
int64_t CurIntVal; int64_t CurIntVal;
/// CurBuffer - This is the current buffer index we're lexing from as managed /// CurBuffer - This is the current buffer index we're lexing from as managed