mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
0d723acf15
commit
d0fde30ce8
558 files changed
+2494
-264
No files matched your search
@@ -15,6 +15,8 @@
|
||||
#include "Record.h"
|
||||
#include "Support/Debug.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
void CodeEmitterGen::run(std::ostream &o) {
|
||||
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
|
||||
|
||||
@@ -221,4 +223,8 @@ void CodeEmitterGen::run(std::ostream &o) {
|
||||
<< " }\n"
|
||||
<< " return Value;\n"
|
||||
<< "}\n";
|
||||
|
||||
EmitSourceFileTail(o);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class CodeEmitterGen : public TableGenBackend {
|
||||
RecordKeeper &Records;
|
||||
public:
|
||||
@@ -28,4 +30,6 @@ private:
|
||||
void emitGetValueBit(std::ostream &o, const std::string &Namespace);
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "CodeGenWrappers.h"
|
||||
#include "Record.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// getValueType - Return the MCV::ValueType that the specified TableGen record
|
||||
/// corresponds to.
|
||||
MVT::ValueType getValueType(Record *Rec) {
|
||||
@@ -94,3 +96,5 @@ const std::string &CodeGenTarget::getName() const {
|
||||
Record *CodeGenTarget::getInstructionSet() const {
|
||||
return TargetRec->getValueAsDef("InstructionSet");
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -21,6 +21,9 @@
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Record;
|
||||
class RecordKeeper;
|
||||
|
||||
@@ -60,4 +63,6 @@ public:
|
||||
// CodeGenInstructionSet *getInstructionSet -
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "CodeGenWrappers.h"
|
||||
#include "Record.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// getValueType - Return the MCV::ValueType that the specified TableGen record
|
||||
/// corresponds to.
|
||||
MVT::ValueType getValueType(Record *Rec) {
|
||||
@@ -94,3 +96,5 @@ const std::string &CodeGenTarget::getName() const {
|
||||
Record *CodeGenTarget::getInstructionSet() const {
|
||||
return TargetRec->getValueAsDef("InstructionSet");
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -21,6 +21,9 @@
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Record;
|
||||
class RecordKeeper;
|
||||
|
||||
@@ -60,4 +63,6 @@ public:
|
||||
// CodeGenInstructionSet *getInstructionSet -
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -28,9 +28,13 @@
|
||||
|
||||
%{
|
||||
#include "Record.h"
|
||||
typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
|
||||
typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy;
|
||||
#include "FileParser.h"
|
||||
|
||||
int Fileparse();
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// Global variable recording the location of the include directory
|
||||
std::string IncludeDirectory;
|
||||
|
||||
@@ -69,7 +73,6 @@ std::ostream &err() {
|
||||
}
|
||||
|
||||
|
||||
int Fileparse();
|
||||
|
||||
//
|
||||
// Function: ParseFile()
|
||||
@@ -171,6 +174,10 @@ int yywrap() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
%}
|
||||
|
||||
Comment \/\/.*
|
||||
|
||||
+17
-10
@@ -20,6 +20,9 @@
|
||||
|
||||
int yyerror(const char *ErrorMsg);
|
||||
int yylex();
|
||||
|
||||
namespace llvm {
|
||||
|
||||
extern int Filelineno;
|
||||
static Record *CurRec = 0;
|
||||
|
||||
@@ -160,20 +163,23 @@ static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
|
||||
addSuperClass(SC);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
std::string *StrVal;
|
||||
int IntVal;
|
||||
RecTy *Ty;
|
||||
Init *Initializer;
|
||||
std::vector<Init*> *FieldList;
|
||||
std::vector<unsigned>*BitList;
|
||||
Record *Rec;
|
||||
SubClassRefTy *SubClassRef;
|
||||
std::vector<SubClassRefTy> *SubClassList;
|
||||
std::vector<std::pair<Init*, std::string> > *DagValueList;
|
||||
std::string* StrVal;
|
||||
int IntVal;
|
||||
llvm::RecTy* Ty;
|
||||
llvm::Init* Initializer;
|
||||
std::vector<llvm::Init*>* FieldList;
|
||||
std::vector<unsigned>* BitList;
|
||||
llvm::Record* Rec;
|
||||
SubClassRefTy* SubClassRef;
|
||||
std::vector<SubClassRefTy>* SubClassList;
|
||||
std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
|
||||
};
|
||||
|
||||
%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN
|
||||
@@ -193,6 +199,7 @@ static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
|
||||
%type <StrVal> Declaration OptID OptVarName
|
||||
|
||||
%start File
|
||||
|
||||
%%
|
||||
|
||||
ClassID : ID {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "CodeGenWrappers.h"
|
||||
#include "Record.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// runEnums - Print out enum values for all of the instructions.
|
||||
void InstrInfoEmitter::runEnums(std::ostream &OS) {
|
||||
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
|
||||
@@ -47,6 +49,7 @@ void InstrInfoEmitter::runEnums(std::ostream &OS) {
|
||||
OS << " };\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
EmitSourceFileTail(OS);
|
||||
}
|
||||
|
||||
void InstrInfoEmitter::printDefList(ListInit *LI, const std::string &Name,
|
||||
@@ -93,6 +96,7 @@ void InstrInfoEmitter::run(std::ostream &OS) {
|
||||
if (Instructions[i] != PHI)
|
||||
emitRecord(Instructions[i], i+1, InstrInfo, OS);
|
||||
OS << "};\n";
|
||||
EmitSourceFileTail(OS);
|
||||
}
|
||||
|
||||
void InstrInfoEmitter::emitRecord(Record *R, unsigned Num, Record *InstrInfo,
|
||||
@@ -169,3 +173,5 @@ void InstrInfoEmitter::emitShiftedValue(Record *R, StringInit *Val,
|
||||
std::cerr << "Unhandled initializer: " << *Val << "\n";
|
||||
throw "In record '" + R->getName() + "' for TSFlag emission.";
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -16,6 +16,9 @@
|
||||
#define INSTRINFO_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class StringInit;
|
||||
class IntInit;
|
||||
class ListInit;
|
||||
@@ -38,4 +41,6 @@ private:
|
||||
std::ostream &OS);
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "Support/StringExtras.h"
|
||||
#include <set>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
NodeType::ArgResultTypes NodeType::Translate(Record *R) {
|
||||
const std::string &Name = R->getName();
|
||||
if (Name == "DNVT_any") return Any;
|
||||
@@ -978,9 +980,10 @@ void InstrSelectorEmitter::run(std::ostream &OS) {
|
||||
|
||||
CalculateComputableValues();
|
||||
|
||||
OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
|
||||
|
||||
EmitSourceFileHeader("Instruction Selector for the " + Target.getName() +
|
||||
" target", OS);
|
||||
OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
|
||||
|
||||
// Output the slot number enums...
|
||||
OS << "\nenum { // Slot numbers...\n"
|
||||
@@ -1290,5 +1293,7 @@ void InstrSelectorEmitter::run(std::ostream &OS) {
|
||||
<< " }\n\n N->addValue(Val); // Do not ever recalculate this\n"
|
||||
<< " return Val;\n}\n\n";
|
||||
}
|
||||
EmitSourceFileTail(OS);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class DagInit;
|
||||
class Init;
|
||||
class InstrSelectorEmitter;
|
||||
@@ -391,4 +393,6 @@ private:
|
||||
bool PrintArg, std::ostream &OS);
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -16,6 +16,8 @@
|
||||
// Type implementations
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace llvm {
|
||||
|
||||
void RecTy::dump() const { print(std::cerr); }
|
||||
|
||||
Init *BitRecTy::convertValue(BitsInit *BI) {
|
||||
@@ -681,3 +683,5 @@ RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const {
|
||||
|
||||
return Defs;
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// RecTy subclasses...
|
||||
class BitRecTy;
|
||||
class BitsRecTy;
|
||||
@@ -853,4 +855,6 @@ std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
|
||||
|
||||
extern RecordKeeper Records;
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "Support/StringExtras.h"
|
||||
#include <set>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
// runEnums - Print out enum values for all of the registers.
|
||||
void RegisterInfoEmitter::runEnums(std::ostream &OS) {
|
||||
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
|
||||
@@ -40,6 +42,7 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
|
||||
OS << " };\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
EmitSourceFileTail(OS);
|
||||
}
|
||||
|
||||
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
@@ -68,6 +71,7 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n";
|
||||
}
|
||||
OS << "} // end of namespace " << TargetName << "\n\n";
|
||||
EmitSourceFileTail(OS);
|
||||
}
|
||||
|
||||
// RegisterInfoEmitter::run - Main register file description emitter.
|
||||
@@ -240,4 +244,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
for (unsigned i = 0, e = CSR.size(); i != e; ++i)
|
||||
OS << getQualifiedName(CSR[i]) << ", ";
|
||||
OS << " 0\n };\n return CalleeSaveRegs;\n}\n\n";
|
||||
EmitSourceFileTail(OS);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class RegisterInfoEmitter : public TableGenBackend {
|
||||
RecordKeeper &Records;
|
||||
public:
|
||||
@@ -33,4 +35,6 @@ public:
|
||||
void runEnums(std::ostream &o);
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
enum ActionType {
|
||||
PrintRecords,
|
||||
GenEmitter,
|
||||
@@ -406,6 +408,9 @@ static void ParseMachineCode() {
|
||||
}
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cl::ParseCommandLineOptions(argc, argv);
|
||||
@@ -459,12 +464,17 @@ int main(int argc, char **argv) {
|
||||
InstrSelectorEmitter(Records).run(*Out);
|
||||
break;
|
||||
case PrintEnums:
|
||||
{
|
||||
std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
|
||||
for (unsigned i = 0, e = Recs.size(); i != e; ++i)
|
||||
*Out << Recs[i] << ", ";
|
||||
*Out << "\n";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert(1 && "Invalid Action");
|
||||
return 1;
|
||||
}
|
||||
} catch (const std::string &Error) {
|
||||
std::cerr << Error << "\n";
|
||||
if (Out != &std::cout) {
|
||||
|
||||
@@ -15,12 +15,18 @@
|
||||
#include "Record.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
|
||||
std::ostream &OS) const {
|
||||
OS << "//===- TableGen'erated file -------------------------------------*-"
|
||||
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
|
||||
"d file, do not edit!\n//\n//===------------------------------------"
|
||||
"----------------------------------===//\n\n";
|
||||
"----------------------------------===//\n\nnamespace llvm {\n\n";
|
||||
}
|
||||
|
||||
void TableGenBackend::EmitSourceFileTail( std::ostream& OS ) const {
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
/// getQualifiedName - Return the name of the specified record, with a
|
||||
@@ -32,3 +38,4 @@ std::string TableGenBackend::getQualifiedName(Record *R) const {
|
||||
return Namespace + "::" + R->getName();
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Record;
|
||||
class RecordKeeper;
|
||||
|
||||
@@ -33,9 +36,15 @@ public: // Useful helper routines...
|
||||
/// ostream.
|
||||
void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const;
|
||||
|
||||
/// EmitSourceFileTail - Output an LLVm styelf ile tail to the specified
|
||||
/// ostream.
|
||||
void EmitSourceFileTail( std::ostream& OS ) const;
|
||||
|
||||
/// getQualifiedName - Return the name of the specified record, with a
|
||||
/// namespace qualifier if the record contains one.
|
||||
std::string getQualifiedName(Record *R) const;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user