Commit Graph

92 Commits

Author SHA1 Message Date
Roman Divacky
fd42ed676e Implement local-exec TLS on PowerPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157935 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04 17:36:38 +00:00
Craig Topper
f1d0f7781e Prune some includes and forward declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153429 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 06:58:25 +00:00
Jim Grosbach
0db1241416 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
2012-02-24 05:12:18 +00:00
Anton Korobeynikov
d4a19b6a72 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
2012-02-11 17:26:53 +00:00
Craig Topper
858143816d Convert assert(0) to llvm_unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-07 05:05:23 +00:00
James Molloy
34982576a4 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
2012-01-26 09:25:43 +00:00
Chandler Carruth
732f05c41f 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
2012-01-10 18:08:01 +00:00
David Blaikie
2bd335470f 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
2012-01-10 16:47:17 +00:00
Akira Hatanaka
bc24985c5f 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
2011-12-22 01:05:17 +00:00
Akira Hatanaka
00e1fa499d Remove function printMipsSymbolRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144663 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-15 18:38:35 +00:00
Bruno Cardoso Lopes
3507d24547 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
2011-10-25 18:13:20 +00:00
Evan Cheng
78c10eeaa5 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
2011-07-25 23:24:55 +00:00
Evan Cheng
a7cfc08ebe 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
2011-07-23 00:45:41 +00:00
Roman Divacky
a1000742d2 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
2011-06-09 20:25:38 +00:00
Daniel Dunbar
0eab5c4d85 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
2011-04-29 18:00:03 +00:00
Chris Lattner
7a2bdde0a0 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
2011-04-15 05:18:47 +00:00
Owen Anderson
ce3a1bac4b 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
2011-03-21 23:13:43 +00:00
Rafael Espindola
54104db434 Add support for lowercase variants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124071 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 16:11:25 +00:00
Evan Cheng
7597212abc 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
2011-01-13 07:58:56 +00:00
Rafael Espindola
10b6d33581 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
2010-12-22 22:16:24 +00:00
Rafael Espindola
bf57b838b8 Revert r122359 while I debug PR8845.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 19:05:49 +00:00
Rafael Espindola
33a38a1b5a Use references and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22 16:11:57 +00:00
Rafael Espindola
64b4412196 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
2010-12-21 20:51:42 +00:00
Rafael Espindola
c5b0e44aca 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
2010-12-19 04:18:56 +00:00
Rafael Espindola
af0e6ce80f Revert 122160 while I debug it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122165 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 03:22:05 +00:00
Rafael Espindola
f399d9d37b Move all folding to AttemptToFoldSymbolOffsetDifference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 02:15:04 +00:00
Rafael Espindola
3132780a2e Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 06:27:54 +00:00
Rafael Espindola
1ec5bd31fe Remove the MCObjectFormat class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 05:37:28 +00:00
Rafael Espindola
3f037ef2f5 Add a FIXME and explain a hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:19:20 +00:00
Rafael Espindola
f705a7ed27 Fix the note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:01:45 +00:00
Rafael Espindola
d076482ab7 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
2010-12-18 03:57:21 +00:00
Daniel Dunbar
17304b3489 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
2010-12-17 05:50:33 +00:00
Daniel Dunbar
8f714fedba MC/Expr: Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 02:05:45 +00:00
Daniel Dunbar
2d8e3e741f 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
2010-12-17 01:07:35 +00:00
Daniel Dunbar
92c66c7bf9 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
2010-12-17 01:07:31 +00:00
Daniel Dunbar
204e3b65eb 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
2010-12-17 01:07:28 +00:00
Daniel Dunbar
cdf94e8592 Write => in a more normal form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122009 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:07:22 +00:00
Daniel Dunbar
f2ed62d6bf MC/Expr: Simplify (and add a FIXME).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122008 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 01:07:20 +00:00
Daniel Dunbar
dd18e28c62 MC/Expr: Add a doxyment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 18:36:25 +00:00
Rafael Espindola
85f2ecc697 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
2010-12-07 00:27:36 +00:00
Rafael Espindola
22373b230a 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
2010-12-06 22:30:54 +00:00
Rafael Espindola
f3faf92636 Simplify a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120980 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 03:36:43 +00:00
Rafael Espindola
32a006e606 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
2010-12-03 00:55:40 +00:00
Rafael Espindola
76507f14ed 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
2010-12-02 07:53:12 +00:00
Jim Grosbach
4d08863108 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 19:30:11 +00:00
Rafael Espindola
94ed5fca3f 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
2010-11-15 16:33:49 +00:00
Chris Lattner
1e61e69d40 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
2010-11-15 02:46:57 +00:00
Chris Lattner
6135a96792 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
2010-11-14 22:22:59 +00:00
Jim Grosbach
2c4d5125c7 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
2010-11-10 03:26:07 +00:00
Rafael Espindola
b4d1721eff Implement TLSLD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 15:02:40 +00:00