MIR Serialization: Serialize machine instruction names.

This commit implements initial machine instruction serialization. It
serializes machine instruction names. The instructions are represented
using a YAML sequence of string literals and are a part of machine
basic block YAML mapping.

This commit introduces a class called 'MIParser' which will be used to
parse the machine instructions and operands.

Reviewers: Duncan P. N. Exon Smith

Differential Revision: http://reviews.llvm.org/D10481


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240295 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz
2015-06-22 17:02:30 +00:00
parent 39befc6ca8
commit 2f801faafb
9 changed files with 236 additions and 4 deletions

View File

@ -22,6 +22,8 @@
#include "llvm/Support/YAMLTraits.h"
#include <vector>
LLVM_YAML_IS_SEQUENCE_VECTOR(std::string)
namespace llvm {
namespace yaml {
@ -31,7 +33,8 @@ struct MachineBasicBlock {
bool IsLandingPad = false;
bool AddressTaken = false;
// TODO: Serialize the successors and liveins.
// TODO: Serialize machine instructions.
std::vector<std::string> Instructions;
};
template <> struct MappingTraits<MachineBasicBlock> {
@ -41,6 +44,7 @@ template <> struct MappingTraits<MachineBasicBlock> {
YamlIO.mapOptional("alignment", MBB.Alignment);
YamlIO.mapOptional("isLandingPad", MBB.IsLandingPad);
YamlIO.mapOptional("addressTaken", MBB.AddressTaken);
YamlIO.mapOptional("instructions", MBB.Instructions);
}
};