[llvm-commits] [dragonegg] r104040 - in /dragonegg/trunk: llvm-abi-default.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-debug.h llvm-types.cpp x86/llvm-target.cpp x86/llvm-target.h

Duncan Sands baldrick at free.fr
Tue May 18 11:13:30 PDT 2010


Author: baldrick
Date: Tue May 18 13:13:30 2010
New Revision: 104040

URL: http://llvm.org/viewvc/llvm-project?rev=104040&view=rev
Log:
Strip trailing white-space, turn tabs into spaces.

Modified:
    dragonegg/trunk/llvm-abi-default.cpp
    dragonegg/trunk/llvm-abi.h
    dragonegg/trunk/llvm-backend.cpp
    dragonegg/trunk/llvm-convert.cpp
    dragonegg/trunk/llvm-debug.cpp
    dragonegg/trunk/llvm-debug.h
    dragonegg/trunk/llvm-types.cpp
    dragonegg/trunk/x86/llvm-target.cpp
    dragonegg/trunk/x86/llvm-target.h

Modified: dragonegg/trunk/llvm-abi-default.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi-default.cpp?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-abi-default.cpp (original)
+++ dragonegg/trunk/llvm-abi-default.cpp Tue May 18 13:13:30 2010
@@ -96,7 +96,7 @@
       ScalarElts.push_back(Ty);
     }
   } else if (LLVM_TRY_PASS_AGGREGATE_CUSTOM(type, ScalarElts,
-					    C.getCallingConv(), &C)) {
+                                            C.getCallingConv(), &C)) {
     // Nothing to do.
   } else if (Ty->isSingleValueType()) {
     C.HandleScalarArgument(Ty, type);

Modified: dragonegg/trunk/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi.h?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-abi.h (original)
+++ dragonegg/trunk/llvm-abi.h Tue May 18 13:13:30 2010
@@ -47,7 +47,7 @@
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-}  
+}
 
 // Plugin headers
 #include "llvm-internal.h"
@@ -95,7 +95,7 @@
   /// 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. 
+  /// from LLVMTy.
   virtual void HandleScalarArgument(const llvm::Type *LLVMTy, tree type,
                             unsigned RealSize = 0) {}
 
@@ -135,8 +135,8 @@
  false
 #endif
 
-// doNotUseShadowReturn - Return true if the specified GCC type 
-// should not be returned using a pointer to struct parameter. 
+// doNotUseShadowReturn - Return true if the specified GCC type
+// should not be returned using a pointer to struct parameter.
 static inline bool doNotUseShadowReturn(tree type, tree fndecl,
                                         CallingConv::ID CC) {
   if (!TYPE_SIZE(type))
@@ -156,7 +156,7 @@
 /// isSingleElementStructOrArray - If this is (recursively) a structure with one
 /// field or an array with one element, return the field type, otherwise return
 /// null.  If ignoreZeroLength, the struct (recursively) may include zero-length
-/// fields in addition to the single element that has data.  If 
+/// fields in addition to the single element that has data.  If
 /// rejectFatBitField, and the single element is a bitfield of a type that's
 /// bigger than the struct, return null anyway.
 static inline
@@ -180,7 +180,7 @@
     for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field))
       if (TREE_CODE(Field) == FIELD_DECL) {
         if (ignoreZeroLength) {
-          if (DECL_SIZE(Field) && 
+          if (DECL_SIZE(Field) &&
               TREE_CODE(DECL_SIZE(Field)) == INTEGER_CST &&
               TREE_INT_CST_LOW(DECL_SIZE(Field)) == 0)
             continue;
@@ -188,7 +188,7 @@
         if (!FoundField) {
           if (rejectFatBitfield &&
               TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST &&
-              TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(Field))) > 
+              TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(Field))) >
               TREE_INT_CST_LOW(TYPE_SIZE(type)))
             return 0;
           FoundField = TREE_TYPE(Field);
@@ -196,7 +196,7 @@
           return 0;   // More than one field.
         }
       }
-    return FoundField ? isSingleElementStructOrArray(FoundField, 
+    return FoundField ? isSingleElementStructOrArray(FoundField,
                                                      ignoreZeroLength, false)
                       : 0;
   case ARRAY_TYPE:
@@ -207,7 +207,7 @@
   }
 }
 
-/// isZeroSizedStructOrUnion - Returns true if this is a struct or union 
+/// isZeroSizedStructOrUnion - Returns true if this is a struct or union
 /// which is zero bits wide.
 static inline bool isZeroSizedStructOrUnion(tree type) {
   if (TREE_CODE(type) != RECORD_TYPE &&
@@ -217,7 +217,7 @@
   return int_size_in_bytes(type) == 0;
 }
 
-// getLLVMScalarTypeForStructReturn - Return LLVM Type if TY can be 
+// getLLVMScalarTypeForStructReturn - Return LLVM Type if TY can be
 // returned as a scalar, otherwise return NULL. This is the default
 // target independent implementation.
 static inline
@@ -251,7 +251,7 @@
 }
 
 #ifndef LLVM_TRY_PASS_AGGREGATE_CUSTOM
-#define LLVM_TRY_PASS_AGGREGATE_CUSTOM(T, E, CC, C)	\
+#define LLVM_TRY_PASS_AGGREGATE_CUSTOM(T, E, CC, C) \
   false
 #endif
 
@@ -326,7 +326,7 @@
 #endif
 
 // LLVM_SHOULD_RETURN_SELT_STRUCT_AS_SCALAR - Return a TYPE tree if this single
-// element struct should be returned using the convention for that scalar TYPE, 
+// element struct should be returned using the convention for that scalar TYPE,
 // 0 otherwise.
 // The returned TYPE must be the same size as X for this to work; that is
 // checked elsewhere.  (Structs where this is not the case can be constructed
@@ -350,14 +350,14 @@
 #define LLVM_SHOULD_RETURN_VECTOR_AS_SHADOW(X,Y) 0
 #endif
 
-// LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be 
+// LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be
 // returned as a scalar, otherwise return NULL.
 #ifndef LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN
 #define LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(X, Y) \
   getLLVMScalarTypeForStructReturn((X), (Y))
 #endif
 
-// LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be 
+// LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be
 // returned as an aggregate, otherwise return NULL.
 #ifndef LLVM_AGGR_TYPE_FOR_STRUCT_RETURN
 #define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X, CC)    \

Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Tue May 18 13:13:30 2010
@@ -1,4 +1,4 @@
-/* High-level LLVM backend interface 
+/* High-level LLVM backend interface
 Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 Contributed by Chris Lattner (sabre at nondot.org)
 
@@ -131,7 +131,7 @@
 std::vector<Constant*> AttributeAnnotateGlobals;
 
 /// PerFunctionPasses - This is the list of cleanup passes run per-function
-/// as each is compiled.  In cases where we are not doing IPO, it includes the 
+/// as each is compiled.  In cases where we are not doing IPO, it includes the
 /// code generator.
 static FunctionPassManager *PerFunctionPasses = 0;
 static PassManager *PerModulePasses = 0;
@@ -289,7 +289,7 @@
   if (optimize_size)
     // Reduce inline limit.
     return 75;
-  
+
   if (optimize >= 3)
     return 275;
   return 225;
@@ -645,7 +645,7 @@
 //TODO  flag_llvm_pch_read = 1;
 //TODO}
 //TODO
-//TODO/// llvm_pch_write_init - Initialize PCH writing. 
+//TODO/// llvm_pch_write_init - Initialize PCH writing.
 //TODOvoid llvm_pch_write_init(void) {
 //TODO  timevar_push(TV_LLVM_INIT);
 //TODO  AsmOutStream = new oFILEstream(asm_out_file);
@@ -664,7 +664,7 @@
 //TODO  // Emit an LLVM .bc file to the output.  This is used when passed
 //TODO  // -emit-llvm -c to the GCC driver.
 //TODO  PerModulePasses->add(createBitcodeWriterPass(*AsmOutStream));
-//TODO  
+//TODO
 //TODO  // Disable emission of .ident into the output file... which is completely
 //TODO  // wrong for llvm/.bc emission cases.
 //TODO  flag_no_ident = 1;
@@ -685,7 +685,7 @@
 //TODO}
 
 static void createPerFunctionOptimizationPasses() {
-  if (PerFunctionPasses) 
+  if (PerFunctionPasses)
     return;
 
   // Create and set up the per-function pass manager.
@@ -718,7 +718,7 @@
   // FIXME: This is disabled right now until bugs can be worked out.  Reenable
   // this for fast -O0 compiles!
   if (!EmitIR && 0) {
-    FunctionPassManager *PM = PerFunctionPasses;    
+    FunctionPassManager *PM = PerFunctionPasses;
     HasPerFunctionPasses = true;
 
     CodeGenOpt::Level OptLevel = CodeGenOpt::Default;  // -O2, -Os, and -Oz
@@ -748,7 +748,7 @@
       exit(1);
     }
   }
-  
+
   if (HasPerFunctionPasses) {
     PerFunctionPasses->doInitialization();
   } else {
@@ -802,7 +802,7 @@
     PerModulePasses->add(createBitcodeWriterPass(*OutStream));
     HasPerModulePasses = true;
   } else if (EmitIR) {
-    // Emit an LLVM .ll file to the output.  This is used when passed 
+    // Emit an LLVM .ll file to the output.  This is used when passed
     // -emit-llvm -S to the GCC driver.
     InitializeOutputStreams(false);
     PerModulePasses->add(createPrintModulePass(OutStream));
@@ -885,17 +885,17 @@
   std::vector<Constant*> InitList;
   std::vector<Constant*> StructInit;
   StructInit.resize(2);
-  
+
   LLVMContext &Context = getGlobalContext();
-  
+
   const Type *FPTy =
     FunctionType::get(Type::getVoidTy(Context),
                       std::vector<const Type*>(), false);
   FPTy = FPTy->getPointerTo();
-  
+
   for (unsigned i = 0, e = Tors.size(); i != e; ++i) {
     StructInit[0] = ConstantInt::get(Type::getInt32Ty(Context), Tors[i].second);
-    
+
     // __attribute__(constructor) can be on a function with any type.  Make sure
     // the pointer is void()*.
     StructInit[1] = TheFolder->CreateBitCast(Tors[i].first, FPTy);
@@ -911,14 +911,14 @@
 /// ConvertMetadataStringToGV - Convert string to global value. Use existing
 /// global if possible.
 Constant* ConvertMetadataStringToGV(const char *str) {
-  
+
   Constant *Init = ConstantArray::get(getGlobalContext(), std::string(str));
 
   // Use cached string if it exists.
   static std::map<Constant*, GlobalVariable*> StringCSTCache;
   GlobalVariable *&Slot = StringCSTCache[Init];
   if (Slot) return Slot;
-  
+
   // Create a new string global.
   GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(), true,
                                           GlobalVariable::PrivateLinkage,
@@ -926,42 +926,42 @@
   GV->setSection("llvm.metadata");
   Slot = GV;
   return GV;
-  
+
 }
 
 /// AddAnnotateAttrsToGlobal - Adds decls that have a annotate attribute to a
 /// vector to be emitted later.
 void AddAnnotateAttrsToGlobal(GlobalValue *GV, tree decl) {
   LLVMContext &Context = getGlobalContext();
-  
+
   // Handle annotate attribute on global.
   tree annotateAttr = lookup_attribute("annotate", DECL_ATTRIBUTES (decl));
   if (annotateAttr == 0)
     return;
-  
+
   // Get file and line number
   Constant *lineNo = ConstantInt::get(Type::getInt32Ty(Context),
                                       DECL_SOURCE_LINE(decl));
   Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl));
   const Type *SBP = Type::getInt8PtrTy(Context);
   file = TheFolder->CreateBitCast(file, SBP);
- 
-  // There may be multiple annotate attributes. Pass return of lookup_attr 
+
+  // There may be multiple annotate attributes. Pass return of lookup_attr
   //  to successive lookups.
   while (annotateAttr) {
-    
+
     // Each annotate attribute is a tree list.
     // Get value of list which is our linked list of args.
     tree args = TREE_VALUE(annotateAttr);
-    
+
     // Each annotate attribute may have multiple args.
     // Treat each arg as if it were a separate annotate attribute.
     for (tree a = args; a; a = TREE_CHAIN(a)) {
       // Each element of the arg list is a tree list, so get value
       tree val = TREE_VALUE(a);
-      
+
       // Assert its a string, and then get that string.
-      assert(TREE_CODE(val) == STRING_CST && 
+      assert(TREE_CODE(val) == STRING_CST &&
              "Annotate attribute arg should always be a string");
       Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val);
       Constant *Element[4] = {
@@ -970,11 +970,11 @@
         file,
         lineNo
       };
- 
+
       AttributeAnnotateGlobals.push_back(
         ConstantStruct::get(Context, Element, 4, false));
     }
-      
+
     // Get next annotate attribute.
     annotateAttr = TREE_CHAIN(annotateAttr);
     if (annotateAttr)
@@ -993,7 +993,7 @@
     return;
 
   // If tree nodes says defer output then do not emit global yet.
-  if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS) 
+  if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)
       && (DECL_DEFER_OUTPUT(decl)))
       return;
 
@@ -1005,7 +1005,7 @@
 
   // Get or create the global variable now.
   GlobalVariable *GV = cast<GlobalVariable>(DECL_LLVM(decl));
-  
+
   // Convert the initializer over.
   Constant *Init;
   if (DECL_INITIAL(decl) == 0 || DECL_INITIAL(decl) == error_mark_node) {
@@ -1018,10 +1018,10 @@
     else
       Init = UndefValue::get(Ty);
   } else {
-    assert((TREE_CONSTANT(DECL_INITIAL(decl)) || 
+    assert((TREE_CONSTANT(DECL_INITIAL(decl)) ||
             TREE_CODE(DECL_INITIAL(decl)) == STRING_CST) &&
            "Global initializer should be constant!");
-    
+
     // Temporarily set an initializer for the global, so we don't infinitely
     // recurse.  If we don't do this, we can hit cases where we see "oh a global
     // with an initializer hasn't been initialized yet, call emit_global on it".
@@ -1047,7 +1047,7 @@
     SET_DECL_LLVM(decl, NGV);
     GV = NGV;
   }
- 
+
   // Set the initializer.
   GV->setInitializer(Init);
 
@@ -1105,12 +1105,12 @@
     if (DECL_SECTION_NAME(decl)) {
       GV->setSection(TREE_STRING_POINTER(DECL_SECTION_NAME(decl)));
 #ifdef LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION
-    } else if (const char *Section = 
+    } else if (const char *Section =
                 LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) {
       GV->setSection(Section);
 #endif
     }
-    
+
     // Set the alignment for the global if one of the following condition is met
     // 1) DECL_ALIGN is better than the alignment as per ABI specification
     // 2) DECL_ALIGN is set by user.
@@ -1137,14 +1137,14 @@
       else
         AttributeUsedGlobals.insert(GV);
     }
-  
+
     // Add annotate attributes for globals
     if (DECL_ATTRIBUTES(decl))
       AddAnnotateAttrsToGlobal(GV, decl);
-  
+
 #ifdef LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION
   } else if (TREE_CODE(decl) == CONST_DECL) {
-    if (const char *Section = 
+    if (const char *Section =
         LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) {
       GV->setSection(Section);
 
@@ -1235,7 +1235,7 @@
 
   if (errorcount || sorrycount)
     return NULL;  // Do not process broken code.
-  
+
   LLVMContext &Context = getGlobalContext();
 
   // Global register variable with asm name, e.g.:
@@ -1246,7 +1246,7 @@
     ValidateRegisterVariable(decl);
     return NULL;
   }
-  
+
 //TODO  timevar_push(TV_LLVM_GLOBALS);
 
   std::string Name;
@@ -1264,17 +1264,17 @@
     }
 #endif
   }
-  
+
   // Specifying a section attribute on a variable forces it into a
   // non-.bss section, and thus it cannot be common.
   if (TREE_CODE(decl) == VAR_DECL && DECL_SECTION_NAME(decl) != NULL_TREE &&
       DECL_INITIAL(decl) == NULL_TREE && DECL_COMMON(decl))
     DECL_COMMON(decl) = 0;
-  
+
   // Variables can't be both common and weak.
   if (TREE_CODE(decl) == VAR_DECL && DECL_WEAK(decl))
     DECL_COMMON(decl) = 0;
-  
+
   // Okay, now we need to create an LLVM global variable or function for this
   // object.  Note that this is quite possibly a forward reference to the
   // object, so its type may change later.
@@ -1286,7 +1286,7 @@
     if (FnEntry == 0) {
       CallingConv::ID CC;
       AttrListPtr PAL;
-      const FunctionType *Ty = 
+      const FunctionType *Ty =
         TheTypeConverter->ConvertFunctionType(TREE_TYPE(decl), decl, NULL,
                                               CC, PAL);
       FnEntry = Function::Create(Ty, Function::ExternalLinkage, Name, TheModule);
@@ -1319,7 +1319,7 @@
 
         // Now we can give GV the proper name.
         FnEntry->takeName(G);
-        
+
         // G is now dead, nuke it.
         G->eraseFromParent();
       }
@@ -1337,7 +1337,7 @@
       Ty = StructType::get(Context);
 
     if (Name.empty()) {   // Global has no name.
-      GV = new GlobalVariable(*TheModule, Ty, false, 
+      GV = new GlobalVariable(*TheModule, Ty, false,
                               GlobalValue::ExternalLinkage, 0, "");
 
       // Check for external weak linkage.
@@ -1353,7 +1353,7 @@
       // If the global has a name, prevent multiple vars with the same name from
       // being created.
       GlobalVariable *GVE = TheModule->getGlobalVariable(Name, true);
-    
+
       if (GVE == 0) {
         GV = new GlobalVariable(*TheModule, Ty, false,
                                 GlobalValue::ExternalLinkage, 0, Name);
@@ -1374,7 +1374,7 @@
         if (GV->getName() != Name) {
           Function *F = TheModule->getFunction(Name);
           assert(F && F->isDeclaration() && "A function turned into a global?");
-          
+
           // Replace any uses of "F" with uses of GV.
           Constant *FInNewType = TheFolder->CreateBitCast(GV, F->getType());
           F->replaceAllUsesWith(FInNewType);
@@ -1384,11 +1384,11 @@
 
           // Now we can give GV the proper name.
           GV->takeName(F);
-          
+
           // F is now dead, nuke it.
           F->eraseFromParent();
         }
-        
+
       } else {
         GV = GVE;  // Global already created, reuse it.
       }
@@ -1474,7 +1474,7 @@
 //FIXMEvoid print_llvm_type(FILE *file, void *LLVM) {
 //FIXME  oFILEstream FS(file);
 //FIXME  FS << "LLVM: ";
-//FIXME  
+//FIXME
 //FIXME  // FIXME: oFILEstream can probably be removed in favor of a new raw_ostream
 //FIXME  // adaptor which would be simpler and more efficient.  In the meantime, just
 //FIXME  // adapt the adaptor.
@@ -2160,7 +2160,7 @@
 
 //TODO  // Emit intermediate file before module level optimization passes are run.
 //TODO  if (flag_debug_llvm_module_opt) {
-//TODO    
+//TODO
 //TODO    static PassManager *IntermediatePM = new PassManager();
 //TODO    IntermediatePM->add(new TargetData(*TheTarget->getTargetData()));
 //TODO
@@ -2169,7 +2169,7 @@
 //TODO    strcat(&asm_intermediate_out_filename[0],".0");
 //TODO    FILE *asm_intermediate_out_file = fopen(asm_intermediate_out_filename, "w+b");
 //TODO    AsmIntermediateOutStream = new oFILEstream(asm_intermediate_out_file);
-//TODO    raw_ostream *AsmIntermediateRawOutStream = 
+//TODO    raw_ostream *AsmIntermediateRawOutStream =
 //TODO      new raw_os_ostream(*AsmIntermediateOutStream);
 //TODO    if (EmitIR && 0)
 //TODO      IntermediatePM->add(createBitcodeWriterPass(*AsmIntermediateOutStream));
@@ -2189,7 +2189,7 @@
   createPerModuleOptimizationPasses();
   if (PerModulePasses)
     PerModulePasses->run(*TheModule);
-  
+
   // Run the code generator, if present.
   if (CodeGenPasses) {
     CodeGenPasses->doInitialization();

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue May 18 13:13:30 2010
@@ -223,7 +223,7 @@
   return *TheTarget->getTargetData();
 }
 
-/// EmitDebugInfo - Return true if debug info is to be emitted for current 
+/// EmitDebugInfo - Return true if debug info is to be emitted for current
 /// function.
 bool TreeToLLVM::EmitDebugInfo() {
   if (TheDebugInfo && !DECL_IGNORED_P(getFUNCTION_DECL()))
@@ -3690,15 +3690,15 @@
 
     // LLVM doesn't handle type 1 or type 3. Deal with that here.
     Value *Tmp = EmitMemory(gimple_call_arg(stmt, 1));
-    
+
     ConstantInt *CI = cast<ConstantInt>(Tmp);
-    
+
     // Clear the bottom bit since we only handle whole objects and shift to turn
     // the second bit into our boolean.
     uint64_t val = (CI->getZExtValue() & 0x2) >> 1;
-    
+
     Value *NewTy = ConstantInt::get(Tmp->getType(), val);
-    
+
     Value* Args[] = {
       EmitMemory(gimple_call_arg(stmt, 0)),
       NewTy

Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Tue May 18 13:13:30 2010
@@ -1,4 +1,4 @@
-/* High-level LLVM backend interface 
+/* High-level LLVM backend interface
 Copyright (C) 2005 Free Software Foundation, Inc.
 Contributed by Jim Laskey (jlaskey at apple.com)
 
@@ -74,7 +74,7 @@
                              std::string &Directory, std::string &FileName) {
   // Look for the directory slash.
   size_t Slash = FullPath.rfind('/');
-  
+
   // If no slash
   if (Slash == std::string::npos) {
     // The entire path is the file name.
@@ -85,7 +85,7 @@
     Directory = FullPath.substr(0, Slash);
     FileName = FullPath.substr(Slash + 1);
   }
-  
+
   // If no directory present then use source working directory.
   if (Directory.empty() || Directory[0] != '/') {
     Directory = std::string(get_src_pwd()) + "/" + Directory;
@@ -112,7 +112,7 @@
     else
       return DECL_ALIGN(Node);
   }
-  
+
   return 0;
 }
 
@@ -137,7 +137,7 @@
 /// node is a TYPE or DECL.
 static StringRef GetNodeName(tree Node) {
   tree Name = NULL;
-  
+
   if (DECL_P(Node)) {
     Name = DECL_NAME(Node);
   } else if (TYPE_P(Node)) {
@@ -152,7 +152,7 @@
       return StringRef(IDENTIFIER_POINTER(DECL_NAME(Name)));
     }
   }
-  
+
   return StringRef();
 }
 
@@ -166,13 +166,13 @@
     return Location;
 
   tree Name = NULL;
-  
+
   if (DECL_P(Node)) {
     Name = DECL_NAME(Node);
   } else if (TYPE_P(Node)) {
     Name = TYPE_NAME(Node);
   }
-  
+
   if (Name) {
     if (TYPE_STUB_DECL(Name)) {
       tree Stub = TYPE_STUB_DECL(Name);
@@ -181,7 +181,7 @@
       Location = expand_location(DECL_SOURCE_LOCATION(Name));
     }
   }
-  
+
   if (!Location.line) {
     if (UseStub && TYPE_STUB_DECL(Node)) {
       tree Stub = TYPE_STUB_DECL(Node);
@@ -190,7 +190,7 @@
       Location = expand_location(DECL_SOURCE_LOCATION(Node));
     }
   }
-  
+
   return Location;
 }
 
@@ -205,10 +205,10 @@
   tree decl_name = DECL_NAME(Node);
   if (decl_name != NULL && IDENTIFIER_POINTER (decl_name) != NULL) {
     if (TREE_PUBLIC(Node) &&
-        DECL_ASSEMBLER_NAME(Node) != DECL_NAME(Node) && 
+        DECL_ASSEMBLER_NAME(Node) != DECL_NAME(Node) &&
         !DECL_ABSTRACT(Node)) {
       return StringRef(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(Node)));
-    } 
+    }
   }
   return StringRef();
 }
@@ -236,7 +236,7 @@
   if (FnNodeName.equals(FnName))
     return FnNodeName;
 
-  // Use name returned by dwarf_name. It is in a temp. storage so make a 
+  // Use name returned by dwarf_name. It is in a temp. storage so make a
   // copy first.
   char *StrPtr = FunctionNames.Allocate<char>(FnName.size() + 1);
   strncpy(StrPtr, FnName.data(), FnName.size());
@@ -254,7 +254,7 @@
   std::map<tree_node *, WeakVH >::iterator I = SPCache.find(FnDecl);
   if (I != SPCache.end()) {
     DISubprogram SPDecl(cast<MDNode>(I->second));
-    DISubprogram SP = 
+    DISubprogram SP =
       DebugFactory.CreateSubprogramDefinition(SPDecl);
     SPDecl->replaceAllUsesWith(SP);
 
@@ -262,7 +262,7 @@
     RegionStack.push_back(WeakVH(SP));
     RegionMap[FnDecl] = WeakVH(SP);
     return;
-  } 
+  }
 
   bool ArtificialFnWithAbstractOrigin = false;
   // If this artificial function has abstract origin then put this function
@@ -281,7 +281,7 @@
   I = SPCache.find(FnDecl);
   if (I != SPCache.end()) {
     DISubprogram SPDecl(cast<MDNode>(I->second));
-    DISubprogram SP = 
+    DISubprogram SP =
       DebugFactory.CreateSubprogramDefinition(SPDecl);
     SPDecl->replaceAllUsesWith(SP);
 
@@ -289,7 +289,7 @@
     RegionStack.push_back(WeakVH(SP));
     RegionMap[FnDecl] = WeakVH(SP);
     return;
-  } 
+  }
 
   // Gather location information.
   expanded_location Loc = GetNodeLocation(FnDecl, false);
@@ -310,7 +310,7 @@
 
   StringRef FnName = getFunctionName(FnDecl);
 
-  DISubprogram SP = 
+  DISubprogram SP =
     DebugFactory.CreateSubprogram(SPContext,
                                   FnName, FnName,
                                   LinkageName,
@@ -319,7 +319,7 @@
                                   Fn->hasInternalLinkage(),
                                   true /*definition*/,
                                   Virtuality, VIndex, ContainingType);
