History log of /external/llvm/lib/MC/MCExpr.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
de2d8694e25a814696358e95141f4b1aa4d8847e 20-Sep-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r275480

Bug: http://b/31320715

This merges commit 7dcf7f03e005379ef2f06db96aa93f06186b66d5 from
aosp/dev.

Test: Build AOSP and run RenderScript tests (host tests for slang and
libbcc, RsTest, CTS)

Change-Id: Iaf3738f74312d875e69f61d604ac058f381a2a1a
/external/llvm/lib/MC/MCExpr.cpp
f3ef5332fa3f4d5ec72c178a2b19dac363a19383 04-Mar-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r256229

http://b/26987366

Change-Id: I1f29c4676a8abe633ab5707dded58d846c973d50
/external/llvm/lib/MC/MCExpr.cpp
6948897e478cbd66626159776a8017b3c18579b9 01-Jul-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r239765

Bug: 20140355: This rebase pulls the upstream fix for the spurious
warnings mentioned in the bug.

Change-Id: I7fd24253c50f4d48d900875dcf43ce3f1721a3da
/external/llvm/lib/MC/MCExpr.cpp
0c7f116bb6950ef819323d855415b2f2b0aad987 06-May-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r235153

Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7
/external/llvm/lib/MC/MCExpr.cpp
4c5e43da7792f75567b693105cc53e3f1992ad98 08-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master llvm for rebase to r233350

Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49
/external/llvm/lib/MC/MCExpr.cpp
ebe69fe11e48d322045d5949c83283927a0d790b 23-Mar-2015 Stephen Hines <srhines@google.com> Update aosp/master LLVM for rebase to r230699.

Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
/external/llvm/lib/MC/MCExpr.cpp
37ed9c199ca639565f6ce88105f9e39e898d82d0 01-Dec-2014 Stephen Hines <srhines@google.com> Update aosp/master LLVM for rebase to r222494.

Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
/external/llvm/lib/MC/MCExpr.cpp
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/MC/MCExpr.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/MC/MCExpr.cpp
7a34599db017a5486cf7cd11eb124984acec8286 09-Jul-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Revert r185476 and fix up TLS variant kinds

In the commit message to r185476 I wrote:

>The PowerPC-specific modifiers VK_PPC_TLSGD and VK_PPC_TLSLD
>correspond exactly to the generic modifiers VK_TLSGD and VK_TLSLD.
>This causes some confusion with the asm parser, since VK_PPC_TLSGD
>is output as @tlsgd, which is then read back in as VK_TLSGD.
>
>To avoid this confusion, this patch removes the PowerPC-specific
>modifiers and uses the generic modifiers throughout. (The only
>drawback is that the generic modifiers are printed in upper case
>while the usual convention on PowerPC is to use lower-case modifiers.
>But this is just a cosmetic issue.)

This was unfortunately incorrect, there is is fact another,
serious drawback to using the default VK_TLSLD/VK_TLSGD
variant kinds: using these causes ELFObjectWriter::RelocNeedsGOT
to return true, which in turn causes the ELFObjectWriter to emit
an undefined reference to _GLOBAL_OFFSET_TABLE_.

This is a problem on powerpc64, because it uses the TOC instead
of the GOT, and the linker does not provide _GLOBAL_OFFSET_TABLE_,
so the symbol remains undefined. This means shared libraries
using TLS built with the integrated assembler are currently
broken.

While the whole RelocNeedsGOT / _GLOBAL_OFFSET_TABLE_ situation
probably ought to be properly fixed at some point, for now I'm
simply reverting the r185476 commit. Now this in turn exposes
the breakage of handling @tlsgd/@tlsld in the asm parser that
this check-in was originally intended to fix.

To avoid this regression, I'm also adding a different fix for
this problem: while common code now parses @tlsgd as VK_TLSGD,
a special hack in the asm parser translates this code to the
platform-specific VK_PPC_TLSGD that the back-end now expects.
While this is not really pretty, it's self-contained and
shouldn't hurt anything else for now. One the underlying
problem is fixed, this hack can be reverted again.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
58fc1f52ce070003acbdfedc85d52ba999a2bd11 02-Jul-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Remove VK_PPC_TLSGD and VK_PPC_TLSLD

The PowerPC-specific modifiers VK_PPC_TLSGD and VK_PPC_TLSLD
correspond exactly to the generic modifiers VK_TLSGD and VK_TLSLD.
This causes some confusion with the asm parser, since VK_PPC_TLSGD
is output as @tlsgd, which is then read back in as VK_TLSGD.

