diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-24 19:25:34 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-24 19:25:34 +0000 |
commit | f9e2b0c1d06fb8f3619433b9830e9cb9ac38d8d0 (patch) | |
tree | 15243cb6095f4f5eb5c00b47dd28a5a6998f11de /unittests/MC | |
parent | 14f791a5d50335f90bd0e57b5c3b45fdd84216d9 (diff) | |
download | external_llvm-f9e2b0c1d06fb8f3619433b9830e9cb9ac38d8d0.zip external_llvm-f9e2b0c1d06fb8f3619433b9830e9cb9ac38d8d0.tar.gz external_llvm-f9e2b0c1d06fb8f3619433b9830e9cb9ac38d8d0.tar.bz2 |
Sketch streamer support for .align, .org functionality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/MC')
-rw-r--r-- | unittests/MC/AsmStreamerTest.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/unittests/MC/AsmStreamerTest.cpp b/unittests/MC/AsmStreamerTest.cpp index 76da23b..d4b93ea 100644 --- a/unittests/MC/AsmStreamerTest.cpp +++ b/unittests/MC/AsmStreamerTest.cpp @@ -72,4 +72,32 @@ b:\n\ "); } +TEST(AsmStreamer, Align) { + StringAsmStreamer S; + MCSection *Sec0 = S.getContext().GetSection("foo"); + S.getStreamer().SwitchSection(Sec0); + S.getStreamer().EmitValueToAlignment(4); + S.getStreamer().EmitValueToAlignment(4, /*Value=*/12, /*ValueSize=*/2); + S.getStreamer().EmitValueToAlignment(8, /*Value=*/12, /*ValueSize=*/4, + /*MaxBytesToEmit=*/24); + EXPECT_EQ(S.getString(), ".section foo\n\ +.p2align 2, 0\n\ +.p2alignw 2, 12\n\ +.p2alignl 3, 12, 24\n\ +"); +} + +TEST(AsmStreamer, Org) { + StringAsmStreamer S; + MCSection *Sec0 = S.getContext().GetSection("foo"); + S.getStreamer().SwitchSection(Sec0); + MCSymbol *A = S.getContext().CreateSymbol("a"); + S.getStreamer().EmitLabel(A); + S.getStreamer().EmitValueToOffset(MCValue::get(A, 0, 4), 32); + EXPECT_EQ(S.getString(), ".section foo\n\ +a:\n\ +.org a + 4, 32\n\ +"); +} + } |