Commit Graph

38 Commits

Author SHA1 Message Date
Rafael Espindola
f230df9af4 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
2010-10-16 18:23:53 +00:00
Kevin Enderby
b5a3ec17a4 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
2010-09-30 16:42:21 +00:00
Jim Grosbach
637d89fe0e 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
2010-09-22 23:27:36 +00:00
Duncan Sands
3472766f9e Convert some tab stops into spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 08:16:59 +00:00
Eric Christopher
96ac5156ca Start adding mach-o tls reloc support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 00:02:12 +00:00
Rafael Espindola
18c1021ec1 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
2010-05-12 05:16:34 +00:00
Daniel Dunbar
08a408a4b3 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
2010-05-05 17:41:00 +00:00
Chris Lattner
9b97a73ded 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
2010-03-30 18:10:53 +00:00
Daniel Dunbar
e9cfd685f5 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
2010-03-25 01:03:17 +00:00
Daniel Dunbar
207e06ea04 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
2010-03-24 03:43:40 +00:00
Daniel Dunbar
ff54784683 MC: Sprinkle in some more interesting statistics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99350 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 23:47:14 +00:00
Daniel Dunbar
ef6e96f91f llvm-mc: Fast path EvaluateAbsolute of constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99348 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 23:47:07 +00:00
Daniel Dunbar
9a1d20042f 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
2010-03-18 00:59:10 +00:00
Daniel Dunbar
4e815f8a8c 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
2010-03-15 23:51:06 +00:00
Daniel Dunbar
d3da36286f 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
2010-03-14 03:10:40 +00:00
Daniel Dunbar
a0e36d55c4 MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:00:45 +00:00
Daniel Dunbar
979ba5b3c7 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
2010-03-11 05:53:37 +00:00
Daniel Dunbar
f82f4490b1 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
2010-03-11 02:28:59 +00:00
Chris Lattner
98cdab53c3 set the temporary bit on MCSymbols correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 02:25:11 +00:00
Dan Gohman
036c130e90 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
2010-02-08 23:58:47 +00:00
Chris Lattner
df9c4380ee 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
2010-02-08 22:07:36 +00:00
Chris Lattner
5d917a8952 add scaffolding for target-specific MCExprs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 19:41:07 +00:00
Chris Lattner
8cb9a3b13f 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
2010-01-18 00:37:40 +00:00
Chris Lattner
10b318bcb3 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
2010-01-17 21:43:43 +00:00
David Greene
5d2bcb18f6 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92630 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:28:07 +00:00
Daniel Dunbar
2928c83b01 Pass StringRef by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 10:58:06 +00:00
Daniel Dunbar
e00b011e6a 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
2009-10-16 01:57:52 +00:00
Daniel Dunbar
7c3600de94 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
2009-10-16 01:33:57 +00:00
Daniel Dunbar
e579849652 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
2009-10-16 01:33:11 +00:00
Chris Lattner
4f3e7aa154 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
2009-09-16 01:26:31 +00:00
Chris Lattner
d50c2b9064 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
2009-09-08 23:20:50 +00:00
Chris Lattner
d19ceb9b12 Print "X-42" instead of "X+-42".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 06:37:35 +00:00
Chris Lattner
be73e8c4e7 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
2009-09-08 06:34:07 +00:00
Chris Lattner
8b4ada248a tidy whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81201 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 06:27:48 +00:00
Chris Lattner
684c593d05 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
2009-09-03 05:46:51 +00:00
Daniel Dunbar
87392fde1f llvm-mc: Add MCExpr::{dump,print}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:07:33 +00:00
Daniel Dunbar
9643ac5514 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
2009-08-31 08:07:22 +00:00
Daniel Dunbar
28c251b54b 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
2009-08-31 08:06:59 +00:00