[llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c llvm-representation.c llvm-representation.h llvm-types.c

Reid Spencer reid at x10sys.com
Sat Jun 18 14:11:31 PDT 2005



Changes in directory llvm-gcc/gcc:

llvm-expand.c updated: 1.101 -> 1.102
llvm-representation.c updated: 1.17 -> 1.18
llvm-representation.h updated: 1.15 -> 1.16
llvm-types.c updated: 1.22 -> 1.23
---
Log message:

Clean up some code (no functional changes):
* Correct constructs that GCC 4.0.0 errors on such as functions with no
  return type, inconsistent constness, and under-specified static 
  initializers
* Wrap some long lines
* Comment out some variables that are not used.


---
Diffs of the changes:  (+31 -30)

 llvm-expand.c         |   11 ++++++-----
 llvm-representation.c |   10 +++++-----
 llvm-representation.h |    8 ++++----
 llvm-types.c          |   32 ++++++++++++++++----------------
 4 files changed, 31 insertions(+), 30 deletions(-)


Index: llvm-gcc/gcc/llvm-expand.c
diff -u llvm-gcc/gcc/llvm-expand.c:1.101 llvm-gcc/gcc/llvm-expand.c:1.102
--- llvm-gcc/gcc/llvm-expand.c:1.101	Wed Jun 15 17:44:27 2005
+++ llvm-gcc/gcc/llvm-expand.c	Sat Jun 18 16:11:19 2005
@@ -160,8 +160,9 @@
   return I;
 }
 
