Generate bitcasts going in and out of MMX parameters
in asm's. PR 8501, 8602988.
I don't like including Type.h where it is; the idea was
to get references to X86_MMXTy out of the common code.
Maybe there's a better way?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117736 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 5ed285d..631aa1f 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -985,6 +985,9 @@
}
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}";
@@ -1306,6 +1309,16 @@
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 {
switch (Constraint) {