Reapply: IR: add optional type to 'byval' function parameters

When we switch to opaque pointer types we will need some way to describe
how many bytes a 'byval' parameter should occupy on the stack. This adds
a (for now) optional extra type parameter.

If present, the type must match the pointee type of the argument.

The original commit did not remap byval types when linking modules, which broke
LTO. This version fixes that.

Note to front-end maintainers: if this causes test failures, it's probably
because the "byval" attribute is printed after attributes without any parameter
after this change.

llvm-svn: 362128
This commit is contained in:
Tim Northover
2019-05-30 18:48:23 +00:00
parent 96b45bff23
commit 42e839cbcd
45 changed files with 497 additions and 42 deletions
+4 -2
View File
@@ -949,9 +949,11 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
incorporateFunctionMetadata(F);
// Adding function arguments to the value table.
for (const auto &I : F.args())
for (const auto &I : F.args()) {
EnumerateValue(&I);
if (I.hasAttribute(Attribute::ByVal) && I.getParamByValType())
EnumerateType(I.getParamByValType());
}
FirstFuncConstantID = Values.size();
// Add all function-level constants to the value table.