-                          
+
 
   SPCache[FnDecl] = WeakVH(SP);
 
@@ -330,7 +330,7 @@
 
 /// getOrCreateNameSpace - Get name space descriptor for the tree node.
 DINameSpace DebugInfo::getOrCreateNameSpace(tree Node, DIDescriptor Context) {
-  std::map<tree_node *, WeakVH >::iterator I = 
+  std::map<tree_node *, WeakVH >::iterator I =
     NameSpaceCache.find(Node);
   if (I != NameSpaceCache.end())
     return DINameSpace(cast<MDNode>(I->second));
@@ -408,12 +408,12 @@
                                 Loc.line, Ty);
 
   // Insert an llvm.dbg.declare into the current block.
-  Instruction *Call = DebugFactory.InsertDeclare(AI, D, 
+  Instruction *Call = DebugFactory.InsertDeclare(AI, D,
                                                  Builder.GetInsertBlock());
   Call->setDebugLoc(DebugLoc::get(CurLineNo, 0, VarScope));
 }
 
-/// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of 
+/// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of
 /// source line - "llvm.dbg.stoppoint."  Now enabled at -O.
 void DebugInfo::EmitStopPoint(Function *Fn, BasicBlock *CurBB,
                               LLVMBuilder &Builder) {
@@ -423,7 +423,7 @@
       (PrevFullPath == CurFullPath ||
        !strcmp(PrevFullPath, CurFullPath))) return;
   if (!CurFullPath[0] || CurLineNo == 0) return;
-  
+
   // Update last state.
   PrevFullPath = CurFullPath;
   PrevLineNo = CurLineNo;
@@ -468,7 +468,7 @@
   uint64_t Align = NodeAlignInBits(type);
 
   unsigned Encoding = 0;
-  
+
   switch (TREE_CODE(type)) {
   case INTEGER_TYPE:
     if (TYPE_STRING_FLAG (type)) {
@@ -492,7 +492,7 @@
   case BOOLEAN_TYPE:
     Encoding = DW_ATE_boolean;
     break;
-  default: { 
+  default: {
     DEBUGASSERT(0 && "Basic type case missing");
     Encoding = DW_ATE_signed;
     Size = BITS_PER_WORD;
@@ -501,9 +501,9 @@
   }
   }
 
-  return 
+  return
     DebugFactory.CreateBasicType(getOrCreateFile(main_input_filename),
-                                 TypeName, 
+                                 TypeName,
                                  getOrCreateFile(main_input_filename),
                                  0, Size, Align,
                                  0, 0, Encoding);
@@ -531,7 +531,7 @@
   // for the argument types.
   char *FwdTypeName = (char *)alloca(65);
   sprintf(FwdTypeName, "fwd.type.%d", FwdTypeCount++);
-  llvm::DIType FwdType = 
+  llvm::DIType FwdType =
     DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_subroutine_type,
                                      getOrCreateFile(main_input_filename),
                                      FwdTypeName,
@@ -544,12 +544,12 @@
   // Push the struct on region stack.
   RegionStack.push_back(WeakVH(FwdType));
   RegionMap[type] = WeakVH(FwdType);
-  
+
   llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
-  
+
   // Add the result type at least.
   EltTys.push_back(getOrCreateType(TREE_TYPE(type)));
-  
+
   // Set up remainder of arguments.
   bool ProcessedFirstArg = false;
   for (tree arg = TYPE_ARG_TYPES(type); arg; arg = TREE_CHAIN(arg)) {
@@ -564,7 +564,7 @@
     if (!ProcessedFirstArg)
       ProcessedFirstArg = true;
   }
-  
+
   llvm::DIArray EltTypeArray =
     DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size());
 
@@ -575,7 +575,7 @@
 
   llvm::DIType RealType =
     DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_subroutine_type,
-                                     findRegion(TYPE_CONTEXT(type)), 
+                                     findRegion(TYPE_CONTEXT(type)),
                                      StringRef(),
                                      getOrCreateFile(main_input_filename),
                                      0, 0, 0, 0, 0,
@@ -600,34 +600,34 @@
   unsigned Flags = 0;
 
   // Check if this pointer type has a name.
-  if (tree TyName = TYPE_NAME(type)) 
+  if (tree TyName = TYPE_NAME(type))
     if (TREE_CODE(TyName) == TYPE_DECL && !DECL_ORIGINAL_TYPE(TyName)) {
       expanded_location TypeNameLoc = GetNodeLocation(TyName);
-      DIType Ty = 
+      DIType Ty =
         DebugFactory.CreateDerivedType(Tag, findRegion(DECL_CONTEXT(TyName)),
-                                       GetNodeName(TyName), 
+                                       GetNodeName(TyName),
                                        getOrCreateFile(TypeNameLoc.file),
                                        TypeNameLoc.line,
                                        0 /*size*/,
                                        0 /*align*/,
-                                       0 /*offset */, 
-                                       0 /*flags*/, 
+                                       0 /*offset */,
+                                       0 /*flags*/,
                                        FromTy);
       TypeCache[TyName] = WeakVH(Ty);
       return Ty;
     }
-  
+
   StringRef PName = FromTy.getName();
-  DIType PTy = 
-    DebugFactory.CreateDerivedType(Tag, findRegion(TYPE_CONTEXT(type)), 
-                                   Tag == DW_TAG_pointer_type ? 
+  DIType PTy =
+    DebugFactory.CreateDerivedType(Tag, findRegion(TYPE_CONTEXT(type)),
+                                   Tag == DW_TAG_pointer_type ?
                                    StringRef() : PName,
                                    getOrCreateFile(main_input_filename),
-                                   0 /*line no*/, 
+                                   0 /*line no*/,
                                    NodeSizeInBits(type),
                                    NodeAlignInBits(type),
-                                   0 /*offset */, 
-                                   Flags, 
+                                   0 /*offset */,
+                                   Flags,
                                    FromTy);
   return PTy;
 }
@@ -641,26 +641,26 @@
     DEBUGASSERT(0 && "Don't support pascal strings");
     return DIType();
   }
-  
+
   unsigned Tag = 0;
-  
+
   if (TREE_CODE(type) == VECTOR_TYPE) {
     Tag = DW_TAG_vector_type;
     type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
   }
   else
     Tag = DW_TAG_array_type;
-  
+
   // Add the dimensions of the array.  FIXME: This loses CV qualifiers from
   // interior arrays, do we care?  Why aren't nested arrays represented the
   // obvious/recursive way?
   llvm::SmallVector<llvm::DIDescriptor, 8> Subscripts;
-  
+
   // There will be ARRAY_TYPE nodes for each rank.  Followed by the derived
   // type.
   tree atype = type;
   tree EltTy = TREE_TYPE(atype);
