diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2019-05-29 03:29:01 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-05-29 03:29:01 +0000 |
| commit | 31fda09b2db405bbaa225bb6068c5f787506b9db (patch) | |
| tree | c6571ccf7d6848532f8a4e92c9027a0fc9ed047a /llvm/lib/AsmParser | |
| parent | 10c548cdfa1ebe15c0312d373191b09fbe7b6a3c (diff) | |
| download | bcm5719-llvm-31fda09b2db405bbaa225bb6068c5f787506b9db.tar.gz bcm5719-llvm-31fda09b2db405bbaa225bb6068c5f787506b9db.zip | |
Add IR support, ELF section and user documentation for partitioning feature.
The partitioning feature was proposed here:
http://lists.llvm.org/pipermail/llvm-dev/2019-February/130583.html
This is mostly just documentation. The feature itself will be contributed
in subsequent patches.
Differential Revision: https://reviews.llvm.org/D60242
llvm-svn: 361923
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/LLLexer.cpp | 1 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 29 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/LLToken.h | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index c0b9cd12d0c..dc8ff7f1315 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -570,6 +570,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(align); KEYWORD(addrspace); KEYWORD(section); + KEYWORD(partition); KEYWORD(alias); KEYWORD(ifunc); KEYWORD(module); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 6af084edbd8..28a8480e7d3 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -856,11 +856,14 @@ static void maybeSetDSOLocal(bool DSOLocal, GlobalValue &GV) { /// ::= GlobalVar '=' OptionalLinkage OptionalPreemptionSpecifier /// OptionalVisibility OptionalDLLStorageClass /// OptionalThreadLocal OptionalUnnamedAddr -// 'alias|ifunc' IndirectSymbol +/// 'alias|ifunc' IndirectSymbol IndirectSymbolAttr* /// /// IndirectSymbol /// ::= TypeAndValue /// +/// IndirectSymbolAttr +/// ::= ',' 'partition' StringConstant +/// /// Everything through OptionalUnnamedAddr has already been parsed. /// bool LLParser::parseIndirectSymbol(const std::string &Name, LocTy NameLoc, @@ -960,6 +963,21 @@ bool LLParser::parseIndirectSymbol(const std::string &Name, LocTy NameLoc, GA->setUnnamedAddr(UnnamedAddr); maybeSetDSOLocal(DSOLocal, *GA); + // At this point we've parsed everything except for the IndirectSymbolAttrs. + // Now parse them if there are any. + while (Lex.getKind() == lltok::comma) { + Lex.Lex(); + + if (Lex.getKind() == lltok::kw_partition) { + Lex.Lex(); + GA->setPartition(Lex.getStrVal()); + if (ParseToken(lltok::StringConstant, "expected partition string")) + return true; + } else { + return TokError("unknown alias or ifunc property!"); + } + } + if (Name.empty()) NumberedVals.push_back(GA.get()); @@ -1095,6 +1113,11 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc, GV->setSection(Lex.getStrVal()); if (ParseToken(lltok::StringConstant, "expected global section string")) return true; + } else if (Lex.getKind() == lltok::kw_partition) { + Lex.Lex(); + GV->setPartition(Lex.getStrVal()); + if (ParseToken(lltok::StringConstant, "expected partition string")) + return true; } else if (Lex.getKind() == lltok::kw_align) { unsigned Alignment; if (ParseOptionalAlignment(Alignment)) return true; @@ -5287,6 +5310,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { std::vector<unsigned> FwdRefAttrGrps; LocTy BuiltinLoc; std::string Section; + std::string Partition; unsigned Alignment; std::string GC; GlobalValue::UnnamedAddr UnnamedAddr = GlobalValue::UnnamedAddr::None; @@ -5303,6 +5327,8 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { BuiltinLoc) || (EatIfPresent(lltok::kw_section) && ParseStringConstant(Section)) || + (EatIfPresent(lltok::kw_partition) && + ParseStringConstant(Partition)) || parseOptionalComdat(FunctionName, C) || ParseOptionalAlignment(Alignment) || (EatIfPresent(lltok::kw_gc) && @@ -5404,6 +5430,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { Fn->setUnnamedAddr(UnnamedAddr); Fn->setAlignment(Alignment); Fn->setSection(Section); + Fn->setPartition(Partition); Fn->setComdat(C); Fn->setPersonalityFn(PersonalityFn); if (!GC.empty()) Fn->setGC(GC); diff --git a/llvm/lib/AsmParser/LLToken.h b/llvm/lib/AsmParser/LLToken.h index 33ea28bb10e..a1e70932178 100644 --- a/llvm/lib/AsmParser/LLToken.h +++ b/llvm/lib/AsmParser/LLToken.h @@ -113,6 +113,7 @@ enum Kind { kw_align, kw_addrspace, kw_section, + kw_partition, kw_alias, kw_ifunc, kw_module, |

