diff options
author | Matheus Almeida <matheus.almeida@imgtec.com> | 2014-04-30 11:28:42 +0000 |
---|---|---|
committer | Matheus Almeida <matheus.almeida@imgtec.com> | 2014-04-30 11:28:42 +0000 |
commit | 00bdeb4c545051f04e0a85b5773813b277095de4 (patch) | |
tree | b49953513f521f760db6fa970eaf396a038aaf2e /lib/Target/Mips/MipsTargetStreamer.h | |
parent | 737de9db8ee23d1b953aa147b6b36a18f30920f6 (diff) | |
download | llvm-00bdeb4c545051f04e0a85b5773813b277095de4.tar.gz llvm-00bdeb4c545051f04e0a85b5773813b277095de4.tar.bz2 llvm-00bdeb4c545051f04e0a85b5773813b277095de4.tar.xz |
[mips] Add support for .cpload.
Summary:
This directive is used for setting up $gp in the beginning of a function.
It expands to three instructions if PIC is enabled:
lui $gp, %hi(_gp_disp)
addui $gp, $gp, %lo(_gp_disp)
addu $gp, $gp, $reg
_gp_disp is a special symbol that the linker sets to the distance between
the lui instruction and the context pointer (_gp).
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D3480
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsTargetStreamer.h')
-rw-r--r-- | lib/Target/Mips/MipsTargetStreamer.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsTargetStreamer.h b/lib/Target/Mips/MipsTargetStreamer.h index 7873ed9a60..e649a4d14f 100644 --- a/lib/Target/Mips/MipsTargetStreamer.h +++ b/lib/Target/Mips/MipsTargetStreamer.h @@ -47,6 +47,9 @@ public: virtual void emitDirectiveSetMips64() = 0; virtual void emitDirectiveSetMips64R2() = 0; virtual void emitDirectiveSetDsp() = 0; + + // PIC support + virtual void emitDirectiveCpload(unsigned RegNo) = 0; }; // This part is for ascii assembly output @@ -83,6 +86,9 @@ public: void emitDirectiveSetMips64() override; void emitDirectiveSetMips64R2() override; void emitDirectiveSetDsp() override; + + // PIC support + virtual void emitDirectiveCpload(unsigned RegNo); }; // This part is for ELF object output @@ -128,6 +134,14 @@ public: void emitDirectiveSetMips64() override; void emitDirectiveSetMips64R2() override; void emitDirectiveSetDsp() override; + + // PIC support + virtual void emitDirectiveCpload(unsigned RegNo); + +protected: + bool isO32() const { return STI.getFeatureBits() & Mips::FeatureO32; } + bool isN32() const { return STI.getFeatureBits() & Mips::FeatureN32; } + bool isN64() const { return STI.getFeatureBits() & Mips::FeatureN64; } }; } #endif |