Add CDataModel in ABI definition

This commit is contained in:
Lauri Vasama
2026-04-16 09:46:40 +03:00
parent 27fb305c5a
commit 0ab9f769dd
31 changed files with 559 additions and 240 deletions
+9
View File
@@ -0,0 +1,9 @@
#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "revng/ABI/Generated/Early/CType.h"
#include "revng/ABI/Generated/Late/CType.h"
+8
View File
@@ -12,6 +12,7 @@
#include "revng/Model/ABI.h"
#include "revng/Model/RawFunctionDefinition.h"
#include "revng/Model/Register.h"
#include "revng/Support/CDataModel.h"
#include "revng/Support/Debug.h"
#include "revng/TupleTree/TupleTree.h"
#include "revng/TupleTree/TupleTreeDiff.h"
@@ -34,6 +35,11 @@ public:
return model::ABI::getArchitecture(ABI());
}
[[nodiscard]] const ScalarType *findIntegerType(uint64_t Size) const;
[[nodiscard]] const ScalarType *findFloatingPointType(uint64_t Size) const;
const ScalarType &getWidestIntegerType() const;
/// Make sure current definition is valid.
bool verify() const debug_function;
@@ -108,6 +114,8 @@ public:
return alignedOffset(Offset, *alignment(Type));
}
[[nodiscard]] CDataModel getDataModel() const;
public:
using RegisterSet = std::set<model::Register::Values>;
+9
View File
@@ -0,0 +1,9 @@
#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "revng/ABI/Generated/Early/ScalarKind.h"
#include "revng/ABI/Generated/Late/ScalarKind.h"
+3
View File
@@ -6,6 +6,9 @@
#include <cstdint>
#include "revng/ABI/CType.h"
#include "revng/ABI/ScalarKind.h"
#include "revng/ABI/Generated/Early/ScalarType.h"
namespace abi {
+32 -5
View File
@@ -102,11 +102,6 @@ definitions:
type: SortedVector
elementType: ScalarType
- name: FloatingPointScalarTypes
sequence:
type: SortedVector
elementType: ScalarType
key:
- ABI
@@ -116,15 +111,47 @@ definitions:
Represents type specific information ABI needs to be aware of,
for example, alignment.
fields:
- name: Kind
type: ScalarKind
- name: Size
type: uint64_t
default: -1
# TODO: For MS x86 ABIs, alignment of 4 is incorrectly used for long
# long. The reason being that the MS ABI seems to align all stack
# arguments to 4 bytes. To fix this, a separate stack alignment
# field is probably needed (single per-ABI value may be enough).
- name: AlignedAt
doc: |
When set to `0`, the alignment of this type matches its size.
type: uint64_t
default: 0
- name: CTypes
sequence:
type: SortedVector
elementType: CType
key:
- Kind
- Size
- name: ScalarKind
type: enum
members:
- name: Integer
- name: FloatingPoint
- name: CType
type: enum
members:
- name: Char
- name: Short
- name: Int
- name: Long
- name: LongLong
- name: Float
- name: Double
- name: LongDouble
+113 -16
View File
@@ -13,6 +13,8 @@
#include "revng/Support/ResourceFinder.h"
#include "revng/Support/YAMLTraits.h"
namespace {
template<std::ranges::range RegisterContainer>
bool verifyRegisters(const RegisterContainer &Registers,
model::Architecture::Values Architecture) {
@@ -29,7 +31,7 @@ bool verifyRegisters(const RegisterContainer &Registers,
return true;
}
static bool isVectorRegister(model::Register::Values Register) {
bool isVectorRegister(model::Register::Values Register) {
using model::Register::primitiveKind;
return primitiveKind(Register) == model::PrimitiveKind::Float;
}
@@ -41,7 +43,7 @@ static bool isVectorRegister(model::Register::Values Register) {
/// see the `static_assert` that invokes it in \ref distributeArguments
///
/// \return `true` if the ABI is valid, `false` otherwise.
static bool verifyReturnValueLocation(const abi::Definition &D) {
bool verifyReturnValueLocation(const abi::Definition &D) {
if (not model::Register::isValid(D.ReturnValueLocationRegister())) {
// Skip ABIs that do not allow returning big values.
// They do not benefit from this check.
@@ -74,8 +76,42 @@ static bool verifyReturnValueLocation(const abi::Definition &D) {
return true;
}
abi::ScalarKind::Values getScalarKind(abi::CType::Values Type) {
if (abi::CType::Char <= Type and Type <= abi::CType::LongLong)
return abi::ScalarKind::Integer;
if (abi::CType::Float <= Type and Type <= abi::CType::LongDouble)
return abi::ScalarKind::FloatingPoint;
return abi::ScalarKind::Invalid;
}
} // namespace
namespace abi {
const ScalarType *Definition::findIntegerType(uint64_t Size) const {
// TODO: If and when invalidation tracking is introduced for ABI definitions,
// this function should be changed to use tryGet in place of find.
auto I = ScalarTypes().find({ ScalarKind::Integer, Size });
return I != ScalarTypes().end() ? &*I : nullptr;
}
const ScalarType *Definition::findFloatingPointType(uint64_t Size) const {
// TODO: If and when invalidation tracking is introduced for ABI definitions,
// this function should be changed to use tryGet in place of find.
auto I = ScalarTypes().find({ ScalarKind::FloatingPoint, Size });
return I != ScalarTypes().end() ? &*I : nullptr;
}
const ScalarType &Definition::getWidestIntegerType() const {
for (const ScalarType &Type : llvm::reverse(ScalarTypes())) {
if (Type.Kind() == ScalarKind::Integer)
return Type;
}
revng_abort("Invalid ABI definition.");
}
bool Definition::verify() const {
if (not model::ABI::isValid(ABI()))
return false;
@@ -104,16 +140,39 @@ bool Definition::verify() const {
if (ScalarTypes().empty())
return false;
for (const abi::ScalarType &Type : ScalarTypes())
bool CTypes[CType::Count] = {};
bool HasIntegerScalar = false;
for (const abi::ScalarType &Type : ScalarTypes()) {
if (Type.Kind() == ScalarKind::Invalid)
return false;
if (Type.Kind() == ScalarKind::Integer)
HasIntegerScalar = true;
if (Type.Size() == 0)
return false;
if (FloatingPointScalarTypes().empty())
for (auto CT : Type.CTypes()) {
if (CT == CType::Invalid)
return false;
// The C type kind must match the scalar kind.
if (getScalarKind(CT) != Type.Kind())
return false;
// The ABI may not associate the same C type with multiple scalars.
if (std::exchange(CTypes[CT], true))
return false;
}
}
// The ABI must define at least one integer scalar.
if (not HasIntegerScalar)
return false;
for (const abi::ScalarType &Type : FloatingPointScalarTypes())
if (Type.Size() == 0)
return false;
if (not getDataModel().verify())
return false;
return true;
}
@@ -337,7 +396,7 @@ naturalAlignment(const abi::Definition &ABI,
} else if (const auto *P = llvm::dyn_cast<model::PointerType>(&Type)) {
// Doesn't matter what the type is, use alignment of the pointer.
rc_return AlignmentInfo{ ABI.ScalarTypes().at(P->PointerSize()).alignedAt(),
rc_return AlignmentInfo{ ABI.findIntegerType(P->PointerSize())->alignedAt(),
true };
} else if (const auto *P = llvm::dyn_cast<model::PrimitiveType>(&Type)) {
@@ -348,17 +407,15 @@ naturalAlignment(const abi::Definition &ABI,
rc_return AlignmentInfo{ 0, false };
} else if (P->PrimitiveKind() == model::PrimitiveKind::Float) {
auto Iterator = ABI.FloatingPointScalarTypes().find(P->Size());
if (Iterator == ABI.FloatingPointScalarTypes().end())
rc_return std::nullopt;
if (auto ABIType = ABI.findFloatingPointType(P->Size()))
rc_return AlignmentInfo{ ABIType->alignedAt(), true };
rc_return AlignmentInfo{ Iterator->alignedAt(), true };
rc_return std::nullopt;
} else {
auto Iterator = ABI.ScalarTypes().find(P->Size());
if (Iterator == ABI.ScalarTypes().end())
rc_return std::nullopt;
if (auto ABIType = ABI.findIntegerType(P->Size()))
rc_return AlignmentInfo{ ABIType->alignedAt(), true };
rc_return AlignmentInfo{ Iterator->alignedAt(), true };
rc_return std::nullopt;
}
} else {
revng_abort("Unsupported type.");
@@ -418,4 +475,44 @@ Definition::hasNaturalAlignment(const model::TypeDefinition &Type,
return Result->IsNatural;
}
CDataModel Definition::getDataModel() const {
CDataModel DM = CDataModel::getDefaultDataModel(getPointerSize());
for (const ScalarType &Type : ScalarTypes()) {
for (auto CT : Type.CTypes()) {
switch (CT) {
case CType::Char:
DM.getStandardTypeSize(CStandardType::Char) = Type.Size();
break;
case CType::Short:
DM.getStandardTypeSize(CStandardType::Short) = Type.Size();
break;
case CType::Int:
DM.getStandardTypeSize(CStandardType::Int) = Type.Size();
break;
case CType::Long:
DM.getStandardTypeSize(CStandardType::Long) = Type.Size();
break;
case CType::LongLong:
DM.getStandardTypeSize(CStandardType::LongLong) = Type.Size();
break;
case CType::Float:
DM.getStandardTypeSize(CStandardType::Float) = Type.Size();
break;
case CType::Double:
DM.getStandardTypeSize(CStandardType::Double) = Type.Size();
break;
case CType::LongDouble:
DM.getStandardTypeSize(CStandardType::LongDouble) = Type.Size();
break;
case CType::Invalid:
case CType::Count:
revng_abort("Invalid C type in ABI definition.");
}
}
}
return DM;
}
} // namespace abi
+1 -1
View File
@@ -698,7 +698,7 @@ TCC::tryConvertingReturnValue(RFTReturnValues Registers) {
// into preserving it at least partially.
uint64_t PointerSize = model::ABI::getPointerSize(ABI.ABI());
uint64_t PrimitiveSize = Ordered.size() * PointerSize;
if (ABI.ScalarTypes().contains(PrimitiveSize)) {
if (ABI.findIntegerType(PrimitiveSize) != nullptr) {
return model::PrimitiveType::makeGeneric(PrimitiveSize);
} else {
revng_log(Log,
+14 -9
View File
@@ -61,12 +61,17 @@ ReturnValueLocationRegister: r0_arm
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
FloatingPointScalarTypes:
- Size: 2
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+20 -11
View File
@@ -87,14 +87,23 @@ ReturnValueLocationRegister: x8_aarch64
ReturnValueLocationIsReturned: false
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
FloatingPointScalarTypes:
- Size: 2
- Size: 4
- Size: 8
- Size: 16
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
CTypes:
- LongDouble
+20 -11
View File
@@ -87,14 +87,23 @@ ReturnValueLocationRegister: x8_aarch64
ReturnValueLocationIsReturned: false
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
FloatingPointScalarTypes:
- Size: 2
- Size: 4
- Size: 8
- Size: 16
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
CTypes:
- LongDouble
+20 -11
View File
@@ -87,14 +87,23 @@ ReturnValueLocationRegister: x8_aarch64
ReturnValueLocationIsReturned: false
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
FloatingPointScalarTypes:
- Size: 2
- Size: 4
- Size: 8
- Size: 16
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
CTypes:
- Long
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
+18 -9
View File
@@ -54,12 +54,21 @@ ReturnValueLocationRegister: rcx_x86_64
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
CTypes:
- Long
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
@@ -56,12 +56,21 @@ ReturnValueLocationRegister: rcx_x86_64
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
CTypes:
- Long
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+15 -10
View File
@@ -36,13 +36,18 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
AlignedAt: 4
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4 # TODO: The correct value is 8, but stack arguments align to 4.
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+18 -9
View File
@@ -36,13 +36,22 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
CTypes:
- LongDouble
+15 -10
View File
@@ -39,13 +39,18 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
AlignedAt: 4
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4 # TODO: The correct value is 8, but stack arguments align to 4.
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+18 -9
View File
@@ -39,13 +39,22 @@ ReturnValueLocationRegister: ecx_x86
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
CTypes:
- LongDouble
+15 -10
View File
@@ -36,13 +36,18 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
AlignedAt: 4
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4 # TODO: The correct value is 8, but stack arguments align to 4.
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+18 -9
View File
@@ -36,13 +36,22 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
CTypes:
- LongDouble
+15 -10
View File
@@ -38,13 +38,18 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
AlignedAt: 4
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4 # TODO: The correct value is 8, but stack arguments align to 4.
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+15 -10
View File
@@ -50,13 +50,18 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
AlignedAt: 4
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4 # TODO: The correct value is 8, but stack arguments align to 4.
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+12 -8
View File
@@ -70,11 +70,15 @@ ReturnValueLocationRegister: v0_mips
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+12 -8
View File
@@ -70,11 +70,15 @@ ReturnValueLocationRegister: v0_mips
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
+20 -10
View File
@@ -38,16 +38,26 @@ ReturnValueLocationOnStack: true
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
AlignedAt: 4
- Size: 12
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
- Size: 16
CTypes:
- LongDouble
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
+20 -11
View File
@@ -58,14 +58,23 @@ ReturnValueLocationRegister: rdi_x86_64
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
FloatingPointScalarTypes:
- Size: 2
- Size: 4
- Size: 8
- Size: 16
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
- Kind: FloatingPoint
Size: 16 # x87 Extended
CTypes:
- LongDouble
+20 -10
View File
@@ -42,16 +42,26 @@ ReturnValueLocationRegister: eax_x86
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
AlignedAt: 4
- Size: 12
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
- Size: 16
CTypes:
- LongDouble
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
+20 -10
View File
@@ -43,16 +43,26 @@ ReturnValueLocationRegister: eax_x86
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
AlignedAt: 4
- Size: 12
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
- Size: 16
CTypes:
- LongDouble
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
+20 -10
View File
@@ -44,16 +44,26 @@ ReturnValueLocationRegister: eax_x86
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
AlignedAt: 4
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Kind: FloatingPoint
Size: 2 # IEEE Binary16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary64
AlignedAt: 4
- Size: 12
- Kind: FloatingPoint
Size: 12 # x87 Extended
AlignedAt: 4
- Size: 16
CTypes:
- LongDouble
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
+18 -10
View File
@@ -72,15 +72,23 @@ ReturnValueLocationRegister: r2_systemz
ReturnValueLocationIsReturned: true
ScalarTypes:
- Size: 1
- Size: 2
- Size: 4
- Size: 8
- Size: 16
- Kind: Integer
Size: 1
- Kind: Integer
Size: 2
- Kind: Integer
Size: 4
- Kind: Integer
Size: 8
- Kind: Integer
Size: 16
AlignedAt: 8
FloatingPointScalarTypes:
- Size: 4
- Size: 8
- Size: 16
- Kind: FloatingPoint
Size: 4 # IEEE Binary32
- Kind: FloatingPoint
Size: 8 # IEEE Binary16
- Kind: FloatingPoint
Size: 16 # IEEE Binary128
AlignedAt: 8
CTypes:
- LongDouble
@@ -269,8 +269,7 @@ VH::LeftToVerify VH::verifyAnArgument(const runtime_test::State &State,
}
}
revng_assert(!ABI.ScalarTypes().empty());
auto &BiggestScalarType = *std::prev(ABI.ScalarTypes().end());
auto &BiggestScalarType = ABI.getWidestIntegerType();
if (BiggestScalarType.alignedAt() != ABI.getPointerSize()) {
// If the ABI supports unusual alignment, try to account for it,
// by dropping an conflicting part of the stack data.
+2 -2
View File
@@ -44,14 +44,14 @@ void testAlignment(model::UpcastableType &&Type, const Types &...TestCases) {
static bool ABIhasIntsOfSizes(const abi::Definition &ABI,
std::initializer_list<uint64_t> Values) {
return std::ranges::all_of(Values, [&ABI](uint64_t Value) {
return ABI.ScalarTypes().contains(Value);
return ABI.findIntegerType(Value) != nullptr;
});
}
static bool ABIhasFloatsOfSizes(const abi::Definition &ABI,
std::initializer_list<uint64_t> Values) {
return std::ranges::all_of(Values, [&ABI](uint64_t Value) {
return ABI.FloatingPointScalarTypes().contains(Value);
return ABI.findFloatingPointType(Value) != nullptr;
});
}