summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Peixotto <dpeixott@codeaurora.org>2013-12-19 18:26:07 +0000
committerDavid Peixotto <dpeixott@codeaurora.org>2013-12-19 18:26:07 +0000
commit3793977e90f07b4e2b08bc8cc7437785e4475af6 (patch)
tree170fae3cb132557f30a01fdb8937dcce26bd93d2 /lib
parent927ad4a9f68dc9b3f652ceba3b590749d04ac613 (diff)
downloadllvm-3793977e90f07b4e2b08bc8cc7437785e4475af6.tar.gz
llvm-3793977e90f07b4e2b08bc8cc7437785e4475af6.tar.bz2
llvm-3793977e90f07b4e2b08bc8cc7437785e4475af6.tar.xz
Implement the .ltorg directive for ARM assembly
This directive will write out the assembler-maintained constant pool for the current section. These constant pools are created to support the ldr-pseudo instruction (e.g. ldr r0, =val). The directive can be used by the programmer to place the constant pool in a location that can be reached by a pc-relative offset in the ldr instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197711 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 8ebf1e41eb..f794e21b2b 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -115,6 +115,10 @@ class ARMAsmParser : public MCTargetAsmParser {
return ConstantPools[Section];
}
+ void destroyConstantPool(const MCSection *Section) {
+ ConstantPools.erase(Section);
+ }
+
ARMTargetStreamer &getTargetStreamer() {
MCTargetStreamer &TS = getParser().getStreamer().getTargetStreamer();
return static_cast<ARMTargetStreamer &>(TS);
@@ -211,6 +215,7 @@ class ARMAsmParser : public MCTargetAsmParser {
bool parseDirectivePad(SMLoc L);
bool parseDirectiveRegSave(SMLoc L, bool IsVector);
bool parseDirectiveInst(SMLoc L, char Suffix = '\0');
+ bool parseDirectiveLtorg(SMLoc L);
StringRef splitMnemonic(StringRef Mnemonic, unsigned &PredicationCode,
bool &CarrySetting, unsigned &ProcessorIMod,
@@ -7894,6 +7899,8 @@ bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) {
return parseDirectiveInst(DirectiveID.getLoc(), 'n');
else if (IDVal == ".inst.w")
return parseDirectiveInst(DirectiveID.getLoc(), 'w');
+ else if (IDVal == ".ltorg")
+ return parseDirectiveLtorg(DirectiveID.getLoc());
return true;
}
@@ -8445,6 +8452,20 @@ bool ARMAsmParser::parseDirectiveInst(SMLoc Loc, char Suffix) {
return false;
}
+/// parseDirectiveLtorg
+/// ::= .ltorg
+bool ARMAsmParser::parseDirectiveLtorg(SMLoc L) {
+ MCStreamer &Streamer = getParser().getStreamer();
+ const MCSection *Section = Streamer.getCurrentSection().first;
+
+ if (ConstantPool *CP = getConstantPool(Section)) {
+ CP->emitEntries(Streamer);
+ CP = 0;
+ destroyConstantPool(Section);
+ }
+ return false;
+}
+
/// Force static initialization.
extern "C" void LLVMInitializeARMAsmParser() {
RegisterMCAsmParser<ARMAsmParser> X(TheARMTarget);