summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ParameterAttributes.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-02-19 23:51:49 +0000
committerDale Johannesen <dalej@apple.com>2008-02-19 23:51:49 +0000
commit11a555e94a807dc9547bfb76db870300769d2fa1 (patch)
tree78123aaa160b29d55138ad47af83d280cb48f4fc /llvm/lib/VMCore/ParameterAttributes.cpp
parent5ce8dd93efa4f2d1af187bd41e7d76dd5dd3e423 (diff)
downloadbcm5719-llvm-11a555e94a807dc9547bfb76db870300769d2fa1.tar.gz
bcm5719-llvm-11a555e94a807dc9547bfb76db870300769d2fa1.zip
Add Alignment field to ParameterAttributes and
treat more or less rationally in interface functions, subject to change. No functional change. llvm-svn: 47352
Diffstat (limited to 'llvm/lib/VMCore/ParameterAttributes.cpp')
-rw-r--r--llvm/lib/VMCore/ParameterAttributes.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ParameterAttributes.cpp b/llvm/lib/VMCore/ParameterAttributes.cpp
index d78068df113..c49e14c76ed 100644
--- a/llvm/lib/VMCore/ParameterAttributes.cpp
+++ b/llvm/lib/VMCore/ParameterAttributes.cpp
@@ -14,6 +14,7 @@
#include "llvm/ParameterAttributes.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Support/ManagedStatic.h"
+#include <sstream>
using namespace llvm;
@@ -68,13 +69,20 @@ ParamAttrsList::getParamAttrsText(ParameterAttributes Attrs) {
Result += "readnone ";
if (Attrs & ParamAttr::ReadOnly)
Result += "readonly ";
+ if (Attrs & ParamAttr::Alignment) {
+ std::stringstream s;
+ s << ((Attrs & ParamAttr::Alignment) >> 16);
+ Result += "align ";
+ Result += s.str();
+ Result += " ";
+ }
return Result;
}
void ParamAttrsList::Profile(FoldingSetNodeID &ID,
const ParamAttrsVector &Attrs) {
for (unsigned i = 0; i < Attrs.size(); ++i)
- ID.AddInteger(unsigned(Attrs[i].attrs) << 16 | unsigned(Attrs[i].index));
+ ID.AddInteger(uint64_t(Attrs[i].attrs) << 16 | unsigned(Attrs[i].index));
}
const ParamAttrsList *
@@ -173,6 +181,15 @@ ParamAttrsList::includeAttrs(const ParamAttrsList *PAL,
uint16_t idx, ParameterAttributes attrs) {
ParameterAttributes OldAttrs = PAL ? PAL->getParamAttrs(idx) :
ParamAttr::None;
+#ifndef NDEBUG
+ // FIXME it is not obvious how this should work for alignment.
+ // For now, say we can't change a known alignment.
+ ParameterAttributes OldAlign = OldAttrs & ParamAttr::Alignment;
+ ParameterAttributes NewAlign = attrs & ParamAttr::Alignment;
+ assert(!OldAlign || !NewAlign || OldAlign == NewAlign &&
+ "Attempt to change alignment!");
+#endif
+
ParameterAttributes NewAttrs = OldAttrs | attrs;
if (NewAttrs == OldAttrs)
return PAL;
@@ -185,6 +202,11 @@ ParamAttrsList::includeAttrs(const ParamAttrsList *PAL,
const ParamAttrsList *
ParamAttrsList::excludeAttrs(const ParamAttrsList *PAL,
uint16_t idx, ParameterAttributes attrs) {
+#ifndef NDEBUG
+ // FIXME it is not obvious how this should work for alignment.
+ // For now, say we can't pass in alignment, which no current use does.
+ assert(!(attrs & ParamAttr::Alignment) && "Attempt to exclude alignment!");
+#endif
ParameterAttributes OldAttrs = PAL ? PAL->getParamAttrs(idx) :
ParamAttr::None;
ParameterAttributes NewAttrs = OldAttrs & ~attrs;
OpenPOWER on IntegriCloud