aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/Lexer.l5
-rw-r--r--lib/AsmParser/Parser.cpp4
-rw-r--r--lib/AsmParser/ParserInternals.h14
-rw-r--r--lib/AsmParser/llvmAsmParser.y61
4 files changed, 53 insertions, 31 deletions
diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l
index 6466cb7..b0e174a 100644
--- a/lib/AsmParser/Lexer.l
+++ b/lib/AsmParser/Lexer.l
@@ -35,6 +35,7 @@
#define RET_TOK(type, Enum, sym) \
llvmAsmlval.type = Instruction::Enum; return sym
+namespace llvm {
// TODO: All of the static identifiers are figured out by the lexer,
// these should be hashed to reduce the lexer size
@@ -121,6 +122,10 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
return BOut;
}
+} // End llvm namespace
+
+using namespace llvm;
+
#define YY_NEVER_INTERACTIVE 1
%}
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp
index e8a7bdb..2d6185e 100644
--- a/lib/AsmParser/Parser.cpp
+++ b/lib/AsmParser/Parser.cpp
@@ -15,6 +15,8 @@
#include "llvm/Module.h"
#include "llvm/Analysis/Verifier.h"
+namespace llvm {
+
// The useful interface defined by this file... Parse an ASCII file, and return
// the internal representation in a nice slice'n'dice'able representation.
//
@@ -82,3 +84,5 @@ const std::string ParseException::getMessage() const {
return Result + ": " + Message;
}
+
+} // End llvm namespace
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index c783795..c18434d 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -22,18 +22,22 @@
#include "llvm/Assembly/Parser.h"
#include "Support/StringExtras.h"
-class Module;
-
// Global variables exported from the lexer...
extern std::FILE *llvmAsmin;
extern int llvmAsmlineno;
// Globals exported by the parser...
+extern char* llvmAsmtext;
+extern int llvmAsmleng;
+
+namespace llvm {
+
+// Globals exported by the parser...
extern std::string CurFilename;
+
+class Module;
Module *RunVMAsmParser(const std::string &Filename, FILE *F);
-extern char* llvmAsmtext;
-extern int llvmAsmleng;
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
// appropriate character. If AllowNull is set to false, a \00 value will cause
@@ -209,4 +213,6 @@ static inline int getLineNumFromPlaceHolder(const Value *Val) {
}
}
+} // End llvm namespace
+
#endif
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 96d2dae..a55e735 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -29,6 +29,8 @@ int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
int yylex(); // declaration" of xxx warnings.
int yyparse();
+namespace llvm {
+
static Module *ParserResult;
std::string CurFilename;
@@ -686,30 +688,34 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) {
return Result;
}
+} // End llvm namespace
+
+using namespace llvm;
+
%}
%union {
- Module *ModuleVal;
- Function *FunctionVal;
- std::pair<PATypeHolder*, char*> *ArgVal;
- BasicBlock *BasicBlockVal;
- TerminatorInst *TermInstVal;
- Instruction *InstVal;
- Constant *ConstVal;
-
- const Type *PrimType;
- PATypeHolder *TypeVal;
- Value *ValueVal;
-
- std::vector<std::pair<PATypeHolder*,char*> > *ArgList;
- std::vector<Value*> *ValueList;
- std::list<PATypeHolder> *TypeList;
- std::list<std::pair<Value*,
- BasicBlock*> > *PHIList; // Represent the RHS of PHI node
- std::vector<std::pair<Constant*, BasicBlock*> > *JumpTable;
- std::vector<Constant*> *ConstVector;
-
- GlobalValue::LinkageTypes Linkage;
+ llvm::Module *ModuleVal;
+ llvm::Function *FunctionVal;
+ std::pair<llvm::PATypeHolder*, char*> *ArgVal;
+ llvm::BasicBlock *BasicBlockVal;
+ llvm::TerminatorInst *TermInstVal;
+ llvm::Instruction *InstVal;
+ llvm::Constant *ConstVal;
+
+ const llvm::Type *PrimType;
+ llvm::PATypeHolder *TypeVal;
+ llvm::Value *ValueVal;
+
+ std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
+ std::vector<llvm::Value*> *ValueList;
+ std::list<llvm::PATypeHolder> *TypeList;
+ std::list<std::pair<llvm::Value*,
+ llvm::BasicBlock*> > *PHIList; // Represent the RHS of PHI node
+ std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
+ std::vector<llvm::Constant*> *ConstVector;
+
+ llvm::GlobalValue::LinkageTypes Linkage;
int64_t SInt64Val;
uint64_t UInt64Val;
int SIntVal;
@@ -718,13 +724,13 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) {
bool BoolVal;
char *StrVal; // This memory is strdup'd!
- ValID ValIDVal; // strdup'd memory maybe!
+ llvm::ValID ValIDVal; // strdup'd memory maybe!
- Instruction::BinaryOps BinaryOpVal;
- Instruction::TermOps TermOpVal;
- Instruction::MemoryOps MemOpVal;
- Instruction::OtherOps OtherOpVal;
- Module::Endianness Endianness;
+ llvm::Instruction::BinaryOps BinaryOpVal;
+ llvm::Instruction::TermOps TermOpVal;
+ llvm::Instruction::MemoryOps MemOpVal;
+ llvm::Instruction::OtherOps OtherOpVal;
+ llvm::Module::Endianness Endianness;
}
%type <ModuleVal> Module FunctionList
@@ -1892,6 +1898,7 @@ MemoryInst : MALLOC Types {
delete $2; delete $4;
};
+
%%
int yyerror(const char *ErrorMsg) {
std::string where