[dragonegg] r178533 - Remove 'using namespace llvm; ' from Internals.h and deal with the fallout. This

Duncan Sands baldrick at free.fr
Tue Apr 2 03:08:17 PDT 2013


Author: baldrick
Date: Tue Apr  2 05:08:16 2013
New Revision: 178533

URL: http://llvm.org/viewvc/llvm-project?rev=178533&view=rev
Log:
Remove 'using namespace llvm;' from Internals.h and deal with the fallout.  This
is a step towards gcc-4.8 support. Note that changing dyn_cast to llvm::dyn_cast
is needed when compiling against gcc-4.8 since it has its own dyn_cast. Patch by
Peter Collingbourne.

Modified:
    dragonegg/trunk/include/dragonegg/ABI.h
    dragonegg/trunk/include/dragonegg/Debug.h
    dragonegg/trunk/include/dragonegg/Internals.h
    dragonegg/trunk/include/dragonegg/TypeConversion.h
    dragonegg/trunk/include/x86/dragonegg/Target.h
    dragonegg/trunk/src/Backend.cpp
    dragonegg/trunk/src/Convert.cpp
    dragonegg/trunk/src/DefaultABI.cpp
    dragonegg/trunk/src/TypeConversion.cpp
    dragonegg/trunk/src/x86/Target.cpp

