diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-26 08:04:51 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-26 08:04:51 +0000 |
| commit | 791b8ef1b61e8e5546d61bf6bd7eeab391a2a4b1 (patch) | |
| tree | 178eccb83d88bb5de5a56c53a189ec444578617c /llvm/lib/AsmParser/ParserInternals.h | |
| parent | 788e317cd721b2737222d061b41ef1b546b0caa2 (diff) | |
| download | bcm5719-llvm-791b8ef1b61e8e5546d61bf6bd7eeab391a2a4b1.tar.gz bcm5719-llvm-791b8ef1b61e8e5546d61bf6bd7eeab391a2a4b1.zip | |
For PR645:
Implement separation of local and global symbols. Local symbols and types
now use % prefix. Global variables and functions now use @ prefix.
For PR761:
Replace:
target endian =
target pointersize =
With:
target datalayout =
llvm-svn: 33524
Diffstat (limited to 'llvm/lib/AsmParser/ParserInternals.h')
| -rw-r--r-- | llvm/lib/AsmParser/ParserInternals.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h index 613e8ce39c0..1bc744bc4bb 100644 --- a/llvm/lib/AsmParser/ParserInternals.h +++ b/llvm/lib/AsmParser/ParserInternals.h @@ -88,12 +88,13 @@ struct InlineAsmDescriptor { // struct ValID { enum { - NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal, + LocalID, GlobalID, LocalName, GlobalName, + ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal, ConstUndefVal, ConstZeroVal, ConstantVal, InlineAsmVal } Type; union { - int Num; // If it's a numeric reference + unsigned Num; // If it's a numeric reference like %1234 char *Name; // If it's a named reference. Memory must be free'd. int64_t ConstPool64; // Constant pool reference. This is the value uint64_t UConstPool64;// Unsigned constant pool reference. @@ -102,14 +103,19 @@ struct ValID { InlineAsmDescriptor *IAD; }; - static ValID create(int Num) { - ValID D; D.Type = NumberVal; D.Num = Num; return D; + static ValID createLocalID(unsigned Num) { + ValID D; D.Type = LocalID; D.Num = Num; return D; } - - static ValID create(char *Name) { - ValID D; D.Type = NameVal; D.Name = Name; return D; + static ValID createGlobalID(unsigned Num) { + ValID D; D.Type = GlobalID; D.Num = Num; return D; } - + static ValID createLocalName(char *Name) { + ValID D; D.Type = LocalName; D.Name = Name; return D; + } + static ValID createGlobalName(char *Name) { + ValID D; D.Type = GlobalName; D.Name = Name; return D; + } + static ValID create(int64_t Val) { ValID D; D.Type = ConstSIntVal; D.ConstPool64 = Val; return D; } @@ -148,14 +154,14 @@ struct ValID { } inline void destroy() const { - if (Type == NameVal) + if (Type == LocalName || Type == GlobalName) free(Name); // Free this strdup'd memory. else if (Type == InlineAsmVal) delete IAD; } inline ValID copy() const { - if (Type != NameVal) return *this; + if (Type != LocalName && Type != GlobalName) return *this; ValID Result = *this; Result.Name = strdup(Name); return Result; @@ -163,8 +169,10 @@ struct ValID { inline std::string getName() const { switch (Type) { - case NumberVal : return std::string("#") + itostr(Num); - case NameVal : return Name; + case LocalID : return '%' + utostr(Num); + case GlobalID : return '@' + utostr(Num); + case LocalName : return Name; + case GlobalName : return Name; case ConstFPVal : return ftostr(ConstPoolFP); case ConstNullVal : return "null"; case ConstUndefVal : return "undef"; @@ -185,8 +193,10 @@ struct ValID { bool operator<(const ValID &V) const { if (Type != V.Type) return Type < V.Type; switch (Type) { - case NumberVal: return Num < V.Num; - case NameVal: return strcmp(Name, V.Name) < 0; + case LocalID: + case GlobalID: return Num < V.Num; + case LocalName: + case GlobalName: return strcmp(Name, V.Name) < 0; case ConstSIntVal: return ConstPool64 < V.ConstPool64; case ConstUIntVal: return UConstPool64 < V.UConstPool64; case ConstFPVal: return ConstPoolFP < V.ConstPoolFP; |

