diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-14 23:08:04 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-14 23:08:04 +0000 |
commit | c1882215a037f9ff4b56bdaf34a57cdb91f497ef (patch) | |
tree | ceba12dc0a3b4956bfb85153120e8c682daa114b /tools/llvm-upgrade | |
parent | 8ee16fbc731d1b16e613bed20af60bca8eeb41c3 (diff) | |
download | external_llvm-c1882215a037f9ff4b56bdaf34a57cdb91f497ef.zip external_llvm-c1882215a037f9ff4b56bdaf34a57cdb91f497ef.tar.gz external_llvm-c1882215a037f9ff4b56bdaf34a57cdb91f497ef.tar.bz2 |
For PR1256:
Carry sign with ValID and make TypeInfo sortable (useful in a map).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-upgrade')
-rw-r--r-- | tools/llvm-upgrade/UpgradeInternals.h | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/tools/llvm-upgrade/UpgradeInternals.h b/tools/llvm-upgrade/UpgradeInternals.h index bbf6737..7a0446a 100644 --- a/tools/llvm-upgrade/UpgradeInternals.h +++ b/tools/llvm-upgrade/UpgradeInternals.h @@ -59,6 +59,10 @@ struct InlineAsmDescriptor { : AsmString(as), Constraints(c), HasSideEffects(HSE) {} }; +/// An enumeration for defining the Signedness of a type or value. Signless +/// means the signedness is not relevant to the type or value. +enum Signedness { Signless, Unsigned, Signed }; + // ValID - Represents a reference of a definition of some sort. This may either // be a numeric reference or a symbolic (%var) reference. This is just a @@ -82,41 +86,51 @@ struct ValID { Constant *ConstantValue; // Fully resolved constant for ConstantVal case. InlineAsmDescriptor *IAD; }; + Signedness S; - static ValID create(int Num) { - ValID D; D.Type = NumberVal; D.Num = Num; return D; + static ValID create(int Num, Signedness Sign) { + ValID D; D.Type = NumberVal; D.Num = Num; D.S = Sign; + return D; } - static ValID create(char *Name) { - ValID D; D.Type = NameVal; D.Name = Name; return D; + static ValID create(char *Name, Signedness Sign) { + ValID D; D.Type = NameVal; D.Name = Name; D.S = Sign; + return D; } static ValID create(int64_t Val) { - ValID D; D.Type = ConstSIntVal; D.ConstPool64 = Val; return D; + ValID D; D.Type = ConstSIntVal; D.ConstPool64 = Val; D.S = Signed; + return D; } static ValID create(uint64_t Val) { - ValID D; D.Type = ConstUIntVal; D.UConstPool64 = Val; return D; + ValID D; D.Type = ConstUIntVal; D.UConstPool64 = Val; D.S = Unsigned; + return D; } static ValID create(double Val) { - ValID D; D.Type = ConstFPVal; D.ConstPoolFP = Val; return D; + ValID D; D.Type = ConstFPVal; D.ConstPoolFP = Val; D.S = Signless; + return D; } static ValID createNull() { - ValID D; D.Type = ConstNullVal; return D; + ValID D; D.Type = ConstNullVal; D.S = Signless; + return D; } static ValID createUndef() { - ValID D; D.Type = ConstUndefVal; return D; + ValID D; D.Type = ConstUndefVal; D.S = Signless; + return D; } static ValID createZeroInit() { - ValID D; D.Type = ConstZeroVal; return D; + ValID D; D.Type = ConstZeroVal; D.S = Signless; + return D; } - static ValID create(Constant *Val) { - ValID D; D.Type = ConstantVal; D.ConstantValue = Val; return D; + static ValID create(Constant *Val, Signedness Sign) { + ValID D; D.Type = ConstantVal; D.ConstantValue = Val; D.S = Sign; + return D; } static ValID createInlineAsm(const std::string &AsmString, @@ -221,10 +235,6 @@ namespace OldCallingConv { }; } -/// An enumeration for defining the Signedness of a type or value. Signless -/// means the signedness is not relevant to the type or value. -enum Signedness { Signless, Unsigned, Signed }; - /// These structures are used as the semantic values returned from various /// productions in the grammar. They simply bundle an LLVM IR object with /// its Signedness value. These help track signedness through the various @@ -232,6 +242,16 @@ enum Signedness { Signless, Unsigned, Signed }; struct TypeInfo { const llvm::Type *T; Signedness S; + bool operator<(const TypeInfo& that) const { + if (this == &that) + return false; + return (T < that.T) || (T == that.T && S < that.S); + } + bool operator==(const TypeInfo& that) const { + if (this == &that) + return true; + return T == that.T && S == that.S; + } }; struct PATypeInfo { |