[PATCH] D21739: [TTI] Add functions determining if int parameters/returns should be zeroext/signext.
Marcin KoĆcielnicki via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 28 11:04:20 PDT 2016
koriakin updated this revision to Diff 62112.
koriakin added a comment.
Split off the target-specific parts.
Repository:
rL LLVM
http://reviews.llvm.org/D21739
Files:
include/llvm/Analysis/TargetTransformInfo.h
include/llvm/Analysis/TargetTransformInfoImpl.h
lib/Analysis/TargetTransformInfo.cpp
Index: lib/Analysis/TargetTransformInfo.cpp
===================================================================
--- lib/Analysis/TargetTransformInfo.cpp
+++ lib/Analysis/TargetTransformInfo.cpp
@@ -396,6 +396,18 @@
return TTIImpl->areInlineCompatible(Caller, Callee);
}
+bool TargetTransformInfo::shouldExtI32Param() const {
+ return TTIImpl->shouldExtI32Param();
+}
+
+bool TargetTransformInfo::shouldExtI32Result() const {
+ return TTIImpl->shouldExtI32Result();
+}
+
+bool TargetTransformInfo::shouldSignExtI32Param() const {
+ return TTIImpl->shouldSignExtI32Param();
+}
+
TargetTransformInfo::Concept::~Concept() {}
TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {}
Index: include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- include/llvm/Analysis/TargetTransformInfoImpl.h
+++ include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -371,6 +371,12 @@
(Caller->getFnAttribute("target-features") ==
Callee->getFnAttribute("target-features"));
}
+
+ bool shouldExtI32Param() const { return false; }
+
+ bool shouldExtI32Result() const { return false; }
+
+ bool shouldSignExtI32Param() const { return false; }
};
/// \brief CRTP base class for use as a mix-in that aids implementing
Index: include/llvm/Analysis/TargetTransformInfo.h
===================================================================
--- include/llvm/Analysis/TargetTransformInfo.h
+++ include/llvm/Analysis/TargetTransformInfo.h
@@ -598,6 +598,20 @@
/// @}
+ /// Returns true iff i32 parameters to library functions should have
+ /// signext or zeroext attributes if they correspond to C-level int or
+ /// unsigned int, respectively.
+ bool shouldExtI32Param() const;
+
+ /// Returns true iff i32 results from library functions should have
+ /// signext or zeroext attributes if they correspond to C-level int or
+ /// unsigned int, respectively.
+ bool shouldExtI32Result() const;
+
+ /// Returns true iff i32 parameters to library functions should have
+ /// signext attribute if they correspond to C-level int or unsigned int.
+ bool shouldSignExtI32Param() const;
+
private:
/// \brief The abstract base class used to type erase specific TTI
/// implementations.
@@ -716,6 +730,9 @@
Type *ExpectedType) = 0;
virtual bool areInlineCompatible(const Function *Caller,
const Function *Callee) const = 0;
+ virtual bool shouldExtI32Param() const = 0;
+ virtual bool shouldExtI32Result() const = 0;
+ virtual bool shouldSignExtI32Param() const = 0;
};
template <typename T>
@@ -948,6 +965,15 @@
const Function *Callee) const override {
return Impl.areInlineCompatible(Caller, Callee);
}
+ bool shouldExtI32Param() const override {
+ return Impl.shouldExtI32Param();
+ }
+ bool shouldExtI32Result() const override {
+ return Impl.shouldExtI32Result();
+ }
+ bool shouldSignExtI32Param() const override {
+ return Impl.shouldSignExtI32Param();
+ }
};
template <typename T>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21739.62112.patch
Type: text/x-patch
Size: 3150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160628/04047349/attachment.bin>
More information about the llvm-commits
mailing list