aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-02-22 17:49:45 +0000
committerDale Johannesen <dalej@apple.com>2008-02-22 17:49:45 +0000
commit08e78b18b8ef2c939ee95469662c98e23846d860 (patch)
treeef1a7297738a17ceda59046eaf2b1a9f15222760 /lib/VMCore
parent3edd6dcf82c45d1b2644c6dac7deb3d9844ece6b (diff)
Pass alignment on ByVal parameters, from FE, all
the way through. It is now used for codegen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Function.cpp5
-rw-r--r--lib/VMCore/Instructions.cpp22
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 49d770d5bd..0cf808c507 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -143,6 +143,11 @@ bool Function::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return ParamAttrs && ParamAttrs->paramHasAttr(i, attr);
}
+/// @brief Extract the alignment for a call or parameter (0=unknown).
+uint16_t Function::getParamAlignment(uint16_t i) const {
+ return ParamAttrs ? ParamAttrs->getParamAlignment(i) : 0;
+}
+
/// @brief Determine if the function cannot return.
bool Function::doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 4197f80c92..b3a78b729f 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -61,6 +61,13 @@ bool CallSite::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
else
return cast<InvokeInst>(I)->paramHasAttr(i, attr);
}
+uint16_t CallSite::getParamAlignment(uint16_t i) const {
+ if (CallInst *CI = dyn_cast<CallInst>(I))
+ return CI->getParamAlignment(i);
+ else
+ return cast<InvokeInst>(I)->getParamAlignment(i);
+}
+
bool CallSite::doesNotAccessMemory() const {
if (CallInst *CI = dyn_cast<CallInst>(I))
return CI->doesNotAccessMemory();
@@ -384,6 +391,14 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
+uint16_t CallInst::getParamAlignment(uint16_t i) const {
+ if (ParamAttrs && ParamAttrs->getParamAlignment(i))
+ return ParamAttrs->getParamAlignment(i);
+ if (const Function *F = getCalledFunction())
+ return F->getParamAlignment(i);
+ return 0;
+}
+
/// @brief Determine if the call does not access memory.
bool CallInst::doesNotAccessMemory() const {
return paramHasAttr(0, ParamAttr::ReadNone);
@@ -508,6 +523,13 @@ bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
+uint16_t InvokeInst::getParamAlignment(uint16_t i) const {
+ if (ParamAttrs && ParamAttrs->getParamAlignment(i))
+ return ParamAttrs->getParamAlignment(i);
+ if (const Function *F = getCalledFunction())
+ return F->getParamAlignment(i);
+ return 0;
+}
/// @brief Determine if the call does not access memory.
bool InvokeInst::doesNotAccessMemory() const {