summaryrefslogtreecommitdiff
path: root/tools/llvm-upgrade/UpgradeLexer.l
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-21 17:14:36 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-21 17:14:36 +0000
commit3e5affd26347351a67145e562b1599d124bcce4f (patch)
tree097e68a40ae662f4eeb4921941ba1b0a0270081f /tools/llvm-upgrade/UpgradeLexer.l
parent82d4264c1fe71480bcaa63235e385a01e38dbe8c (diff)
downloadllvm-3e5affd26347351a67145e562b1599d124bcce4f.tar.gz
llvm-3e5affd26347351a67145e562b1599d124bcce4f.tar.bz2
llvm-3e5affd26347351a67145e562b1599d124bcce4f.tar.xz
For PR1256:
Make Signedness information pervasive throughout all types and values. There is no easy way to get around this. Because the GEP instruction can index through an arbitrarily complex value structure, it is necessary to keep track of signedness information throughout that structure. This change makes Signedness a full class, capable of representing Signedness in arbitrarily shaped types. The class is then used throughout llvm-upgrade to track signedness and differentiate between globals, locals, and functions based on their signedness. For PR1243: This patch also removes bogus warnings about renaming internal globals. It now only emits such warnings when renaming non-internal globals because they may affect linkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-upgrade/UpgradeLexer.l')
-rw-r--r--tools/llvm-upgrade/UpgradeLexer.l43
1 files changed, 24 insertions, 19 deletions
diff --git a/tools/llvm-upgrade/UpgradeLexer.l b/tools/llvm-upgrade/UpgradeLexer.l
index ebab6db9c0..300cf5cc1a 100644
--- a/tools/llvm-upgrade/UpgradeLexer.l
+++ b/tools/llvm-upgrade/UpgradeLexer.l
@@ -51,7 +51,12 @@
#define RET_TY(sym,NewTY,sign) \
Upgradelval.PrimType.T = NewTY; \
- Upgradelval.PrimType.S = sign; \
+ switch (sign) { \
+ case 0: Upgradelval.PrimType.S.makeSignless(); break; \
+ case 1: Upgradelval.PrimType.S.makeUnsigned(); break; \
+ case 2: Upgradelval.PrimType.S.makeSigned(); break; \
+ default: assert(0 && "Invalid sign kind"); break; \
+ }\
return sym
namespace llvm {
@@ -238,24 +243,24 @@ coldcc { return COLDCC_TOK; }
x86_stdcallcc { return X86_STDCALLCC_TOK; }
x86_fastcallcc { return X86_FASTCALLCC_TOK; }
-sbyte { RET_TY(SBYTE, Type::Int8Ty, Signed); }
-ubyte { RET_TY(UBYTE, Type::Int8Ty, Unsigned); }
-i8 { RET_TY(UBYTE, Type::Int8Ty, Unsigned); }
-short { RET_TY(SHORT, Type::Int16Ty, Signed); }
-ushort { RET_TY(USHORT, Type::Int16Ty, Unsigned); }
-i16 { RET_TY(USHORT, Type::Int16Ty, Unsigned); }
-int { RET_TY(INT, Type::Int32Ty, Signed); }
-uint { RET_TY(UINT, Type::Int32Ty, Unsigned); }
-i32 { RET_TY(UINT, Type::Int32Ty, Unsigned); }
-long { RET_TY(LONG, Type::Int64Ty, Signed); }
-ulong { RET_TY(ULONG, Type::Int64Ty, Unsigned); }
-i64 { RET_TY(ULONG, Type::Int64Ty, Unsigned); }
-void { RET_TY(VOID, Type::VoidTy, Signless ); }
-bool { RET_TY(BOOL, Type::Int1Ty, Unsigned ); }
-i1 { RET_TY(BOOL, Type::Int1Ty, Unsigned ); }
-float { RET_TY(FLOAT, Type::FloatTy, Signless ); }
-double { RET_TY(DOUBLE, Type::DoubleTy,Signless); }
-label { RET_TY(LABEL, Type::LabelTy, Signless ); }
+sbyte { RET_TY(SBYTE, Type::Int8Ty, 2); }
+ubyte { RET_TY(UBYTE, Type::Int8Ty, 1); }
+i8 { RET_TY(UBYTE, Type::Int8Ty, 1); }
+short { RET_TY(SHORT, Type::Int16Ty, 2); }
+ushort { RET_TY(USHORT, Type::Int16Ty, 1); }
+i16 { RET_TY(USHORT, Type::Int16Ty, 1); }
+int { RET_TY(INT, Type::Int32Ty, 2); }
+uint { RET_TY(UINT, Type::Int32Ty, 1); }
+i32 { RET_TY(UINT, Type::Int32Ty, 1); }
+long { RET_TY(LONG, Type::Int64Ty, 2); }
+ulong { RET_TY(ULONG, Type::Int64Ty, 1); }
+i64 { RET_TY(ULONG, Type::Int64Ty, 1); }
+void { RET_TY(VOID, Type::VoidTy, 0); }
+bool { RET_TY(BOOL, Type::Int1Ty, 1); }
+i1 { RET_TY(BOOL, Type::Int1Ty, 1); }
+float { RET_TY(FLOAT, Type::FloatTy, 0); }
+double { RET_TY(DOUBLE, Type::DoubleTy,0); }
+label { RET_TY(LABEL, Type::LabelTy, 0); }
type { return TYPE; }
opaque { return OPAQUE; }