Commit Graph

99 Commits

Author SHA1 Message Date
Ivan Krysak 724f8bfb59 ABI: streamline terminology
"packed" is used instead of "unnaturally aligned".
2024-10-08 13:53:53 +02:00
Ivan Krysak 5150fbd8c8 ABI: Limit usage of the StackAlignment option 2024-10-08 13:53:53 +02:00
Ivan Krysak 659bd01974 ABI: make distribution carry alignment information
This allows argument distribution to change based on the previous
argument by only preserving alignment information.
2024-10-08 13:53:53 +02:00
Ivan Krysak 85474eb228 ABI: let last argument distribution differ 2024-10-08 13:53:52 +02:00
Ivan Krysak 7dfd669bde ABI: introduce a new configuration option:
`StackArgumentsUseRegularStructAlignmentRules`.
2024-10-08 13:53:52 +02:00
Ivan Krysak b378ac9b17 ABI: improve handling of padding arguments 2024-10-08 13:53:52 +02:00
Ivan Krysak 1289678457 ABI: fix AArch64 pointer-to-copy handling 2024-10-08 13:53:52 +02:00
Ivan Krysak d314c6ca36 ABI: fix a bug related to argument splitting 2024-10-08 13:53:52 +02:00
Ivan Krysak e4d8ead973 ABI: make MinimumStackArgumentSize explicit 2024-10-08 13:53:52 +02:00
Ivan Krysak d6ca06b864 ABI: handle SPTAR return value register correctly 2024-10-08 13:53:51 +02:00
Alessandro Di Federico 2cdedc71f4 s/serialize/toString/
We keep serialize for method dealing with streams.
If it returns a `std::string`, let's use `toString`.
2024-09-27 12:07:17 +02:00
Ivan Krysak 336fac0a67 ABI: do not assert when offset is not aligned
Abort the conversion instead.
2024-08-06 10:26:34 +02:00
Ivan Krysak 4a2db0ba4f UpcastablePointer: streamline empty behavior 2024-06-27 11:05:52 +02:00
Ivan Krysak 823e561806 TTG: rework polymorphic serialization
For now, the only serialization trait we were verifying
a polymorphic TTG type to have was the wrong (the one
that only printed base class's fields).

This commit explicitly disables said serializer and
ensures it's never used.

Here's an illustration of the impact of the changes:
```
model::UpcastableType MyType = getTypeFromSomewhere();
model::Type &View = *MyType;
model::PointerType &Pointer = MyType->asPointer();

serialize(MyType); // Good
serialize(Pointer); // Good
serialize(View); // new: explicit error
                 // old: only print base type's fields
```
2024-06-27 11:05:51 +02:00
Ivan Krysak dfa7478685 Adopt reworked model::Type 2024-06-27 11:05:51 +02:00
Ivan Krysak 927e8006b9 Model: rename TypePath to DefinitionReference 2024-06-27 11:05:49 +02:00
Ivan Krysak ac587cbb4f Model: rename Type into TypeDefinition 2024-06-27 11:05:48 +02:00
Alessandro Di Federico 2925b11f6a Model: adopt getConst where appropriate 2024-06-20 10:24:49 +02:00
Lauri Vasama 3e33a300d5 Introduce RawFunctionType::Architecture 2024-05-29 15:42:15 +02:00
Alessandro Di Federico 0459b9d084 Introduce RegisterUsageAnalyses 2024-04-19 18:33:00 +02:00
Ivan Krysak dc16217f6d Layout: introduce usedRegisters helper 2024-03-18 19:32:34 +01:00
Ivan Krysak 0d5c93ed36 Distributor: add nextPositionBasedIndex 2024-03-18 19:32:34 +01:00
Ivan Krysak 408c37caf2 Layout: introduce finalStackOffset helper 2024-03-18 19:32:34 +01:00
Ivan Krysak 58e5fffb14 Layout: rework dump 2024-03-18 19:32:34 +01:00
Ivan Krysak 08041ba771 ToCFT: fix last stack argument verification
It was still broken, even after `feature/alignment-fixes`, so
this commit softens requirements even further, to allow some of
the desired cases to pass through the verifier.
2024-03-15 19:05:10 +01:00
Ivan Krysak 069d3d3972 ToCABI: improve logger messages 2024-02-09 15:09:37 +00:00
Ivan Krysak c8cd0ab503 ValueDistributor: improve success log message 2024-02-09 15:09:37 +00:00
Ivan Krysak 27491410d6 ABI: introduce a way to disable vector registers 2024-02-09 15:09:37 +00:00
Ivan Krysak 68301138c0 ABI: redesign register sorting from the ground up 2024-02-09 15:09:37 +00:00
Ivan Krysak 9d815d79ec ToRaw: take advantage of the updated distributor
This lets us drop the repeated alignment calculations at
the "leaves" of the conversion. Since new distributor already
provides the necessary information, we can just grab it from
there.
2024-02-09 15:09:37 +00:00
Ivan Krysak 40e443f354 ArgumentDistributor: add a SPTAR helper 2024-02-09 15:09:37 +00:00
Ivan Krysak 526cb7385a ValueDistributor: support stack argument offset 2024-02-09 15:09:37 +00:00
Ivan Krysak 5c99229c6f ToRaw: fix issues with how types were selected
Pointer-to-copy support was severely flawed.
2024-02-09 15:09:37 +00:00
Ivan Krysak 65cf1f08fd Distributor: add explicit pointer-to-copy-support 2024-02-09 15:09:37 +00:00
Ivan Krysak a468698d23 ValueDistributor: be extra explicit around padding
Before this, padding was just handled as a part of the size, but that
made it unnecessarily hard to work with. Now, everything padding-related
is extremely explicit.
2024-02-09 15:09:37 +00:00
Ivan Krysak 5994e4bf05 ToCAFT: always preserve stack types with metadata 2024-02-09 15:09:37 +00:00
Ivan Krysak d13e83163d Minor improvements 2024-02-09 15:09:37 +00:00
Ivan Krysak 8a74ff94b7 ABI: prevent emission of unsupported primitives 2024-02-09 10:04:27 +01:00
Ivan Krysak a331dcc878 ToCFT: improve naming 2024-01-29 11:57:54 +02:00
Ivan Krysak 82c2162d7d ABI: add an explicit void distribution helper 2024-01-29 11:57:54 +02:00
Ivan Krysak 78510010f8 ABI: rename isIncompatibleWith
The new name is `isPreliminarilyCompatibleWith`.
2024-01-29 11:57:54 +02:00
Ivan Krysak 81d365a24b ABI: assert on broken alignment calculation result 2024-01-29 11:57:54 +02:00
Ivan Krysak 79d68dcafc ABI: allow reusing the stack struct
When there's a single struct argument (as in, all we see is a nested
struct) and all the sizes match, just use the inner struct instead of
creating a new one.
2024-01-29 11:57:54 +02:00
Ivan Krysak d0b3777db4 ToCFT: use structs as a fallback
When a stack argument cannot be converted "as is",
use a struct instead to try and overcome the limitation.
2024-01-29 11:57:54 +02:00
Ivan Krysak 093cacdb6f ValueDistributor: enable working on model::Type 2024-01-29 11:57:54 +02:00
Ivan Krysak 35326b29ec ABI: streamline position-based argument handling 2024-01-29 11:57:54 +02:00
Ivan Krysak ce0ada6027 ToCFT: fix a invalid iterator access
Because of a mistake in the previous iteration, an invalid iteration was
dereferenced when a struct had non-zero size but no fields (padding only
struct).
2024-01-29 11:57:54 +02:00
Ivan Krysak 89b5cacc3b ToCFT: introduce more complete result verification 2024-01-29 11:57:54 +02:00
Ivan Krysak 39532658f9 ToCFT: improve alignment verification logger 2024-01-29 11:57:54 +02:00
Ivan Krysak 039efcfee8 ToCFT: use adjusted alignment for verification
Adjusted alignment means alignment when it's bigger than the pointer
size and pointer size otherwise.
2024-01-29 11:57:54 +02:00