-  for (; TREE_CODE(atype) == ARRAY_TYPE; 
+  for (; TREE_CODE(atype) == ARRAY_TYPE;
        atype = TREE_TYPE(atype)) {
     tree Domain = TYPE_DOMAIN(atype);
     if (Domain) {
@@ -677,15 +677,15 @@
     }
     EltTy = TREE_TYPE(atype);
   }
-  
+
   llvm::DIArray SubscriptArray =
     DebugFactory.GetOrCreateArray(Subscripts.data(), Subscripts.size());
   expanded_location Loc = GetNodeLocation(type);
   return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_array_type,
-                                          findRegion(TYPE_CONTEXT(type)), 
+                                          findRegion(TYPE_CONTEXT(type)),
                                           StringRef(),
-                                          getOrCreateFile(Loc.file), 0, 
-                                          NodeSizeInBits(type), 
+                                          getOrCreateFile(Loc.file), 0,
+                                          NodeSizeInBits(type),
                                           NodeAlignInBits(type), 0, 0,
                                           getOrCreateType(EltTy),
                                           SubscriptArray);
@@ -695,7 +695,7 @@
 DIType DebugInfo::createEnumType(tree type) {
   // enum { a, b, ..., z };
   llvm::SmallVector<llvm::DIDescriptor, 32> Elements;
-  
+
   if (TYPE_SIZE(type)) {
     for (tree Link = TYPE_VALUES(type); Link; Link = TREE_CHAIN(Link)) {
       tree EnumValue = TREE_VALUE(Link);
@@ -706,21 +706,21 @@
       Elements.push_back(DebugFactory.CreateEnumerator(EnumName, Value));
     }
   }
-  
+
   llvm::DIArray EltArray =
     DebugFactory.GetOrCreateArray(Elements.data(), Elements.size());
-  
+
   expanded_location Loc = { NULL, 0 };
-  if (TYPE_SIZE(type)) 
+  if (TYPE_SIZE(type))
     // Incomplete enums do not  have any location info.
     Loc = GetNodeLocation(TREE_CHAIN(type), false);
 
   return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
-                                          findRegion(TYPE_CONTEXT(type)), 
-                                          GetNodeName(type), 
-                                          getOrCreateFile(Loc.file), 
+                                          findRegion(TYPE_CONTEXT(type)),
+                                          GetNodeName(type),
+                                          getOrCreateFile(Loc.file),
                                           Loc.line,
-                                          NodeSizeInBits(type), 
+                                          NodeSizeInBits(type),
                                           NodeAlignInBits(type), 0, 0,
                                           llvm::DIType(), EltArray);
 }
@@ -731,7 +731,7 @@
   // struct { a; b; ... z; }; | union { a; b; ... z; };
   unsigned Tag = TREE_CODE(type) == RECORD_TYPE ? DW_TAG_structure_type :
     DW_TAG_union_type;
-  
+
   unsigned RunTimeLang = 0;
 //TODO  if (TYPE_LANG_SPECIFIC (type)
 //TODO      && lang_hooks.types.is_runtime_specific_type (type))
@@ -751,14 +751,14 @@
 //TODO        break;
 //TODO      }
 //TODO    }
-    
+
   // Records and classes and unions can all be recursive.  To handle them,
-  // we first generate a debug descriptor for the struct as a forward 
-  // declaration. Then (if it is a definition) we go through and get debug 
+  // we first generate a debug descriptor for the struct as a forward
+  // declaration. Then (if it is a definition) we go through and get debug
   // info for all of its members.  Finally, we create a descriptor for the
-  // complete type (which may refer to the forward decl if the struct is 
-  // recursive) and replace all  uses of the forward declaration with the 
-  // final definition. 
+  // complete type (which may refer to the forward decl if the struct is
+  // recursive) and replace all  uses of the forward declaration with the
+  // final definition.
   expanded_location Loc = GetNodeLocation(TREE_CHAIN(type), false);
   // FIXME: findRegion() is not able to find context all the time. This
   // means when type names in different context match then FwdDecl is
@@ -776,27 +776,27 @@
   unsigned SFlags = 0;
   DIDescriptor TyContext =  findRegion(TYPE_CONTEXT(type));
 
-  // Check if this type is created while creating context information 
-  // descriptor. 
+  // Check if this type is created while creating context information
+  // descriptor.
   std::map<tree_node *, WeakVH >::iterator I = TypeCache.find(type);
   if (I != TypeCache.end())
     if (MDNode *TN = dyn_cast_or_null<MDNode>(I->second))
       return DIType(TN);
-  
+
   llvm::DICompositeType FwdDecl =
-    DebugFactory.CreateCompositeType(Tag, 
+    DebugFactory.CreateCompositeType(Tag,
                                      TyContext,
                                      FwdName.c_str(),
-                                     getOrCreateFile(Loc.file), 
-                                     Loc.line, 
+                                     getOrCreateFile(Loc.file),
+                                     Loc.line,
                                      0, 0, 0, SFlags | llvm::DIType::FlagFwdDecl,
                                      llvm::DIType(), llvm::DIArray(),
                                      RunTimeLang);
-  
-  // forward declaration, 
-  if (TYPE_SIZE(type) == 0) 
+
+  // forward declaration,
+  if (TYPE_SIZE(type) == 0)
     return FwdDecl;
-  
+
   // Insert into the TypeCache so that recursive uses will find it.
   llvm::MDNode *FDN = FwdDecl;
   llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FDN;
@@ -805,10 +805,10 @@
   // Push the struct on region stack.
   RegionStack.push_back(WeakVH(FwdDecl));
   RegionMap[type] = WeakVH(FwdDecl);
-  
+
   // Convert all the elements.
   llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
-  
+
   if (tree binfo = TYPE_BINFO(type)) {
     VEC(tree,gc) *accesses = BINFO_BASE_ACCESSES (binfo);
 
@@ -827,24 +827,24 @@
           BFlags |= llvm::DIType::FlagPrivate;
       }
 
-      // Check for zero BINFO_OFFSET. 
+      // Check for zero BINFO_OFFSET.
       // FIXME : Is this correct ?
-      unsigned Offset = BINFO_OFFSET(BInfo) ? 
-	getINTEGER_CSTVal(BINFO_OFFSET(BInfo))*8 : 0;
+      unsigned Offset = BINFO_OFFSET(BInfo) ?
+        getINTEGER_CSTVal(BINFO_OFFSET(BInfo))*8 : 0;
 
       if (BINFO_VIRTUAL_P (BInfo))
         Offset = 0 - getINTEGER_CSTVal(BINFO_VPTR_FIELD (BInfo));
       // FIXME : name, size, align etc...
-      DIType DTy = 
-        DebugFactory.CreateDerivedType(DW_TAG_inheritance, 
+      DIType DTy =
+        DebugFactory.CreateDerivedType(DW_TAG_inheritance,
                                        findRegion(TYPE_CONTEXT(type)), StringRef(),
-                                       llvm::DIFile(), 0,0,0, 
+                                       llvm::DIFile(), 0,0,0,
                                        Offset,
                                        BFlags, BaseClass);
       EltTys.push_back(DTy);
     }
   }
-  
+
   // Now add members of this class.
   for (tree Member = TYPE_FIELDS(type); Member;
        Member = TREE_CHAIN(Member)) {
@@ -858,18 +858,18 @@
       // otherwise is a static variable, whose debug info is emitted
       // when through EmitGlobalVariable().
       continue;
-      
+
     if (!OffsetIsLLVMCompatible(Member))
       // FIXME: field with variable or humongous offset.
       // Skip it for now.
       continue;
-      
+
     /* Ignore nameless fields.  */
     if (DECL_NAME (Member) == NULL_TREE
         && !(TREE_CODE (TREE_TYPE (Member)) == UNION_TYPE
              || TREE_CODE (TREE_TYPE (Member)) == RECORD_TYPE))
       continue;
-    
+
     // Field type is the declared type of the field.
     tree FieldNodeType = FieldType(Member);
     DIType MemberType = getOrCreateType(FieldNodeType);
@@ -879,22 +879,22 @@
       MFlags = llvm::DIType::FlagProtected;
     else if (TREE_PRIVATE(Member))
       MFlags = llvm::DIType::FlagPrivate;
-    
+
     DIType DTy =
-      DebugFactory.CreateDerivedType(DW_TAG_member, 
+      DebugFactory.CreateDerivedType(DW_TAG_member,
                                      findRegion(DECL_CONTEXT(Member)),
-                                     MemberName, 
+                                     MemberName,
                                      getOrCreateFile(MemLoc.file),
                                      MemLoc.line, NodeSizeInBits(Member),
                                      NodeAlignInBits(FieldNodeType),
-                                     int_bit_position(Member), 
+                                     int_bit_position(Member),
                                      MFlags, MemberType);
     EltTys.push_back(DTy);
   }
-  
+
   for (tree Member = TYPE_METHODS(type); Member;
        Member = TREE_CHAIN(Member)) {
-    
+
     if (DECL_ABSTRACT_ORIGIN (Member)) continue;
     // Ignore unused aritificial members.
     if (DECL_ARTIFICIAL (Member) && !TREE_USED (Member)) continue;
@@ -919,10 +919,10 @@
         Virtuality = dwarf::DW_VIRTUALITY_virtual;
         ContainingType = getOrCreateType(DECL_CONTEXT(Member));
       }
-      DISubprogram SP = 
-        DebugFactory.CreateSubprogram(findRegion(DECL_CONTEXT(Member)), 
+      DISubprogram SP =
+        DebugFactory.CreateSubprogram(findRegion(DECL_CONTEXT(Member)),
                                       MemberName, MemberName,
-                                      LinkageName, 
+                                      LinkageName,
                                       getOrCreateFile(MemLoc.file),
                                       MemLoc.line, SPTy, false, false,
                                       Virtuality, VIndex, ContainingType,
@@ -931,7 +931,7 @@
       SPCache[Member] = WeakVH(SP);
     }
   }
-  
+
   llvm::DIArray Elements =
     DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size());
 
@@ -949,7 +949,7 @@
     DebugFactory.CreateCompositeType(Tag, findRegion(TYPE_CONTEXT(type)),
                                      GetNodeName(type),
                                      getOrCreateFile(Loc.file),
-                                     Loc.line, 
+                                     Loc.line,
                                      NodeSizeInBits(type), NodeAlignInBits(type),
                                      0, SFlags, llvm::DIType(), Elements,
                                      RunTimeLang, ContainingType);
