[cfe-commits] r125819 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/CodeGen/CGStmt.cpp lib/CodeGen/TargetInfo.cpp lib/CodeGen/TargetInfo.h

Peter Collingbourne peter at pcc.me.uk
Thu Feb 17 18:24:56 PST 2011


Author: pcc
Date: Thu Feb 17 20:24:56 2011
New Revision: 125819

URL: http://llvm.org/viewvc/llvm-project?rev=125819&view=rev
Log:
Move TargetInfo::adjustInlineAsmType to TargetCodeGenInfo

Modified:
    cfe/trunk/include/clang/Basic/TargetInfo.h
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/lib/CodeGen/TargetInfo.h

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=125819&r1=125818&r2=125819&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Thu Feb 17 20:24:56 2011
@@ -26,8 +26,6 @@
 namespace llvm {
 struct fltSemantics;
 class StringRef;
-class LLVMContext;
-class Type;
 }
 
 namespace clang {
@@ -532,12 +530,6 @@
   virtual const char *getStaticInitSectionSpecifier() const {
     return 0;
   }
-
-  virtual const llvm::Type* adjustInlineAsmType(std::string& Constraint, 
-                                     const llvm::Type* Ty,
-                                     llvm::LLVMContext& Context) const {
-    return Ty;
-  }
 protected:
   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
     return PointerWidth;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=125819&r1=125818&r2=125819&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Feb 17 20:24:56 2011
@@ -1014,9 +1014,6 @@
   }
   virtual bool validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const;
-  virtual const llvm::Type* adjustInlineAsmType(std::string& Constraint,
-                                     const llvm::Type* Ty,
-                                     llvm::LLVMContext& Context) const;
   virtual std::string convertConstraint(const char Constraint) const;
   virtual const char *getClobbers() const {
     return "~{dirflag},~{fpsr},~{flags}";
@@ -1341,15 +1338,6 @@
   return false;
 }
 
-const llvm::Type*
-X86TargetInfo::adjustInlineAsmType(std::string& Constraint,
-                                   const llvm::Type* Ty,
-                                   llvm::LLVMContext &Context) const {
-  if (Constraint=="y" && Ty->isVectorTy())
-    return llvm::Type::getX86_MMXTy(Context);
-  return Ty;
-}
-
 
 std::string
 X86TargetInfo::convertConstraint(const char Constraint) const {

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=125819&r1=125818&r2=125819&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Thu Feb 17 20:24:56 2011
@@ -14,6 +14,7 @@
 #include "CGDebugInfo.h"
 #include "CodeGenModule.h"
 #include "CodeGenFunction.h"
+#include "TargetInfo.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Basic/PrettyStackTrace.h"
 #include "clang/Basic/TargetInfo.h"
@@ -1135,8 +1136,8 @@
         }
       }
       if (const llvm::Type* AdjTy = 
-            Target.adjustInlineAsmType(OutputConstraint, ResultRegTypes.back(),
-                                       getLLVMContext()))
+            getTargetHooks().adjustInlineAsmType(*this, OutputConstraint,
+                                                 ResultRegTypes.back()))
         ResultRegTypes.back() = AdjTy;
     } else {
       ArgTypes.push_back(Dest.getAddress()->getType());
@@ -1207,8 +1208,8 @@
       }
     }
     if (const llvm::Type* AdjTy = 
-              Target.adjustInlineAsmType(InputConstraint, Arg->getType(),
-                                         getLLVMContext()))
+              getTargetHooks().adjustInlineAsmType(*this, InputConstraint,
+                                                   Arg->getType()))
       Arg = Builder.CreateBitCast(Arg, AdjTy);
 
     ArgTypes.push_back(Arg->getType());

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=125819&r1=125818&r2=125819&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Feb 17 20:24:56 2011
@@ -355,6 +355,14 @@
     IRType->getScalarSizeInBits() != 64;
 }
 
+static const llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
+                                                llvm::StringRef Constraint,
+                                                const llvm::Type* Ty) {
+  if (Constraint=="y" && UseX86_MMXType(Ty))
+    return llvm::Type::getX86_MMXTy(CGF.getLLVMContext());
+  return Ty;
+}
+
 //===----------------------------------------------------------------------===//
 // X86-32 ABI Implementation
 //===----------------------------------------------------------------------===//
@@ -415,6 +423,13 @@
 
   bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
                                llvm::Value *Address) const;
+
+  const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
+                                        llvm::StringRef Constraint,
+                                        const llvm::Type* Ty) const {
+    return X86AdjustInlineAsmType(CGF, Constraint, Ty);
+  }
+
 };
 
 }
@@ -895,6 +910,13 @@
 
     return false;
   }
+
+  const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
+                                        llvm::StringRef Constraint,
+                                        const llvm::Type* Ty) const {
+    return X86AdjustInlineAsmType(CGF, Constraint, Ty);
+  }
+
 };
 
 class WinX86_64TargetCodeGenInfo : public TargetCodeGenInfo {

Modified: cfe/trunk/lib/CodeGen/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.h?rev=125819&r1=125818&r2=125819&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.h (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.h Thu Feb 17 20:24:56 2011
@@ -15,8 +15,11 @@
 #ifndef CLANG_CODEGEN_TARGETINFO_H
 #define CLANG_CODEGEN_TARGETINFO_H
 
+#include "llvm/ADT/StringRef.h"
+
 namespace llvm {
   class GlobalValue;
+  class Type;
   class Value;
 }
 
@@ -102,6 +105,12 @@
                                              llvm::Value *Address) const {
       return Address;
     }
+
+    virtual const llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
+                                                  llvm::StringRef Constraint, 
+                                                  const llvm::Type* Ty) const {
+      return Ty;
+    }
   };
 }
 





More information about the cfe-commits mailing list