diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-28 20:01:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-28 20:01:34 +0000 |
commit | f460048771217932f9098dc8023653eba0c70a7f (patch) | |
tree | 84714d7f639a552c6b8b6f3309dcd4e02266428c | |
parent | 22b1fa0ef279f090d4f36a57acdb288e8157cdb3 (diff) | |
download | external_llvm-f460048771217932f9098dc8023653eba0c70a7f.zip external_llvm-f460048771217932f9098dc8023653eba0c70a7f.tar.gz external_llvm-f460048771217932f9098dc8023653eba0c70a7f.tar.bz2 |
Add support for a new zeroinitializer token which can be used to get rid of
huge arrays of zero initialized values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6937 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/Lexer.l | 1 | ||||
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index 7a56fcc..e124d24 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -174,6 +174,7 @@ appending { return APPENDING; } uninitialized { return EXTERNAL; } /* Deprecated, turn into external */ external { return EXTERNAL; } implementation { return IMPLEMENTATION; } +zeroinitializer { return ZEROINITIALIZER; } \.\.\. { return DOTDOTDOT; } null { return NULL_TOK; } to { return TO; } diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ca5b48d..233d9ea 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -702,7 +702,8 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { %type <StrVal> OptVAR_ID OptAssign FuncName -%token IMPLEMENTATION TRUE FALSE BEGINTOK ENDTOK DECLARE GLOBAL CONSTANT +%token IMPLEMENTATION ZEROINITIALIZER TRUE FALSE BEGINTOK ENDTOK +%token DECLARE GLOBAL CONSTANT %token TO EXCEPT DOTDOTDOT NULL_TOK CONST INTERNAL LINKONCE APPENDING %token OPAQUE NOT EXTERNAL TARGET ENDIAN POINTERSIZE LITTLE BIG @@ -1039,6 +1040,10 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr ThrowException("Mismatched types for constant expression!"); $$ = $2; delete $1; + } + | Types ZEROINITIALIZER { + $$ = Constant::getNullValue($1->get()); + delete $1; }; ConstVal : SIntType EINT64VAL { // integral constants |