[PATCH] D5626: [mips] Make the MipsAsmParser capable of knowing whether PIC mode is enabled or not.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 05:34:46 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245291: [mips] Make the MipsAsmParser capable of knowing whether PIC mode is enabled… (authored by dsanders).
Changed prior to commit:
http://reviews.llvm.org/D5626?vs=16098&id=32404#toc
Repository:
rL LLVM
http://reviews.llvm.org/D5626
Files:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Index: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -11,6 +11,7 @@
#include "MCTargetDesc/MipsMCExpr.h"
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "MipsRegisterInfo.h"
+#include "MipsTargetObjectFile.h"
#include "MipsTargetStreamer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/SmallVector.h"
@@ -114,6 +115,7 @@
// selected. This usually happens after an '.end func'
// directive.
bool IsLittleEndian;
+ bool IsPicEnabled;
// Print a warning along with its fix-it message at the given range.
void printWarningWithFixIt(const Twine &Msg, const Twine &FixMsg,
@@ -406,6 +408,9 @@
CurrentFn = nullptr;
+ IsPicEnabled =
+ (getContext().getObjectFileInfo()->getRelocM() == Reloc::PIC_);
+
Triple TheTriple(sti.getTargetTriple());
if ((TheTriple.getArch() == Triple::mips) ||
(TheTriple.getArch() == Triple::mips64))
@@ -475,6 +480,10 @@
return (STI.getFeatureBits()[Mips::FeatureCnMips]);
}
+ bool inPicMode() {
+ return IsPicEnabled;
+ }
+
bool inMips16Mode() const {
return STI.getFeatureBits()[Mips::FeatureMips16];
}
@@ -4714,6 +4723,9 @@
StringRef Option = Tok.getIdentifier();
if (Option == "pic0") {
+ // MipsAsmParser needs to know if the current PIC mode changes.
+ IsPicEnabled = false;
+
getTargetStreamer().emitDirectiveOptionPic0();
Parser.Lex();
if (Parser.getTok().isNot(AsmToken::EndOfStatement)) {
@@ -4725,6 +4737,9 @@
}
if (Option == "pic2") {
+ // MipsAsmParser needs to know if the current PIC mode changes.
+ IsPicEnabled = true;
+
getTargetStreamer().emitDirectiveOptionPic2();
Parser.Lex();
if (Parser.getTok().isNot(AsmToken::EndOfStatement)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5626.32404.patch
Type: text/x-patch
Size: 1966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150818/2999aa81/attachment.bin>
More information about the llvm-commits
mailing list