[llvm-commits] [llvm-gcc-4.2] r94337 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-convert.cpp llvm-types.cpp

Rafael Espindola rafael.espindola at gmail.com
Sat Jan 23 16:04:53 PST 2010


Author: rafael
Date: Sat Jan 23 18:04:53 2010
New Revision: 94337

URL: http://llvm.org/viewvc/llvm-project?rev=94337&view=rev
Log:
Replace the template in llvm-abi.h with virtual methods.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-abi.h
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=94337&r1=94336&r2=94337&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sat Jan 23 18:04:53 2010
@@ -56,61 +56,62 @@
 /// DefaultABIClient - This is a simple implementation of the ABI client
 /// interface that can be subclassed.
 struct DefaultABIClient {
-  bool isShadowReturn() const { return false; }
+  virtual CallingConv::ID& getCallingConv(void) = 0;
+  virtual bool isShadowReturn() const { return false; }
 
   /// HandleScalarResult - This callback is invoked if the function returns a
   /// simple scalar result value, which is of type RetTy.
-  void HandleScalarResult(const Type *RetTy) {}
+  virtual void HandleScalarResult(const Type *RetTy) {}
 
   /// HandleAggregateResultAsScalar - This callback is invoked if the function
   /// returns an aggregate value by bit converting it to the specified scalar
   /// type and returning that.  The bit conversion should start at byte Offset
   /// within the struct, and ScalarTy is not necessarily big enough to cover
   /// the entire struct.
-  void HandleAggregateResultAsScalar(const Type *ScalarTy, unsigned Offset=0) {}
+  virtual void HandleAggregateResultAsScalar(const Type *ScalarTy, unsigned Offset=0) {}
 
   /// HandleAggregateResultAsAggregate - This callback is invoked if the function
   /// returns an aggregate value using multiple return values.
-  void HandleAggregateResultAsAggregate(const Type *AggrTy) {}
+  virtual void HandleAggregateResultAsAggregate(const Type *AggrTy) {}
 
   /// HandleAggregateShadowResult - This callback is invoked if the function
   /// returns an aggregate value by using a "shadow" first parameter, which is
   /// a pointer to the aggregate, of type PtrArgTy.  If RetPtr is set to true,
   /// the pointer argument itself is returned from the function.
-  void HandleAggregateShadowResult(const PointerType *PtrArgTy, bool RetPtr){}
+  virtual void HandleAggregateShadowResult(const PointerType *PtrArgTy, bool RetPtr){}
 
   /// HandleScalarShadowResult - This callback is invoked if the function
   /// returns a scalar value by using a "shadow" first parameter, which is a
   /// pointer to the scalar, of type PtrArgTy.  If RetPtr is set to true,
   /// the pointer argument itself is returned from the function.
-  void HandleScalarShadowResult(const PointerType *PtrArgTy, bool RetPtr) {}
+  virtual void HandleScalarShadowResult(const PointerType *PtrArgTy, bool RetPtr) {}
 
 
   /// HandleScalarArgument - This is the primary callback that specifies an
   /// LLVM argument to pass.  It is only used for first class types.
   /// If RealSize is non Zero then it specifies number of bytes to access
   /// from LLVMTy. 
-  void HandleScalarArgument(const llvm::Type *LLVMTy, tree type,
+  virtual void HandleScalarArgument(const llvm::Type *LLVMTy, tree type,
                             unsigned RealSize = 0) {}
 
   /// HandleByInvisibleReferenceArgument - This callback is invoked if a pointer
   /// (of type PtrTy) to the argument is passed rather than the argument itself.
-  void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, tree type) {}
+  virtual void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, tree type) {}
 
   /// HandleByValArgument - This callback is invoked if the aggregate function
   /// argument is passed by value.
-  void HandleByValArgument(const llvm::Type *LLVMTy, tree type) {}
+  virtual void HandleByValArgument(const llvm::Type *LLVMTy, tree type) {}
 
   /// HandleFCAArgument - This callback is invoked if the aggregate function
   /// argument is passed by value as a first class aggregate.
