[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Chris Lattner
lattner at cs.uiuc.edu
Tue Apr 22 14:08:01 PDT 2003
Changes in directory llvm/lib/AsmParser:
Lexer.l updated: 1.31 -> 1.32
llvmAsmParser.y updated: 1.107 -> 1.108
---
Log message:
Allow information about the target to be specified in the .ll file
---
Diffs of the changes:
Index: llvm/lib/AsmParser/Lexer.l
diff -u llvm/lib/AsmParser/Lexer.l:1.31 llvm/lib/AsmParser/Lexer.l:1.32
--- llvm/lib/AsmParser/Lexer.l:1.31 Thu Apr 17 17:17:32 2003
+++ llvm/lib/AsmParser/Lexer.l Tue Apr 22 14:07:06 2003
@@ -19,6 +19,7 @@
%{
#include "ParserInternals.h"
+#include "llvm/Module.h"
#include <list>
#include "llvmAsmParser.h"
#include <ctype.h>
@@ -176,6 +177,11 @@
to { return TO; }
except { return EXCEPT; }
not { return NOT; } /* Deprecated, turned into XOR */
+target { return TARGET; }
+endian { return ENDIAN; }
+pointersize { return POINTERSIZE; }
+little { return LITTLE; }
+big { return BIG; }
void { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; }
bool { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; }
Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.107 llvm/lib/AsmParser/llvmAsmParser.y:1.108
--- llvm/lib/AsmParser/llvmAsmParser.y:1.107 Tue Apr 22 13:42:41 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y Tue Apr 22 14:07:06 2003
@@ -635,6 +635,7 @@
Instruction::TermOps TermOpVal;
Instruction::MemoryOps MemOpVal;
Instruction::OtherOps OtherOpVal;
+ Module::Endianness Endianness;
}
%type <ModuleVal> Module FunctionList
@@ -653,6 +654,7 @@
%type <JumpTable> JumpTable
%type <BoolVal> GlobalType // GLOBAL or CONSTANT?
%type <Linkage> OptLinkage
+%type <Endianness> BigOrLittle
// ValueRef - Unresolved reference to a definition or BB
%type <ValIDVal> ValueRef ConstValueRef SymbolicValueRef
@@ -683,7 +685,7 @@
%token IMPLEMENTATION TRUE FALSE BEGINTOK ENDTOK DECLARE GLOBAL CONSTANT
%token TO EXCEPT DOTDOTDOT NULL_TOK CONST INTERNAL LINKONCE APPENDING
-%token OPAQUE NOT EXTERNAL
+%token OPAQUE NOT EXTERNAL TARGET ENDIAN POINTERSIZE LITTLE BIG
// Basic Block Terminating Operators
%token <TermOpVal> RET BR SWITCH
@@ -1177,7 +1179,26 @@
}
delete $5;
}
+ | ConstPool TARGET TargetDefinition {
+ }
| /* empty: end of list */ {
+ };
+
+
+
+BigOrLittle : BIG { $$ = Module::BigEndian; };
+BigOrLittle : LITTLE { $$ = Module::LittleEndian; };
+
+TargetDefinition : ENDIAN '=' BigOrLittle {
+ CurModule.CurrentModule->setEndianness($3);
+ }
+ | POINTERSIZE '=' EUINT64VAL {
+ if ($3 == 32)
+ CurModule.CurrentModule->setPointerSize(Module::Pointer32);
+ else if ($3 == 64)
+ CurModule.CurrentModule->setPointerSize(Module::Pointer64);
+ else
+ ThrowException("Invalid pointer size: '" + utostr($3) + "'!");
};
More information about the llvm-commits
mailing list