[mips] Add support for .cpload.
authorMatheus Almeida <matheus.almeida@imgtec.com>
Wed, 30 Apr 2014 11:28:42 +0000 (11:28 +0000)
committerMatheus Almeida <matheus.almeida@imgtec.com>
Wed, 30 Apr 2014 11:28:42 +0000 (11:28 +0000)
commit00bdeb4c545051f04e0a85b5773813b277095de4
treeb49953513f521f760db6fa970eaf396a038aaf2e
parent737de9db8ee23d1b953aa147b6b36a18f30920f6
[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
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
lib/Target/Mips/MipsTargetStreamer.h
test/MC/Mips/cpload-bad.s [new file with mode: 0644]
test/MC/Mips/cpload.s [new file with mode: 0644]