-  void HandleFCAArgument(const llvm::Type *LLVMTy,
+  virtual void HandleFCAArgument(const llvm::Type *LLVMTy,
                          tree type ATTRIBUTE_UNUSED) {}
 
   /// EnterField - Called when we're about the enter the field of a struct
   /// or union.  FieldNo is the number of the element we are entering in the
   /// LLVM Struct, StructTy is the LLVM type of the struct we are entering.
-  void EnterField(unsigned FieldNo, const llvm::Type *StructTy) {}
-  void ExitField() {}
+  virtual void EnterField(unsigned FieldNo, const llvm::Type *StructTy) {}
+  virtual void ExitField() {}
 };
 
 /// isAggregateTreeType - Return true if the specified GCC type is an aggregate
@@ -378,12 +379,11 @@
 /// passed by decimating them into individual components and unions are passed
 /// by passing the largest member of the union.
 ///
-template<typename Client>
 class DefaultABI {
 protected:
-  Client &C;
+  DefaultABIClient &C;
 public:
-  DefaultABI(Client &c) : C(c) {}
+  DefaultABI(DefaultABIClient &c) : C(c) {}
 
   bool isShadowReturn() const { return C.isShadowReturn(); }
   
@@ -734,15 +734,14 @@
 /// SVR4ABI - This class implements the System V Release 4 ABI for PowerPC. The
 /// SVR4 ABI is the ABI used on 32-bit PowerPC Linux.
 ///
-template<typename Client>
 class SVR4ABI {
   // Number of general purpose argument registers which have already been
   // assigned.
   unsigned NumGPR;
 protected:
-  Client &C;
+  DefaultABIClient &C;
 public:
-  SVR4ABI(Client &c) : NumGPR(0), C(c) {}
+  SVR4ABI(DefaultABIClient &c) : NumGPR(0), C(c) {}
 
   bool isShadowReturn() const { return C.isShadowReturn(); }
   

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=94337&r1=94336&r2=94337&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Jan 23 18:04:53 2010
@@ -607,7 +607,7 @@
 
   // Rename and alloca'ify real arguments.
   FunctionPrologArgumentConversion Client(FnDecl, AI, Builder, CallingConv);
-  TheLLVMABI<FunctionPrologArgumentConversion> ABIConverter(Client);
+  TheLLVMABI ABIConverter(Client);
 
   // Handle the DECL_RESULT.
   ABIConverter.HandleReturnType(TREE_TYPE(TREE_TYPE(FnDecl)), FnDecl,
@@ -2813,7 +2813,7 @@
   FunctionCallArgumentConversion Client(CallOperands, FTy, DestLoc,
                                         CALL_EXPR_RETURN_SLOT_OPT(exp),
                                         Builder, CallingConvention);
-  TheLLVMABI<FunctionCallArgumentConversion> ABIConverter(Client);
+  TheLLVMABI ABIConverter(Client);
 
   // Handle the result, including struct returns.
   ABIConverter.HandleReturnType(TREE_TYPE(exp),

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=94337&r1=94336&r2=94337&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat Jan 23 18:04:53 2010
@@ -1043,7 +1043,7 @@
   PATypeHolder RetTy(Type::getVoidTy(Context));
 
   FunctionTypeConversion Client(RetTy, ArgTys, CallingConv, true /*K&R*/);
-  TheLLVMABI<FunctionTypeConversion> ABIConverter(Client);
+  TheLLVMABI ABIConverter(Client);
 
 #ifdef TARGET_ADJUST_LLVM_CC
   TARGET_ADJUST_LLVM_CC(CallingConv, type);
@@ -1106,7 +1106,7 @@
   std::vector<PATypeHolder> ArgTypes;
   bool isVarArg = false;
   FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/*not K&R*/);
-  TheLLVMABI<FunctionTypeConversion> ABIConverter(Client);
+  TheLLVMABI ABIConverter(Client);
 
   // Allow the target to set the CC for things like fastcall etc.
 #ifdef TARGET_ADJUST_LLVM_CC





More information about the llvm-commits mailing list