[llvm-commits] [llvm] r49498 - in /llvm/branches/ggreif/use-diet: include/llvm/User.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Reader/BitcodeReader.h

Gabor Greif ggreif at gmail.com
Thu Apr 10 15:12:32 PDT 2008


Author: ggreif
Date: Thu Apr 10 17:12:32 2008
New Revision: 49498

URL: http://llvm.org/viewvc/llvm-project?rev=49498&view=rev
Log:
more BitcodeReaderValueList stuff. this does not link yet

Modified:
    llvm/branches/ggreif/use-diet/include/llvm/User.h
    llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h

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=49498&r1=49497&r2=49498&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/User.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/User.h Thu Apr 10 17:12:32 2008
@@ -211,6 +211,8 @@
 class User : public Value {
   User(const User &);             // Do not implement
   void *operator new(size_t);     // Do not implement
+  template <unsigned>
+	friend struct HungoffOperandTraits;
 protected:
   /// OperandList - This is a pointer to the array of Users for this operand.
   /// For nodes of fixed arity (e.g. a binary operator) this array will live

Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp?rev=49498&r1=49497&r2=49498&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.cpp Thu Apr 10 17:12:32 2008
@@ -146,6 +146,18 @@
 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantPlaceHolder, Value)
 }
 
+void BitcodeReaderValueList::resize(unsigned Desired) {
+  unsigned Capacity = 0;
+	if (OperandList) {
+		Capacity = OperandList->getImpliedUser() - OperandList;
+	}
+
+	if (Desired > Capacity)
+	{
+		// FIXME
+	}
+}
+
 Constant *BitcodeReaderValueList::getConstantFwdRef(unsigned Idx,
                                                     const Type *Ty) {
   if (Idx >= size()) {

Modified: llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h?rev=49498&r1=49497&r2=49498&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h (original)
+++ llvm/branches/ggreif/use-diet/lib/Bitcode/Reader/BitcodeReader.h Thu Apr 10 17:12:32 2008
@@ -17,7 +17,7 @@
 #include "llvm/ModuleProvider.h"
 #include "llvm/ParameterAttributes.h"
 #include "llvm/Type.h"
-#include "llvm/User.h"
+#include "llvm/OperandTraits.h"
 #include "llvm/Bitcode/BitstreamReader.h"
 #include "llvm/Bitcode/LLVMBitCodes.h"
 #include "llvm/ADT/DenseMap.h"
@@ -30,7 +30,7 @@
 //                          HungoffOperand Trait Class
 //===----------------------------------------------------------------------===//
 
-template <unsigned MINARITY = 0>
+template <unsigned MINARITY = 1>
 struct HungoffOperandTraits {
   static Use *op_begin(User* U) {
     return U->OperandList;
@@ -52,6 +52,9 @@
 public:
   BitcodeReaderValueList() : User(Type::VoidTy, Value::ArgumentVal, 0, 0) {}
   
+  /// Provide fast operand accessors
+	DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
+
   // vector compatibility methods
   unsigned size() const { return getNumOperands(); }
 	void resize(unsigned);
@@ -101,7 +104,12 @@
 //    Uses[Idx].init(V, this);
   }
 };
-  
+
+template <>
+struct OperandTraits<BitcodeReaderValueList> : HungoffOperandTraits</*16 FIXME*/> {
+};
+
+DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BitcodeReaderValueList, Value)  
 
 class BitcodeReader : public ModuleProvider {
   MemoryBuffer *Buffer;





More information about the llvm-commits mailing list