-static inline llvm_value *cast_if_type_not_equal(llvm_function *Fn,
-                                                 llvm_value *V, llvm_type *Ty) {
+static inline llvm_value *
+cast_if_type_not_equal(llvm_function *Fn,
+                       llvm_value *V, const llvm_type *Ty) {
   llvm_instruction *Cast;
   if (V->Ty == Ty) return V;  /* No cast required? */
 
@@ -2645,7 +2646,7 @@
  */
 static void llvm_expand_anon_union_decl(llvm_function *Fn, tree decl,
                                         tree decl_elts) {
-  llvm_nesting *InnermostCleanupScope = Fn->ExpandInfo->InnermostBlockScope;
+  /*llvm_nesting *InnermostCleanupScope = Fn->ExpandInfo->InnermostBlockScope;*/
   llvm_value *x;
   tree t;
 
@@ -7438,7 +7439,7 @@
    assembler symbol name. */
 extern int decode_reg_name(const char *);
 void llvm_make_decl_llvm(tree decl, const char *asmspec) {
-  int top_level = (DECL_CONTEXT (decl) == NULL_TREE);
+  /*int top_level = (DECL_CONTEXT (decl) == NULL_TREE); */
   const char *name = 0;
   int reg_number;
 
@@ -8144,7 +8145,7 @@
 
 
 /* Emit intrinsics to mark variable declarations */
-static void llvm_emit_dbg_declare(llvm_function *Fn, tree t){
+static void llvm_emit_dbg_declare(llvm_function * Fn, tree t){
   /* FIXME: need to actually do this.  
 
   See llvm_emit_dbg_stoppoint for an example of how to create a new


Index: llvm-gcc/gcc/llvm-representation.c
diff -u llvm-gcc/gcc/llvm-representation.c:1.17 llvm-gcc/gcc/llvm-representation.c:1.18
--- llvm-gcc/gcc/llvm-representation.c:1.17	Wed Feb 23 11:33:28 2005
+++ llvm-gcc/gcc/llvm-representation.c	Sat Jun 18 16:11:20 2005
@@ -185,12 +185,12 @@
    subsequent values get increasing identifiers.  The name and type of a value
    should not be changed after they are constructed.
  */
-void llvm_value_construct(llvm_value *Val, struct llvm_type *Type,
+void llvm_value_construct(llvm_value *Val, const struct llvm_type *Type,
 			  const char *Name, enum ValueType VT) {
   llvm_value *GlobalVal;
   Val->VTy = VT;
   GlobalVal = llvm_value_is_global(Val) ? Val : 0;
-  Val->Ty = Type;
+  Val->Ty = (struct llvm_type*) Type;
   if (Name[0] == '*') ++Name;
   Val->Name = Name[0] ? IdentifierTableGetName(Name, GlobalVal) : xstrdup(Name);
 }
@@ -267,7 +267,7 @@
 
 /* llvm_constant implementation ********************************************
  */
-void llvm_constant_construct(llvm_constant *C, struct llvm_type *Ty,
+void llvm_constant_construct(llvm_constant *C, const struct llvm_type *Ty,
                              const char *Name, enum ValueType VT,
                              const char *Rep) {
   llvm_value_construct(D2V(C), Ty, Name, VT);
@@ -279,7 +279,7 @@
   llvm_value_destruct(D2V(C));
 }
 
-llvm_value *llvm_constant_new(struct llvm_type *Ty, const char *Rep) {
+llvm_value *llvm_constant_new(const struct llvm_type *Ty, const char *Rep) {
   llvm_constant *C = (llvm_constant*)xcalloc(sizeof(llvm_constant), 1);
   llvm_constant_construct(C, Ty, "", Constant, Rep);
   return D2V(C);
@@ -340,7 +340,7 @@
     llvm_constant_intptr_0 = llvm_constant_int_0;
 }
 
-llvm_value *llvm_constant_get_null(llvm_type *Ty) {
+llvm_value *llvm_constant_get_null(const llvm_type *Ty) {
   if (Ty == UByteTy) return llvm_constant_ubyte_0;
   if (Ty == IntTy)   return llvm_constant_int_0;
   if (Ty == UIntTy)  return llvm_constant_uint_0;


Index: llvm-gcc/gcc/llvm-representation.h
diff -u llvm-gcc/gcc/llvm-representation.h:1.15 llvm-gcc/gcc/llvm-representation.h:1.16
--- llvm-gcc/gcc/llvm-representation.h:1.15	Wed Mar  2 11:03:07 2005
+++ llvm-gcc/gcc/llvm-representation.h	Sat Jun 18 16:11:20 2005
@@ -48,7 +48,7 @@
 } llvm_value;
 
 /* llvm_value_construct make a copy of the name string argument */
-void llvm_value_construct(llvm_value *Val, struct llvm_type *Type,
+void llvm_value_construct(llvm_value *Val, const struct llvm_type *Type,
 			  const char *Name, enum ValueType VT);
 void llvm_value_destruct(llvm_value *Val);
 
@@ -90,11 +90,11 @@
           "Operand to V2C is not a constant"), \
    (llvm_constant*)(VAL))
 
-llvm_value *llvm_constant_new(struct llvm_type *Ty, const char *Rep);
+llvm_value *llvm_constant_new(const struct llvm_type *Ty, const char *Rep);
 llvm_value *llvm_constant_new_integral(struct llvm_type *Ty, long long X);
-llvm_value *llvm_constant_get_null(struct llvm_type *Ty);
+llvm_value *llvm_constant_get_null(const struct llvm_type *Ty);
 int llvm_is_null_constant(llvm_value *V);
-void llvm_constant_construct(llvm_constant *C, struct llvm_type *Ty,
+void llvm_constant_construct(llvm_constant *C, const struct llvm_type *Ty,
                              const char *Name, enum ValueType VT,
                              const char *Rep);
 void llvm_constant_destruct(llvm_constant *C);


Index: llvm-gcc/gcc/llvm-types.c
diff -u llvm-gcc/gcc/llvm-types.c:1.22 llvm-gcc/gcc/llvm-types.c:1.23
--- llvm-gcc/gcc/llvm-types.c:1.22	Fri May 13 00:30:45 2005
+++ llvm-gcc/gcc/llvm-types.c	Sat Jun 18 16:11:20 2005
@@ -70,19 +70,19 @@
 }
 
 /* All of the primitive types... */
-static llvm_type TheVoidTy   = { VoidTyID };
-static llvm_type TheBoolTy   = { BoolTyID };
-static llvm_type TheUByteTy  = { UByteTyID };
-static llvm_type TheSByteTy  = { SByteTyID };
-static llvm_type TheUShortTy = { UShortTyID };
-static llvm_type TheShortTy  = { ShortTyID };
-static llvm_type TheUIntTy   = { UIntTyID };
-static llvm_type TheIntTy    = { IntTyID };
-static llvm_type TheULongTy  = { ULongTyID };
-static llvm_type TheLongTy   = { LongTyID };
-static llvm_type TheFloatTy  = { FloatTyID };
-static llvm_type TheDoubleTy = { DoubleTyID };
-static llvm_type TheLabelTy  = { LabelTyID };
+static llvm_type TheVoidTy   = { VoidTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheBoolTy   = { BoolTyID , 0, {{0}}, 0, {0} };
+static llvm_type TheUByteTy  = { UByteTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheSByteTy  = { SByteTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheUShortTy = { UShortTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheShortTy  = { ShortTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheUIntTy   = { UIntTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheIntTy    = { IntTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheULongTy  = { ULongTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheLongTy   = { LongTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheFloatTy  = { FloatTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheDoubleTy = { DoubleTyID, 0, {{0}}, 0, {0} };
+static llvm_type TheLabelTy  = { LabelTyID, 0, {{0}}, 0, {0} };
 llvm_type *VoidTy   = &TheVoidTy;
 llvm_type *BoolTy   = &TheBoolTy;
 llvm_type *UByteTy  = &TheUByteTy;
@@ -637,8 +637,8 @@
 
 #define DEBUG_STRUCT_LAYOUT 0
 
-static void PrintFieldInfo(tree field ATTRIBUTE_UNUSED) {
 #if DEBUG_STRUCT_LAYOUT
+static void PrintFieldInfo(tree field ATTRIBUTE_UNUSED) {
   llvm_type *FieldTy = llvm_type_get_from_tree(TREE_TYPE(field));
   fprintf(stderr, "FIELD: off=%d size=%d ",
           GetFieldOffset(field), GetDeclSize(field));
@@ -646,8 +646,8 @@
   fprintf(stderr, " name='%s' talign=%d dalign=%d\n", DECL_NAME(field) ? 
           IDENTIFIER_POINTER(DECL_NAME(field)) : "<empty>",
           GetFieldAlignmentInBits(field), TYPE_ALIGN(TREE_TYPE(field))/8);
-#endif
 }
+#endif
 
 
 /* For bit-field layout, "integral" types are treated differently than other
@@ -946,7 +946,7 @@
 /* isStructWithHoles - This function returns true if the specified type is a
  * struct and if it has inter-element gaps.
  */
-static isStructWithHoles(llvm_type *Ty) {
+static int isStructWithHoles(llvm_type *Ty) {
   unsigned i, e;
   if (Ty->ID != StructTyID) return 0;
 






More information about the llvm-commits mailing list