summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDavid Peixotto <dpeixott@codeaurora.org>2014-02-06 18:19:40 +0000
committerDavid Peixotto <dpeixott@codeaurora.org>2014-02-06 18:19:40 +0000
commitea2bcb9e0750f971a98dfd3d7f2ac27e0aabbcb9 (patch)
treee7539ee9746bbcfe326ff647b596018317812435 /llvm/lib/Target
parentf0e21616f332fb504f28f6115a9e72b6ee929717 (diff)
downloadbcm5719-llvm-ea2bcb9e0750f971a98dfd3d7f2ac27e0aabbcb9.tar.gz
bcm5719-llvm-ea2bcb9e0750f971a98dfd3d7f2ac27e0aabbcb9.zip
Remove const_cast for STI when parsing inline asm
In a previous commit (r199818) we added a const_cast to an existing subtarget info instead of creating a new one so that we could reuse it when creating the TargetAsmParser for parsing inline assembly. This cast was necessary because we needed to reuse the existing STI to avoid generating incorrect code when the inline asm contained mode-switching directives (e.g. .code 16). The root cause of the failure was that there was an implicit sharing of the STI between the parser and the MCCodeEmitter. To fix a different but related issue, we now explicitly pass the STI to the MCCodeEmitter (see commits r200345-r200351). The const_cast is no longer necessary and we can now create a fresh STI for the inline asm parser to use. Differential Revision: http://llvm-reviews.chandlerc.com/D2709 llvm-svn: 200929
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp4
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.h3
2 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index d0aad327c40..82355063221 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -443,14 +443,12 @@ static bool isThumb(const MCSubtargetInfo& STI) {
}
void ARMAsmPrinter::emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
- MCSubtargetInfo *EndInfo) const {
+ const MCSubtargetInfo *EndInfo) const {
// If either end mode is unknown (EndInfo == NULL) or different than
// the start mode, then restore the start mode.
const bool WasThumb = isThumb(StartInfo);
if (EndInfo == NULL || WasThumb != isThumb(*EndInfo)) {
OutStreamer.EmitAssemblerFlag(WasThumb ? MCAF_Code16 : MCAF_Code32);
- if (EndInfo)
- EndInfo->ToggleFeature(ARM::ModeThumb);
}
}
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.h b/llvm/lib/Target/ARM/ARMAsmPrinter.h
index d1c0e09e610..fe17d996b73 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.h
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.h
@@ -64,7 +64,8 @@ public:
raw_ostream &O) LLVM_OVERRIDE;
virtual void emitInlineAsmEnd(const MCSubtargetInfo &StartInfo,
- MCSubtargetInfo *EndInfo) const LLVM_OVERRIDE;
+ const MCSubtargetInfo *EndInfo) const
+ LLVM_OVERRIDE;
void EmitJumpTable(const MachineInstr *MI);
void EmitJump2Table(const MachineInstr *MI);
OpenPOWER on IntegriCloud