[llvm-commits] [llvm] r114077 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/ELF/zero.s
Rafael Espindola
rafael.espindola at gmail.com
Thu Sep 16 08:03:59 PDT 2010
Author: rafael
Date: Thu Sep 16 10:03:59 2010
New Revision: 114077
URL: http://llvm.org/viewvc/llvm-project?rev=114077&view=rev
Log:
Add support for the .zero directive.
Added:
llvm/trunk/test/MC/ELF/zero.s
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=114077&r1=114076&r2=114077&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Sep 16 10:03:59 2010
@@ -180,6 +180,7 @@
bool ParseDirectiveValue(unsigned Size); // ".byte", ".long", ...
bool ParseDirectiveFill(); // ".fill"
bool ParseDirectiveSpace(); // ".space"
+ bool ParseDirectiveZero(); // ".zero"
bool ParseDirectiveSet(); // ".set"
bool ParseDirectiveOrg(); // ".org"
// ".align{,32}", ".p2align{,w,l}"
@@ -871,6 +872,8 @@
return ParseDirectiveFill();
if (IDVal == ".space")
return ParseDirectiveSpace();
+ if (IDVal == ".zero")
+ return ParseDirectiveZero();
// Symbol attribute directives
@@ -1353,6 +1356,25 @@
return false;
}
+/// ParseDirectiveZero
+/// ::= .zero expression
+bool AsmParser::ParseDirectiveZero() {
+ CheckForValidSection();
+
+ int64_t NumBytes;
+ if (ParseAbsoluteExpression(NumBytes))
+ return true;
+
+ if (getLexer().isNot(AsmToken::EndOfStatement))
+ return TokError("unexpected token in '.zero' directive");
+
+ Lex();
+
+ getStreamer().EmitFill(NumBytes, 0, DEFAULT_ADDRSPACE);
+
+ return false;
+}
+
/// ParseDirectiveFill
/// ::= .fill expression , expression , expression
bool AsmParser::ParseDirectiveFill() {
Added: llvm/trunk/test/MC/ELF/zero.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/zero.s?rev=114077&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/zero.s (added)
+++ llvm/trunk/test/MC/ELF/zero.s Thu Sep 16 10:03:59 2010
@@ -0,0 +1,15 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+.zero 4
+
+// CHECK: ('sh_name', 1) # '.text'
+// CHECK: ('sh_type', 1)
+// CHECK: ('sh_flags', 6)
+// CHECK: ('sh_addr', 0)
+// CHECK: ('sh_offset', 64)
+// CHECK: ('sh_size', 4)
+// CHECK: ('sh_link', 0)
+// CHECK: ('sh_info', 0)
+// CHECK: ('sh_addralign', 4)
+// CHECK: ('sh_entsize', 0)
+// CHECK: ('_section_data', '00000000')
More information about the llvm-commits
mailing list