mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Add back support for reading and parsing 'deplibs'.
This is for backwards compatibility for pre-3.x bc files. The code reads the code, but does nothing with it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b1496c922
commit
3defc0bfa6
@ -55,6 +55,9 @@ namespace bitc {
|
||||
MODULE_CODE_ASM = 4, // ASM: [strchr x N]
|
||||
MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N]
|
||||
|
||||
// FIXME: Remove DEPLIB in 4.0.
|
||||
MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N]
|
||||
|
||||
// GLOBALVAR: [pointer type, isconst, initid,
|
||||
// linkage, alignment, section, visibility, threadlocal]
|
||||
MODULE_CODE_GLOBALVAR = 7,
|
||||
|
@ -486,6 +486,7 @@ lltok::Kind LLLexer::LexIdentifier() {
|
||||
KEYWORD(target);
|
||||
KEYWORD(triple);
|
||||
KEYWORD(unwind);
|
||||
KEYWORD(deplibs); // FIXME: Remove in 4.0.
|
||||
KEYWORD(datalayout);
|
||||
KEYWORD(volatile);
|
||||
KEYWORD(atomic);
|
||||
|
@ -168,6 +168,7 @@ bool LLParser::ParseTopLevelEntities() {
|
||||
case lltok::kw_define: if (ParseDefine()) return true; break;
|
||||
case lltok::kw_module: if (ParseModuleAsm()) return true; break;
|
||||
case lltok::kw_target: if (ParseTargetDefinition()) return true; break;
|
||||
case lltok::kw_deplibs: if (ParseDepLibs()) return true; break;
|
||||
case lltok::LocalVarID: if (ParseUnnamedType()) return true; break;
|
||||
case lltok::LocalVar: if (ParseNamedType()) return true; break;
|
||||
case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break;
|
||||
@ -263,6 +264,28 @@ bool LLParser::ParseTargetDefinition() {
|
||||
}
|
||||
}
|
||||
|
||||
/// toplevelentity
|
||||
/// ::= 'deplibs' '=' '[' ']'
|
||||
/// ::= 'deplibs' '=' '[' STRINGCONSTANT (',' STRINGCONSTANT)* ']'
|
||||
/// FIXME: Remove in 4.0. Currently parse, but ignore.
|
||||
bool LLParser::ParseDepLibs() {
|
||||
assert(Lex.getKind() == lltok::kw_deplibs);
|
||||
Lex.Lex();
|
||||
if (ParseToken(lltok::equal, "expected '=' after deplibs") ||
|
||||
ParseToken(lltok::lsquare, "expected '=' after deplibs"))
|
||||
return true;
|
||||
|
||||
if (EatIfPresent(lltok::rsquare))
|
||||
return false;
|
||||
|
||||
do {
|
||||
std::string Str;
|
||||
if (ParseStringConstant(Str)) return true;
|
||||
} while (EatIfPresent(lltok::comma));
|
||||
|
||||
return ParseToken(lltok::rsquare, "expected ']' at end of list");
|
||||
}
|
||||
|
||||
/// ParseUnnamedType:
|
||||
/// ::= LocalVarID '=' 'type' type
|
||||
bool LLParser::ParseUnnamedType() {
|
||||
|
@ -217,6 +217,7 @@ namespace llvm {
|
||||
bool ValidateEndOfModule();
|
||||
bool ParseTargetDefinition();
|
||||
bool ParseModuleAsm();
|
||||
bool ParseDepLibs(); // FIXME: Remove in 4.0.
|
||||
bool ParseUnnamedType();
|
||||
bool ParseNamedType();
|
||||
bool ParseDeclare();
|
||||
|
@ -54,6 +54,7 @@ namespace lltok {
|
||||
kw_target,
|
||||
kw_triple,
|
||||
kw_unwind,
|
||||
kw_deplibs, // FIXME: Remove in 4.0
|
||||
kw_datalayout,
|
||||
kw_volatile,
|
||||
kw_atomic,
|
||||
|
@ -1564,6 +1564,14 @@ bool BitcodeReader::ParseModule(bool Resume) {
|
||||
TheModule->setModuleInlineAsm(S);
|
||||
break;
|
||||
}
|
||||
case bitc::MODULE_CODE_DEPLIB: { // DEPLIB: [strchr x N]
|
||||
// FIXME: Remove in 4.0.
|
||||
std::string S;
|
||||
if (ConvertToString(Record, 0, S))
|
||||
return Error("Invalid MODULE_CODE_DEPLIB record");
|
||||
// Ignore value.
|
||||
break;
|
||||
}
|
||||
case bitc::MODULE_CODE_SECTIONNAME: { // SECTIONNAME: [strchr x N]
|
||||
std::string S;
|
||||
if (ConvertToString(Record, 0, S))
|
||||
|
@ -150,6 +150,7 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
||||
case bitc::MODULE_CODE_DATALAYOUT: return "DATALAYOUT";
|
||||
case bitc::MODULE_CODE_ASM: return "ASM";
|
||||
case bitc::MODULE_CODE_SECTIONNAME: return "SECTIONNAME";
|
||||
case bitc::MODULE_CODE_DEPLIB: return "DEPLIB"; // FIXME: Remove in 4.0
|
||||
case bitc::MODULE_CODE_GLOBALVAR: return "GLOBALVAR";
|
||||
case bitc::MODULE_CODE_FUNCTION: return "FUNCTION";
|
||||
case bitc::MODULE_CODE_ALIAS: return "ALIAS";
|
||||
|
Loading…
Reference in New Issue
Block a user