summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-06-30 18:16:42 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-06-30 18:16:42 +0000
commitf09df00daad64a809204cd12ed47c3d81e25652d (patch)
tree1343916e5f3598b76af7b47929ccffb6e98943d5 /llvm/include
parent5b03e1ada8312e1aff57b829b7c328b85fcb7b0f (diff)
downloadbcm5719-llvm-f09df00daad64a809204cd12ed47c3d81e25652d.tar.gz
bcm5719-llvm-f09df00daad64a809204cd12ed47c3d81e25652d.zip
MIR Serialization: Serialize MBB successors.
This commit implements serialization of the machine basic block successors. It uses a YAML flow sequence that contains strings that have the MBB references. The MBB references in those strings use the same syntax as the MBB machine operands in the machine instruction strings. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D10699 llvm-svn: 241093
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/MIRYamlMapping.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
index bb8df6307d5..a6ffeb38297 100644
--- a/llvm/include/llvm/CodeGen/MIRYamlMapping.h
+++ b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
@@ -55,10 +55,28 @@ template <> struct ScalarTraits<StringValue> {
static bool mustQuote(StringRef Scalar) { return needsQuotes(Scalar); }
};
+struct FlowStringValue : StringValue {
+ FlowStringValue() {}
+ FlowStringValue(std::string Value) : StringValue(Value) {}
+};
+
+template <> struct ScalarTraits<FlowStringValue> {
+ static void output(const FlowStringValue &S, void *, llvm::raw_ostream &OS) {
+ return ScalarTraits<StringValue>::output(S, nullptr, OS);
+ }
+
+ static StringRef input(StringRef Scalar, void *Ctx, FlowStringValue &S) {
+ return ScalarTraits<StringValue>::input(Scalar, Ctx, S);
+ }
+
+ static bool mustQuote(StringRef Scalar) { return needsQuotes(Scalar); }
+};
+
} // end namespace yaml
} // end namespace llvm
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::StringValue)
+LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::FlowStringValue)
namespace llvm {
namespace yaml {
@@ -69,7 +87,8 @@ struct MachineBasicBlock {
unsigned Alignment = 0;
bool IsLandingPad = false;
bool AddressTaken = false;
- // TODO: Serialize the successors and liveins.
+ // TODO: Serialize the successor weights and liveins.
+ std::vector<FlowStringValue> Successors;
std::vector<StringValue> Instructions;
};
@@ -82,6 +101,7 @@ template <> struct MappingTraits<MachineBasicBlock> {
YamlIO.mapOptional("alignment", MBB.Alignment);
YamlIO.mapOptional("isLandingPad", MBB.IsLandingPad);
YamlIO.mapOptional("addressTaken", MBB.AddressTaken);
+ YamlIO.mapOptional("successors", MBB.Successors);
YamlIO.mapOptional("instructions", MBB.Instructions);
}
};
OpenPOWER on IntegriCloud