From 78d7831b0fa2bd7c20c94ba90968923b938c6112 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Thu, 28 May 2015 22:41:12 +0000 Subject: MIR Serialization: print and parse machine function names. This commit introduces a serializable structure called 'llvm::yaml::MachineFunction' that stores the machine function's name. This structure will mirror the machine function's state in the future. This commit prints machine functions as YAML documents containing a YAML mapping that stores the state of a machine function. This commit also parses the YAML documents that contain the machine functions. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D9841 llvm-svn: 238519 --- .../CodeGen/MIR/machine-function-missing-name.mir | 22 ++++++++++++++++++++ llvm/test/CodeGen/MIR/machine-function.mir | 24 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 llvm/test/CodeGen/MIR/machine-function-missing-name.mir create mode 100644 llvm/test/CodeGen/MIR/machine-function.mir (limited to 'llvm/test/CodeGen/MIR') diff --git a/llvm/test/CodeGen/MIR/machine-function-missing-name.mir b/llvm/test/CodeGen/MIR/machine-function-missing-name.mir new file mode 100644 index 00000000000..54668f1a5ef --- /dev/null +++ b/llvm/test/CodeGen/MIR/machine-function-missing-name.mir @@ -0,0 +1,22 @@ +# RUN: not llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s +# This test ensures that an error is reported when a machine function doesn't +# have a name attribute. + +--- | + + define i32 @foo() { + ret i32 0 + } + + define i32 @bar() { + ret i32 0 + } + +... +--- +# CHECK: [[@LINE+1]]:1: error: missing required key 'name' +nme: foo +... +--- +name: bar +... diff --git a/llvm/test/CodeGen/MIR/machine-function.mir b/llvm/test/CodeGen/MIR/machine-function.mir new file mode 100644 index 00000000000..679bfd2d162 --- /dev/null +++ b/llvm/test/CodeGen/MIR/machine-function.mir @@ -0,0 +1,24 @@ +# RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser parses machine functions correctly. + +--- | + + define i32 @foo() { + ret i32 0 + } + + define i32 @bar() { + ret i32 0 + } + +... +--- +# CHECK: name: foo +# CHECK-NEXT: ... +name: foo +... +--- +# CHECK: name: bar +# CHECK-NEXT: ... +name: bar +... -- cgit v1.2.3