Modified: dragonegg/trunk/include/dragonegg/ABI.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/ABI.h?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/ABI.h (original)
+++ dragonegg/trunk/include/dragonegg/ABI.h Tue Apr  2 05:08:16 2013
@@ -41,37 +41,37 @@ namespace llvm { class BasicBlock; }
 struct DefaultABIClient {
   virtual void anchor();
   virtual ~DefaultABIClient() {}
-  virtual CallingConv::ID getCallingConv(void) = 0;
+  virtual llvm::CallingConv::ID getCallingConv(void) = 0;
   virtual bool isShadowReturn() const { return false; }
 
   /// HandleScalarResult - This callback is invoked if the function returns a
   /// simple scalar result value, which is of type RetTy.
-  virtual void HandleScalarResult(Type */*RetTy*/) {}
+  virtual void HandleScalarResult(llvm::Type */*RetTy*/) {}
 
   /// HandleAggregateResultAsScalar - This callback is invoked if the function
   /// returns an aggregate value by bit converting it to the specified scalar
   /// type and returning that.  The bit conversion should start at byte Offset
   /// within the struct, and ScalarTy is not necessarily big enough to cover
   /// the entire struct.
-  virtual void HandleAggregateResultAsScalar(Type */*ScalarTy*/,
+  virtual void HandleAggregateResultAsScalar(llvm::Type */*ScalarTy*/,
                                              unsigned /*Offset*/ = 0) {}
 
   /// HandleAggregateResultAsAggregate - This callback is invoked if the function
   /// returns an aggregate value using multiple return values.
-  virtual void HandleAggregateResultAsAggregate(Type */*AggrTy*/) {}
+  virtual void HandleAggregateResultAsAggregate(llvm::Type */*AggrTy*/) {}
 
   /// HandleAggregateShadowResult - This callback is invoked if the function
   /// returns an aggregate value by using a "shadow" first parameter, which is
   /// a pointer to the aggregate, of type PtrArgTy.  If RetPtr is set to true,
   /// the pointer argument itself is returned from the function.
-  virtual void HandleAggregateShadowResult(PointerType */*PtrArgTy*/,
+  virtual void HandleAggregateShadowResult(llvm::PointerType */*PtrArgTy*/,
                                            bool /*RetPtr*/) {}
 
   /// HandleScalarShadowResult - This callback is invoked if the function
   /// returns a scalar value by using a "shadow" first parameter, which is a
   /// pointer to the scalar, of type PtrArgTy.  If RetPtr is set to true,
   /// the pointer argument itself is returned from the function.
-  virtual void HandleScalarShadowResult(PointerType */*PtrArgTy*/,
+  virtual void HandleScalarShadowResult(llvm::PointerType */*PtrArgTy*/,
                                         bool /*RetPtr*/) {}
 
   /// HandleScalarArgument - This is the primary callback that specifies an
@@ -119,7 +119,7 @@ struct DefaultABIClient {
 // doNotUseShadowReturn - Return true if the specified GCC type
 // should not be returned using a pointer to struct parameter.
 extern bool doNotUseShadowReturn(tree_node *type, tree_node *fndecl,
-                                 CallingConv::ID CC);
+                                 llvm::CallingConv::ID CC);
 
 /// isSingleElementStructOrArray - If this is (recursively) a structure with one
 /// field or an array with one element, return the field type, otherwise return
@@ -137,25 +137,25 @@ extern bool isZeroSizedStructOrUnion(tre
 // getLLVMScalarTypeForStructReturn - Return LLVM Type if TY can be
 // returned as a scalar, otherwise return NULL. This is the default
 // target independent implementation.
-inline Type *
+inline llvm::Type *
 getLLVMScalarTypeForStructReturn(tree_node *type, unsigned *Offset) {
-  Type *Ty = ConvertType(type);
+  llvm::Type *Ty = ConvertType(type);
   uint64_t Size = getDataLayout().getTypeAllocSize(Ty);
   *Offset = 0;
   if (Size == 0)
-    return Type::getVoidTy(getGlobalContext());
+    return llvm::Type::getVoidTy(llvm::getGlobalContext());
   else if (Size == 1)
-    return Type::getInt8Ty(getGlobalContext());
+    return llvm::Type::getInt8Ty(llvm::getGlobalContext());
   else if (Size == 2)
-    return Type::getInt16Ty(getGlobalContext());
+    return llvm::Type::getInt16Ty(llvm::getGlobalContext());
   else if (Size <= 4)
-    return Type::getInt32Ty(getGlobalContext());
+    return llvm::Type::getInt32Ty(llvm::getGlobalContext());
   else if (Size <= 8)
-    return Type::getInt64Ty(getGlobalContext());
+    return llvm::Type::getInt64Ty(llvm::getGlobalContext());
   else if (Size <= 16)
-    return IntegerType::get(getGlobalContext(), 128);
+    return llvm::IntegerType::get(llvm::getGlobalContext(), 128);
   else if (Size <= 32)
-    return IntegerType::get(getGlobalContext(), 256);
+    return llvm::IntegerType::get(llvm::getGlobalContext(), 256);
 
   return NULL;
 }
@@ -163,7 +163,7 @@ getLLVMScalarTypeForStructReturn(tree_no
 // getLLVMAggregateTypeForStructReturn - Return LLVM type if TY can be
 // returns as multiple values, otherwise return NULL. This is the default
 // target independent implementation.
-inline Type *getLLVMAggregateTypeForStructReturn(tree_node */*type*/) {
+inline llvm::Type *getLLVMAggregateTypeForStructReturn(tree_node */*type*/) {
   return NULL;
 }
 
@@ -282,7 +282,7 @@ inline Type *getLLVMAggregateTypeForStru
   llvm_default_extract_multiple_return_value((Src), (Dest), (V), (B))
 #endif
 inline void llvm_default_extract_multiple_return_value(
-    Value */*Src*/, Value */*Dest*/, bool /*isVolatile*/,
+    llvm::Value */*Src*/, llvm::Value */*Dest*/, bool /*isVolatile*/,
     LLVMBuilder &/*Builder*/) {
   llvm_unreachable("LLVM_EXTRACT_MULTIPLE_RETURN_VALUE is not implemented!");
 }
@@ -310,24 +310,25 @@ public:
   /// argument and invokes methods on the client that indicate how its pieces
   /// should be handled.  This handles things like decimating structures into
   /// their fields.
-  void HandleArgument(tree_node *type, std::vector<Type *> &ScalarElts,
-                      AttrBuilder *AttrBuilder = NULL);
+  void HandleArgument(tree_node *type, std::vector<llvm::Type *> &ScalarElts,
+                      llvm::AttrBuilder *AttrBuilder = NULL);
 
   /// HandleUnion - Handle a UNION_TYPE or QUAL_UNION_TYPE tree.
   ///
-  void HandleUnion(tree_node *type, std::vector<Type *> &ScalarElts);
+  void HandleUnion(tree_node *type, std::vector<llvm::Type *> &ScalarElts);
 
   /// PassInIntegerRegisters - Given an aggregate value that should be passed in
   /// integer registers, convert it to a structure containing ints and pass all
   /// of the struct elements in.  If Size is set we pass only that many bytes.
-  void PassInIntegerRegisters(tree_node *type, std::vector<Type *> &ScalarElts,
+  void PassInIntegerRegisters(tree_node *type,
+                              std::vector<llvm::Type *> &ScalarElts,
                               unsigned origSize, bool DontCheckAlignment);
 
   /// PassInMixedRegisters - Given an aggregate value that should be passed in
   /// mixed integer, floating point, and vector registers, convert it to a
   /// structure containing the specified struct elements in.
-  void PassInMixedRegisters(Type *Ty, std::vector<Type *> &OrigElts,
-                            std::vector<Type *> &ScalarElts);
+  void PassInMixedRegisters(llvm::Type *Ty, std::vector<llvm::Type *> &OrigElts,
+                            std::vector<llvm::Type *> &ScalarElts);
 };
 
 #endif /* DRAGONEGG_ABI_H */

Modified: dragonegg/trunk/include/dragonegg/Debug.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Debug.h?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Debug.h (original)
+++ dragonegg/trunk/include/dragonegg/Debug.h Tue Apr  2 05:08:16 2013
@@ -48,30 +48,30 @@ class Module;
 /// is responsible for emitting to llvm globals or pass directly to the backend.
 class DebugInfo {
 private:
-  SmallVector<WeakVH, 4> RegionStack;
+  llvm::SmallVector<llvm::WeakVH, 4> RegionStack;
   // Stack to track declarative scopes.
 
-  std::map<tree_node *, WeakVH> RegionMap;
+  std::map<tree_node *, llvm::WeakVH> RegionMap;
 
-  Module &M;
-  LLVMContext &VMContext;
-  DIBuilder Builder;
-  Function *DeclareFn; // llvm.dbg.declare
-  Function *ValueFn;   // llvm.dbg.value
+  llvm::Module &M;
+  llvm::LLVMContext &VMContext;
+  llvm::DIBuilder Builder;
+  llvm::Function *DeclareFn; // llvm.dbg.declare
+  llvm::Function *ValueFn;   // llvm.dbg.value
 
   const char *CurFullPath;  // Previous location file encountered.
   const char *PrevFullPath; // Previous location file encountered.
   int CurLineNo;            // Previous location line# encountered.
   int PrevLineNo;           // Previous location line# encountered.
-  BasicBlock *PrevBB;       // Last basic block encountered.
+  llvm::BasicBlock *PrevBB;       // Last basic block encountered.
 
-  std::map<tree_node *, WeakVH> TypeCache;
+  std::map<tree_node *, llvm::WeakVH> TypeCache;
   // Cache of previously constructed
   // Types.
-  std::map<tree_node *, WeakVH> SPCache;
+  std::map<tree_node *, llvm::WeakVH> SPCache;
   // Cache of previously constructed
   // Subprograms.
-  std::map<tree_node *, WeakVH> NameSpaceCache;
+  std::map<tree_node *, llvm::WeakVH> NameSpaceCache;
   // Cache of previously constructed name
   // spaces.
 
@@ -80,7 +80,7 @@ private:
   llvm::BumpPtrAllocator FunctionNames;
 
 public:
-  DebugInfo(Module *m);
+  DebugInfo(llvm::Module *m);
 
   ~DebugInfo() { Builder.finalize(); }
 
@@ -95,7 +95,7 @@ public:
 
   /// EmitFunctionStart - Constructs the debug code for entering a function -
   /// "llvm.dbg.func.start."
-  void EmitFunctionStart(tree_node *FnDecl, Function *Fn);
+  void EmitFunctionStart(tree_node *FnDecl, llvm::Function *Fn);
 
   /// EmitFunctionEnd - Constructs the debug code for exiting a declarative
   /// region - "llvm.dbg.region.end."
@@ -103,103 +103,112 @@ public:
 
   /// EmitDeclare - Constructs the debug code for allocation of a new variable.
   /// region - "llvm.dbg.declare."
-  void EmitDeclare(tree_node *decl, unsigned Tag, StringRef Name,
-                   tree_node *type, Value *AI, LLVMBuilder &Builder);
+  void EmitDeclare(tree_node *decl, unsigned Tag, llvm::StringRef Name,
+                   tree_node *type, llvm::Value *AI, LLVMBuilder &Builder);
 
   /// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of
   /// source line.
-  void EmitStopPoint(BasicBlock *CurBB, LLVMBuilder &Builder);
+  void EmitStopPoint(llvm::BasicBlock *CurBB, LLVMBuilder &Builder);
 
   /// EmitGlobalVariable - Emit information about a global variable.
   ///
-  void EmitGlobalVariable(GlobalVariable *GV, tree_node *decl);
+  void EmitGlobalVariable(llvm::GlobalVariable *GV, tree_node *decl);
 
   /// getOrCreateType - Get the type from the cache or create a new type if
   /// necessary.
-  DIType getOrCreateType(tree_node *type);
+  llvm::DIType getOrCreateType(tree_node *type);
 
   /// createBasicType - Create BasicType.
-  DIType createBasicType(tree_node *type);
+  llvm::DIType createBasicType(tree_node *type);
 
   /// createMethodType - Create MethodType.
-  DIType createMethodType(tree_node *type);
+  llvm::DIType createMethodType(tree_node *type);
 
   /// createPointerType - Create PointerType.
-  DIType createPointerType(tree_node *type);
+  llvm::DIType createPointerType(tree_node *type);
 
   /// createArrayType - Create ArrayType.
-  DIType createArrayType(tree_node *type);
+  llvm::DIType createArrayType(tree_node *type);
 
   /// createEnumType - Create EnumType.
-  DIType createEnumType(tree_node *type);
+  llvm::DIType createEnumType(tree_node *type);
 
   /// createStructType - Create StructType for struct or union or class.
-  DIType createStructType(tree_node *type);
+  llvm::DIType createStructType(tree_node *type);
 
   /// createVarinatType - Create variant type or return MainTy.
-  DIType createVariantType(tree_node *type, DIType MainTy);
+  llvm::DIType createVariantType(tree_node *type, llvm::DIType MainTy);
 
   /// getOrCreateCompileUnit - Create a new compile unit.
   void getOrCreateCompileUnit(const char *FullPath, bool isMain = false);
 
   /// getOrCreateFile - Get DIFile descriptor.
-  DIFile getOrCreateFile(const char *FullPath);
+  llvm::DIFile getOrCreateFile(const char *FullPath);
 
   /// findRegion - Find tree_node N's region.
-  DIDescriptor findRegion(tree_node *n);
+  llvm::DIDescriptor findRegion(tree_node *n);
 
   /// getOrCreateNameSpace - Get name space descriptor for the tree node.
-  DINameSpace getOrCreateNameSpace(tree_node *Node, DIDescriptor Context);
+  llvm::DINameSpace getOrCreateNameSpace(tree_node *Node,
+                                         llvm::DIDescriptor Context);
 
   /// getFunctionName - Get function name for the given FnDecl. If the
   /// name is constructred on demand (e.g. C++ destructor) then the name
   /// is stored on the side.
-  StringRef getFunctionName(tree_node *FnDecl);
+  llvm::StringRef getFunctionName(tree_node *FnDecl);
 
 private:
   /// CreateDerivedType - Create a derived type like const qualified type,
   /// pointer, typedef, etc.
-  DIDerivedType CreateDerivedType(
-      unsigned Tag, DIDescriptor Context, StringRef Name, DIFile F,
-      unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits,
-      uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom);
+  llvm::DIDerivedType CreateDerivedType(
+      unsigned Tag, llvm::DIDescriptor Context, llvm::StringRef Name,
+      llvm::DIFile F, unsigned LineNumber, uint64_t SizeInBits,
+      uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
+      llvm::DIType DerivedFrom);
 
   /// CreateCompositeType - Create a composite type like array, struct, etc.
-  DICompositeType CreateCompositeType(
-      unsigned Tag, DIDescriptor Context, StringRef Name, DIFile F,
-      unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits,
-      uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom,
-      DIArray Elements, unsigned RunTimeLang = 0, MDNode *ContainingType = 0);
+  llvm::DICompositeType CreateCompositeType(
+      unsigned Tag, llvm::DIDescriptor Context, llvm::StringRef Name,
+      llvm::DIFile F, unsigned LineNumber, uint64_t SizeInBits,
+      uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
+      llvm::DIType DerivedFrom, llvm::DIArray Elements,
+      unsigned RunTimeLang = 0, llvm::MDNode *ContainingType = 0);
 
   /// CreateSubprogram - Create a new descriptor for the specified subprogram.
   /// See comments in DISubprogram for descriptions of these fields.
-  DISubprogram CreateSubprogram(
-      DIDescriptor Context, StringRef Name, StringRef DisplayName,
-      StringRef LinkageName, DIFile F, unsigned LineNo, DIType Ty,
-      bool isLocalToUnit, bool isDefinition, unsigned VK = 0,
-      unsigned VIndex = 0, DIType ContainingType = DIType(), unsigned Flags = 0,
-      bool isOptimized = false, Function *Fn = 0);
+  llvm::DISubprogram CreateSubprogram(
+      llvm::DIDescriptor Context, llvm::StringRef Name,
+      llvm::StringRef DisplayName, llvm::StringRef LinkageName, llvm::DIFile F,
+      unsigned LineNo, llvm::DIType Ty, bool isLocalToUnit, bool isDefinition,
+      unsigned VK = 0, unsigned VIndex = 0,
+      llvm::DIType ContainingType = llvm::DIType(), unsigned Flags = 0,
+      bool isOptimized = false, llvm::Function *Fn = 0);
 
   /// CreateSubprogramDefinition - Create new subprogram descriptor for the
   /// given declaration.
-  DISubprogram CreateSubprogramDefinition(DISubprogram &SPDeclaration,
-                                          unsigned LineNo, Function *Fn);
+  llvm::DISubprogram
+  CreateSubprogramDefinition(llvm::DISubprogram &SPDeclaration,
+                             unsigned LineNo, llvm::Function *Fn);
 
   /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
-  Instruction *
-  InsertDeclare(llvm::Value *Storage, DIVariable D, BasicBlock *InsertAtEnd);
+  llvm::Instruction *
+  InsertDeclare(llvm::Value *Storage, llvm::DIVariable D,
+                llvm::BasicBlock *InsertAtEnd);
 
   /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
-  Instruction *
-  InsertDeclare(llvm::Value *Storage, DIVariable D, Instruction *InsertBefore);
+  llvm::Instruction *
+  InsertDeclare(llvm::Value *Storage, llvm::DIVariable D,
+                llvm::Instruction *InsertBefore);
 
   /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
-  Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
-                                       DIVariable D, BasicBlock *InsertAtEnd);
+  llvm::Instruction *
+  InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset, llvm::DIVariable D,
+                          llvm::BasicBlock *InsertAtEnd);
 
   /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
-  Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
-                                       DIVariable D, Instruction *InsertBefore);
+  llvm::Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
+                                             llvm::DIVariable D,
+                                             llvm::Instruction *InsertBefore);
 };
 
 #endif /* DRAGONEGG_DEBUG_H */

Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Tue Apr  2 05:08:16 2013
@@ -56,9 +56,8 @@ template <typename> class AssertingVH;
 template <typename> class TrackingVH;
 }
 class DebugInfo;
-using namespace llvm;
 
-typedef IRBuilder<true, TargetFolder> LLVMBuilder;
+typedef llvm::IRBuilder<true, llvm::TargetFolder> LLVMBuilder;
 
 // Global state.
 
@@ -75,10 +74,10 @@ extern DebugInfo *TheDebugInfo;
 extern llvm::TargetMachine *TheTarget;
 
 /// TheFolder - The constant folder to use.
-extern TargetFolder *TheFolder;
+extern llvm::TargetFolder *TheFolder;
 
 /// getDataLayout - Return the current DataLayout object from TheTarget.
-const DataLayout &getDataLayout();
+const llvm::DataLayout &getDataLayout();
 
 /// flag_default_initialize_globals - Whether global variables with no explicit
 /// initial value should be zero initialized.
@@ -96,28 +95,28 @@ extern bool flag_odr;
 extern bool flag_functions_from_args;
 
 /// AttributeUsedGlobals - The list of globals that are marked attribute(used).
-extern SmallSetVector<Constant *, 32> AttributeUsedGlobals;
+extern llvm::SmallSetVector<llvm::Constant *, 32> AttributeUsedGlobals;
 
-extern Constant *ConvertMetadataStringToGV(const char *str);
+extern llvm::Constant *ConvertMetadataStringToGV(const char *str);
 
 /// AddAnnotateAttrsToGlobal - Adds decls that have a
 /// annotate attribute to a vector to be emitted later.
-extern void AddAnnotateAttrsToGlobal(GlobalValue *GV, tree_node *decl);
+extern void AddAnnotateAttrsToGlobal(llvm::GlobalValue *GV, tree_node *decl);
 
 // Mapping between GCC declarations and LLVM values.  The GCC declaration must
 // satisfy HAS_RTL_P.
 
 /// DECL_LLVM - Returns the LLVM declaration of a global variable or function.
-extern Value *make_decl_llvm(tree_node *);
+extern llvm::Value *make_decl_llvm(tree_node *);
 #define DECL_LLVM(NODE) make_decl_llvm(NODE)
 
 /// SET_DECL_LLVM - Set the DECL_LLVM for NODE to LLVM.
-extern Value *set_decl_llvm(tree_node *, Value *);
+extern llvm::Value *set_decl_llvm(tree_node *, llvm::Value *);
 #define SET_DECL_LLVM(NODE, LLVM) set_decl_llvm(NODE, LLVM)
 
 /// DECL_LLVM_IF_SET - The DECL_LLVM for NODE, if it is set, or NULL, if it is
 /// not set.
-extern Value *get_decl_llvm(tree_node *);
+extern llvm::Value *get_decl_llvm(tree_node *);
 #define DECL_LLVM_IF_SET(NODE) (HAS_RTL_P(NODE) ? get_decl_llvm(NODE) : NULL)
 
 /// DECL_LLVM_SET_P - Returns nonzero if the DECL_LLVM for NODE has already
@@ -126,16 +125,16 @@ extern Value *get_decl_llvm(tree_node *)
 
 /// DEFINITION_LLVM - Ensures that the body or initial value of the given GCC
 /// global will be output, and returns a declaration for it.
-Value *make_definition_llvm(tree_node *decl);
+llvm::Value *make_definition_llvm(tree_node *decl);
 #define DEFINITION_LLVM(NODE) make_definition_llvm(NODE)
 
 // Mapping between GCC declarations and non-negative integers.  The GCC
 // declaration must not satisfy HAS_RTL_P.
 
-void changeLLVMConstant(Constant *Old, Constant *New);
-void register_ctor_dtor(Function *, int, bool);
+void changeLLVMConstant(llvm::Constant *Old, llvm::Constant *New);
+void register_ctor_dtor(llvm::Function *, int, bool);
 const char *extractRegisterName(tree_node *);
-void handleVisibility(tree_node *decl, GlobalValue *GV);
+void handleVisibility(tree_node *decl, llvm::GlobalValue *GV);
 
 /// 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.
@@ -144,9 +143,9 @@ bool isPaddingElement(tree_node *, unsig
 /// getDefaultValue - Return the default value to use for a constant or global
 /// that has no value specified.  For example in C like languages such variables
 /// are initialized to zero, while in Ada they hold an undefined value.
-inline Constant *getDefaultValue(Type *Ty) {
-  return flag_default_initialize_globals ? Constant::getNullValue(Ty)
-                                         : UndefValue::get(Ty);
+inline llvm::Constant *getDefaultValue(llvm::Type *Ty) {
+  return flag_default_initialize_globals ? llvm::Constant::getNullValue(Ty)
+                                         : llvm::UndefValue::get(Ty);
 }
 
 /// isPassedByInvisibleReference - Return true if the specified type should be
@@ -163,13 +162,13 @@ bool ValidateRegisterVariable(tree_node
 /// a pointer to the memory, its alignment and whether the access is volatile.
 class MemRef {
 public:
-  Value *Ptr;
+  llvm::Value *Ptr;
   bool Volatile;
 private:
   unsigned char LogAlign;
 public:
   explicit MemRef() : Ptr(0), Volatile(false), LogAlign(0) {}
-  explicit MemRef(Value *P, uint32_t A, bool V) : Ptr(P), Volatile(V) {
+  explicit MemRef(llvm::Value *P, uint32_t A, bool V) : Ptr(P), Volatile(V) {
     setAlignment(A);
   }
 
@@ -177,8 +176,8 @@ public:
 
   void setAlignment(uint32_t A) {
     // Forbid alignment 0 along with non-power-of-2 alignment values.
-    assert(isPowerOf2_32(A) && "Alignment not a power of 2!");
-    LogAlign = (unsigned char) Log2_32(A);
+    assert(llvm::isPowerOf2_32(A) && "Alignment not a power of 2!");
+    LogAlign = (unsigned char) llvm::Log2_32(A);
   }
 };
 
@@ -196,9 +195,9 @@ public:
 public:
   explicit LValue() : BitStart(255), BitSize(255) {}
   explicit LValue(MemRef &M) : MemRef(M), BitStart(255), BitSize(255) {}
-  LValue(Value *P, uint32_t A, bool V = false)
+  LValue(llvm::Value *P, uint32_t A, bool V = false)
       : MemRef(P, A, V), BitStart(255), BitSize(255) {}
-  LValue(Value *P, uint32_t A, unsigned BSt, unsigned BSi, bool V = false)
+  LValue(llvm::Value *P, uint32_t A, unsigned BSt, unsigned BSi, bool V = false)
       : MemRef(P, A, V), BitStart((unsigned char) BSt),
         BitSize((unsigned char) BSi) {
     assert(BitStart == BSt && BitSize == BSi && "Bit values larger than 256?");
@@ -210,7 +209,7 @@ public:
 /// PhiRecord - This struct holds the LLVM PHI node associated with a GCC phi.
 struct PhiRecord {
   gimple_statement_d *gcc_phi;
-  PHINode *PHI;
+  llvm::PHINode *PHI;
 };
 
 /// TreeToLLVM - An instance of this class is created and used to convert the
@@ -218,10 +217,10 @@ struct PhiRecord {
 ///
 class TreeToLLVM {
   // State that is initialized when the function starts.
-  const DataLayout &DL;
+  const llvm::DataLayout &DL;
   tree_node *FnDecl;
-  Function *Fn;
-  BasicBlock *ReturnBB;
+  llvm::Function *Fn;
+  llvm::BasicBlock *ReturnBB;
   unsigned ReturnOffset;
 
   // State that changes as the function is emitted.
@@ -232,23 +231,23 @@ class TreeToLLVM {
 
   // AllocaInsertionPoint - Place to insert alloca instructions.  Lazily created
   // and managed by CreateTemporary.
-  Instruction *AllocaInsertionPoint;
+  llvm::Instruction *AllocaInsertionPoint;
 
   // SSAInsertionPoint - Place to insert reads corresponding to SSA default
   // definitions.
-  Instruction *SSAInsertionPoint;
+  llvm::Instruction *SSAInsertionPoint;
 
   /// BasicBlocks - Map from GCC to LLVM basic blocks.
-  DenseMap<basic_block_def *, BasicBlock *> BasicBlocks;
+  llvm::DenseMap<basic_block_def *, llvm::BasicBlock *> BasicBlocks;
 
   /// LocalDecls - Map from local declarations to their associated LLVM values.
-  DenseMap<tree_node *, AssertingVH<Value> > LocalDecls;
+  llvm::DenseMap<tree_node *, llvm::AssertingVH<llvm::Value> > LocalDecls;
 
   /// PendingPhis - Phi nodes which have not yet been populated with operands.
-  SmallVector<PhiRecord, 16> PendingPhis;
+  llvm::SmallVector<PhiRecord, 16> PendingPhis;
 
   // SSANames - Map from GCC ssa names to the defining LLVM value.
-  DenseMap<tree_node *, TrackingVH<Value> > SSANames;
+  llvm::DenseMap<tree_node *, llvm::TrackingVH<llvm::Value> > SSANames;
 
 public:
 
@@ -257,23 +256,23 @@ public:
   /// DECL_LOCAL - Like DECL_LLVM, returns the LLVM declaration of a variable or
   /// function.  However DECL_LOCAL can be used with declarations local to the
   /// current function as well as with global declarations.
-  Value *make_decl_local(tree_node *);
+  llvm::Value *make_decl_local(tree_node *);
 #define DECL_LOCAL(NODE) make_decl_local(NODE)
 
   /// DEFINITION_LOCAL - Like DEFINITION_LLVM, ensures that the initial value or
   /// body of a variable or function will be output.  However DEFINITION_LOCAL
   /// can be used with declarations local to the current function as well as
   /// with global declarations.
-  Value *make_definition_local(tree_node *);
+  llvm::Value *make_definition_local(tree_node *);
 #define DEFINITION_LOCAL(NODE) make_definition_local(NODE)
 
   /// SET_DECL_LOCAL - Set the DECL_LOCAL for NODE to LLVM.
-  Value *set_decl_local(tree_node *, Value *);
+  llvm::Value *set_decl_local(tree_node *, llvm::Value *);
 #define SET_DECL_LOCAL(NODE, LLVM) set_decl_local(NODE, LLVM)
 
   /// DECL_LOCAL_IF_SET - The DECL_LOCAL for NODE, if it is set, or NULL, if it
   /// is not set.
-  Value *get_decl_local(tree_node *);
+  llvm::Value *get_decl_local(tree_node *);
 #define DECL_LOCAL_IF_SET(NODE) (HAS_RTL_P(NODE) ? get_decl_local(NODE) : NULL)
 
 /// DECL_LOCAL_SET_P - Returns nonzero if the DECL_LOCAL for NODE has already
@@ -286,20 +285,20 @@ private:
 
   /// NormalInvokes - Mapping from landing pad number to the set of invoke
   /// instructions that unwind to that landing pad.
-  SmallVector<SmallVector<InvokeInst *, 8>, 16> NormalInvokes;
+  llvm::SmallVector<llvm::SmallVector<llvm::InvokeInst *, 8>, 16> NormalInvokes;
 
   /// ExceptionPtrs - Mapping from EH region index to the local holding the
   /// exception pointer for that region.
-  SmallVector<AllocaInst *, 16> ExceptionPtrs;
+  llvm::SmallVector<llvm::AllocaInst *, 16> ExceptionPtrs;
 
   /// ExceptionFilters - Mapping from EH region index to the local holding the
   /// filter value for that region.
-  SmallVector<AllocaInst *, 16> ExceptionFilters;
+  llvm::SmallVector<llvm::AllocaInst *, 16> ExceptionFilters;
 
   /// FailureBlocks - Mapping from the index of a must-not-throw EH region to
   /// the block containing the failure code for the region (the code that is
   /// run if an exception is thrown in this region).
-  SmallVector<BasicBlock *, 16> FailureBlocks;
+  llvm::SmallVector<llvm::BasicBlock *, 16> FailureBlocks;
 
 public:
   TreeToLLVM(tree_node *fndecl);
@@ -310,7 +309,7 @@ public:
   tree_node *getFUNCTION_DECL() const { return FnDecl; }
 
   /// EmitFunction - Convert 'fndecl' to LLVM code.
-  Function *EmitFunction();
+  llvm::Function *EmitFunction();
 
   /// EmitBasicBlock - Convert the given basic block.
   void EmitBasicBlock(basic_block_def *bb);
@@ -321,47 +320,50 @@ public:
 
   /// CastToAnyType - Cast the specified value to the specified type regardless
   /// of the types involved. This is an inferred cast.
-  Value *
-  CastToAnyType(Value *Src, bool SrcIsSigned, Type *DstTy, bool DstIsSigned);
-  Constant *
-  CastToAnyType(Constant *Src, bool SrcIsSigned, Type *DstTy, bool DstIsSigned);
+  llvm::Value *CastToAnyType(llvm::Value *Src, bool SrcIsSigned,
+                             llvm::Type *DstTy, bool DstIsSigned);
+  llvm::Constant *CastToAnyType(llvm::Constant *Src, bool SrcIsSigned,
+                                llvm::Type *DstTy, bool DstIsSigned);
 
   /// CastFromSameSizeInteger - Cast an integer (or vector of integer) value to
   /// the given scalar (resp. vector of scalar) type of the same bitwidth.
-  Value *CastFromSameSizeInteger(Value *V, Type *Ty);
+  llvm::Value *CastFromSameSizeInteger(llvm::Value *V, llvm::Type *Ty);
 
   /// CastToSameSizeInteger - Cast the specified scalar (or vector of scalar)
   /// value to an integer (resp. vector of integer) of the same bit width.
-  Value *CastToSameSizeInteger(Value *V);
+  llvm::Value *CastToSameSizeInteger(llvm::Value *V);
 
   /// CastToFPType - Cast the specified value to the specified type assuming
   /// that V's type and Ty are floating point types. This arbitrates between
   /// BitCast, FPTrunc and FPExt.
-  Value *CastToFPType(Value *V, Type *Ty);
+  llvm::Value *CastToFPType(llvm::Value *V, llvm::Type *Ty);
 
   /// CreateAnyAdd - Add two LLVM scalar values with the given GCC type.  Does
   /// not support complex numbers.  The type is used to set overflow flags.
-  Value *CreateAnyAdd(Value *LHS, Value *RHS, tree_node *type);
+  llvm::Value *CreateAnyAdd(llvm::Value *LHS, llvm::Value *RHS,
+                            tree_node *type);
 
   /// CreateAnyMul - Multiply two LLVM scalar values with the given GCC type.
   /// Does not support complex numbers.  The type is used to set overflow flags.
-  Value *CreateAnyMul(Value *LHS, Value *RHS, tree_node *type);
+  llvm::Value *CreateAnyMul(llvm::Value *LHS, llvm::Value *RHS,
+                            tree_node *type);
 
   /// CreateAnyNeg - Negate an LLVM scalar value with the given GCC type.  Does
   /// not support complex numbers.  The type is used to set overflow flags.
-  Value *CreateAnyNeg(Value *V, tree_node *type);
+  llvm::Value *CreateAnyNeg(llvm::Value *V, tree_node *type);
 
   /// CreateAnySub - Subtract two LLVM scalar values with the given GCC type.
   /// Does not support complex numbers.
-  Value *CreateAnySub(Value *LHS, Value *RHS, tree_node *type);
+  llvm::Value *CreateAnySub(llvm::Value *LHS, llvm::Value *RHS,
+                            tree_node *type);
 
   /// CreateTemporary - Create a new alloca instruction of the specified type,
   /// inserting it into the entry block and returning it.  The resulting
   /// instruction's type is a pointer to the specified type.
-  AllocaInst *CreateTemporary(Type *Ty, unsigned align = 0);
+  llvm::AllocaInst *CreateTemporary(llvm::Type *Ty, unsigned align = 0);
 
   /// CreateTempLoc - Like CreateTemporary, but returns a MemRef.
-  MemRef CreateTempLoc(Type *Ty);
+  MemRef CreateTempLoc(llvm::Type *Ty);
 
   /// EmitAggregateCopy - Copy the elements from SrcLoc to DestLoc, using the
   /// GCC type specified by GCCType to know which elements to copy.
@@ -379,7 +381,7 @@ private : // Helper functions.
 
   /// FinishFunctionBody - Once the body of the function has been emitted, this
   /// cleans up and returns the result function.
-  Function *FinishFunctionBody();
+  llvm::Function *FinishFunctionBody();
 
   /// EmitVariablesInScope - Output a declaration for every variable in the
   /// given scope.
@@ -389,19 +391,19 @@ private : // Helper functions.
   void PopulatePhiNodes();
 
   /// getBasicBlock - Find or create the LLVM basic block corresponding to BB.
-  BasicBlock *getBasicBlock(basic_block_def *bb);
+  llvm::BasicBlock *getBasicBlock(basic_block_def *bb);
 
   /// getLabelDeclBlock - Lazily get and create a basic block for the specified
   /// label.
-  BasicBlock *getLabelDeclBlock(tree_node *LabelDecl);
+  llvm::BasicBlock *getLabelDeclBlock(tree_node *LabelDecl);
 
   /// DefineSSAName - Use the given value as the definition of the given SSA
   /// name.  Returns the provided value as a convenience.
-  Value *DefineSSAName(tree_node *reg, Value *Val);
+  llvm::Value *DefineSSAName(tree_node *reg, llvm::Value *Val);
 
   /// BeginBlock - Add the specified basic block to the end of the function.  If
   /// the previous block falls through into it, add an explicit branch.
-  void BeginBlock(BasicBlock *BB);
+  void BeginBlock(llvm::BasicBlock *BB);
 
   /// CopyElementByElement - Recursively traverse the potentially aggregate
   /// src/dest ptrs, copying all of the elements.  Helper for EmitAggregateCopy.
@@ -417,10 +419,12 @@ private : // Helper functions.
   /// EmitMemCpy/EmitMemMove/EmitMemSet - Emit an llvm.memcpy/llvm.memmove or
   /// llvm.memset call with the specified operands.  Returns DestPtr bitcast
   /// to i8*.
-  Value *EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align);
-  Value *
-  EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align);
-  Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align);
+  llvm::Value *EmitMemCpy(llvm::Value *DestPtr, llvm::Value *SrcPtr,
+                          llvm::Value *Size, unsigned Align);
+  llvm::Value *EmitMemMove(llvm::Value *DestPtr, llvm::Value *SrcPtr,
+                           llvm::Value *Size, unsigned Align);
+  llvm::Value *EmitMemSet(llvm::Value *DestPtr, llvm::Value *SrcVal,
+                          llvm::Value *Size, unsigned Align);
 
   /// EmitLandingPads - Emit EH landing pads.
   void EmitLandingPads();
@@ -437,24 +441,24 @@ private : // Helpers for exception handl
 
   /// getExceptionPtr - Return the local holding the exception pointer for the
   /// given exception handling region, creating it if necessary.
-  AllocaInst *getExceptionPtr(int RegionNo);
+  llvm::AllocaInst *getExceptionPtr(int RegionNo);
 
   /// getExceptionFilter - Return the local holding the filter value for the
   /// given exception handling region, creating it if necessary.
-  AllocaInst *getExceptionFilter(int RegionNo);
+  llvm::AllocaInst *getExceptionFilter(int RegionNo);
 
   /// getFailureBlock - Return the basic block containing the failure code for
   /// the given exception handling region, creating it if necessary.
-  BasicBlock *getFailureBlock(int RegionNo);
+  llvm::BasicBlock *getFailureBlock(int RegionNo);
 
 private:
   void EmitAutomaticVariableDecl(tree_node *decl);
 
   /// EmitAnnotateIntrinsic - Emits call to annotate attr intrinsic
-  void EmitAnnotateIntrinsic(Value *V, tree_node *decl);
+  void EmitAnnotateIntrinsic(llvm::Value *V, tree_node *decl);
 
   /// EmitTypeGcroot - Emits call to make type a gcroot
-  void EmitTypeGcroot(Value *V);
+  void EmitTypeGcroot(llvm::Value *V);
 
 private:
 
@@ -473,17 +477,17 @@ private:
   // Render helpers.
 
   /// EmitAssignRHS - Convert the RHS of a scalar GIMPLE_ASSIGN to LLVM.
-  Value *EmitAssignRHS(gimple_statement_d *stmt);
+  llvm::Value *EmitAssignRHS(gimple_statement_d *stmt);
 
   /// EmitAssignSingleRHS - Helper for EmitAssignRHS.  Handles those RHS that
   /// are not register expressions.
-  Value *EmitAssignSingleRHS(tree_node *rhs);
+  llvm::Value *EmitAssignSingleRHS(tree_node *rhs);
 
   /// OutputCallRHS - Convert the RHS of a GIMPLE_CALL.
-  Value *OutputCallRHS(gimple_statement_d *stmt, const MemRef *DestLoc);
+  llvm::Value *OutputCallRHS(gimple_statement_d *stmt, const MemRef *DestLoc);
 
   /// WriteScalarToLHS - Store RHS, a non-aggregate value, into the given LHS.
-  void WriteScalarToLHS(tree_node *lhs, Value *Scalar);
+  void WriteScalarToLHS(tree_node *lhs, llvm::Value *Scalar);
 
 private:
 
@@ -493,7 +497,7 @@ private:
   /// that the original and target types are LLVM register types that correspond
   /// to GCC scalar types t1 and t2 satisfying useless_type_conversion_p(t1, t2)
   /// or useless_type_conversion_p(t2, t1).
-  Value *TriviallyTypeConvert(Value *V, Type *Ty) {
+  llvm::Value *TriviallyTypeConvert(llvm::Value *V, llvm::Type *Ty) {
     // If useless_type_conversion_p(t1, t2) holds then the corresponding LLVM
     // register types are either equal or are both pointer types.
     if (V->getType() == Ty)
@@ -504,164 +508,180 @@ private:
 
   /// EmitRegister - Convert the specified gimple register or local constant of
   /// register type to an LLVM value.  Only creates code in the entry block.
-  Value *EmitRegister(tree_node *reg);
+  llvm::Value *EmitRegister(tree_node *reg);
 
   /// EmitRegisterWithCast - Utility method that calls EmitRegister, then casts
   /// the returned value to the given register type.
-  Value *EmitRegisterWithCast(tree_node *reg, tree_node *type);
+  llvm::Value *EmitRegisterWithCast(tree_node *reg, tree_node *type);
 
   /// EmitReg_SSA_NAME - Return the defining value of the given SSA_NAME.
   /// Only creates code in the entry block.
-  Value *EmitReg_SSA_NAME(tree_node *reg);
+  llvm::Value *EmitReg_SSA_NAME(tree_node *reg);
 
   // Unary expressions.
-  Value *EmitReg_ABS_EXPR(tree_node *op);
-  Value *EmitReg_BIT_NOT_EXPR(tree_node *op);
-  Value *EmitReg_CONJ_EXPR(tree_node *op);
-  Value *EmitReg_CONVERT_EXPR(tree_node *type, tree_node *op);
-  Value *EmitReg_NEGATE_EXPR(tree_node *op);
-  Value *EmitReg_PAREN_EXPR(tree_node *exp);
-  Value *EmitReg_TRUTH_NOT_EXPR(tree_node *type, tree_node *op);
+  llvm::Value *EmitReg_ABS_EXPR(tree_node *op);
+  llvm::Value *EmitReg_BIT_NOT_EXPR(tree_node *op);
+  llvm::Value *EmitReg_CONJ_EXPR(tree_node *op);
+  llvm::Value *EmitReg_CONVERT_EXPR(tree_node *type, tree_node *op);
+  llvm::Value *EmitReg_NEGATE_EXPR(tree_node *op);
+  llvm::Value *EmitReg_PAREN_EXPR(tree_node *exp);
+  llvm::Value *EmitReg_TRUTH_NOT_EXPR(tree_node *type, tree_node *op);
 
   // Comparisons.
 
   /// EmitCompare - Compare LHS with RHS using the appropriate comparison code.
   /// The result is an i1 boolean.
-  Value *EmitCompare(tree_node *lhs, tree_node *rhs, unsigned code);
+  llvm::Value *EmitCompare(tree_node *lhs, tree_node *rhs, unsigned code);
 
   // Binary expressions.
-  Value *EmitReg_MinMaxExpr(tree_node *op0, tree_node *op1, unsigned UIPred,
-                            unsigned SIPred, unsigned Opc);
-  Value *EmitReg_ReducMinMaxExpr(tree_node *op, unsigned UIPred,
-                                 unsigned SIPred, unsigned Opc);
-  Value *EmitReg_RotateOp(tree_node *type, tree_node *op0, tree_node *op1,
-                          unsigned Opc1, unsigned Opc2);
-  Value *EmitReg_ShiftOp(tree_node *op0, tree_node *op1, unsigned Opc);
-  Value *EmitReg_VecShiftOp(tree_node *op0, tree_node *op1, bool isLeftShift);
-  Value *EmitReg_TruthOp(tree_node *type, tree_node *op0, tree_node *op1,
-                         unsigned Opc);
-  Value *EmitReg_VecUnpackHiExpr(tree_node *type, tree_node *op0);
-  Value *EmitReg_VecUnpackLoExpr(tree_node *type, tree_node *op0);
-  Value *EmitReg_BIT_AND_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_BIT_IOR_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_BIT_XOR_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_CEIL_DIV_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_COMPLEX_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_FLOOR_DIV_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_FLOOR_MOD_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_MINUS_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_MULT_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_PLUS_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_POINTER_PLUS_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_RDIV_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_REDUC_PLUS_EXPR(tree_node *op);
-  Value *EmitReg_ROUND_DIV_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_TRUNC_DIV_EXPR(tree_node *op0, tree_node *op1, bool isExact);
-  Value *EmitReg_TRUNC_MOD_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_MinMaxExpr(tree_node *op0, tree_node *op1,
+                                  unsigned UIPred, unsigned SIPred,
+                                  unsigned Opc);
+  llvm::Value *EmitReg_ReducMinMaxExpr(tree_node *op, unsigned UIPred,
+                                       unsigned SIPred, unsigned Opc);
+  llvm::Value *EmitReg_RotateOp(tree_node *type, tree_node *op0, tree_node *op1,
+                                unsigned Opc1, unsigned Opc2);
+  llvm::Value *EmitReg_ShiftOp(tree_node *op0, tree_node *op1, unsigned Opc);
+  llvm::Value *EmitReg_VecShiftOp(tree_node *op0, tree_node *op1,
+                                  bool isLeftShift);
+  llvm::Value *EmitReg_TruthOp(tree_node *type, tree_node *op0, tree_node *op1,
+                               unsigned Opc);
+  llvm::Value *EmitReg_VecUnpackHiExpr(tree_node *type, tree_node *op0);
+  llvm::Value *EmitReg_VecUnpackLoExpr(tree_node *type, tree_node *op0);
+  llvm::Value *EmitReg_BIT_AND_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_BIT_IOR_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_BIT_XOR_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_CEIL_DIV_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_COMPLEX_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_FLOOR_DIV_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_FLOOR_MOD_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_MINUS_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_MULT_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_PLUS_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_POINTER_PLUS_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_RDIV_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_REDUC_PLUS_EXPR(tree_node *op);
+  llvm::Value *EmitReg_ROUND_DIV_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_TRUNC_DIV_EXPR(tree_node *op0, tree_node *op1,
+                                      bool isExact);
+  llvm::Value *EmitReg_TRUNC_MOD_EXPR(tree_node *op0, tree_node *op1);
 #if (GCC_MINOR < 7)
-  Value *EmitReg_VEC_EXTRACT_EVEN_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_VEC_EXTRACT_ODD_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_VEC_INTERLEAVE_HIGH_EXPR(tree_node *op0, tree_node *op1);
-  Value *EmitReg_VEC_INTERLEAVE_LOW_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_VEC_EXTRACT_EVEN_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_VEC_EXTRACT_ODD_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_VEC_INTERLEAVE_HIGH_EXPR(tree_node *op0, tree_node *op1);
+  llvm::Value *EmitReg_VEC_INTERLEAVE_LOW_EXPR(tree_node *op0, tree_node *op1);
 #endif
-  Value *EmitReg_VEC_PACK_FIX_TRUNC_EXPR(tree_node *type, tree_node *op0,
+  llvm::Value *EmitReg_VEC_PACK_FIX_TRUNC_EXPR(tree_node *type, tree_node *op0,
                                          tree_node *op1);
-  Value *
+  llvm::Value *
   EmitReg_VEC_PACK_TRUNC_EXPR(tree_node *type, tree_node *op0, tree_node *op1);
-  Value *EmitReg_VEC_WIDEN_MULT_HI_EXPR(tree_node *type, tree_node *op0,
+  llvm::Value *EmitReg_VEC_WIDEN_MULT_HI_EXPR(tree_node *type, tree_node *op0,
                                         tree_node *op1);
-  Value *EmitReg_VEC_WIDEN_MULT_LO_EXPR(tree_node *type, tree_node *op0,
+  llvm::Value *EmitReg_VEC_WIDEN_MULT_LO_EXPR(tree_node *type, tree_node *op0,
                                         tree_node *op1);
-  Value *
+  llvm::Value *
   EmitReg_WIDEN_MULT_EXPR(tree_node *type, tree_node *op0, tree_node *op1);
 
   // Ternary expressions.
-  Value *EmitReg_CondExpr(tree_node *op0, tree_node *op1, tree_node *op2);
+  llvm::Value *EmitReg_CondExpr(tree_node *op0, tree_node *op1, tree_node *op2);
 #if (GCC_MINOR > 6)
-  Value *EmitReg_VEC_PERM_EXPR(tree_node *op0, tree_node *op1, tree_node *op2);
+  llvm::Value *EmitReg_VEC_PERM_EXPR(tree_node *op0, tree_node *op1,
+                                     tree_node *op2);
 #endif
 
-  Value *EmitLoadOfLValue(tree_node *exp);
-  Value *EmitOBJ_TYPE_REF(tree_node *exp);
-  Value *EmitADDR_EXPR(tree_node *exp);
+  llvm::Value *EmitLoadOfLValue(tree_node *exp);
+  llvm::Value *EmitOBJ_TYPE_REF(tree_node *exp);
+  llvm::Value *EmitADDR_EXPR(tree_node *exp);
 #if (GCC_MINOR < 7)
-  Value *EmitCondExpr(tree_node *exp);
+  llvm::Value *EmitCondExpr(tree_node *exp);
 #endif
-  Value *EmitCallOf(Value *Callee, gimple_statement_d *stmt,
-                    const MemRef *DestLoc, const AttributeSet &PAL);
-  CallInst *EmitSimpleCall(StringRef CalleeName, tree_node *ret_type,
-                           /* arguments */ ...) END_WITH_NULL;
-  Value *EmitFieldAnnotation(Value *FieldPtr, tree_node *FieldDecl);
+  llvm::Value *EmitCallOf(llvm::Value *Callee, gimple_statement_d *stmt,
+                          const MemRef *DestLoc, const llvm::AttributeSet &PAL);
+  llvm::CallInst *EmitSimpleCall(llvm::StringRef CalleeName,
+                                 tree_node *ret_type,
+                                 /* arguments */ ...) END_WITH_NULL;
+  llvm::Value *EmitFieldAnnotation(llvm::Value *FieldPtr, tree_node *FieldDecl);
 
   // Inline Assembly and Register Variables.
-  Value *EmitReadOfRegisterVariable(tree_node *vardecl);
-  void EmitModifyOfRegisterVariable(tree_node *vardecl, Value *RHS);
+  llvm::Value *EmitReadOfRegisterVariable(tree_node *vardecl);
+  void EmitModifyOfRegisterVariable(tree_node *vardecl, llvm::Value *RHS);
 
   // Helpers for Builtin Function Expansion.
-  Value *BuildVector(const std::vector<Value *> &Elts);
-  Value *BuildVector(Value *Elt, ...);
-  Value *BuildVectorShuffle(Value *InVec1, Value *InVec2, ...);
-  Value *BuildBinaryAtomic(gimple_statement_d *stmt, AtomicRMWInst::BinOp Kind,
-                           unsigned PostOp = 0);
-  Value *
+  llvm::Value *BuildVector(const std::vector<llvm::Value *> &Elts);
+  llvm::Value *BuildVector(llvm::Value *Elt, ...);
+  llvm::Value *BuildVectorShuffle(llvm::Value *InVec1, llvm::Value *InVec2, ...);
+  llvm::Value *BuildBinaryAtomic(gimple_statement_d *stmt,
+                                 llvm::AtomicRMWInst::BinOp Kind,
+                                 unsigned PostOp = 0);
+  llvm::Value *
   BuildCmpAndSwapAtomic(gimple_statement_d *stmt, unsigned Bits, bool isBool);
 
   // Builtin Function Expansion.
   bool EmitBuiltinCall(gimple_statement_d *stmt, tree_node *fndecl,
-                       const MemRef *DestLoc, Value *&Result);
+                       const MemRef *DestLoc, llvm::Value *&Result);
   bool EmitFrontendExpandedBuiltinCall(gimple_statement_d *stmt,
                                        tree_node *fndecl, const MemRef *DestLoc,
-                                       Value *&Result);
-  bool EmitBuiltinUnaryOp(Value *InVal, Value *&Result, Intrinsic::ID Id);
-  Value *
-  EmitBuiltinBitCountIntrinsic(gimple_statement_d *stmt, Intrinsic::ID Id);
-  Value *EmitBuiltinSQRT(gimple_statement_d *stmt);
-  Value *EmitBuiltinPOWI(gimple_statement_d *stmt);
-  Value *EmitBuiltinPOW(gimple_statement_d *stmt);
-  Value *EmitBuiltinLCEIL(gimple_statement_d *stmt);
-  Value *EmitBuiltinLFLOOR(gimple_statement_d *stmt);
-  Value *EmitBuiltinCEXPI(gimple_statement_d *stmt);
-
-  bool EmitBuiltinAdjustTrampoline(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinAlloca(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinAllocaWithAlign(gimple_statement_d *stmt, Value *&Result);
+                                       llvm::Value *&Result);
+  bool EmitBuiltinUnaryOp(llvm::Value *InVal, llvm::Value *&Result,
+                          llvm::Intrinsic::ID Id);
+  llvm::Value *
+  EmitBuiltinBitCountIntrinsic(gimple_statement_d *stmt,
+                               llvm::Intrinsic::ID Id);
+  llvm::Value *EmitBuiltinSQRT(gimple_statement_d *stmt);
+  llvm::Value *EmitBuiltinPOWI(gimple_statement_d *stmt);
+  llvm::Value *EmitBuiltinPOW(gimple_statement_d *stmt);
+  llvm::Value *EmitBuiltinLCEIL(gimple_statement_d *stmt);
+  llvm::Value *EmitBuiltinLFLOOR(gimple_statement_d *stmt);
+  llvm::Value *EmitBuiltinCEXPI(gimple_statement_d *stmt);
+
+  bool EmitBuiltinAdjustTrampoline(gimple_statement_d *stmt,
+                                   llvm::Value *&Result);
+  bool EmitBuiltinAlloca(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinAllocaWithAlign(gimple_statement_d *stmt,
+                                  llvm::Value *&Result);
 #if (GCC_MINOR > 6)
-  bool EmitBuiltinAssumeAligned(gimple_statement_d *stmt, Value *&Result);
+  bool EmitBuiltinAssumeAligned(gimple_statement_d *stmt, llvm::Value *&Result);
 #endif
-  bool EmitBuiltinBZero(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinConstantP(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinExpect(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinExtendPointer(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinExtractReturnAddr(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinFrobReturnAddr(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinInitTrampoline(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinMemCopy(gimple_statement_d *stmt, Value *&Result,
+  bool EmitBuiltinBZero(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinConstantP(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinExpect(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinExtendPointer(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinExtractReturnAddr(gimple_statement_d *stmt,
+                                    llvm::Value *&Result);
+  bool EmitBuiltinFrobReturnAddr(gimple_statement_d *stmt,
+                                 llvm::Value *&Result);
+  bool EmitBuiltinInitTrampoline(gimple_statement_d *stmt,
+                                 llvm::Value *&Result);
+  bool EmitBuiltinMemCopy(gimple_statement_d *stmt, llvm::Value *&Result,
                           bool isMemMove, bool SizeCheck);
-  bool EmitBuiltinMemSet(gimple_statement_d *stmt, Value *&Result,
+  bool EmitBuiltinMemSet(gimple_statement_d *stmt, llvm::Value *&Result,
                          bool SizeCheck);
   bool EmitBuiltinPrefetch(gimple_statement_d *stmt);
-  bool EmitBuiltinReturnAddr(gimple_statement_d *stmt, Value *&Result,
+  bool EmitBuiltinReturnAddr(gimple_statement_d *stmt, llvm::Value *&Result,
                              bool isFrame);
   bool EmitBuiltinStackRestore(gimple_statement_d *stmt);
-  bool EmitBuiltinStackSave(gimple_statement_d *stmt, Value *&Result);
+  bool EmitBuiltinStackSave(gimple_statement_d *stmt, llvm::Value *&Result);
   bool EmitBuiltinUnreachable();
   bool EmitBuiltinVACopy(gimple_statement_d *stmt);
   bool EmitBuiltinVAEnd(gimple_statement_d *stmt);
   bool EmitBuiltinVAStart(gimple_statement_d *stmt);
 
   bool EmitBuiltinEHCopyValues(gimple_statement_d *stmt);
-  bool EmitBuiltinEHFilter(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinEHPointer(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinDwarfCFA(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinDwarfSPColumn(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinEHReturnDataRegno(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinEHReturn(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinInitDwarfRegSizes(gimple_statement_d *stmt, Value *&Result);
-  bool EmitBuiltinUnwindInit(gimple_statement_d *stmt, Value *&Result);
+  bool EmitBuiltinEHFilter(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinEHPointer(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinDwarfCFA(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinDwarfSPColumn(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinEHReturnDataRegno(gimple_statement_d *stmt,
+                                    llvm::Value *&Result);
+  bool EmitBuiltinEHReturn(gimple_statement_d *stmt, llvm::Value *&Result);
+  bool EmitBuiltinInitDwarfRegSizes(gimple_statement_d *stmt,
+                                    llvm::Value *&Result);
+  bool EmitBuiltinUnwindInit(gimple_statement_d *stmt, llvm::Value *&Result);
 
   // Complex Math Expressions.
-  Value *CreateComplex(Value *Real, Value *Imag);
-  void SplitComplex(Value *Complex, Value *&Real, Value *&Imag);
+  llvm::Value *CreateComplex(llvm::Value *Real, llvm::Value *Imag);
+  void SplitComplex(llvm::Value *Complex, llvm::Value *&Real,
+                    llvm::Value *&Imag);
 
   // L-Value Expressions.
   LValue EmitLV_ARRAY_REF(tree_node *exp);
@@ -682,70 +702,71 @@ private:
   LValue EmitLV_TARGET_MEM_REF(tree_node *exp);
 
   // Constant Expressions.
-  Value *EmitINTEGER_CST(tree_node *exp);
-  Value *EmitREAL_CST(tree_node *exp);
-  Value *EmitCONSTRUCTOR(tree_node *exp, const MemRef *DestLoc);
+  llvm::Value *EmitINTEGER_CST(tree_node *exp);
+  llvm::Value *EmitREAL_CST(tree_node *exp);
+  llvm::Value *EmitCONSTRUCTOR(tree_node *exp, const MemRef *DestLoc);
 
   // Emit helpers.
 
   /// EmitMinInvariant - The given value is constant in this function.  Return
   /// the corresponding LLVM value. Only creates code in the entry block.
-  Value *EmitMinInvariant(tree_node *reg);
+  llvm::Value *EmitMinInvariant(tree_node *reg);
 
   /// EmitInvariantAddress - The given address is constant in this function.
   /// Return the corresponding LLVM value. Only creates code in the entry block.
-  Value *EmitInvariantAddress(tree_node *addr);
+  llvm::Value *EmitInvariantAddress(tree_node *addr);
 
   /// EmitRegisterConstant - Convert the given global constant of register type
   /// to an LLVM constant.  Creates no code, only constants.
-  Constant *EmitRegisterConstant(tree_node *reg);
+  llvm::Constant *EmitRegisterConstant(tree_node *reg);
 
   /// EmitRegisterConstantWithCast - Utility that casts the value returned by
   /// EmitRegisterConstant to the given register type.
-  Constant *EmitRegisterConstantWithCast(tree_node *reg, tree_node *type);
+  llvm::Constant *EmitRegisterConstantWithCast(tree_node *reg, tree_node *type);
 
   /// EmitComplexRegisterConstant - Turn the given COMPLEX_CST into an LLVM
   /// constant of the corresponding register type.
-  Constant *EmitComplexRegisterConstant(tree_node *reg);
+  llvm::Constant *EmitComplexRegisterConstant(tree_node *reg);
 
   /// EmitIntegerRegisterConstant - Turn the given INTEGER_CST into an LLVM
   /// constant of the corresponding register type.
-  Constant *EmitIntegerRegisterConstant(tree_node *reg);
+  llvm::Constant *EmitIntegerRegisterConstant(tree_node *reg);
 
   /// EmitRealRegisterConstant - Turn the given REAL_CST into an LLVM constant
   /// of the corresponding register type.
-  Constant *EmitRealRegisterConstant(tree_node *reg);
+  llvm::Constant *EmitRealRegisterConstant(tree_node *reg);
 
   /// EmitConstantVectorConstructor - Turn the given constant CONSTRUCTOR into
   /// an LLVM constant of the corresponding vector register type.
-  Constant *EmitConstantVectorConstructor(tree_node *reg);
+  llvm::Constant *EmitConstantVectorConstructor(tree_node *reg);
 
   /// EmitVectorRegisterConstant - Turn the given VECTOR_CST into an LLVM
   /// constant of the corresponding register type.
-  Constant *EmitVectorRegisterConstant(tree_node *reg);
+  llvm::Constant *EmitVectorRegisterConstant(tree_node *reg);
 
   /// EmitMemory - Convert the specified gimple register or local constant of
   /// register type to an LLVM value with in-memory type (given by ConvertType).
   /// TODO: Eliminate this method, see Mem2Reg and Reg2Mem above.
-  Value *EmitMemory(tree_node *reg);
+  llvm::Value *EmitMemory(tree_node *reg);
 
   /// VectorHighElements - Return a vector of half the length, consisting of the
   /// elements of the given vector with indices in the top half.
-  Value *VectorHighElements(Value *Vec);
+  llvm::Value *VectorHighElements(llvm::Value *Vec);
 
   /// VectorLowElements - Return a vector of half the length, consisting of the
   /// elements of the given vector with indices in the bottom half.
-  Value *VectorLowElements(Value *Vec);
+  llvm::Value *VectorLowElements(llvm::Value *Vec);
 
 private:
   // Optional target defined builtin intrinsic expanding function.
   bool TargetIntrinsicLower(gimple_statement_d *stmt, tree_node *fndecl,
-                            const MemRef *DestLoc, Value *&Result,
-                            Type *ResultType, std::vector<Value *> &Ops);
+                            const MemRef *DestLoc, llvm::Value *&Result,
+                            llvm::Type *ResultType,
+                            std::vector<llvm::Value *> &Ops);
 
 public:
   // Helper for taking the address of a label.
-  Constant *AddressOfLABEL_DECL(tree_node *exp);
+  llvm::Constant *AddressOfLABEL_DECL(tree_node *exp);
 };
 
 #endif /* DRAGONEGG_INTERNALS_H */

Modified: dragonegg/trunk/include/dragonegg/TypeConversion.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/TypeConversion.h?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/TypeConversion.h (original)
+++ dragonegg/trunk/include/dragonegg/TypeConversion.h Tue Apr  2 05:08:16 2013
@@ -96,7 +96,8 @@ ConvertFunctionType(tree_node *type, tre
 /// return the LLVM type corresponding to the function.  This is useful for
 /// turning "T foo(...)" functions into "T foo(void)" functions.
 llvm::FunctionType *ConvertArgListToFnType(
-    tree_node *type, ArrayRef<tree_node *> arglist, tree_node *static_chain,
-    bool KNRPromotion, llvm::CallingConv::ID &CC, llvm::AttributeSet &PAL);
+    tree_node *type, llvm::ArrayRef<tree_node *> arglist,
+    tree_node *static_chain, bool KNRPromotion, llvm::CallingConv::ID &CC,
+    llvm::AttributeSet &PAL);
 
 #endif /* DRAGONEGG_TYPES_H */

Modified: dragonegg/trunk/include/x86/dragonegg/Target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/x86/dragonegg/Target.h?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/include/x86/dragonegg/Target.h (original)
+++ dragonegg/trunk/include/x86/dragonegg/Target.h Tue Apr  2 05:08:16 2013
@@ -125,7 +125,7 @@ extern bool llvm_x86_should_pass_aggrega
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X, Y, Z)                    \
   llvm_x86_should_pass_aggregate_in_integer_regs((X), (Y), (Z))
 
-extern Type *
+extern llvm::Type *
 llvm_x86_scalar_type_for_struct_return(tree_node *type, unsigned *Offset);
 
 /* LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be
@@ -133,7 +133,7 @@ llvm_x86_scalar_type_for_struct_return(t
 #define LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(X, Y)                               \
   llvm_x86_scalar_type_for_struct_return((X), (Y))
 
-extern Type *llvm_x86_aggr_type_for_struct_return(tree_node *type);
+extern llvm::Type *llvm_x86_aggr_type_for_struct_return(tree_node *type);
 
 /* LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be
    returned as an aggregate, otherwise return NULL. */
@@ -141,7 +141,7 @@ extern Type *llvm_x86_aggr_type_for_stru
   llvm_x86_aggr_type_for_struct_return(X)
 
 extern void llvm_x86_extract_multiple_return_value(
-    Value *Src, Value *Dest, bool isVolatile, LLVMBuilder &B);
+    llvm::Value *Src, llvm::Value *Dest, bool isVolatile, LLVMBuilder &B);
 
 /* LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from
    SRC and assign it to DEST. */
@@ -185,7 +185,8 @@ extern bool llvm_x86_should_not_return_c
 #define LLVM_SHOULD_NOT_RETURN_COMPLEX_IN_MEMORY(X)                            \
   llvm_x86_should_not_return_complex_in_memory((X))
 
-extern bool llvm_x86_should_pass_aggregate_as_fca(tree_node *type, Type *);
+extern bool llvm_x86_should_pass_aggregate_as_fca(tree_node *type,
+                                                  llvm::Type *);
 
 /* LLVM_SHOULD_PASS_AGGREGATE_AS_FCA - Return true if an aggregate of the
    specified type should be passed as a first-class aggregate. */
@@ -194,15 +195,15 @@ extern bool llvm_x86_should_pass_aggrega
   llvm_x86_should_pass_aggregate_as_fca(X, TY)
 #endif
 
-extern bool llvm_x86_should_pass_aggregate_in_memory(tree_node *, Type *);
+extern bool llvm_x86_should_pass_aggregate_in_memory(tree_node *, llvm::Type *);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY)                     \
   llvm_x86_should_pass_aggregate_in_memory(X, TY)
 
 extern bool llvm_x86_64_should_pass_aggregate_in_mixed_regs(
-    tree_node *, Type *Ty, std::vector<Type *> &);
+    tree_node *, llvm::Type *Ty, std::vector<llvm::Type *> &);
 extern bool llvm_x86_32_should_pass_aggregate_in_mixed_regs(
-    tree_node *, Type *Ty, std::vector<Type *> &);
+    tree_node *, llvm::Type *Ty, std::vector<llvm::Type *> &);
 
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E)                 \
   (TARGET_64BIT                                                                \
@@ -210,7 +211,7 @@ extern bool llvm_x86_32_should_pass_aggr
        : llvm_x86_32_should_pass_aggregate_in_mixed_regs((T), (TY), (E)))
 
 extern bool llvm_x86_64_aggregate_partially_passed_in_regs(
-    std::vector<Type *> &, std::vector<Type *> &, bool);
+    std::vector<llvm::Type *> &, std::vector<llvm::Type *> &, bool);
 
 #define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR, CC)                \
   (TARGET_64BIT                                                                \

Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Tue Apr  2 05:08:16 2013
@@ -99,6 +99,8 @@ tree default_mangle_decl_assembler_name(
 #error Unsupported GCC major version
 #endif
 
+using namespace llvm;
+
 // Non-zero if libcalls should not be simplified.
 int flag_no_simplify_libcalls;
 
@@ -921,11 +923,11 @@ static void emit_alias(tree decl, tree t
       }
     } else {
       // weakref to external symbol.
-      if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
+      if (GlobalVariable *GV = llvm::dyn_cast<GlobalVariable>(V))
         Aliasee = new GlobalVariable(
             *TheModule, GV->getType()->getElementType(), GV->isConstant(),
             GlobalVariable::ExternalWeakLinkage, NULL, AliaseeName);
-      else if (Function *F = dyn_cast<Function>(V))
+      else if (Function *F = llvm::dyn_cast<Function>(V))
         Aliasee = Function::Create(F->getFunctionType(),
                                    Function::ExternalWeakLinkage, AliaseeName,
                                    TheModule);

Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Tue Apr  2 05:08:16 2013
@@ -68,6 +68,8 @@ extern "C" {
 #include "tree-flow.h"
 #include "tree-pass.h"
 
+using namespace llvm;
+
 #if (GCC_MINOR < 6)
 extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
 #else
@@ -128,7 +130,7 @@ static Value *GetSSAPlaceholder(Type *Ty
 /// isSSAPlaceholder - Whether this is a fake value being used as a placeholder
 /// for the definition of an SSA name.
 static bool isSSAPlaceholder(Value *V) {
-  LoadInst *LI = dyn_cast<LoadInst>(V);
+  LoadInst *LI = llvm::dyn_cast<LoadInst>(V);
   return LI && !LI->getParent();
 }
 
@@ -1353,7 +1355,8 @@ Function *TreeToLLVM::FinishFunctionBody
               ReturnLoc.Ptr, ResultLV.Ptr, Builder.getInt64(OctetsToCopy),
               std::min(ReturnLoc.getAlignment(), ResultLV.getAlignment()));
 
-          if (StructType *STy = dyn_cast<StructType>(Fn->getReturnType())) {
+          if (StructType *STy =
+                llvm::dyn_cast<StructType>(Fn->getReturnType())) {
             llvm::Value *Idxs[2];
             Idxs[0] = Builder.getInt32(0);
             bool Packed = STy->isPacked();
@@ -1879,7 +1882,7 @@ Value *TreeToLLVM::CastToSameSizeInteger
   assert(OrigEltTy->isFloatingPointTy() && "Expected a floating point type!");
   unsigned BitWidth = OrigEltTy->getPrimitiveSizeInBits();
   Type *NewEltTy = IntegerType::get(Context, BitWidth);
-  if (VectorType *VecTy = dyn_cast<VectorType>(OrigTy)) {
+  if (VectorType *VecTy = llvm::dyn_cast<VectorType>(OrigTy)) {
     Type *NewTy = VectorType::get(NewEltTy, VecTy->getNumElements());
     return Builder.CreateBitCast(V, NewTy);
   }
@@ -2879,7 +2882,7 @@ Value *TreeToLLVM::EmitOBJ_TYPE_REF(tree
 Value *TreeToLLVM::EmitCONSTRUCTOR(tree exp, const MemRef *DestLoc) {
   tree type = TREE_TYPE(exp);
   Type *Ty = ConvertType(type);
-  if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
+  if (VectorType *VTy = llvm::dyn_cast<VectorType>(Ty)) {
     assert(DestLoc == 0 && "Dest location for vector value?");
     std::vector<Value *> BuildVecOps;
     BuildVecOps.reserve(VTy->getNumElements());
@@ -2890,7 +2893,7 @@ Value *TreeToLLVM::EmitCONSTRUCTOR(tree
     FOR_EACH_CONSTRUCTOR_VALUE(CONSTRUCTOR_ELTS(exp), idx, value) {
       Value *Elt = EmitRegister(value);
 
-      if (VectorType *EltTy = dyn_cast<VectorType>(Elt->getType())) {
+      if (VectorType *EltTy = llvm::dyn_cast<VectorType>(Elt->getType())) {
         // GCC allows vectors to be built up from vectors.  Extract all of the
         // vector elements and add them to the list of build vector operands.
         for (unsigned i = 0, e = EltTy->getNumElements(); i != e; ++i) {
@@ -3544,7 +3547,7 @@ CallInst *TreeToLLVM::EmitSimpleCall(Str
 
   // If the function already existed with the wrong prototype then don't try to
   // muck with its calling convention.  Otherwise, set the calling convention.
-  if (Function *F = dyn_cast<Function>(Func))
+  if (Function *F = llvm::dyn_cast<Function>(Func))
     F->setCallingConv(CC);
 
   // Finally, call the function.
@@ -5213,7 +5216,7 @@ bool TreeToLLVM::EmitBuiltinCall(gimple
 
         // If the function already existed with the wrong prototype then don't try to
         // muck with its calling convention.  Otherwise, set the calling convention.
-        if (Function *F = dyn_cast<Function>(Func))
+        if (Function *F = llvm::dyn_cast<Function>(Func))
           F->setCallingConv(CC);
 
         // Call sincos.
@@ -5252,7 +5255,7 @@ bool TreeToLLVM::EmitBuiltinCall(gimple
 
         // If the function already existed with the wrong prototype then don't try to
         // muck with its calling convention.  Otherwise, set the calling convention.
-        if (Function *F = dyn_cast<Function>(Func))
+        if (Function *F = llvm::dyn_cast<Function>(Func))
           F->setCallingConv(CC);
 
         // Form the complex number "0 + i*arg".
@@ -5355,18 +5358,18 @@ bool TreeToLLVM::EmitBuiltinCall(gimple
     /// or large enough to ensure no overflow (> len), then it's safe to do so.
     static bool OptimizeIntoPlainBuiltIn(gimple stmt, Value * Len,
                                          Value * Size) {
-      if (BitCastInst *SizeBC = dyn_cast<BitCastInst>(Size))
+      if (BitCastInst *SizeBC = llvm::dyn_cast<BitCastInst>(Size))
         Size = SizeBC->getOperand(0);
-      ConstantInt *SizeCI = dyn_cast<ConstantInt>(Size);
+      ConstantInt *SizeCI = llvm::dyn_cast<ConstantInt>(Size);
       if (!SizeCI)
         return false;
       if (SizeCI->isAllOnesValue())
         // If size is -1, convert to plain memcpy, etc.
         return true;
 
-      if (BitCastInst *LenBC = dyn_cast<BitCastInst>(Len))
+      if (BitCastInst *LenBC = llvm::dyn_cast<BitCastInst>(Len))
         Len = LenBC->getOperand(0);
-      ConstantInt *LenCI = dyn_cast<ConstantInt>(Len);
+      ConstantInt *LenCI = llvm::dyn_cast<ConstantInt>(Len);
       if (!LenCI)
         return false;
       if (SizeCI->getValue().ult(LenCI->getValue())) {
@@ -5520,7 +5523,7 @@ bool TreeToLLVM::EmitBuiltinCall(gimple
         return false;
 
       ConstantInt *Level =
-          dyn_cast<ConstantInt>(EmitMemory(gimple_call_arg(stmt, 0)));
+          llvm::dyn_cast<ConstantInt>(EmitMemory(gimple_call_arg(stmt, 0)));
       if (!Level) {
         if (isFrame)
           error("invalid argument to %<__builtin_frame_address%>");
@@ -7209,7 +7212,7 @@ bool TreeToLLVM::EmitBuiltinCall(gimple
       unsigned Bits = VecTy->getPrimitiveSizeInBits();
 
       // If the shift is by a multiple of the element size then emit a shuffle.
-      if (ConstantInt *CI = dyn_cast<ConstantInt>(Amt)) {
+      if (ConstantInt *CI = llvm::dyn_cast<ConstantInt>(Amt)) {
         // The GCC docs are not clear whether the bits shifted in must be zero or if
         // they can be anything.  Since these expressions are currently only used in
         // situations which make no assumptions about the shifted in bits, we choose

Modified: dragonegg/trunk/src/DefaultABI.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/DefaultABI.cpp?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Tue Apr  2 05:08:16 2013
@@ -46,6 +46,8 @@ extern "C" {
 // Trees header.
 #include "dragonegg/Trees.h"
 
+using namespace llvm;
+
 void DefaultABIClient::anchor() {}
 
 // doNotUseShadowReturn - Return true if the specified GCC type

Modified: dragonegg/trunk/src/TypeConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/TypeConversion.cpp?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/src/TypeConversion.cpp (original)
+++ dragonegg/trunk/src/TypeConversion.cpp Tue Apr  2 05:08:16 2013
@@ -56,6 +56,8 @@ extern "C" {
 // Trees header.
 #include "dragonegg/Trees.h"
 
+using namespace llvm;
+
 static LLVMContext &Context = getGlobalContext();
 
 /// SCCInProgress - Set of mutually dependent types currently being converted.

Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=178533&r1=178532&r2=178533&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Tue Apr  2 05:08:16 2013
@@ -63,6 +63,12 @@ extern void debug_gimple_stmt(union gimp
 // Trees header.
 #include "dragonegg/Trees.h"
 
+// One day we will do parameter marshalling right: by using CUMULATIVE_ARGS.
+// While waiting for that happy day, just include a chunk of i386.c.
+#include "ABIHack.inc"
+
+using namespace llvm;
+
 static LLVMContext &Context = getGlobalContext();
 
 /// BitCastToIntVector - Bitcast the vector operand to a vector of integers of
@@ -173,7 +179,7 @@ bool TreeToLLVM::TargetIntrinsicLower(
   case copysignps256: {
     if (Ops.size() != 2)
       return false;
-    VectorType *VecTy = dyn_cast<VectorType>(Ops[0]->getType());
+    VectorType *VecTy = llvm::dyn_cast<VectorType>(Ops[0]->getType());
     if (Ops[1]->getType() != VecTy)
       return false;
     Type *EltTy = VecTy->getElementType();
@@ -288,7 +294,7 @@ bool TreeToLLVM::TargetIntrinsicLower(
     Result = Builder.CreateBitCast(Result, ResultType);
     return true;
   case shufps:
-    if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[2])) {
+    if (ConstantInt *Elt = llvm::dyn_cast<ConstantInt>(Ops[2])) {
       int EV = Elt->getZExtValue();
       Result = BuildVectorShuffle(Ops[0], Ops[1], ((EV & 0x03) >> 0),
                                   ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4) + 4,
@@ -299,7 +305,7 @@ bool TreeToLLVM::TargetIntrinsicLower(
     }
     return true;
   case shufpd:
-    if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[2])) {
+    if (ConstantInt *Elt = llvm::dyn_cast<ConstantInt>(Ops[2])) {
       int EV = Elt->getZExtValue();
       Result = BuildVectorShuffle(Ops[0], Ops[1], ((EV & 0x01) >> 0),
                                   ((EV & 0x02) >> 1) + 2);
@@ -310,7 +316,7 @@ bool TreeToLLVM::TargetIntrinsicLower(
     return true;
   case pshufw:
   case pshufd:
-    if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) {
+    if (ConstantInt *Elt = llvm::dyn_cast<ConstantInt>(Ops[1])) {
       int EV = Elt->getZExtValue();
       Result = BuildVectorShuffle(Ops[0], Ops[0], ((EV & 0x03) >> 0),
                                   ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4),
@@ -321,7 +327,7 @@ bool TreeToLLVM::TargetIntrinsicLower(
     }
     return true;
   case pshufhw:
-    if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) {
+    if (ConstantInt *Elt = llvm::dyn_cast<ConstantInt>(Ops[1])) {
       int EV = Elt->getZExtValue();
       Result =
           BuildVectorShuffle(Ops[0], Ops[0], 0, 1, 2, 3, ((EV & 0x03) >> 0) + 4,
@@ -331,7 +337,7 @@ bool TreeToLLVM::TargetIntrinsicLower(
     }
     return false;
   case pshuflw:
-    if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) {
+    if (ConstantInt *Elt = llvm::dyn_cast<ConstantInt>(Ops[1])) {
       int EV = Elt->getZExtValue();
       Result = BuildVectorShuffle(Ops[0], Ops[0], ((EV & 0x03) >> 0),
                                   ((EV & 0x0c) >> 2), ((EV & 0x30) >> 4),
@@ -971,14 +977,14 @@ bool TreeToLLVM::TargetIntrinsicLower(
   case vec_perm_v8hi:
   case vec_perm_v8hi_u:
   case vec_perm_v8sf: {
-    VectorType *VecTy = dyn_cast<VectorType>(Ops[0]->getType());
+    VectorType *VecTy = llvm::dyn_cast<VectorType>(Ops[0]->getType());
     if (Ops[1]->getType() != VecTy)
       return false;
     unsigned NElts = VecTy->getNumElements();
-    Constant *Mask = dyn_cast<Constant>(Ops[2]);
+    Constant *Mask = llvm::dyn_cast<Constant>(Ops[2]);
     if (!Mask)
       return false;
-    VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
+    VectorType *MaskTy = llvm::dyn_cast<VectorType>(Mask->getType());
     if (!MaskTy || MaskTy->getNumElements() != NElts ||
         !MaskTy->getElementType()->isIntegerTy())
       return false;
@@ -1063,10 +1069,6 @@ bool TreeToLLVM::TargetIntrinsicLower(
   llvm_unreachable("Forgot case for code?");
 }
 
-// One day we will do parameter marshalling right: by using CUMULATIVE_ARGS.
-// While waiting for that happy day, just include a chunk of i386.c.
-#include "ABIHack.inc"
-
 /* Target hook for llvm-abi.h. It returns true if an aggregate of the
    specified type should be passed in memory. This is only called for
    x86-64. */
@@ -1110,7 +1112,7 @@ bool llvm_x86_32_should_pass_aggregate_i
   // Note that we can't support passing all structs this way.  For example,
   // {i16, i16} should be passed in on 32-bit unit, which is not how "i16, i16"
   // would be passed as stand-alone arguments.
-  StructType *STy = dyn_cast<StructType>(Ty);
+  StructType *STy = llvm::dyn_cast<StructType>(Ty);
   if (!STy || STy->isPacked())
     return false;
 
@@ -1142,7 +1144,7 @@ bool llvm_x86_32_should_pass_aggregate_i
 bool llvm_x86_should_pass_aggregate_as_fca(tree type, Type *Ty) {
   if (!isa<COMPLEX_TYPE>(type))
     return false;
-  StructType *STy = dyn_cast<StructType>(Ty);
+  StructType *STy = llvm::dyn_cast<StructType>(Ty);
   if (!STy || STy->isPacked())
     return false;
 
@@ -1183,7 +1185,7 @@ static void count_num_registers_uses(std
                                      unsigned &NumGPRs, unsigned &NumXMMs) {
   for (size_t i = 0, e = ScalarElts.size(); i != e; ++i) {
     Type *Ty = ScalarElts[i];
-    if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
+    if (VectorType *VTy = llvm::dyn_cast<VectorType>(Ty)) {
       if (!TARGET_MACHO)
         continue;
       if (VTy->getNumElements() == 1)
@@ -1305,11 +1307,11 @@ bool llvm_x86_64_should_pass_aggregate_i
       } else if ((NumClasses - i) == 2) {
         if (Class[i + 1] == X86_64_SSEUP_CLASS) {
           Type *LLVMTy = ConvertType(TreeType);
-          if (StructType *STy = dyn_cast<StructType>(LLVMTy))
+          if (StructType *STy = llvm::dyn_cast<StructType>(LLVMTy))
             // Look pass the struct wrapper.
             if (STy->getNumElements() == 1)
               LLVMTy = STy->getElementType(0);
-          if (VectorType *VTy = dyn_cast<VectorType>(LLVMTy)) {
+          if (VectorType *VTy = llvm::dyn_cast<VectorType>(LLVMTy)) {
             if (VTy->getNumElements() == 2) {
               if (VTy->getElementType()->isIntegerTy()) {
                 Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2));
@@ -1489,7 +1491,7 @@ static bool llvm_suitable_multiple_ret_v
   if (!TARGET_64BIT)
     return false;
 
-  StructType *STy = dyn_cast<StructType>(Ty);
+  StructType *STy = llvm::dyn_cast<StructType>(Ty);
   if (!STy)
     return false;
 
@@ -1653,11 +1655,11 @@ static void llvm_x86_64_get_multiple_ret
       } else if ((NumClasses - i) == 2) {
         if (Class[i + 1] == X86_64_SSEUP_CLASS) {
           Type *Ty = ConvertType(TreeType);
-          if (StructType *STy = dyn_cast<StructType>(Ty))
+          if (StructType *STy = llvm::dyn_cast<StructType>(Ty))
             // Look pass the struct wrapper.
             if (STy->getNumElements() == 1)
               Ty = STy->getElementType(0);
-          if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
+          if (VectorType *VTy = llvm::dyn_cast<VectorType>(Ty)) {
             if (VTy->getNumElements() == 2) {
               if (VTy->getElementType()->isIntegerTy())
                 Elts.push_back(VectorType::get(Type::getInt64Ty(Context), 2));
@@ -1861,7 +1863,7 @@ void llvm_x86_extract_multiple_return_va
       unsigned Size = 1;
 
       if (VectorType *SElemTy =
-              dyn_cast<VectorType>(STy->getElementType(SNO))) {
+              llvm::dyn_cast<VectorType>(STy->getElementType(SNO))) {
         Size = SElemTy->getNumElements();
         if (SElemTy->getElementType()->getTypeID() == Type::FloatTyID &&
             Size == 4)





More information about the llvm-commits mailing list