To avoid this confusion, this patch removes the PowerPC-specific
modifiers and uses the generic modifiers throughout. (The only
drawback is that the generic modifiers are printed in upper case
while the usual convention on PowerPC is to use lower-case modifiers.
But this is just a cosmetic issue.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
228e0afcfd0d5f167a95c6ddbec2c6a4a90b6d2b 02-Jul-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Add support for TLS data relocations

This adds support for TLS data relocations and modifiers:
.quad target@dtpmod
.quad target@tprel
.quad target@dtprel
Currently exploited by the asm parser only.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
5de735a962a255676cf3a9bc255579d465670633 25-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Support @got modifier

Add VK_... values and relocation types necessary to support
the @got family of modifiers. Used by the asm parser only.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
cab0a1933875935c717136d251e2af9749533ba8 21-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Support various tls-related modifiers

The current code base only supports the minimum set of tls-related
relocations and @modifiers that are necessary to support compiler-
generated code. This patch extends this to the full set defined
in the ABI (and supported by the GNU assembler) for the benefit
of the assembler parser.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f7c1ee79fe90353fcd3f545f9d45a01a837bbf4b 21-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Support @higher et.al. modifiers

This adds support for the @higher, @highera, @highest, and @highesta
modifers, including some missing relocation types.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f8f87dcfceadd1b842d130303a7091ad7d7d67d0 21-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Support @toc@h modifier

This adds the relocation type and other necessary infrastructure
to use the @toc@h modifier in the assembler.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d2849572463da994c685b3bd7a60d5a7566c01e3 21-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Support @h modifier

This adds necessary infrastructure to support the @h modifier.
Note that all required relocation types were already present
(and unused).

This patch provides support for using @h in the assembler;
it would also be possible to now use this feature in code
generated by the compiler, but this is not done yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184548 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
92cfa61c50d01307d658753f8d47f4e8555a6fa9 21-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Rename some more VK_PPC_ enums

This renames more VK_PPC_ enums, to make them more closely reflect
the @modifier string they represent. This also prepares for adding
a bunch of new VK_PPC_ enums in upcoming patches.

For consistency, some MO_ flags related to VK_PPC_ enums are
likewise renamed.

No change in behaviour.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
846565924a6f2932efc75c249b29c3619e587bbb 21-Jun-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Clean up VK_PPC_TOC... names

This is another minor cleanup; to bring enum names in line
with the corresponding @modifier names, this renames:

VK_PPC_TOC -> VK_PPC_TOCBASE
VK_PPC_TOC_ENTRY -> VK_PPC_TOC16

No code change intended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
edaa58ee66699b99841ee5dfdd485aedbae3bf90 24-May-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Clean up generation of ha16() / lo16() markers

When targeting the Darwin assembler, we need to generate markers ha16() and
lo16() to designate the high and low parts of a (symbolic) immediate. This
is necessary not just for plain symbols, but also for certain symbolic
expression, typically along the lines of ha16(A - B). The latter doesn't
work when simply using VariantKind flags on the symbol reference.
This is why the current back-end uses hacks (explicitly called out as such
via multiple FIXMEs) in the symbolLo/symbolHi print methods.

This patch uses target-defined MCExpr codes to represent the Darwin
ha16/lo16 constructs, following along the lines of the equivalent solution
used by the ARM back end to handle their :upper16: / :lower16: markers.
This allows us to get rid of special handling both in the symbolLo/symbolHi
print method and in the common code MCExpr::print routine. Instead, the
ha16 / lo16 markers are printed simply in a custom print routine for the
target MCExpr types. (As a result, the symbolLo/symbolHi print methods
can now replaced by a single printS16ImmOperand routine that also handles
symbolic operands.)

The patch also provides a EvaluateAsRelocatableImpl routine to handle
ha16/lo16 constructs. This is not actually used at the moment by any
in-tree code, but is provided as it makes merging into David Fang's
out-of-tree Mach-O object writer simpler.

Since there is no longer any need to treat VK_PPC_GAS_HA16 and
VK_PPC_DARWIN_HA16 differently, they are merged into a single
VK_PPC_ADDR16_HA (and likewise for the _LO16 types).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
a7e5e6b959bfd2b7982e116a4fd6955b35534b4c 03-May-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> [PowerPC] Parse platform-specifc variant kinds in AsmParser

This patch adds support for PowerPC platform-specific variant
kinds in MCSymbolRefExpr::getVariantKindForName, and also
adds a test case to verify they are translated to the appropriate
fixup type.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
93d0b06e2adca2d9f3d4ec544f352cc4e5e9618a 25-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix section relocation for SECTIONREL32 with immediate offset.

Patch by Kai Nacke. This matches the gnu as output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180568 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
18d49acdab79d6f0966b47182b6c3a2ba3d9f80f 11-Apr-2013 Nico Rieck <nico.rieck@gmail.com> MC: Support COFF image-relative MCSymbolRefs

Add support for the COFF relocation types IMAGE_REL_I386_DIR32NB and
IMAGE_REL_AMD64_ADDR32NB for 32- and 64-bit respectively. These are
similar to normal 4-byte relocations except that they do not include
the base address of the image.

Image-relative relocations are used for debug information (32-bit) and
SEH unwind tables (64-bit).

A new MCSymbolRef variant called 'VK_COFF_IMGREL32' is introduced to
specify such relocations. For AT&T assembly, this variant can be accessed
using the symbol suffix '@imgrel'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
42734cfb4140287d59d3b35718d62b5f90737499 30-Mar-2013 Benjamin Kramer <benny.kra@googlemail.com> Change '@SECREL' suffix to GAS-compatible '@SECREL32'.

'@SECREL' is what is used by the Microsoft assembler, but GNU as expects '@SECREL32'.
With the patch, the MC-generated code works fine in combination with a recent GNU as (2.23.51.20120920 here).

Patch by David Nadlinger!
Differential Revision: http://llvm-reviews.chandlerc.com/D429

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
b453e16855f347e300f1dc0cd0dfbdd65c27b0d2 14-Dec-2012 Bill Schmidt <wschmidt@linux.vnet.ibm.com> This patch improves the 64-bit PowerPC InitialExec TLS support by providing
for a wider range of GOT entries that can hold thread-relative offsets.
This matches the behavior of GCC, which was not documented in the PPC64 TLS
ABI. The ABI will be updated with the new code sequence.

Former sequence:

ld 9,x@got@tprel(2)
add 9,9,x@tls

New sequence:

addis 9,2,x@got@tprel@ha
ld 9,x@got@tprel@l(9)
add 9,9,x@tls

Note that a linker optimization exists to transform the new sequence into
the shorter sequence when appropriate, by replacing the addis with a nop
and modifying the base register and relocation type of the ld.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170209 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
349c2787cf9e174c8aa955bf8e3b09a405b2aece 12-Dec-2012 Bill Schmidt <wschmidt@linux.vnet.ibm.com> This patch implements local-dynamic TLS model support for the 64-bit
PowerPC target. This is the last of the four models, so we now have
full TLS support.

This is mostly a straightforward extension of the general dynamic model.
I had to use an additional Chain operand to tie ADDIS_DTPREL_HA to the
register copy following ADDI_TLSLD_L; otherwise everything above the
ADDIS_DTPREL_HA appeared dead and was removed.

As before, there are new test cases to test the assembly generation, and
the relocations output during integrated assembly. The expected code
gen sequence can be read in test/CodeGen/PowerPC/tls-ld.ll.

There are a couple of things I think can be done more efficiently in the
overall TLS code, so there will likely be a clean-up patch forthcoming;
but for now I want to be sure the functionality is in place.

Bill


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
37c7461fc3f1983a81bfe934855d707fd6572e78 12-Dec-2012 Logan Chien <tzuhsiang.chien@gmail.com> Add ARM NONE and PREL31 relocation types.

Add R_ARM_NONE and R_ARM_PREL31 relocation types
to MCExpr. Both of them will be used while
generating .ARM.extab and .ARM.exidx sections.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
57ac1f458a754f30cf500410b438fb260f9b8fe5 11-Dec-2012 Bill Schmidt <wschmidt@linux.vnet.ibm.com> This patch implements the general dynamic TLS model for 64-bit PowerPC.

Given a thread-local symbol x with global-dynamic access, the generated
code to obtain x's address is:

Instruction Relocation Symbol
addis ra,r2,x@got@tlsgd@ha R_PPC64_GOT_TLSGD16_HA x
addi r3,ra,x@got@tlsgd@l R_PPC64_GOT_TLSGD16_L x
bl __tls_get_addr(x@tlsgd) R_PPC64_TLSGD x
R_PPC64_REL24 __tls_get_addr
nop
<use address in r3>

The implementation borrows from the medium code model work for introducing
special forms of ADDIS and ADDI into the DAG representation. This is made
slightly more complicated by having to introduce a call to the external
function __tls_get_addr. Using the full call machinery is overkill and,
more importantly, makes it difficult to add a special relocation. So I've
introduced another opcode GET_TLS_ADDR to represent the function call, and
surrounded it with register copies to set up the parameter and return value.

Most of the code is pretty straightforward. I ran into one peculiarity
when I introduced a new PPC opcode BL8_NOP_ELF_TLSGD, which is just like
BL8_NOP_ELF except that it takes another parameter to represent the symbol
("x" above) that requires a relocation on the call. Something in the
TblGen machinery causes BL8_NOP_ELF and BL8_NOP_ELF_TLSGD to be treated
identically during the emit phase, so this second operand was never
visited to generate relocations. This is the reason for the slightly
messy workaround in PPCMCCodeEmitter.cpp:getDirectBrEncoding().

Two new tests are included to demonstrate correct external assembly and
correct generation of relocations using the integrated assembler.

Comments welcome!

Thanks,
Bill


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d7802bf0ddcac16ee910105922492aee86a53e1b 04-Dec-2012 Bill Schmidt <wschmidt@linux.vnet.ibm.com> This patch introduces initial-exec model support for thread-local storage
on 64-bit PowerPC ELF.

The patch includes code to handle external assembly and MC output with the
integrated assembler. It intentionally does not support the "old" JIT.

For the initial-exec TLS model, the ABI requires the following to calculate
the address of external thread-local variable x:

Code sequence Relocation Symbol
ld 9,x@got@tprel(2) R_PPC64_GOT_TPREL16_DS x
add 9,9,x@tls R_PPC64_TLS x

The register 9 is arbitrary here. The linker will replace x@got@tprel
with the offset relative to the thread pointer to the generated GOT
entry for symbol x. It will replace x@tls with the thread-pointer
register (13).

The two test cases verify correct assembly output and relocation output
as just described.

PowerPC-specific selection node variants are added for the two
instructions above: LD_GOT_TPREL and ADD_TLS. These are inserted
when an initial-exec global variable is encountered by
PPCTargetLowering::LowerGlobalTLSAddress(), and later lowered to
machine instructions LDgotTPREL and ADD8TLS. LDgotTPREL is a pseudo
that uses the same LDrs support added for medium code model's LDtocL,
with a different relocation type.

The rest of the processing is straightforward.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
34a9d4b3b9b7858b729a1af67afa721c048fe5e7 27-Nov-2012 Bill Schmidt <wschmidt@linux.vnet.ibm.com> This patch implements medium code model support for 64-bit PowerPC.

The default for 64-bit PowerPC is small code model, in which TOC entries
must be addressable using a 16-bit offset from the TOC pointer. Additionally,
only TOC entries are addressed via the TOC pointer.

With medium code model, TOC entries and data sections can all be addressed
via the TOC pointer using a 32-bit offset. Cooperation with the linker
allows 16-bit offsets to be used when these are sufficient, reducing the
number of extra instructions that need to be executed. Medium code model
also does not generate explicit TOC entries in ".section toc" for variables
that are wholly internal to the compilation unit.

Consider a load of an external 4-byte integer. With small code model, the
compiler generates:

ld 3, .LC1@toc(2)
lwz 4, 0(3)

.section .toc,"aw",@progbits
.LC1:
.tc ei[TC],ei

With medium model, it instead generates:

addis 3, 2, .LC1@toc@ha
ld 3, .LC1@toc@l(3)
lwz 4, 0(3)

.section .toc,"aw",@progbits
.LC1:
.tc ei[TC],ei

Here .LC1@toc@ha is a relocation requesting the upper 16 bits of the
32-bit offset of ei's TOC entry from the TOC base pointer. Similarly,
.LC1@toc@l is a relocation requesting the lower 16 bits. Note that if
the linker determines that ei's TOC entry is within a 16-bit offset of
the TOC base pointer, it will replace the "addis" with a "nop", and
replace the "ld" with the identical "ld" instruction from the small
code model example.

Consider next a load of a function-scope static integer. For small code
model, the compiler generates:

ld 3, .LC1@toc(2)
lwz 4, 0(3)

.section .toc,"aw",@progbits
.LC1:
.tc test_fn_static.si[TC],test_fn_static.si
.type test_fn_static.si,@object
.local test_fn_static.si
.comm test_fn_static.si,4,4

For medium code model, the compiler generates:

addis 3, 2, test_fn_static.si@toc@ha
addi 3, 3, test_fn_static.si@toc@l
lwz 4, 0(3)

.type test_fn_static.si,@object
.local test_fn_static.si
.comm test_fn_static.si,4,4

Again, the linker may replace the "addis" with a "nop", calculating only
a 16-bit offset when this is sufficient.

Note that it would be more efficient for the compiler to generate:

addis 3, 2, test_fn_static.si@toc@ha
lwz 4, test_fn_static.si@toc@l(3)

The current patch does not perform this optimization yet. This will be
addressed as a peephole optimization in a later patch.

For the moment, the default code model for 64-bit PowerPC will remain the
small code model. We plan to eventually change the default to medium code
model, which matches current upstream GCC behavior. Note that the different
code models are ABI-compatible, so code compiled with different models will
be linked and execute correctly.

I've tested the regression suite and the application/benchmark test suite in
two ways: Once with the patch as submitted here, and once with additional
logic to force medium code model as the default. The tests all compile
cleanly, with one exception. The mandel-2 application test fails due to an
unrelated ABI compatibility with passing complex numbers. It just so happens
that small code model was incredibly lucky, in that temporary values in
floating-point registers held the expected values needed by the external
library routine that was called incorrectly. My current thought is to correct
the ABI problems with _Complex before making medium code model the default,
to avoid introducing this "regression."

Here are a few comments on how the patch works, since the selection code
can be difficult to follow:

The existing logic for small code model defines three pseudo-instructions:
LDtoc for most uses, LDtocJTI for jump table addresses, and LDtocCPT for
constant pool addresses. These are expanded by SelectCodeCommon(). The
pseudo-instruction approach doesn't work for medium code model, because
we need to generate two instructions when we match the same pattern.
Instead, new logic in PPCDAGToDAGISel::Select() intercepts the TOC_ENTRY
node for medium code model, and generates an ADDIStocHA followed by either
a LDtocL or an ADDItocL. These new node types correspond naturally to
the sequences described above.

The addis/ld sequence is generated for the following cases:
* Jump table addresses
* Function addresses
* External global variables
* Tentative definitions of global variables (common linkage)

The addis/addi sequence is generated for the following cases:
* Constant pool entries
* File-scope static global variables
* Function-scope static variables

Expanding to the two-instruction sequences at select time exposes the
instructions to subsequent optimization, particularly scheduling.

The rest of the processing occurs at assembly time, in
PPCAsmPrinter::EmitInstruction. Each of the instructions is converted to
a "real" PowerPC instruction. When a TOC entry needs to be created, this
is done here in the same manner as for the existing LDtoc, LDtocJTI, and
LDtocCPT pseudo-instructions (I factored out a new routine to handle this).

I had originally thought that if a TOC entry was needed for LDtocL or
ADDItocL, it would already have been generated for the previous ADDIStocHA.
However, at higher optimization levels, the ADDIStocHA may appear in a
different block, which may be assembled textually following the block
containing the LDtocL or ADDItocL. So it is necessary to include the
possibility of creating a new TOC entry for those two instructions.

Note that for LDtocL, we generate a new form of LD called LDrs. This
allows specifying the @toc@l relocation for the offset field of the LD
instruction (i.e., the offset is replaced by a SymbolLo relocation).
When the peephole optimization described above is added, we will need
to do similar things for all immediate-form load and store operations.

The seven "mcm-n.ll" test cases are kept separate because otherwise the
intermingling of various TOC entries and so forth makes the tests fragile
and hard to understand.

The above assumes use of an external assembler. For use of the
integrated assembler, new relocations are added and used by
PPCELFObjectWriter. Testing is done with "mcm-obj.ll", which tests for
proper generation of the various relocations for the same sequences
tested with the external assembler.






git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168708 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
e3904342515658a8561a53b7ef874aace47b700c 21-Nov-2012 Akira Hatanaka <ahatanaka@mips.com> Add relocations used for mips big GOT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
12cfa119600418d31ceb748d077b3e6f7057a22a 09-Nov-2012 Anton Korobeynikov <asl@math.spbu.ru> Add ARM TARGET2 relocation. The testcase will follow with actualy use-case.
Based on the patch by Logan Chien!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
4bb51cc83badd77bdc482b0594b72cb177f052f6 26-Sep-2012 Craig Topper <craig.topper@gmail.com> Rename virtual table anchors from Anchor() to anchor() for consistency with the rest of the tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
286c4dc355b8be6806081b23c3097485821c7642 12-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with
"#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"

No functional change. Update r163344.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
cc77eece74c8db09acc2af425e7e6c88a5bb30d1 06-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with "ifndef NDEBUG"

No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
9fb8b49380e7cf6ce88400ad65051e830563bc81 24-Aug-2012 Roman Divacky <rdivacky@freebsd.org> Lower constant pools and jump tables via TOC on PPC64/SVR4.

In collaboration with Adhemerval Zanella.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
b7dd9fc678ab4b4c57d333cd9940b0e0d7952ea6 21-Jul-2012 Akira Hatanaka <ahatanaka@mips.com> Add VK_Mips_HIGHER and VK_Mips_HIGHEST to MCSymbolRefExpr::VariantKind.

Test case will be added later when long branch patch is checked in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
fd42ed676e37c29364f53f848320b7cb706111e0 04-Jun-2012 Roman Divacky <rdivacky@freebsd.org> Implement local-exec TLS on PowerPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157935 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f1d0f7781e766df878bec4e7977fa3204374f394 26-Mar-2012 Craig Topper <craig.topper@gmail.com> Prune some includes and forward declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
0db1241416f2ca5fe8e81c60204025b585c45c0f 24-Feb-2012 Jim Grosbach <grosbach@apple.com> ARM Thumb symbol references in assembly need the low bit set.

Add support for a missed case when the symbols in a difference
expression are in the same section but not the same fragment.

rdar://10924681

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d4a19b6a72d19a6f90b676aac37118664b7b7a84 11-Feb-2012 Anton Korobeynikov <asl@math.spbu.ru> Add support for implicit TLS model used with MS VC runtime.
Patch by Kai Nacke!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
858143816d43e58b17bfd11cb1b57afbd7f0f893 07-Feb-2012 Craig Topper <craig.topper@gmail.com> Convert assert(0) to llvm_unreachable

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
34982576a43887e7f062ed0a3571af2cbab003f3 26-Jan-2012 James Molloy <james.molloy@arm.com> Add support for the R_ARM_TARGET1 relocation, which should be given to relocations applied to all C++ constructors and destructors.

This enables the linker to match concrete relocation types (absolute or relative) with whatever library or C++ support code is being linked against.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
732f05c41f177a0bc4d47e93a5d02120f146cb4c 10-Jan-2012 Chandler Carruth <chandlerc@gmail.com> Add 'llvm_unreachable' to passify GCC's understanding of the constraints
of several newly un-defaulted switches. This also helps optimizers
(including LLVM's) recognize that every case is covered, and we should
assume as much.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
2bd335470f8939782f3df7f6180282d3825d4f09 10-Jan-2012 David Blaikie <dblaikie@gmail.com> Remove unnecessary default cases in switches that cover all enum values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
bc24985c5ff01fc25336896c388bd8e4e02ffd95 22-Dec-2011 Akira Hatanaka <ahatanaka@mips.com> Local dynamic TLS model for direct object output. Create the correct TLS MIPS
ELF relocations.

Patch by Jack Carter.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
00e1fa499d73d4674e50de313199877512caaf10 15-Nov-2011 Akira Hatanaka <ahatanaka@mips.com> Remove function printMipsSymbolRef.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
3507d24547ce668c9a50c72b6748c0a303e295c1 25-Oct-2011 Bruno Cardoso Lopes <bruno.cardoso@gmail.com> This is the first of several patches for Mips direct object generation.
This first patch is for expression variable kinds.

Patch by Jack Carter!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142934 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
78c10eeaa57d1c6c4b7781d3c0bcb0cfbbc43b5c 26-Jul-2011 Evan Cheng <evan.cheng@apple.com> Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to createMCAsmBackend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
a7cfc08ebe737062917b442830eb5321b0f79e89 23-Jul-2011 Evan Cheng <evan.cheng@apple.com> Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135833 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
a1000742d28f33dd8dd9858e64282e7749c0bd64 09-Jun-2011 Roman Divacky <rdivacky@freebsd.org> Fix emission of PPC64 assembler on non-darwin platforms by splitting
VK_PPC_{HA,LO}16 into darwin and gas variants.

Darwin wants {ha,lo}16(symbol) while gnu as wants symbol@{ha,l}.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
0eab5c4d85b4c4bb161bcdd959aa58a6f54415cc 29-Apr-2011 Daniel Dunbar <daniel@zuster.org> MCExpr: Add FindAssociatedSection, which attempts to mirror the 'as' semantics
that associate sections with expressions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
7a2bdde0a0eebcd2125055e0eacaca040f0b766c 15-Apr-2011 Chris Lattner <sabre@nondot.org> Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
ce3a1bac4bb3168b4862e4b674800dd6922267ac 22-Mar-2011 Owen Anderson <resistor@mac.com> Add support for Thumb interworking addresses for symbol offsets that get constant folded very early.
This fixes SPASS with -integrated-as. <rdar://problem/9165399>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
54104db434d400e07cc238c9ac47c5e34e01cb20 23-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Add support for lowercase variants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
7597212abced110723f2fee985a7d60557c092ec 13-Jan-2011 Evan Cheng <evan.cheng@apple.com> Model :upper16: and :lower16: as ARM specific MCTargetExpr. This is a step
in the right direction. It eliminated some hacks and will unblock codegen
work. But it's far from being done. It doesn't reject illegal expressions,
e.g. (FOO - :lower16:BAR). It also doesn't work in Thumb2 mode at all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
10b6d33581400ec1a0c09f7719ccc3dc1903c27d 22-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Add r122359 back now that the bug in MCDwarfLineAddrFragment fragment has been
fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
bf57b838b8548ae581739cdc3dfbf4e23beb45df 22-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Revert r122359 while I debug PR8845.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
33a38a1b5a35acd15c867193bc2175f3d4e7b83d 22-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Use references and simplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
64b441219671d80dc42859ef37d30727591a5e2d 21-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Simplify EvaluateAsAbsolute now that EvaluateAsRelocatableImpl does all
the folding it can.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
c5b0e44acaaf9e80ad2334bb4b25153ecbea5967 19-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Fixed version of 122160 (the previous one would fold undefined symbols).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
af0e6ce80f7b7b7f6d9a63897267961794ac607d 19-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Revert 122160 while I debug it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f399d9d37be35a965934265bebdc46a799f61a4a 19-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Move all folding to AttemptToFoldSymbolOffsetDifference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122160 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
3132780a2ed58945b0ec5033002be44bedb6b785 18-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
1ec5bd31fe491e610839ea448bd99fd171785837 18-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Remove the MCObjectFormat class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
3f037ef2f52769e0ee9b038177242611fe19d547 18-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Add a FIXME and explain a hack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f705a7ed27eba0e0b33fab43c7f7ee27110ee23b 18-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Fix the note.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d076482ab7e672d1d65a43809695e8d0d3995203 18-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Revert 122011, 122012, 122013, 122023 adding back an important optimization.
I added a note, but suggestions on how to add a test are really welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
17304b3489b7b8ea06dd4df237f15a381ae181ce 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC/Expr: Implemnt more aggressive folding during symbol evaluation using
IsSymbolRefDifferenceFullyResolved(). For example, we will now fold away
something like:
--
_a:
...
L0:
...
L1:
...
.long (L1 - L0) / 2
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
8f714fedba35bc454ff372f084090f14a25c8933 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC/Expr: Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
2d8e3e741f49baadfc72403de9c4b362a07af8d9 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC: Remove another dead MCAssembler argument, and update clients.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
92c66c7bf9533d0ab7cece9532c5060e7d3db6ca 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC: Remove dead MCAssembler argument -- Rafael, can you check the FIXME I added
here?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122012 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
204e3b65eba7f8205a4160865224ffb0a471cd97 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC: Simplify (remove unnecessary MCAssembler argument, obsoleted by containment
in MCAsmLayout).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
cdf94e8592efbab4244a98f7b6678f13c795a7ed 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> Write => in a more normal form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f2ed62d6bfe0693dbcb114b619a08fa9b397a422 17-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC/Expr: Simplify (and add a FIXME).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122008 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
dd18e28c6247469e93a27afaedd846105d9327ea 16-Dec-2010 Daniel Dunbar <daniel@zuster.org> MC/Expr: Add a doxyment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
85f2ecc697a8ca6c8cf08093054cbbb9d2060ccf 07-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Sorry for such a large commit. The summary is that only MachO cares about the
actuall addresses in a .o file, so it is better to let the MachO writer compute
it.

This is good for two reasons. First, areas that shouldn't care about
addresses now don't have access to it. Second, the layout of each section
is independent. I should use this in a subsequent commit to speed it up.

Most of the patch is just removing the section address computation. The two
interesting parts are the change on how we handle padding in the end
of sections and how MachO can get the address of a-b when a and b are in
different sections.

Since now the expression evaluation normally doesn't know the section address,
it will think that a-b needs relocation and let the MachO writer know. Once
it has computed the section addresses, it calls back the expression evaluation
with the section addresses to resolve these expressions.

The remaining problem is the handling of padding. Currently it will create
a special alignment fragment at the end. Since that fragment doesn't update
the alignment of the section, it needs the real address to be computed.

Since now the layout will not compute a-b with a and b in different sections,
the only effect that the special alignment fragment has is update the
address size of the section. This can also be done by the MachO writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
22373b230a053a154f6c7792c6a33d4f78f5479d 06-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Use references to simplify the code a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121050 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f3faf92636a7da01d3cfff1e969988b5fff795eb 06-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Simplify a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
32a006e606742b1c5401e49607e33717bb5441f0 03-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Try to resolve symbol differences early, and if successful create a plain
data fragment. This reduces the time to assemble the test in 8711 from 60s to
54s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
76507f14edbfa7729775ee73173de735aa2f4781 02-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Add a fast path to EvaluateSymbolicAdd. This avoids computing symbol addresses
which then avoids running EnsureValid.
This cuts the assembly time of the testcase in PR8711 from 2:50 minutes to 1
minute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
4d08863108cdf020e64377fe69eb082c140721af 17-Nov-2010 Jim Grosbach <grosbach@apple.com> Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
94ed5fca3f5ab5acb74e70b8393b837131e7110c 15-Nov-2010 Rafael Espindola <rafael.espindola@gmail.com> Change MCExpr::EvaluateAsRelocatableImpl of variables to return the original
variable if recursing fails to simplify it.

Factor AliasedSymbol to be a method of MCSymbol.

Update MCAssembler::EvaluateFixup to match the change in
EvaluateAsRelocatableImpl.

Remove the WeakRefExpr hack, as the object writer now sees the weakref with
no extra effort needed.

Nothing else is using MCTargetExpr, but keep it for now.

Now that the ELF writer sees relocations with aliases, handle

.weak foo2
foo2:
.weak bar2
.set bar2,foo2
.quad bar2

the same way gas does and produce a relocation with bar2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
1e61e69d401045c54b15815f15a0fdb3ca56a9b5 15-Nov-2010 Chris Lattner <sabre@nondot.org> add targetoperand flags for jump tables, constant pool and block address
nodes to indicate when ha16/lo16 modifiers should be used. This lets
us pass PowerPC/indirectbr.ll.

The one annoying thing about this patch is that the MCSymbolExpr isn't
expressive enough to represent ha16(label1-label2) which we need on
PowerPC. I have a terrible hack in the meantime, but this will have
to be revisited at some point.

Last major conversion item left is global variable references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
6135a96792ca05f6366e5dbaee6208e84589c47f 14-Nov-2010 Chris Lattner <sabre@nondot.org> reimplement ppc asmprinter "toc" handling to use a VariantKind
on the operand, required for .o file writing and fixing
the PowerPC/mult-alt-generic-powerpc64.ll failure with the new
instprinter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
2c4d5125c708bb35140fc2a40b02beb1add101db 10-Nov-2010 Jim Grosbach <grosbach@apple.com> Update ARMConstantPoolValue to not use a modifier string. Use an explicit
VariantKind marker to indicate the additional information necessary. Update
MC to handle the new Kinds. rdar://8647623



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118671 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
b4d1721eff7b43577e5f2e53f885973fb6c43683 28-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Implement TLSLD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
0cf15d61b7e3bf53f5a99f58ada37b93bc039559 28-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Implement DTPOFF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
a264f72d3fb9dec1427480fcf17ef3c746ea723a 28-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Implement TLSLDM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
a0a2f8734cdfc19d44201b791a969bcdda96bb70 28-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Implement VK_GOTNTPOFF and switch RelocNeedsGOT to use VariantKind.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
8c8bc05a383890ab29b288625c746bf24240e9a1 21-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Do not recurse into symbol refs that have a variant kind. This prevents us
from losing the variant when producing a relocation on an alias.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f230df9af4012f9510de664b6d62b128e26a5861 16-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Add a MCObjectFormat class so that code common to all targets that use a
single object format can be shared.

This also adds support for

mov zed+(bar-foo), %eax

on ELF and COFF targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
b5a3ec17a4600b0e99bd0f4578e7639cfe46ba5a 30-Sep-2010 Kevin Enderby <enderby@apple.com> Changes EvaluateAsAbsolute() to return the "current value" of the expression
if we are given a Layout object, even in cases when the value is not fixed.
This will be needed by the final patch for the dwarf .loc support to size a
new MCDwarf fragment needed to build and emit dwarf line number tables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115155 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
637d89fe0eca4fa2b9c95f6c15eb69a99bae83bc 23-Sep-2010 Jim Grosbach <grosbach@apple.com> Add support for ELF PLT references for ARM MC asm printing. Adding a
new VariantKind to the MCSymbolExpr seems like overkill, but I'm not sure
there's a more straightforward way to get the printing difference captured.
(i.e., x86 uses @PLT, ARM uses (PLT)).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
3472766f9eb7d66f234c390ce1b3a8b76f0ee9ce 12-Jul-2010 Duncan Sands <baldrick@free.fr> Convert some tab stops into spaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108130 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
96ac5156cadde7e4494990d5b4f873e76787a370 26-May-2010 Eric Christopher <echristo@apple.com> Start adding mach-o tls reloc support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
18c1021ec108722506125926087b1e5fcfb28046 12-May-2010 Rafael Espindola <rafael.espindola@gmail.com> Add support for movi32 of global values to the new (MC) asm printer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103576 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
08a408a4b3224627db07eb27e174085d8e1d2426 05-May-2010 Daniel Dunbar <daniel@zuster.org> MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
9b97a73dedf736e14b04a3d1a153f10d25b2507b 30-Mar-2010 Chris Lattner <sabre@nondot.org> Rip out the 'is temporary' nonsense from the MCContext interface to
create symbols. It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.

This fixes rdar://7807601.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
e9cfd685f5916a45e7cd36e51191cec16b02189d 25-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Fix refacto in MCExpr evaluation, I mistakenly replaced a fragment address with a symbol address.
- This fixes the integrated-as nightly test regressions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
207e06ea0446c51cb1d89f6400ec7becc46487f8 24-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Direct all {fragment,section,symbol} address access through the MCAsmLayout object.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
ff54784683591b2cdbdc18690aeac12c8d87f97b 24-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Sprinkle in some more interesting statistics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99350 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
ef6e96f91fd812ba9ead6fdef3975abb1139c123 24-Mar-2010 Daniel Dunbar <daniel@zuster.org> llvm-mc: Fast path EvaluateAbsolute of constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
9a1d20042f6a6ec648a3588f9b13264a4570aab0 18-Mar-2010 Daniel Dunbar <daniel@zuster.org> MCValue: Change to holding MCSymbolRefExprs instead of MCSymbols, we will need this for accessing to symbol modifiers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
4e815f8a8cae6c846cdca52420046cab902865de 16-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Allow modifiers in MCSymbolRefExpr, and eliminate X86MCTargetExpr.
- Although it would be nice to allow this decoupling, the assembler needs to be able to reason about MCSymbolRefExprs in too many places to make this viable. We can use a target specific encoding of the variant if this becomes an issue.
- This patch also extends llvm-mc to support parsing of the modifiers, as opposed to lumping them in with the symbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d3da36286f9ffe6951abec67b82837e432c858cf 14-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Fix a crash on invalid, attempting to evaluate undefined symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
a0e36d55c495b3325805c659ac365b5faea84e34 12-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
979ba5b3c7c818b826d06298ee7f79c4234faedb 11-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC/Mach-O: Implement "absolutizing" semantics of .set, by evaluating the assembly time value of variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
f82f4490b130eca55b08d605456a4ceacccf288a 11-Mar-2010 Daniel Dunbar <daniel@zuster.org> MC: Sketch initial MCAsmLayout class, which encapsulates the current layout of an assembly file. The MCAsmLayout is also available for use by MCExpr::EvaluateAs{Absolute,Relocatable}, to allow target specific hooks and "absolutizing" of symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98227 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
98cdab53c302a2d6686fa428c0e896b1fb195311 10-Mar-2010 Chris Lattner <sabre@nondot.org> set the temporary bit on MCSymbols correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98124 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
036c130e90eb5c93b0dc0a70ad07b9343623c2a8 09-Feb-2010 Dan Gohman <gohman@apple.com> Document that MCExpr::Mod is actually remainder.

Document that MCExpr::Div, Mod, and the comparison operators are all
signed operators.

Document that the comparison operators' results are target-dependent.

Document that the behavior of shr is target-dependent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
df9c4380ee7e60c1de5cae32685b113170b1faa2 08-Feb-2010 Chris Lattner <sabre@nondot.org> don't make hte dtor private or we can't construct the class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95587 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
5d917a8952c09a345180ec36f0df4ee5dd5eddea 08-Feb-2010 Chris Lattner <sabre@nondot.org> add scaffolding for target-specific MCExprs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
8cb9a3b13f3226b7e741768b69d26ecd6b5231f1 18-Jan-2010 Chris Lattner <sabre@nondot.org> remove the MAI argument to MCExpr::print and switch overthing to use << when printing them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
10b318bcb39218d2ed525e4862c854bc8d1baf63 17-Jan-2010 Chris Lattner <sabre@nondot.org> now that MCSymbol::print doesn't use it's MAI argument, we can
remove it and change all the code that prints MCSymbols to use
<< instead, which is much simpler and cleaner.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
5d2bcb18f6cc22cda5849a10cd198c8842f163ea 05-Jan-2010 David Greene <greened@obbligato.org> Change errs() to dbgs().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
2928c83b010f7cfdb0f819199d806f6942a7d995 06-Nov-2009 Daniel Dunbar <daniel@zuster.org> Pass StringRef by value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
e00b011e6a2597fcc3da88da91a8ffda6eebfcda 16-Oct-2009 Daniel Dunbar <daniel@zuster.org> MC: Remove unneeded context argument to MCExpr::Evaluate*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
7c3600de949347bf5ea6369b2546fac15bd96415 16-Oct-2009 Daniel Dunbar <daniel@zuster.org> MC: Move assembler variable values from MCContext to MCSymbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
e579849652f2ba062e6c91a3af4d9a3843411b44 16-Oct-2009 Daniel Dunbar <daniel@zuster.org> MC: Switch MCContext value table to storing MCExprs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84228 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
4f3e7aa154577c86791908e73a9fec075fdea0ba 16-Sep-2009 Chris Lattner <sabre@nondot.org> add a helper method for creating MCSymbol and MCSymbolRefExpr at
the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d50c2b90647cd34092a106a7124529784b133cee 09-Sep-2009 Chris Lattner <sabre@nondot.org> parenthesize symbol names that start with $, fixing X86/dollar-name.ll with
the new asmprinter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
d19ceb9b122e120009a67231e89903ec2205cf1d 08-Sep-2009 Chris Lattner <sabre@nondot.org> Print "X-42" instead of "X+-42".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
be73e8c4e7ca3dcec4aadef237d8e1779e0836fc 08-Sep-2009 Chris Lattner <sabre@nondot.org> make formatting of expressions more closely match the existing asmprinter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81202 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
8b4ada248a0fa7f6b464a049e7351497bc883b91 08-Sep-2009 Chris Lattner <sabre@nondot.org> tidy whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81201 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
684c593d05db0bd277268fc9d8c05bce138c745a 03-Sep-2009 Chris Lattner <sabre@nondot.org> Thread an MCAsmInfo pointer through the various MC printing APIs,
and fix a few things using << on MCSymbols to use ->print(). No
functionality change other than unbreaking my previous patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
87392fde1f261fea161b48886fafbedddb18dcce 31-Aug-2009 Daniel Dunbar <daniel@zuster.org> llvm-mc: Add MCExpr::{dump,print}.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
9643ac55142d40da404caa8e5fedfef2cd7b4afc 31-Aug-2009 Daniel Dunbar <daniel@zuster.org> llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp
28c251b54b0b311749f07babe0f6909e71e877bc 31-Aug-2009 Daniel Dunbar <daniel@zuster.org> llvm-mc: Move AsmExpr into MC lib (as MCExpr).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/MC/MCExpr.cpp