mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
MIR Serialization: Serialize the variable sized stack objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242095 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -129,9 +129,8 @@ template <> struct MappingTraits<MachineBasicBlock> {
|
||||
///
|
||||
/// TODO: Determine isPreallocated flag by mapping between objects and local
|
||||
/// objects (Serialize local objects).
|
||||
/// TODO: Serialize variable sized objects.
|
||||
struct MachineStackObject {
|
||||
enum ObjectType { DefaultType, SpillSlot };
|
||||
enum ObjectType { DefaultType, SpillSlot, VariableSized };
|
||||
// TODO: Serialize LLVM alloca reference.
|
||||
unsigned ID;
|
||||
ObjectType Type = DefaultType;
|
||||
@@ -144,6 +143,7 @@ template <> struct ScalarEnumerationTraits<MachineStackObject::ObjectType> {
|
||||
static void enumeration(yaml::IO &IO, MachineStackObject::ObjectType &Type) {
|
||||
IO.enumCase(Type, "default", MachineStackObject::DefaultType);
|
||||
IO.enumCase(Type, "spill-slot", MachineStackObject::SpillSlot);
|
||||
IO.enumCase(Type, "variable-sized", MachineStackObject::VariableSized);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -154,7 +154,8 @@ template <> struct MappingTraits<MachineStackObject> {
|
||||
"type", Object.Type,
|
||||
MachineStackObject::DefaultType); // Don't print the default type.
|
||||
YamlIO.mapOptional("offset", Object.Offset);
|
||||
YamlIO.mapRequired("size", Object.Size);
|
||||
if (Object.Type != MachineStackObject::VariableSized)
|
||||
YamlIO.mapRequired("size", Object.Size);
|
||||
YamlIO.mapOptional("alignment", Object.Alignment);
|
||||
}
|
||||
|
||||
|
@@ -541,6 +541,14 @@ public:
|
||||
return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
|
||||
}
|
||||
|
||||
/// Returns true if the specified index corresponds to a variable sized
|
||||
/// object.
|
||||
bool isVariableSizedObjectIndex(int ObjectIdx) const {
|
||||
assert(unsigned(ObjectIdx + NumFixedObjects) < Objects.size() &&
|
||||
"Invalid Object Idx!");
|
||||
return Objects[ObjectIdx + NumFixedObjects].Size == 0;
|
||||
}
|
||||
|
||||
/// Create a new statically sized stack object, returning
|
||||
/// a nonnegative identifier to represent it.
|
||||
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS,
|
||||
|
Reference in New Issue
Block a user