[llvm-commits] [llvm] r49470 - in /llvm/branches/ggreif/use-diet: CREDITS.TXT include/llvm/InstrTypes.h include/llvm/User.h

Gabor Greif ggreif at gmail.com
Thu Apr 10 01:12:39 PDT 2008


Author: ggreif
Date: Thu Apr 10 03:12:39 2008
New Revision: 49470

URL: http://llvm.org/viewvc/llvm-project?rev=49470&view=rev
Log:
introduce and use FixedNumOperandTraits class, though its full potential is still not explored. enter myself in CREDITS

Modified:
    llvm/branches/ggreif/use-diet/CREDITS.TXT
    llvm/branches/ggreif/use-diet/include/llvm/InstrTypes.h
    llvm/branches/ggreif/use-diet/include/llvm/User.h

Modified: llvm/branches/ggreif/use-diet/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/CREDITS.TXT?rev=49470&r1=49469&r2=49470&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/CREDITS.TXT (original)
+++ llvm/branches/ggreif/use-diet/CREDITS.TXT Thu Apr 10 03:12:39 2008
@@ -110,6 +110,10 @@
 D: Miscellaneous bug fixes
 D: Register allocation refactoring
 
+N: Gabor Greif
+E: ggreif at gmail.com
+D: Improvements for space efficiency
+
 N: Gordon Henriksen
 E: gordonhenriksen at mac.com
 D: Pluggable GC support

Modified: llvm/branches/ggreif/use-diet/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/InstrTypes.h?rev=49470&r1=49469&r2=49470&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/InstrTypes.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/InstrTypes.h Thu Apr 10 03:12:39 2008
@@ -79,6 +79,36 @@
 };
 
 //===----------------------------------------------------------------------===//
+//                          FixedNumOperands Trait Class
+//===----------------------------------------------------------------------===//
+
+template <unsigned ARITY>
+struct FixedNumOperandTraits {
+  static Use *op_begin(User* U) {
+		return reinterpret_cast<Use*>(U) - ARITY;
+	}
+  static Use *op_end(User* U) {
+		return reinterpret_cast<Use*>(U);
+	}
+	static unsigned operands(User*) {
+		return ARITY;
+	}
+	struct prefix {
+		Use Ops[ARITY];
+		prefix(); // DO NOT IMPLEMENT
+	};
+  template <class U>
+	struct Layout {
+		struct overlay : prefix, U {
+			overlay(); // DO NOT IMPLEMENT
+		};
+	};
+	static inline void *allocate(unsigned); // FIXME
+};
+
+
+
+//===----------------------------------------------------------------------===//
 //                          UnaryInstruction Class
 //===----------------------------------------------------------------------===//
 
@@ -129,6 +159,10 @@
   }
 };
 
+template <>
+struct OperandTraits<UnaryInstruction> : FixedNumOperandTraits<1> {
+};
+
 //===----------------------------------------------------------------------===//
 //                           BinaryOperator Class
 //===----------------------------------------------------------------------===//
@@ -251,6 +285,10 @@
   }
 };
 
+template <>
+struct OperandTraits<BinaryOperator> : FixedNumOperandTraits<2> {
+};
+
 //===----------------------------------------------------------------------===//
 //                               CastInst Class
 //===----------------------------------------------------------------------===//

Modified: llvm/branches/ggreif/use-diet/include/llvm/User.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/User.h?rev=49470&r1=49469&r2=49470&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/User.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/User.h Thu Apr 10 03:12:39 2008
@@ -312,10 +312,6 @@
 	return U->getNumOperands();
 }
 	/*
-  template <class U>
-	struct Layout {
-		typedef U overlay;
-	};
 	static inline void *allocate(unsigned);
 };
 	*/





More information about the llvm-commits mailing list