mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-12-19 11:23:32 +00:00
MIR Serialization: Initial serialization of machine constant pools.
This commit implements the initial serialization of machine constant pools and the constant pool index machine operands. The constant pool is serialized using a YAML sequence of YAML mappings that represent the constant values. The target-specific constant pool items aren't serialized by this commit. Reviewers: Duncan P. N. Exon Smith git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242707 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -223,6 +223,20 @@ template <> struct MappingTraits<FixedMachineStackObject> {
|
||||
static const bool flow = true;
|
||||
};
|
||||
|
||||
struct MachineConstantPoolValue {
|
||||
unsigned ID;
|
||||
StringValue Value;
|
||||
unsigned Alignment = 0;
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<MachineConstantPoolValue> {
|
||||
static void mapping(IO &YamlIO, MachineConstantPoolValue &Constant) {
|
||||
YamlIO.mapRequired("id", Constant.ID);
|
||||
YamlIO.mapOptional("value", Constant.Value);
|
||||
YamlIO.mapOptional("alignment", Constant.Alignment);
|
||||
}
|
||||
};
|
||||
|
||||
struct MachineJumpTable {
|
||||
struct Entry {
|
||||
unsigned ID;
|
||||
@@ -247,6 +261,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::VirtualRegisterDefinition)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineBasicBlock)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineStackObject)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::FixedMachineStackObject)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineConstantPoolValue)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineJumpTable::Entry)
|
||||
|
||||
namespace llvm {
|
||||
@@ -320,6 +335,7 @@ struct MachineFunction {
|
||||
MachineFrameInfo FrameInfo;
|
||||
std::vector<FixedMachineStackObject> FixedStackObjects;
|
||||
std::vector<MachineStackObject> StackObjects;
|
||||
std::vector<MachineConstantPoolValue> Constants; /// Constant pool.
|
||||
MachineJumpTable JumpTableInfo;
|
||||
|
||||
std::vector<MachineBasicBlock> BasicBlocks;
|
||||
@@ -338,6 +354,7 @@ template <> struct MappingTraits<MachineFunction> {
|
||||
YamlIO.mapOptional("frameInfo", MF.FrameInfo);
|
||||
YamlIO.mapOptional("fixedStack", MF.FixedStackObjects);
|
||||
YamlIO.mapOptional("stack", MF.StackObjects);
|
||||
YamlIO.mapOptional("constants", MF.Constants);
|
||||
if (!YamlIO.outputting() || !MF.JumpTableInfo.Entries.empty())
|
||||
YamlIO.mapOptional("jumpTable", MF.JumpTableInfo);
|
||||
YamlIO.mapOptional("body", MF.BasicBlocks);
|
||||
|
||||
Reference in New Issue
Block a user