@@ -964,7 +964,7 @@
 
 /// createVarinatType - Create variant type or return MainTy.
 DIType DebugInfo::createVariantType(tree type, DIType MainTy) {
-  
+
   DIType Ty;
   if (tree TyDef = TYPE_NAME(type)) {
       std::map<tree_node *, WeakVH >::iterator I = TypeCache.find(TyDef);
@@ -973,15 +973,15 @@
           return DIType(cast<MDNode>(M));
     if (TREE_CODE(TyDef) == TYPE_DECL &&  DECL_ORIGINAL_TYPE(TyDef)) {
       expanded_location TypeDefLoc = GetNodeLocation(TyDef);
-      Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, 
+      Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef,
                                           findRegion(DECL_CONTEXT(TyDef)),
-                                          GetNodeName(TyDef), 
+                                          GetNodeName(TyDef),
                                           getOrCreateFile(TypeDefLoc.file),
                                           TypeDefLoc.line,
                                           0 /*size*/,
                                           0 /*align*/,
-                                          0 /*offset */, 
-                                          0 /*flags*/, 
+                                          0 /*offset */,
+                                          0 /*flags*/,
                                           MainTy);
       TypeCache[TyDef] = WeakVH(Ty);
       return Ty;
@@ -989,31 +989,31 @@
   }
 
   if (TYPE_VOLATILE(type)) {
-    Ty = DebugFactory.CreateDerivedType(DW_TAG_volatile_type, 
-                                        findRegion(TYPE_CONTEXT(type)), 
+    Ty = DebugFactory.CreateDerivedType(DW_TAG_volatile_type,
+                                        findRegion(TYPE_CONTEXT(type)),
                                         StringRef(),
                                         getOrCreateFile(main_input_filename),
-                                        0 /*line no*/, 
+                                        0 /*line no*/,
                                         NodeSizeInBits(type),
                                         NodeAlignInBits(type),
-                                        0 /*offset */, 
-                                        0 /* flags */, 
+                                        0 /*offset */,
+                                        0 /* flags */,
                                         MainTy);
     MainTy = Ty;
   }
 
-  if (TYPE_READONLY(type)) 
-    Ty =  DebugFactory.CreateDerivedType(DW_TAG_const_type, 
-                                         findRegion(TYPE_CONTEXT(type)), 
+  if (TYPE_READONLY(type))
+    Ty =  DebugFactory.CreateDerivedType(DW_TAG_const_type,
+                                         findRegion(TYPE_CONTEXT(type)),
                                          StringRef(),
                                          getOrCreateFile(main_input_filename),
-                                         0 /*line no*/, 
+                                         0 /*line no*/,
                                          NodeSizeInBits(type),
                                          NodeAlignInBits(type),
-                                         0 /*offset */, 
-                                         0 /* flags */, 
+                                         0 /*offset */,
+                                         0 /* flags */,
                                          MainTy);
-  
+
   if (TYPE_VOLATILE(type) || TYPE_READONLY(type)) {
     TypeCache[type] = WeakVH(Ty);
     return Ty;
@@ -1033,7 +1033,7 @@
   // Should only be void if a pointer/reference/return type.  Returning NULL
   // allows the caller to produce a non-derived type.
   if (TREE_CODE(type) == VOID_TYPE) return DIType();
-  
+
   // Check to see if the compile unit already has created this type.
   std::map<tree_node *, WeakVH >::iterator I = TypeCache.find(type);
   if (I != TypeCache.end())
@@ -1057,7 +1057,7 @@
       DEBUGASSERT(0 && "Unsupported type");
       return DIType();
     }
-    
+
     case POINTER_TYPE:
     case REFERENCE_TYPE:
       // Do not cache pointer type. The pointer may point to forward declared
@@ -1073,27 +1073,27 @@
     }
 
     case FUNCTION_TYPE:
-    case METHOD_TYPE: 
+    case METHOD_TYPE:
       Ty = createMethodType(type);
       break;
-      
+
     case VECTOR_TYPE:
-    case ARRAY_TYPE: 
+    case ARRAY_TYPE:
       Ty = createArrayType(type);
       break;
-    
-    case ENUMERAL_TYPE: 
+
+    case ENUMERAL_TYPE:
       Ty = createEnumType(type);
       break;
-    
+
     case RECORD_TYPE:
     case QUAL_UNION_TYPE:
-    case UNION_TYPE: 
+    case UNION_TYPE:
       return createStructType(type);
       break;
 
     case INTEGER_TYPE:
-    case REAL_TYPE:   
+    case REAL_TYPE:
     case COMPLEX_TYPE:
     case BOOLEAN_TYPE:
       Ty = createBasicType(type);
@@ -1110,11 +1110,11 @@
 
   // Each input file is encoded as a separate compile unit in LLVM
   // debugging information output. However, many target specific tool chains
-  // prefer to encode only one compile unit in an object file. In this 
+  // prefer to encode only one compile unit in an object file. In this
   // situation, the LLVM code generator will include  debugging information
-  // entities in the compile unit that is marked as main compile unit. The 
+  // entities in the compile unit that is marked as main compile unit. The
   // code generator accepts maximum one main compile unit per module. If a
-  // module does not contain any main compile unit then the code generator 
+  // module does not contain any main compile unit then the code generator
   // will emit multiple compile units in the output object file.
   if (!strcmp (main_input_filename, ""))
     TheCU = getOrCreateCompileUnit("<stdin>", true);
@@ -1122,7 +1122,7 @@
     TheCU = getOrCreateCompileUnit(main_input_filename, true);
 }
 
-/// getOrCreateCompileUnit - Get the compile unit from the cache or 
+/// getOrCreateCompileUnit - Get the compile unit from the cache or
 /// create a new one if necessary.
 DICompileUnit DebugInfo::getOrCreateCompileUnit(const char *FullPath,
                                                 bool isMain) {
@@ -1137,7 +1137,7 @@
   std::string Directory;
   std::string FileName;
   DirectoryAndFile(FullPath, Directory, FileName);
-  
+
   // Set up Language number.
   unsigned LangTag;
   const std::string LanguageName(lang_hooks.name);
@@ -1155,13 +1155,13 @@
     LangTag = DW_LANG_Java;
   else if (LanguageName == "GNU Objective-C")
     LangTag = DW_LANG_ObjC;
-  else if (LanguageName == "GNU Objective-C++") 
+  else if (LanguageName == "GNU Objective-C++")
     LangTag = DW_LANG_ObjC_plus_plus;
   else
     LangTag = DW_LANG_C89;
 
   StringRef Flags;
-  
+
   // flag_objc_abi represents Objective-C runtime version number. It is zero
   // for all other language.
   unsigned ObjcRunTimeVer = 0;

Modified: dragonegg/trunk/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.h?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.h (original)
+++ dragonegg/trunk/llvm-debug.h Tue May 18 13:13:30 2010
@@ -51,7 +51,7 @@
 class DebugInfo {
 private:
   Module *M;                            // The current module.
-  DIFactory DebugFactory;               
+  DIFactory DebugFactory;
   const char *CurFullPath;              // Previous location file encountered.
   int CurLineNo;                        // Previous location line# encountered.
   const char *PrevFullPath;             // Previous location file encountered.
@@ -61,23 +61,23 @@
   DICompileUnit TheCU;                  // The compile unit.
 
   // This counter counts debug info for forward referenced subroutine types.
-  // This counter is used to create unique name for such types so that their 
+  // This counter is used to create unique name for such types so that their
   // debug info (through MDNodes) is not shared accidently.
   unsigned FwdTypeCount;
 
   std::map<tree_node *, WeakVH > TypeCache;
-                                        // Cache of previously constructed 
+                                        // Cache of previously constructed
                                         // Types.
   std::map<tree_node *, WeakVH > SPCache;
-                                        // Cache of previously constructed 
+                                        // Cache of previously constructed
                                         // Subprograms.
   std::map<tree_node *, WeakVH> NameSpaceCache;
-                                        // Cache of previously constructed name 
+                                        // Cache of previously constructed name
                                         // spaces.
 
   SmallVector<WeakVH, 4> RegionStack;
                                         // Stack to track declarative scopes.
-  
+
   std::map<tree_node *, WeakVH> RegionMap;
 
   /// FunctionNames - This is a storage for function names that are
@@ -95,7 +95,7 @@
   // Accessors.
   void setLocationFile(const char *FullPath) { CurFullPath = FullPath; }
   void setLocationLine(int LineNo)           { CurLineNo = LineNo; }
-  
+
   /// EmitFunctionStart - Constructs the debug code for entering a function -
   /// "llvm.dbg.func.start."
   void EmitFunctionStart(tree_node *FnDecl, Function *Fn, BasicBlock *CurBB);
@@ -109,10 +109,10 @@
   void EmitDeclare(tree_node *decl, unsigned Tag, const char *Name,
                    tree_node *type, Value *AI, LLVMBuilder &Builder);
 
-  /// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of 
+  /// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of
   /// source line.
   void EmitStopPoint(Function *Fn, BasicBlock *CurBB, LLVMBuilder &Builder);
-                     
+
   /// EmitGlobalVariable - Emit information about a global variable.
   ///
   void EmitGlobalVariable(GlobalVariable *GV, tree_node *decl);
@@ -151,7 +151,7 @@
 
   /// findRegion - Find tree_node N's region.
   DIDescriptor findRegion(tree_node *n);
-  
+
   /// getOrCreateNameSpace - Get name space descriptor for the tree node.
   DINameSpace getOrCreateNameSpace(tree_node *Node, DIDescriptor Context);
 

Modified: dragonegg/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-types.cpp?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/llvm-types.cpp (original)
+++ dragonegg/trunk/llvm-types.cpp Tue May 18 13:13:30 2010
@@ -1,4 +1,4 @@
-/* Tree type to LLVM type converter 
+/* Tree type to LLVM type converter
 Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 Contributed by Chris Lattner (sabre at nondot.org)
 
@@ -110,13 +110,13 @@
 //TODO  for (unsigned i = 0; i < LTypesNames->getNumOperands(); ++i) {
 //TODO    const Type *Ty = NULL;
 //TODO
-//TODO    if (ConstantArray *CA = 
+//TODO    if (ConstantArray *CA =
 //TODO        dyn_cast<ConstantArray>(LTypesNames->getOperand(i))) {
 //TODO      std::string Str = CA->getAsString();
 //TODO      Ty = TheModule->getTypeByName(Str);
 //TODO      assert (Ty != NULL && "Invalid Type in LTypes string table");
-//TODO    } 
-//TODO    // If V is not a string then it is empty. Insert NULL to represent 
+//TODO    }
+//TODO    // If V is not a string then it is empty. Insert NULL to represent
 //TODO    // empty entries.
 //TODO    LTypes.push_back(Ty);
 //TODO  }
@@ -131,8 +131,8 @@
 //TODO// Create a string table to hold these LLVM types' names. This string
 //TODO// table will be used to recreate LTypes vector after loading PCH.
 //TODOvoid writeLLVMTypesStringTable() {
-//TODO  
-//TODO  if (LTypes.empty()) 
+//TODO
+//TODO  if (LTypes.empty())
 //TODO    return;
 //TODO
 //TODO  std::vector<Constant *> LTypesNames;
@@ -166,9 +166,9 @@
 //TODO  Constant *LTypesNameTable = ConstantStruct::get(Context, LTypesNames, false);
 //TODO
 //TODO  // Create variable to hold this string table.
-//TODO  GlobalVariable *GV = new GlobalVariable(*TheModule,   
+//TODO  GlobalVariable *GV = new GlobalVariable(*TheModule,
 //TODO                                          LTypesNameTable->getType(), true,
-//TODO                                          GlobalValue::ExternalLinkage, 
+//TODO                                          GlobalValue::ExternalLinkage,
 //TODO                                          LTypesNameTable,
 //TODO                                          "llvm.pch.types");
 //TODO}
@@ -193,7 +193,7 @@
   ArgTysP.reserve(ArgTys.size());
   for (unsigned i = 0, e = ArgTys.size(); i != e; ++i)
     ArgTysP.push_back(ArgTys[i]);
-  
+
   return FunctionType::get(Res, ArgTysP, isVarArg);
 }
 
@@ -336,7 +336,7 @@
     virtual void refineAbstractType(const DerivedType *OldTy,
                                     const Type *NewTy);
     virtual void typeBecameConcrete(const DerivedType *AbsTy);
-    
+
     // TypeUsers - For each abstract LLVM type, we keep track of all of the GCC
     // types that point to it.
     std::map<const Type*, std::vector<tree> > TypeUsers;
@@ -359,7 +359,7 @@
     void RemoveTypeFromTable(tree type);
     void dump() const;
   };
-  
+
   /// TypeDB - The main global type database.
   TypeRefinementDatabase TypeDB;
 }
@@ -371,7 +371,7 @@
   if (!Ty->isAbstract()) return;
   std::map<const Type*, std::vector<tree> >::iterator I = TypeUsers.find(Ty);
   assert(I != TypeUsers.end() && "Using an abstract type but not in table?");
-  
+
   bool FoundIt = false;
   for (unsigned i = 0, e = I->second.size(); i != e; ++i)
     if (I->second[i] == type) {
@@ -381,7 +381,7 @@
       break;
     }
   assert(FoundIt && "Using an abstract type but not in table?");
-  
+
   // If the type plane is now empty, nuke it.
   if (I->second.empty()) {
     TypeUsers.erase(I);
@@ -396,7 +396,7 @@
 void TypeRefinementDatabase::refineAbstractType(const DerivedType *OldTy,
                                                 const Type *NewTy) {
   if (OldTy == NewTy && OldTy->isAbstract()) return; // Nothing to do.
-  
+
   std::map<const Type*, std::vector<tree> >::iterator I = TypeUsers.find(OldTy);
   assert(I != TypeUsers.end() && "Using an abstract type but not in table?");
 
@@ -411,7 +411,7 @@
     // everything over and stop monitoring OldTy.
     std::vector<tree> &NewSlot = TypeUsers[NewTy];
     if (NewSlot.empty()) NewTy->addAbstractTypeUser(this);
-    
+
     for (unsigned i = 0, e = I->second.size(); i != e; ++i) {
       NewSlot.push_back(I->second[i]);
       SET_TYPE_LLVM(I->second[i], NewTy);
@@ -419,11 +419,11 @@
   }
 
   TypeUsers.erase(I);
-  
+
   // Next, remove OldTy's entry in the TargetData object if it has one.
   if (const StructType *STy = dyn_cast<StructType>(OldTy))
     getTargetData().InvalidateStructLayoutInfo(STy);
-  
+
   OldTy->removeAbstractTypeUser(this);
 }
 
@@ -534,7 +534,7 @@
       FindLLVMTypePadding(ATy->getElementType(), 0, BitOffset+i*EltSize,
                           Padding);
   }
-  
+
   // primitive and vector types have no padding.
 }
 
@@ -644,13 +644,13 @@
   }
 }
 
-bool TypeConverter::GCCTypeOverlapsWithLLVMTypePadding(tree type, 
+bool TypeConverter::GCCTypeOverlapsWithLLVMTypePadding(tree type,
                                                        const Type *Ty) {
-  
+
   // Start by finding all of the padding in the LLVM Type.
   SmallVector<std::pair<uint64_t,uint64_t>, 16> StructPadding;
   FindLLVMTypePadding(Ty, type, 0, StructPadding);
-  
+
   for (unsigned i = 0, e = StructPadding.size(); i != e; ++i)
     if (GCCTypeOverlapsWithPadding(type, StructPadding[i].first,
                                    StructPadding[i].second))
@@ -1000,7 +1000,7 @@
   if (TREE_CODE(ArgTy) == BOOLEAN_TYPE) {
     if (TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)) < INT_TYPE_SIZE)
       return Attribute::ZExt;
-  } else if (TREE_CODE(ArgTy) == INTEGER_TYPE && 
+  } else if (TREE_CODE(ArgTy) == INTEGER_TYPE &&
              TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)) < INT_TYPE_SIZE) {
     if (TYPE_UNSIGNED(ArgTy))
       return Attribute::ZExt;
@@ -1030,7 +1030,7 @@
 #ifdef TARGET_ADJUST_LLVM_CC
   TARGET_ADJUST_LLVM_CC(CallingConv, type);
 #endif
-  
+
   // Builtins are always prototyped, so this isn't one.
   ABIConverter.HandleReturnType(ReturnType, current_function_decl, false);
 
@@ -1097,7 +1097,7 @@
 
   ABIConverter.HandleReturnType(TREE_TYPE(type), current_function_decl,
                                 decl ? DECL_BUILT_IN(decl) : false);
-  
+
   // Compute attributes for return type (and function attributes).
   SmallVector<AttributeWithIndex, 8> Attrs;
   Attributes FnAttributes = Attribute::None;
@@ -1177,10 +1177,10 @@
 #ifdef LLVM_TARGET_ENABLE_REGPARM
   LLVM_TARGET_INIT_REGPARM(local_regparam, local_fp_regparam, type);
 #endif // LLVM_TARGET_ENABLE_REGPARM
-  
+
   // Keep track of whether we see a byval argument.
   bool HasByVal = false;
-  
+
   // Check if we have a corresponding decl to inspect.
   tree DeclArgs = (decl) ? DECL_ARGUMENTS(decl) : NULL;
   // Loop over all of the arguments, adding them as we go.
@@ -1198,14 +1198,14 @@
         // Don't nuke last argument.
         ArgTypes.erase(ArgTypes.begin()+1, ArgTypes.end());
       Args = 0;
-      break;        
+      break;
     }
-    
+
     // Determine if there are any attributes for this param.
     Attributes PAttributes = Attribute::None;
 
     unsigned OldSize = ArgTypes.size();
-    
+
     ABIConverter.HandleArgument(ArgTy, ScalarArgs, &PAttributes);
 
     // Compute zext/sext attributes.
@@ -1220,7 +1220,7 @@
       if (TYPE_RESTRICT(RestrictArgTy))
         PAttributes |= Attribute::NoAlias;
     }
-    
+
 #ifdef LLVM_TARGET_ENABLE_REGPARM
     // Allow the target to mark this as inreg.
     if (INTEGRAL_TYPE_P(ArgTy) || POINTER_TYPE_P(ArgTy) ||
@@ -1229,7 +1229,7 @@
                                     TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)),
                                     local_regparam, local_fp_regparam);
 #endif // LLVM_TARGET_ENABLE_REGPARM
-    
+
     if (PAttributes != Attribute::None) {
       HasByVal |= PAttributes & Attribute::ByVal;
 
@@ -1239,11 +1239,11 @@
         Attrs.push_back(AttributeWithIndex::get(i, PAttributes));
       }
     }
-      
+
     if (DeclArgs)
       DeclArgs = TREE_CHAIN(DeclArgs);
   }
-  
+
   // If there is a byval argument then it is not safe to mark the function
   // 'readnone' or 'readonly': gcc permits a 'const' or 'pure' function to
   // write to struct arguments passed by value, but in LLVM this becomes a
@@ -1285,7 +1285,7 @@
 
   StructTypeConversionInfo(TargetMachine &TM, unsigned GCCAlign, bool P)
     : TD(*TM.getTargetData()), GCCStructAlignmentInBytes(GCCAlign),
-      Packed(P), AllBitFields(true), LastFieldStartsAtNonByteBoundry(false), 
+      Packed(P), AllBitFields(true), LastFieldStartsAtNonByteBoundry(false),
       ExtraBitsAvailable(0) {}
 
   void lastFieldStartsAtNonByteBoundry(bool value) {
@@ -1311,19 +1311,19 @@
   unsigned getGCCStructAlignmentInBytes() const {
     return GCCStructAlignmentInBytes;
   }
-  
+
   /// getTypeAlignment - Return the alignment of the specified type in bytes.
   ///
   unsigned getTypeAlignment(const Type *Ty) const {
     return Packed ? 1 : TD.getABITypeAlignment(Ty);
   }
-  
+
   /// getTypeSize - Return the size of the specified type in bytes.
   ///
   uint64_t getTypeSize(const Type *Ty) const {
     return TD.getTypeAllocSize(Ty);
   }
-  
+
   /// getLLVMType - Return the LLVM type for the specified object.
   ///
   const Type *getLLVMType() const {
@@ -1332,7 +1332,7 @@
     return StructType::get(Context, Elements,
                            Packed || (!Elements.empty() && AllBitFields));
   }
-  
+
   /// getAlignmentAsLLVMStruct - Return the alignment of this struct if it were
   /// converted to an LLVM type.
   uint64_t getAlignmentAsLLVMStruct() const {
@@ -1358,7 +1358,7 @@
   void RemoveExtraBytes () {
 
     unsigned NoOfBytesToRemove = ExtraBitsAvailable/8;
-    
+
     if (!Packed && !AllBitFields)
       return;
 
@@ -1429,22 +1429,22 @@
     // declared type, not the shrunk-to-fit type that GCC gives us in TREE_TYPE.
     unsigned ByteAlignment = getTypeAlignment(Ty);
     uint64_t NextByteOffset = getNewElementByteOffset(ByteAlignment);
-    if (NextByteOffset > ByteOffset || 
+    if (NextByteOffset > ByteOffset ||
         ByteAlignment > getGCCStructAlignmentInBytes()) {
       // LLVM disagrees as to where this field should go in the natural field
       // ordering.  Therefore convert to a packed struct and try again.
       return false;
     }
-    
+
     // If alignment won't round us up to the right boundary, insert explicit
     // padding.
     if (NextByteOffset < ByteOffset) {
       uint64_t CurOffset = getNewElementByteOffset(1);
       const Type *Pad = Type::getInt8Ty(Context);
-      if (SavedTy && LastFieldStartsAtNonByteBoundry) 
+      if (SavedTy && LastFieldStartsAtNonByteBoundry)
         // We want to reuse SavedType to access this bit field.
-        // e.g. struct __attribute__((packed)) { 
-        //  unsigned int A, 
+        // e.g. struct __attribute__((packed)) {
+        //  unsigned int A,
         //  unsigned short B : 6,
         //                 C : 15;
         //  char D; };
@@ -1456,29 +1456,29 @@
     }
     return true;
   }
-  
+
   /// FieldNo - Remove the specified field and all of the fields that come after
   /// it.
   void RemoveFieldsAfter(unsigned FieldNo) {
     Elements.erase(Elements.begin()+FieldNo, Elements.end());
-    ElementOffsetInBytes.erase(ElementOffsetInBytes.begin()+FieldNo, 
+    ElementOffsetInBytes.erase(ElementOffsetInBytes.begin()+FieldNo,
                                ElementOffsetInBytes.end());
     ElementSizeInBytes.erase(ElementSizeInBytes.begin()+FieldNo,
                              ElementSizeInBytes.end());
-    PaddingElement.erase(PaddingElement.begin()+FieldNo, 
+    PaddingElement.erase(PaddingElement.begin()+FieldNo,
                          PaddingElement.end());
   }
-  
+
   /// getNewElementByteOffset - If we add a new element with the specified
   /// alignment, what byte offset will it land at?
   uint64_t getNewElementByteOffset(unsigned ByteAlignment) {
     if (Elements.empty()) return 0;
-    uint64_t LastElementEnd = 
+    uint64_t LastElementEnd =
       ElementOffsetInBytes.back() + ElementSizeInBytes.back();
-    
+
     return (LastElementEnd+ByteAlignment-1) & ~(ByteAlignment-1);
   }
-  
+
   /// addElement - Add an element to the structure with the specified type,
   /// offset and size.
   void addElement(const Type *Ty, uint64_t Offset, uint64_t Size,
@@ -1490,7 +1490,7 @@
     lastFieldStartsAtNonByteBoundry(false);
     ExtraBitsAvailable = 0;
   }
-  
+
   /// getFieldEndOffsetInBytes - Return the byte offset of the byte immediately
   /// after the specified field.  For example, if FieldNo is 0 and the field
   /// is 4 bytes in size, this will return 4.
@@ -1498,7 +1498,7 @@
     assert(FieldNo < ElementOffsetInBytes.size() && "Invalid field #!");
     return ElementOffsetInBytes[FieldNo]+ElementSizeInBytes[FieldNo];
   }
-  
+
   /// getEndUnallocatedByte - Return the first byte that isn't allocated at the
   /// end of a structure.  For example, for {}, it's 0, for {int} it is 4, for
   /// {int,short}, it is 6.
@@ -1562,7 +1562,7 @@
     // Instead of inserting a nice whole field, insert a small array of ubytes.
     NewFieldTy = ArrayType::get(Type::getInt8Ty(Context), (Size+7)/8);
   }
-  
+
   // Finally, add the new field.
   addElement(NewFieldTy, FirstUnallocatedByte, getTypeSize(NewFieldTy));
   ExtraBitsAvailable = NewFieldTy->getPrimitiveSizeInBits() - Size;
@@ -1586,7 +1586,7 @@
 /// Return true if and only if field no. N from struct type T is a padding
 /// element added to match llvm struct type size and gcc struct type size.
 bool isPaddingElement(tree type, unsigned index) {
-  
+
   StructTypeConversionInfo *Info = StructTypeInfoMap[type];
 
   // If info is not available then be conservative and return false.
@@ -1595,7 +1595,7 @@
 
   assert ( Info->Elements.size() == Info->PaddingElement.size()
            && "Invalid StructTypeConversionInfo");
-  assert ( index < Info->PaddingElement.size()  
+  assert ( index < Info->PaddingElement.size()
            && "Invalid PaddingElement index");
   return Info->PaddingElement[index];
 }
@@ -1674,7 +1674,7 @@
     // LLVM disagrees as to where this field should go in the natural field
     // ordering.  Therefore convert to a packed struct and try again.
     return false;
-  } 
+  }
   else if (TYPE_USER_ALIGN(TREE_TYPE(Field))
            && (unsigned)DECL_ALIGN(Field) != 8 * Info.getTypeAlignment(Ty)
            && !Info.isPacked()) {
@@ -1697,7 +1697,7 @@
 /// (potentially multiple) integer fields of integer type.  This ensures that
 /// initialized globals with bitfields can have the initializers for the
 /// bitfields specified.
-void TypeConverter::DecodeStructBitField(tree_node *Field, 
+void TypeConverter::DecodeStructBitField(tree_node *Field,
                                          StructTypeConversionInfo &Info) {
   unsigned FieldSizeInBits = TREE_INT_CST_LOW(DECL_SIZE(Field));
 
@@ -1707,7 +1707,7 @@
   // Get the starting offset in the record.
   uint64_t StartOffsetInBits = getFieldOffsetInBits(Field);
   uint64_t EndBitOffset    = FieldSizeInBits+StartOffsetInBits;
-  
+
   // If the last inserted LLVM field completely contains this bitfield, just
   // ignore this field.
   if (!Info.Elements.empty()) {
@@ -1720,10 +1720,10 @@
       // Already contained in previous field. Update remaining extra bits that
       // are available.
       Info.extraBitsAvailable(Info.getEndUnallocatedByte()*8 - EndBitOffset);
-      return; 
+      return;
     }
   }
-  
+
   // Otherwise, this bitfield lives (potentially) partially in the preceeding
   // field and in fields that exist after it.  Add integer-typed fields to the
   // LLVM struct such that there are no holes in the struct where the bitfield
@@ -1774,13 +1774,13 @@
       return;
     }
 
-    // Otherwise, this field's starting point is inside previously used byte. 
+    // Otherwise, this field's starting point is inside previously used byte.
     // This happens with Packed bit fields. In this case one LLVM Field is
     // used to access previous field and current field.
-    unsigned prevFieldTypeSizeInBits = 
+    unsigned prevFieldTypeSizeInBits =
       Info.ElementSizeInBytes[Info.Elements.size() - 1] * 8;
 
-    unsigned NumBitsRequired = prevFieldTypeSizeInBits 
+    unsigned NumBitsRequired = prevFieldTypeSizeInBits
       + (FieldSizeInBits - AvailableBits);
 
     if (NumBitsRequired > 64) {
@@ -1792,13 +1792,13 @@
       // hold both fields.
       Info.RemoveFieldsAfter(Info.Elements.size() - 1);
       for (unsigned idx = 0; idx < (prevFieldTypeSizeInBits/8); ++idx)
-	FirstUnallocatedByte--;
+        FirstUnallocatedByte--;
     }
     Info.addNewBitField(NumBitsRequired, ExtraSizeInBits, FirstUnallocatedByte);
     // Do this after adding Field.
     Info.lastFieldStartsAtNonByteBoundry(true);
     return;
-  } 
+  }
 
   if (StartOffsetInBits > FirstUnallocatedByte*8) {
     // If there is padding between the last field and the struct, insert
@@ -1806,7 +1806,7 @@
     unsigned PadBytes = 0;
     unsigned PadBits = 0;
     if (StartOffsetFromByteBoundry != 0) {
-      // New field does not start at byte boundry. 
+      // New field does not start at byte boundry.
       PadBits = StartOffsetInBits - (FirstUnallocatedByte*8);
       PadBytes = PadBits/8;
       PadBits = PadBits - PadBytes*8;
@@ -1924,21 +1924,21 @@
 //
 // The TYPE nodes gcc builds for classes represent that class as it looks
 // standing alone.  Thus B is size 12 and looks like { vptr; i2; baseclass A; }
-// However, this is not the layout used when that class is a base class for 
+// However, this is not the layout used when that class is a base class for
 // some other class, yet the same TYPE node is still used.  D in the above has
 // both a BINFO list entry and a FIELD that reference type B, but the virtual
 // base class A within B is not allocated in that case; B-within-D is only
 // size 8.  The correct size is in the FIELD node (does not match the size
 // in its child TYPE node.)  The fields to be omitted from the child TYPE,
-// as far as I can tell, are always the last ones; but also, there is a 
-// TYPE_DECL node sitting in the middle of the FIELD list separating virtual 
+// as far as I can tell, are always the last ones; but also, there is a
+// TYPE_DECL node sitting in the middle of the FIELD list separating virtual
 // base classes from everything else.
 //
 // Similarly, a nonvirtual base class which has virtual base classes might
 // not contain those virtual base classes when used as a nonvirtual base class.
 // There is seemingly no way to detect this except for the size differential.
 //
-// For LLVM purposes, we build a new type for B-within-D that 
+// For LLVM purposes, we build a new type for B-within-D that
 // has the correct size and layout for that usage.
 
 const Type *TypeConverter::ConvertRECORD(tree type) {
@@ -1970,7 +1970,7 @@
     for (unsigned j = i; j && Fields[j].second < Fields[j-1].second; j--)
       std::swap(Fields[j], Fields[j-1]);
 
-  StructTypeConversionInfo *Info = 
+  StructTypeConversionInfo *Info =
     new StructTypeConversionInfo(*TheTarget, TYPE_ALIGN(type) / 8,
                                  TYPE_PACKED(type));
 

Modified: dragonegg/trunk/x86/llvm-target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.cpp?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/x86/llvm-target.cpp (original)
+++ dragonegg/trunk/x86/llvm-target.cpp Tue May 18 13:13:30 2010
@@ -1,4 +1,4 @@
-/* High-level LLVM backend interface 
+/* High-level LLVM backend interface
 Copyright (C) 2005 Free Software Foundation, Inc.
 Contributed by Evan Cheng (evan.cheng at apple.com)
 
@@ -911,7 +911,7 @@
       error_at(gimple_location(stmt), "mask must be an immediate");
       Result = Ops[0];
     }
-    
+
     return true;
   IX86_BUILTIN_PUNPCKHBW:
     Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 12, 5, 13,
@@ -1262,7 +1262,7 @@
     Value *Ptr  = CreateTemporary(Type::getInt32Ty(Context));
     Value *BPtr = Builder.CreateBitCast(Ptr, Type::getInt8PtrTy(Context));
     Builder.CreateCall(stmxcsr, BPtr);
-    
+
     Result = Builder.CreateLoad(Ptr);
     return true;
   }
@@ -1271,43 +1271,43 @@
 
       // In the header we multiply by 8, correct that back now.
       unsigned shiftVal = (cast<ConstantInt>(Ops[2])->getZExtValue())/8;
-    
+
       // If palignr is shifting the pair of input vectors less than 9 bytes,
       // emit a shuffle instruction.
       if (shiftVal <= 8) {
         const llvm::Type *IntTy = Type::getInt32Ty(Context);
         const llvm::Type *EltTy = Type::getInt8Ty(Context);
         const llvm::Type *VecTy = VectorType::get(EltTy, 8);
-        
+
         Ops[1] = Builder.CreateBitCast(Ops[1], VecTy);
         Ops[0] = Builder.CreateBitCast(Ops[0], VecTy);
 
         SmallVector<Constant*, 8> Indices;
         for (unsigned i = 0; i != 8; ++i)
           Indices.push_back(ConstantInt::get(IntTy, shiftVal + i));
-      
+
         Value* SV = ConstantVector::get(Indices.begin(), Indices.size());
         Result = Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr");
         return true;
       }
-    
+
       // If palignr is shifting the pair of input vectors more than 8 but less
       // than 16 bytes, emit a logical right shift of the destination.
       if (shiftVal < 16) {
         // MMX has these as 1 x i64 vectors for some odd optimization reasons.
         const llvm::Type *EltTy = Type::getInt64Ty(Context);
         const llvm::Type *VecTy = VectorType::get(EltTy, 1);
-      
+
         Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
         Ops[1] = ConstantInt::get(VecTy, (shiftVal-8) * 8);
-      
+
         // create i32 constant
         Function *F = Intrinsic::getDeclaration(TheModule,
                                                 Intrinsic::x86_mmx_psrl_q);
         Result = Builder.CreateCall(F, &Ops[0], &Ops[0] + 2, "palignr");
         return true;
       }
-    
+
       // If palignr is shifting the pair of vectors more than 32 bytes,
       // emit zero.
       Result = Constant::getNullValue(ResultType);
@@ -1328,7 +1328,7 @@
         const llvm::Type *IntTy = Type::getInt32Ty(Context);
         const llvm::Type *EltTy = Type::getInt8Ty(Context);
         const llvm::Type *VecTy = VectorType::get(EltTy, 16);
-        
+
         Ops[1] = Builder.CreateBitCast(Ops[1], VecTy);
         Ops[0] = Builder.CreateBitCast(Ops[0], VecTy);
 
@@ -1353,7 +1353,7 @@
 
         // create i32 constant
         llvm::Function *F = Intrinsic::getDeclaration(TheModule,
-                                                  Intrinsic::x86_sse2_psrl_dq);        
+                                                  Intrinsic::x86_sse2_psrl_dq);
         Result = Builder.CreateCall(F, &Ops[0], &Ops[0] + 2, "palignr");
         return true;
       }
@@ -1426,26 +1426,26 @@
   for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
     const Type *EltTy = STy->getElementType(i);
     // 32 and 64-bit integers are fine, as are float and double.  Long double
-    // (which can be picked as the type for a union of 16 bytes) is not fine, 
+    // (which can be picked as the type for a union of 16 bytes) is not fine,
     // as loads and stores of it get only 10 bytes.
     if (EltTy == Type::getInt32Ty(Context) ||
-        EltTy == Type::getInt64Ty(Context) || 
+        EltTy == Type::getInt64Ty(Context) ||
         EltTy == Type::getFloatTy(Context) ||
         EltTy == Type::getDoubleTy(Context) ||
         EltTy->isPointerTy()) {
       Elts.push_back(EltTy);
       continue;
     }
-    
+
     // TODO: Vectors are also ok to pass if they don't require extra alignment.
     // TODO: We can also pass structs like {i8, i32}.
-    
+
     Elts.clear();
     return false;
   }
-  
+
   return true;
-}  
+}
 
 /* It returns true if an aggregate of the specified type should be passed as a
    first class aggregate. */
@@ -1528,7 +1528,7 @@
   // Counting number of GPRs and XMMs used so far. According to AMD64 ABI
   // document: "If there are no registers available for any eightbyte of an
   // argument, the whole  argument is passed on the stack." X86-64 uses 6
-  // integer 
+  // integer
   // For example, if two GPRs are required but only one is available, then
   // both parts will be in memory.
   // FIXME: This is a temporary solution. To be removed when llvm has first
@@ -1697,7 +1697,7 @@
   return !totallyEmpty;
 }
 
-/* On Darwin x86-32, vectors which are not MMX nor SSE should be passed as 
+/* On Darwin x86-32, vectors which are not MMX nor SSE should be passed as
    integers.  On Darwin x86-64, such vectors bigger than 128 bits should be
    passed in memory (byval). */
 bool llvm_x86_should_pass_vector_in_integer_regs(tree type) {
@@ -1734,8 +1734,8 @@
 
 /* The MMX vector v1i64 is returned in EAX and EDX on Darwin.  Communicate
     this by returning i64 here.  Likewise, (generic) vectors such as v2i16
-    are returned in EAX.  
-   On Darwin x86-64, v1i64 is returned in RAX and other MMX vectors are 
+    are returned in EAX.
+   On Darwin x86-64, v1i64 is returned in RAX and other MMX vectors are
     returned in XMM0.  Judging from comments, this would not be right for
     Win64.  Don't know about Linux.  */
 tree llvm_x86_should_return_vector_as_scalar(tree type, bool isBuiltin) {
@@ -1789,7 +1789,7 @@
   return false;
 }
 
-// llvm_x86_should_not_return_complex_in_memory -  Return true if TYPE 
+// llvm_x86_should_not_return_complex_in_memory -  Return true if TYPE
 // should be returned using multiple value return instruction.
 bool llvm_x86_should_not_return_complex_in_memory(tree type) {
 
@@ -1803,7 +1803,7 @@
   return false;
 }
 
-// llvm_suitable_multiple_ret_value_type - Return TRUE if return value 
+// llvm_suitable_multiple_ret_value_type - Return TRUE if return value
 // of type TY should be returned using multiple value return instruction.
 static bool llvm_suitable_multiple_ret_value_type(const Type *Ty,
                                                   tree TreeType) {
@@ -1825,7 +1825,7 @@
   if (NumClasses == 0)
     return false;
 
-  if (NumClasses == 1 && 
+  if (NumClasses == 1 &&
       (Class[0] == X86_64_INTEGERSI_CLASS || Class[0] == X86_64_INTEGER_CLASS))
     // This will fit in one i64 register.
     return false;
@@ -1873,7 +1873,7 @@
           Class[0] == X86_64_INTEGER_CLASS) {
         // one int register
         HOST_WIDE_INT Bytes =
-          (Mode == BLKmode) ? int_size_in_bytes(type) : 
+          (Mode == BLKmode) ? int_size_in_bytes(type) :
                               (int) GET_MODE_SIZE(Mode);
         if (Bytes>4)
           return Type::getInt64Ty(Context);
@@ -1884,11 +1884,11 @@
         else
           return Type::getInt8Ty(Context);
       }
-      assert(0 && "Unexpected type!"); 
+      assert(0 && "Unexpected type!");
     }
     if (NumClasses == 2) {
       if (Class[1] == X86_64_NO_CLASS) {
-        if (Class[0] == X86_64_INTEGER_CLASS || 
+        if (Class[0] == X86_64_INTEGER_CLASS ||
             Class[0] == X86_64_NO_CLASS ||
             Class[0] == X86_64_INTEGERSI_CLASS)
           return Type::getInt64Ty(Context);
@@ -1907,7 +1907,7 @@
           return Type::getDoubleTy(Context);
         else if (Class[1] == X86_64_SSESF_CLASS)
           return Type::getFloatTy(Context);
-        assert(0 && "Unexpected type!"); 
+        assert(0 && "Unexpected type!");
       }
       assert(0 && "Unexpected type!");
     }
@@ -1926,7 +1926,7 @@
 /// llvm_x86_64_get_multiple_return_reg_classes - Find register classes used
 /// to return Ty. It is expected that Ty requires multiple return values.
 /// This routine uses GCC implementation to find required register classes.
-/// The original implementation of this routine is based on 
+/// The original implementation of this routine is based on
 /// llvm_x86_64_should_pass_aggregate_in_mixed_regs code.
 void
 llvm_x86_64_get_multiple_return_reg_classes(tree TreeType, const Type *Ty,
@@ -2053,7 +2053,7 @@
   }
 }
 
-// Return LLVM Type if TYPE can be returned as an aggregate, 
+// Return LLVM Type if TYPE can be returned as an aggregate,
 // otherwise return NULL.
 const Type *llvm_x86_aggr_type_for_struct_return(tree type) {
   const Type *Ty = ConvertType(type);
@@ -2068,24 +2068,24 @@
     ElementTypes.push_back(Type::getX86_FP80Ty(Context));
     ElementTypes.push_back(Type::getX86_FP80Ty(Context));
     return StructType::get(Context, ElementTypes, STy->isPacked());
-  } 
+  }
 
   std::vector<const Type*> GCCElts;
   llvm_x86_64_get_multiple_return_reg_classes(type, Ty, GCCElts);
   return StructType::get(Context, GCCElts, false);
 }
 
-// llvm_x86_extract_mrv_array_element - Helper function that help extract 
+// llvm_x86_extract_mrv_array_element - Helper function that help extract
 // an array element from multiple return value.
 //
 // Here, SRC is returning multiple values. DEST's DESTFIELNO field is an array.
-// Extract SRCFIELDNO's ELEMENO value and store it in DEST's FIELDNO field's 
+// Extract SRCFIELDNO's ELEMENO value and store it in DEST's FIELDNO field's
 // ELEMENTNO.
 //
 static void llvm_x86_extract_mrv_array_element(Value *Src, Value *Dest,
-                                               unsigned SrcFieldNo, 
+                                               unsigned SrcFieldNo,
                                                unsigned SrcElemNo,
-                                               unsigned DestFieldNo, 
+                                               unsigned DestFieldNo,
                                                unsigned DestElemNo,
                                                LLVMBuilder &Builder,
                                                bool isVolatile) {
@@ -2111,7 +2111,7 @@
 void llvm_x86_extract_multiple_return_value(Value *Src, Value *Dest,
                                             bool isVolatile,
                                             LLVMBuilder &Builder) {
-  
+
   const StructType *STy = cast<StructType>(Src->getType());
   unsigned NumElements = STy->getNumElements();
 
@@ -2157,7 +2157,7 @@
       Builder.CreateStore(EVI, GEP, isVolatile);
       ++DNO; ++SNO;
       continue;
-    } 
+    }
 
     // Special treatement for _Complex.
     if (DestElemType->isStructTy()) {
@@ -2178,7 +2178,7 @@
       ++DNO; ++SNO;
       continue;
     }
-    
+
     // Access array elements individually. Note, Src and Dest type may
     // not match. For example { <2 x float>, float } and { float[3]; }
     const ArrayType *ATy = cast<ArrayType>(DestElemType);
@@ -2187,8 +2187,8 @@
     while (DElemNo < ArraySize) {
       unsigned i = 0;
       unsigned Size = 1;
-      
-      if (const VectorType *SElemTy = 
+
+      if (const VectorType *SElemTy =
           dyn_cast<VectorType>(STy->getElementType(SNO))) {
         Size = SElemTy->getNumElements();
         if (SElemTy->getElementType()->getTypeID() == Type::FloatTyID
@@ -2197,14 +2197,14 @@
           Size = 2;
       }
       while (i < Size) {
-        llvm_x86_extract_mrv_array_element(Src, Dest, SNO, i++, 
-                                           DNO, DElemNo++, 
+        llvm_x86_extract_mrv_array_element(Src, Dest, SNO, i++,
+                                           DNO, DElemNo++,
                                            Builder, isVolatile);
       }
       // Consumed this src field. Try next one.
       ++SNO;
     }
-    // Finished building current dest field. 
+    // Finished building current dest field.
     ++DNO;
   }
 }
@@ -2250,8 +2250,8 @@
         return true;
       }
     }
-    return false;    
+    return false;
   }
-  else 
+  else
     return !isSingleElementStructOrArray(type, false, true);
 }

Modified: dragonegg/trunk/x86/llvm-target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.h?rev=104040&r1=104039&r2=104040&view=diff
==============================================================================
--- dragonegg/trunk/x86/llvm-target.h (original)
+++ dragonegg/trunk/x86/llvm-target.h Tue May 18 13:13:30 2010
@@ -353,7 +353,7 @@
  * macro should call the target TreeToLLVM::TargetIntrinsicLower method and
  *  return true.This macro is invoked from a method in the TreeToLLVM class.
  */
-#define LLVM_TARGET_INTRINSIC_LOWER(STMT, FNDECL, DESTLOC, RESULT, DESTTY, OPS)	\
+#define LLVM_TARGET_INTRINSIC_LOWER(STMT, FNDECL, DESTLOC, RESULT, DESTTY, OPS) \
         TargetIntrinsicLower(STMT, FNDECL, DESTLOC, RESULT, DESTTY, OPS);
 
 /* LLVM_GET_REG_NAME - When extracting a register name for a constraint, use





More information about the llvm-commits mailing list