1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

514 Commits

Author SHA1 Message Date
David Majnemer
8a584b6eee MC: Cleanup parseMSInlineAsm
Utilize range based for-loops to simplify some code.
Use insert() instead of a loop for simplicity/efficiency.

No functionality change.

llvm-svn: 211486
2014-06-23 02:17:16 +00:00
Oliver Stannard
9efd6f7301 Emit DWARF info for all code section in an assembly file
Currently, when using llvm as an assembler, DWARF debug information is only
generated for the .text section. This patch modifies this so that DWARF info
is emitted for all executable sections.

llvm-svn: 211273
2014-06-19 15:52:37 +00:00
David Majnemer
72f8cc0df8 MS asm: Properly handle quoted symbol names
We would get confused by '@' characters in symbol names, we would
mistake the text following them for the variant kind.

When an identifier a string, the variant kind will never show up inside
of it.  Instead, check to see if there is a variant following the
string.

This fixes PR19965.

llvm-svn: 211249
2014-06-19 01:25:43 +00:00
Saleem Abdulrasool
b0792da80c MCAsmParser: full support for gas' '.if{cond} expression' directives
Patch by Janne Grunau!

llvm-svn: 211218
2014-06-18 20:57:28 +00:00
David Blaikie
f670b953e7 AsmMatchers: Use unique_ptr to manage ownership of MCParsedAsmOperand
I saw at least a memory leak or two from inspection (on probably
untested error paths) and r206991, which was the original inspiration
for this change.

I ran this idea by Jim Grosbach a few weeks ago & he was OK with it.
Since it's a basically mechanical patch that seemed sufficient - usual
post-commit review, revert, etc, as needed.

llvm-svn: 210427
2014-06-08 16:18:35 +00:00
Saleem Abdulrasool
e9a4c52f90 MC: initialise MCAsmParser variable
Properly initialise HadError to false during construction.  Detected as
use-of-uninitialised variable by MSan!

llvm-svn: 209393
2014-05-22 06:02:59 +00:00
Saleem Abdulrasool
d04ccc546a MC: loosen an overzealous assertion
Permit active macro expansions when terminating the assembler if there were
errors during the expansion.  This would only trigger on invalid input when
built with assertions.

llvm-svn: 209309
2014-05-21 17:53:18 +00:00
Benjamin Kramer
4f8fb8ff6c raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary.
llvm-svn: 207593
2014-04-29 23:26:49 +00:00
Craig Topper
c7c3a99ec2 [C++] Use 'nullptr'.
llvm-svn: 207083
2014-04-24 06:44:33 +00:00
Stepan Dyatkovskiy
70097dbad7 Integrated assbemler, macros: added 'vararg' argument qualifier support.
Note, currently we have no 'vararg' support for darwin macros.

llvm-svn: 206951
2014-04-23 06:56:28 +00:00
Kevin Enderby
223e66dc63 Fix the assembler to print a better relocatable expression error
diagnostic that includes location information.

Currently if one has this assembly:

	.quad (0x1234 + (4 * SOME_VALUE))

where SOME_VALUE is undefined ones gets the less than
useful error message with no location information:

% clang -c x.s
clang -cc1as: fatal error: error in backend: expected relocatable expression

With this fix one now gets a more useful error message
with location information:

% clang -c x.s 
x.s:5:8: error: expected relocatable expression
 .quad (0x1234 + (4 * SOME_VALUE))
       ^

To do this I plumbed the SMLoc through the MCObjectStreamer
EmitValue() and EmitValueImpl() interfaces so it could be used
when creating the MCFixup.

rdar://12391022

llvm-svn: 206906
2014-04-22 17:27:29 +00:00
David Blaikie
ad8a56c803 DebugInfo: Emit relocation to debug_line section when emitting asm for asm
I don't think this is reachable by any frontend (why would you transform
asm to asm+debug info?) but it helps tidy up some of this code, avoid
the weird special case of "emit the first CU, store the label, then emit
the rest" in MCDwarfLineTable::Emit by instead having the
DWARF-for-assembly case use the same codepath as DwarfDebug.cpp, by
registering the label of the debug_line section, thus causing it to be
emitted. (with a special case in asm output to just emit the label since
asm output uses the .loc directives, etc, rather than the debug_loc
directly)

llvm-svn: 205286
2014-04-01 07:35:52 +00:00
Arnaud A. de Grandmaison
c417a5d328 Remove some dead assignements found by scan-build
llvm-svn: 204526
2014-03-21 21:54:46 +00:00
Saleem Abdulrasool
554ff1e062 MCParser: add an assertion
Add an assertion that the section is not NULL.  Potential NULL pointer
dereference identified by clang static analyzer.

llvm-svn: 204429
2014-03-21 05:13:23 +00:00
Saleem Abdulrasool
8e877674bc MC: change runtime check to an assertion
It is unclear how it would be possible to get M to be NULL in normal scenarios.
Change this to an assert rather than a runtime check as per dblakie's
suggestion.

llvm-svn: 204060
2014-03-17 17:13:57 +00:00
David Blaikie
616f0545ea DebugInfo: Improve reuse of file table entries in asm debug info
The previous deduping strategy was woefully inadequate - it only
considered the most recent file used and avoided emitting a duplicate in
that case - never considering the a/b/a scenario.

It was also lacking when it came to directory paths as the previous
filename would never match the current if the filename had been split
into file and directory components.

This change builds caching functionality into the line table at the
lowest level in an optional form (a file number of 0 indicates that one
should be chosen and returned) and will eventually be reused by the
normal source level debugging DWARF emission.

llvm-svn: 204027
2014-03-17 01:52:11 +00:00
David Blaikie
299af813bb MCDwarf: Simplify MCDwarfFile to just use std::string instead of cunning use of MCContext's allocator.
There aren't /that/ many files, and we are already using various maps
and other standard containers that don't use MCContext's allocator to
store these values, so this doesn't seem to be critical and simplifies
the design (I'll be moving construction out of MCContext shortly so it'd
be annoying to have to pass the allocator around to allocate these
things... and we'll have non-MCContext users (debug_line.dwo) shortly)

llvm-svn: 203831
2014-03-13 18:55:04 +00:00
David Blaikie
8bf964c3db MCDwarf: Simply MCDwarfFile since it really is just a StringRef and unsigned.
llvm-svn: 203827
2014-03-13 18:21:24 +00:00
Rafael Espindola
28e86f1f9b Use printable names to implement directional labels.
This changes the implementation of local directional labels to use a dedicated
map. With that it can then just use CreateTempSymbol, which is what the rest
of MC uses.

CreateTempSymbol doesn't do a great job at making sure the names are unique
(or being efficient when the names are not needed), but that should probably
be fixed in a followup patch.

This fixes pr18928.

llvm-svn: 203826
2014-03-13 18:09:26 +00:00
Saleem Abdulrasool
a9a6d219ad MC: fix silly typo
llvm-svn: 203763
2014-03-13 07:02:46 +00:00
Saleem Abdulrasool
0e0167f8c3 MC: fix possible NULL pointer dereference
Avoid NULL pointer scenario found via clang's static analyzer.

llvm-svn: 203745
2014-03-13 02:09:51 +00:00
Craig Topper
abf457f661 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203342
2014-03-08 07:14:16 +00:00
Ted Kremenek
e5420af592 Remove unreachable 'return true' always dominated by 'return Error' or 'return false'.
llvm-svn: 203171
2014-03-06 22:13:17 +00:00
Reid Kleckner
7c6162d18a MS asm: The initial dot in struct access is optional
Fixes PR18994.

Tests, once again, in that other repository.  =P

llvm-svn: 203146
2014-03-06 19:19:12 +00:00
Saleem Abdulrasool
e129b591f0 Asm Parser: support .error directive
The .error directive is similar to .err in that it will halt assembly if it is
evaluated for assembly.  However, it permits a user supplied message to be
rendered.

llvm-svn: 201999
2014-02-23 23:02:23 +00:00
Saleem Abdulrasool
72c71c83fc AsmParser: support .ifeqs directive
The .ifeqs directive assembles the following code if the quoted string
parameters are equal.  The strings must be quoted using double quotes.

llvm-svn: 201998
2014-02-23 23:02:18 +00:00
Saleem Abdulrasool
d5860dd600 MCAsmParser: support .ifne
The .ifne directive assembles the following section of code if the argument
expression is non-zero.  Effectively, it is equivalent to if.

llvm-svn: 201986
2014-02-23 15:53:41 +00:00
Saleem Abdulrasool
17ad744c96 MCAsmParser: handle space properly for .ifc/.ifnc
If the strings are not quoted, the first string stops at the first comma, and
the second string stops at the end of the line.  Strings which contain
whitespace should be quoted.  Unquoted space is to be discarded.

llvm-svn: 201985
2014-02-23 15:53:36 +00:00
Saleem Abdulrasool
e868833740 MCAsmParser: add support for .err directive
The .err directive produces an error whenever it is assembled.  This can be
useful for preventing assembly when an unexpected condition occurs.

llvm-svn: 201984
2014-02-23 15:53:30 +00:00
Sylvestre Ledru
8cdfb52e5c Remove dead declaration
llvm-svn: 201863
2014-02-21 17:58:12 +00:00
Benjamin Kramer
6492a4878f AsmParser: Disable Darwin-style macro argument expansion on non-darwin targets.
There is code in the wild that relies on $0 not being expanded.

llvm-svn: 201784
2014-02-20 13:36:32 +00:00
Saleem Abdulrasool
27ee2a5853 MCAsmParser: support required parameters
This enhances the macro parser to parse and handle parameter qualifications,
which is needed to support required formal parameters in macro definitions.  A
required parameter may not be defaulted (though providing a default value is
accepted with a warning).  This improves GAS compatibility.

Partially addresses PR9248.

llvm-svn: 201630
2014-02-19 03:00:29 +00:00
Saleem Abdulrasool
1358c09cd6 MCAsmParser: change representation of MCAsmMacroParameter
Rather than using std::pair, create a structure to represent the type.  This is
a preliminary refactoring to enable required parameter handling.  Additional
state is needed to indicate required parameters.  This has a minor side effect
of improving readability by providing more accurate names compared to first and
second.

llvm-svn: 201629
2014-02-19 03:00:23 +00:00
Anders Waldenborg
81a09cf058 Add support for assigning to . in AsmParser.
This is implemented by handling assignments to the '.' pseudo symbol
as ".org" directives.

Differential Revision: http://llvm-reviews.chandlerc.com/D2625

llvm-svn: 201530
2014-02-17 20:48:32 +00:00
Saleem Abdulrasool
31abfcc09f MCAsmParser: better handling for named arguments
Until this point only macro definition with named parameters were parsed but the
names were ignored.  This adds support for using that information for named
parameter instantiation.

In order to support the full semantics of the keyword arguments, the arguments
are no longer lazily initialised since the keyword arguments can be specified
out of order and partially if they are defaulted.  Prepopulate the arguments
with the default value for any defaulted parameters, and then parse the
specified arguments.

This simplies some of the handling of the arguments in the inner loop since
empty arguments simply increment the parameter index and move on.

Note that keyword and positional arguments cannot be mixed.

llvm-svn: 201499
2014-02-17 00:40:17 +00:00
Saleem Abdulrasool
1ab302ffd6 MCAsmParser: relax declaration parsing
The Linux kernel defines empty macros for compatibility with ARM UAL syntax.
The comma after the name is optional, and if present can be safely lexed.  This
improves compatibility with the GNU assembler.

llvm-svn: 201474
2014-02-16 04:56:31 +00:00
Benjamin Kramer
b8be18dbcc AsmParser: Simplify code with ArrayRef.
No functionality change.

llvm-svn: 201055
2014-02-09 17:13:11 +00:00
Benjamin Kramer
dd9c671cdc AsmParser: Parse (and ignore) nested .macro definitions.
This enables a slightly odd feature of gas. The macro is defined when
the outermost macro is instantiated.

PR18599

llvm-svn: 201045
2014-02-09 16:22:00 +00:00
David Peixotto
a6dfad28da Fix PR18345: ldr= pseudo instruction produces incorrect code when using in inline assembly
This patch fixes the ldr-pseudo implementation to work when used in
inline assembly.  The fix is to move arm assembler constant pools
from the ARMAsmParser class to the ARMTargetStreamer class.

Previously we kept the assembler generated constant pools in the
ARMAsmParser object. This does not work for inline assembly because
a new parser object is created for each blob of inline assembly.
This patch moves the constant pools to the ARMTargetStreamer class
so that the constant pool will remain alive for the entire code
generation process.

An ARMTargetStreamer class is now required for the arm backend.
There was no existing implementation for MachO, only Asm and ELF.
Instead of creating an empty MachO subclass, we decided to make the
ARMTargetStreamer a non-abstract class and provide default
(llvm_unreachable) implementations for the non constant-pool related
methods.

Differential Revision: http://llvm-reviews.chandlerc.com/D2638

llvm-svn: 200777
2014-02-04 17:22:40 +00:00
David Woodhouse
29e7c4248c MC: Fix .octa output for APInts with BitWidth > 128
llvm-svn: 200615
2014-02-01 16:52:33 +00:00
David Woodhouse
03ba7e20e4 MC: Add support for .octa
This is a minimal implementation which accepts only constants rather than
full expressions, but that should be perfectly sufficient for all known
users for now.

Patch from PaX Team <pageexec@freemail.hu>

llvm-svn: 200614
2014-02-01 16:20:59 +00:00
David Woodhouse
56de88752a MC: Add AsmLexer::BigNum token for integers greater than 64 bits
This will be needed for .octa support, but we don't want to just use the
existing AsmLexer::Integer for it and then have to litter all its users
with explicit checks for the size, and make them use the new get APIntVal()
method.

So let the lexer produce an AsmLexer::Integer as before for numbers which
are small enough — which appears to cover what was previously a nasty
special case handling of numbers which don't fit in int64_t but *do* fit
in uint64_t.

Where the number is too large even for that, produce an AsmLexer::BigNum
instead. We do nothing with these except complain about them for now,
but that will be changed shortly...

Based on a patch from PaX Team <pageexec@freemail.hu>

llvm-svn: 200613
2014-02-01 16:20:54 +00:00
David Majnemer
9b4ef71ec8 MC: Improve the .fill directive's compatibility with GAS
Per the GAS documentation, .fill should permit pattern widths that
aren't a power of two. While I was in the neighborhood, I added some
sanity checking. This change was motivated by a use of this construct
in the Linux Kernel.

llvm-svn: 200606
2014-02-01 07:19:38 +00:00
David Majnemer
c3f8d074b2 MC: Better management of macro arguments
The linux kernel makes uses of a GAS `feature' which substitutes nothing
for macro arguments which aren't specified.

Proper support for these kind of macro arguments necessitated a cleanup of
differences between `GAS' and `Darwin' dialect macro processing.

Differential Revision: http://llvm-reviews.chandlerc.com/D2634

llvm-svn: 200409
2014-01-29 18:57:46 +00:00
David Majnemer
e40cc64844 MC: Clean up error paths in AsmParser::parseMacroArgument
Use an RAII object Instead of inserting a call to
AsmLexer::setSkipSpace(true) in all error paths.

No functional change.

llvm-svn: 200358
2014-01-29 00:07:39 +00:00
David Majnemer
68ba6d5a5b MC: Add support for .cfi_startproc simple
This commit allows LLVM MC to process .cfi_startproc directives when
they are followed by an additional `simple' identifier. This signals to
elide the emission of target specific CFI instructions that would
normally occur initially.

This fixes PR16587.

Differential Revision: http://llvm-reviews.chandlerc.com/D2624

llvm-svn: 200227
2014-01-27 17:20:25 +00:00
Saleem Abdulrasool
254ffbe584 AsmParser: improve diagnostics for invalid variants
An emitted diagnostic for an invalid relocation variant would place the caret on
the token following the relocation variant indicator or at the end of the line
if there was no following token.  This change corrects the placement of the
caret to point to the token.

llvm-svn: 200159
2014-01-26 22:29:43 +00:00
Alp Toker
1c4b33e8e5 Fix known typos
Sweep the codebase for common typos. Includes some changes to visible function
names that were misspelt.

llvm-svn: 200018
2014-01-24 17:20:08 +00:00
Rafael Espindola
d04868d854 InitToTextSection is redundant with InitSections. Remove it.
llvm-svn: 199955
2014-01-23 23:14:14 +00:00
Chandler Carruth
87f14b4eec Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

llvm-svn: 198685
2014-01-07 11:48:04 +00:00
Saleem Abdulrasool
3d4218e538 MCParser: introduce Note and use it for ARM AsmParser
Introduce a new virtual method Note into the AsmParser.  This completements the
existing Warning and Error methods.  Use the new method to clean up the output
of the unwind routines in the ARM AsmParser.

llvm-svn: 198661
2014-01-07 02:28:31 +00:00
Saleem Abdulrasool
e4373d751b AsmParser: cleanup diagnostics for .rep/.rept
Avoid double diagnostics for invalid expressions for count.  Improve caret
location for negative count.

llvm-svn: 198099
2013-12-28 06:39:29 +00:00
Saleem Abdulrasool
11a48b8359 IAS: support .rep as an alias for .rept
The GNU assembler supports .rep as an alias for .rept.  This simply creates the
alias for it and introduces a test for both .rept and .rep.

llvm-svn: 198097
2013-12-28 05:54:33 +00:00
David Peixotto
f4537ad9fd Add a finishParse() callback to the targer asm parser
This callback is invoked when the parse has finished successfuly. It
will be used to write out ARM constant pools to implement the ldr
pseudo.

llvm-svn: 197706
2013-12-19 18:08:08 +00:00
Saleem Abdulrasool
58e7056c0b AsmParser: add support for .end directive
The .end directive indicates the end of the file.  No further instructions are
processed after a .end directive is encountered.

One potential (glaringly obvious) optimisation that could be pursued here is to
extend MCAsmParser with a DiscardRemainder method to avoid processing lexemes to
the end of the file.  It was unclear at this point if that would be worth
adding, and could easily be added in a follow on change.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 197547
2013-12-18 02:53:03 +00:00
Reid Kleckner
b6a72325f3 Reland "Fix miscompile of MS inline assembly with stack realignment"
This re-lands commit r196876, which was reverted in r196879.

The tests have been fixed to pass on platforms with a stack alignment
larger than 4.

Update to clang side tests will land shortly.

llvm-svn: 196939
2013-12-10 18:27:32 +00:00
Reid Kleckner
cb3c239850 Revert "Fix miscompile of MS inline assembly with stack realignment"
This reverts commit r196876.  Its tests failed on the bots, so I'll
figure it out tomorrow.

llvm-svn: 196879
2013-12-10 05:31:27 +00:00
Reid Kleckner
26454793b1 Fix miscompile of MS inline assembly with stack realignment
For stack frames requiring realignment, three pointers may be needed:
- ebp to address incoming arguments
- esi (could be any callee-saved register) to address locals
- esp to address outgoing arguments

We would use esi unconditionally without verifying that it did not
conflict with inline assembly.

This change doesn't do the verification, it simply emits a fatal error
on functions that use stack realignment, dynamic SP adjustments, and
inline assembly.

Because stack realignment is common on Windows, we also no longer assume
that MS inline assembly clobbers esp.  Instead, we analyze the inline
instructions for implicit definitions and check if esp is there.  If so,
we require the use of a base pointer and consider it in the condition
above.

Mostly fixes PR16830, but we could try harder to find a non-conflicting
base pointer.

Reviewers: sunfish

Differential Revision: http://llvm-reviews.chandlerc.com/D1317

llvm-svn: 196876
2013-12-10 05:12:23 +00:00
Rafael Espindola
30bfebf7cc Use a more direct check for finding out the file type.
No functionality change.

llvm-svn: 196811
2013-12-09 20:26:40 +00:00
David Peixotto
b6710ff7c7 Add support for parsing ARM symbol variants on ELF targets
ARM symbol variants are written with parens instead of @ like this:

  .word __GLOBAL_I_a(target1)

This commit adds support for parsing these symbol variants in
expressions. We introduce a new flag to MCAsmInfo that indicates the
parser should use parens to parse the symbol variant. The expression
parser is modified to look for symbol variants using parens instead
of @ when the corresponding MCAsmInfo flag is true.

The MCAsmInfo parens flag is enabled only for ARM on ELF.

By adding this flag to MCAsmInfo, we are able to get rid of
redundant ARM-specific symbol variants and use the generic variants
instead (e.g. VK_GOT instead of VK_ARM_GOT). We use the new
UseParensForSymbolVariant attribute in MCAsmInfo to correctly print
the symbol variants for arm.

To achive this we need to keep a handle to the MCAsmInfo in the
MCSymbolRefExpr class that we can check when printing the symbol
variant.

Updated Tests:
  Changed case of symbol variant to match the generic kind.
  test/CodeGen/ARM/tls-models.ll
  test/CodeGen/ARM/tls1.ll
  test/CodeGen/ARM/tls2.ll
  test/CodeGen/Thumb2/tls1.ll
  test/CodeGen/Thumb2/tls2.ll

PR18080

llvm-svn: 196424
2013-12-04 22:43:20 +00:00
Tim Northover
130230544c ARM: allow .thumb_func to be separated from symbol definition
When assembling, a .thumb_func directive is supposed to be applicable to the
next symbol definition, even if there are intervening directives. We were
racing ahead to try and find it, and this commit should fix the issue.

Patch by Gabor Ballabas

llvm-svn: 193403
2013-10-25 12:49:50 +00:00
Hans Wennborg
c1a311233c MC asm parser: allow ?'s in symbol names, and handle @'s in names in MS asm
This is another (final?) stab at making us able to parse our own asm output
on Windows.

Symbols on Windows often contain @'s and ?'s in their names. Our asm parser
didn't like this. ?'s were not allowed, and @'s were intepreted as trying to
reference PLT/GOT/etc.

We can't just add quotes around the bad names, since e.g. for MinGW, we use gas
to assemble, and it doesn't like quotes in some places (notably in .def
directives).

This commit makes us allow ?'s in symbol names, and @'s in symbol names for MS
assembly.

Differential Revision: http://llvm-reviews.chandlerc.com/D1978

llvm-svn: 193000
2013-10-18 20:46:28 +00:00
Hans Wennborg
33576424a9 Revert "Re-commit r192758 - MC: quote tricky symbol names in asm output"
This caused the clang-native-mingw32-win7 buildbot to break.

The assembler was complaining about the following lines that were showing up
in the asm for CrashRecoveryContext.cpp:

  movl  $"__ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4", 4(%eax)
  calll "_AddVectoredExceptionHandler@8"
  .def   "__ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4";
  "__ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4":
  calll "_RemoveVectoredExceptionHandler@4"

Reverting for now.

llvm-svn: 192940
2013-10-18 02:14:40 +00:00
Hans Wennborg
822f0080df Re-commit r192758 - MC: quote tricky symbol names in asm output
The reason this got reverted was that the @feat.00 symbol which was emitted
for every TU became quoted, and on cygwin/mingw we use the gas assembler which
couldn't handle the quotes.

This commit fixes the problem by only emitting @feat.00 for win32, where we use
clang -cc1as to assemble. gas would just drop this symbol anyway, so there is no
loss there.

With @feat.00 gone, there shouldn't be quoted symbols showing up on cygwin since
it uses the Itanium ABI, which doesn't put these funny characters in symbols.

> Because of win32 mangling, we produce symbol and section names with
> funny characters in them, most notably @ characters.
>
> MC would choke on trying to parse its own assembly output. This patch addresses
> that by:
>
> - Making @ trigger quoting of symbol names
> - Also quote section names in the same way
> - Just parse section names like other identifiers (to allow for quotes)
> - Don't assume @ signifies a symbol variant if it is in a string.

llvm-svn: 192859
2013-10-17 01:13:02 +00:00
NAKAMURA Takumi
ab81f8a305 Revert r192758 (and r192759), "MC: Better handling of tricky symbol and section names"
GNU AS didn't like quotes in symbol names.

    Error: junk at end of line, first unrecognized character is `"'

        .def "@feat.00";
        "@feat.00" = 1

Reproduced on Cygwin's 2.23.52.20130309 and mingw32's 2.20.1.20100303.

llvm-svn: 192775
2013-10-16 08:22:49 +00:00
Hans Wennborg
3b3efddc64 MC: Better handling of tricky symbol and section names
Because of win32 mangling, we produce symbol and section names with
funny characters in them, most notably @ characters.

MC would choke on trying to parse its own assembly output. This patch addresses
that by:

- Making @ trigger quoting of symbol names
- Also quote section names in the same way
- Just parse section names like other identifiers (to allow for quotes)
- Don't assume @ signifies a symbol variant if it is in a string.

Differential Revision: http://llvm-reviews.chandlerc.com/D1945

llvm-svn: 192758
2013-10-16 01:20:40 +00:00
Jack Carter
6dc369450f reverting per request
llvm-svn: 191992
2013-10-04 22:52:31 +00:00
Jack Carter
70c25749d2 [MC][AsmParser] Hook for post assembly file processing
This patch handles LLVM standalone assembler (llvm-mc) ELF flag setting based on input file
directive processing.

Mips assembly requires processing inline directives that directly and
indirectly affect the output ELF header flags. This patch handles one
".abicalls".

To process these directives we are following the model the code generator
uses by storing state in a container as we go through processing and when
we detect the end of input file processing, AsmParser is notified and we
update the ELF header flags through a MipsELFStreamer method with a call from
MCTargetAsmParser::emitEndOfAsmFile(MCStreamer &OutStreamer).

This patch will allow other targets the same functionality.

Jack

llvm-svn: 191982
2013-10-04 21:26:15 +00:00
Adrian Prantl
b8d4a7c18d MCParser/Debug info: Accept line number 0 as a legitimate value, since
CFE produces it to indicate artificial locations.
c.f.: DWARF standard, Table 6.2:
line -- An unsigned integer indicating a source line number. Lines are numbered beginning at 1. The compiler may emit the value 0 in cases where an instruction cannot be attributed to any source line.

llvm-svn: 191471
2013-09-26 23:37:11 +00:00
Venkatraman Govindaraju
2ff6b6411c Implements parsing and emitting of .cfi_window_save in MC.
llvm-svn: 191431
2013-09-26 14:49:40 +00:00
David Majnemer
1ffe32b198 MC: Add support for treating $ as a reference to the PC
The binutils assembler supports a mode called DOLLAR_DOT which treats
the dollar sign token as a reference to the current program counter if
the dollar sign doesn't precede a constant or identifier.

This commit adds a new MCAsmInfo flag stating whether or not a given
target supports this interpretation of the dollar sign token; by
default, this flag is not enabled.

Further, enable this flag for PPC. The system assembler for AIX and
binutils both support using the dollar sign in this manner.

This fixes PR17353.

llvm-svn: 191368
2013-09-25 10:47:21 +00:00
Roman Divacky
53c69770f7 Make the size and expr arguments of .fill directive optional.
llvm-svn: 191318
2013-09-24 17:44:41 +00:00
Benjamin Kramer
1308256cf8 Provide basic type safety for array_pod_sort comparators.
This makes using array_pod_sort significantly safer. The implementation relies
on function pointer casting but that should be safe as we're dealing with void*
here.

llvm-svn: 191175
2013-09-22 14:09:50 +00:00
Jim Grosbach
cf9257a3a6 MC: Tidy up.
Clean up some simple code quality issues. Bring internal naming
conventions up to current standard, fix inconsistent formatting, and
tidy up a couple of odd contructs.

llvm-svn: 191117
2013-09-20 23:08:21 +00:00
Jakub Staszak
84872fcf98 Use reference instead of copy.
llvm-svn: 190813
2013-09-16 22:03:38 +00:00
Yunzhong Gao
9c0a894c6d Improve handling of .file, .include and .incbin directives to
allow escaped octal character sequences.

The patch was discussed in Phabricator. See:
http://llvm-reviews.chandlerc.com/D1289

llvm-svn: 190089
2013-09-05 19:14:26 +00:00
Kevin Enderby
45aed251cc The integrated darwin assembler can hang in an infinite loop (or get an assert
with a debug build) with this buggy .indirect_symbol directive usage:

% cat test.s
x: .indirect_symbol _y

The assertion is because it is trying to get the symbol index for the
symbol _y when it is writing out the indirect symbol table. This line of
code in MachObjectWriter::WriteObject() :

        Write32(Asm.getSymbolData(*it->Symbol).getIndex());

And while there is a symbol _y it does not have any getSymbolData set which
is only done in MachObjectWriter::BindIndirectSymbols() for pointer sections
or stub sections.  I added a check and an error in there to catch this in case
something slips through.

But to get a better error the parser should detect when a .indirect_symbol
directive is used and it is not in a pointer section or stub section.  To make
that work I moved the handling of the indirect symbol out of the target
independent AsmParser code into the DarwinAsmParser code that can check
for the proper Mach-O section types.

rdar://14825505

llvm-svn: 189497
2013-08-28 17:50:59 +00:00
Joerg Sonnenberger
b2cc802497 Given target assembler parsers a chance to handle variant expressions
first. Use this to turn the PPC modifiers into PPC specific expressions,
allowing them to work on constants.

llvm-svn: 189400
2013-08-27 20:23:19 +00:00
Vladimir Medic
4271ac93aa Fix style issues in AsmParser.cpp
llvm-svn: 188798
2013-08-20 13:33:18 +00:00
Saleem Abdulrasool
7fcd7a910a [CodeGen] prevent abnormal on invalid attributes
Currently, when an invalid attribute is encountered on processing a .s file,
clang will abort due to llvm_unreachable.  Invalid user input should not cause
an abnormal termination of the compiler.  Change the interface to return a
boolean to indicate the failure as a first step towards improving hanlding of
malformed user input to clang.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 188047
2013-08-09 01:52:03 +00:00
Benjamin Kramer
1a7f3f9391 AsmParser: Store MacroLikeBodies on the side so they don't get leaked.
llvm-svn: 187702
2013-08-04 09:06:29 +00:00
Rafael Espindola
304ef43e7d Remove address spaces from MC.
This is dead code since PIC16 was removed in 2010. The result was an odd mix,
where some parts would carefully pass it along and others would assert it was
zero (most of the object streamer for example).

llvm-svn: 185436
2013-07-02 15:49:13 +00:00
Kevin Enderby
b7f5c9fc9b Improve the time it takes to generating dwarf for assembly source files
that have been run through the 'C' pre-processor.

The implementation of SrcMgr.FindLineNumber() is slow but OK if
it uses its cache when called multiple times with an SMLoc that is
forward of the previous call.

In the case of generating dwarf for assembly source files that have
been run through the 'C' pre-processor we need to calculate the
logical line number based on the last parsed cpp hash file line
comment.  And the current code calls SrcMgr.FindLineNumber()
twice to do this causing its cache not to work and results in very
slow compile times:

% time /Volumes/SandBox/build-llvm/Debug+Asserts/bin/llvm-mc -triple thumbv7-apple-ios -filetype=obj -o /tmp/x.o mscorlib.dll.E -g
672.542u 0.299s 11:13.15 99.9%	0+0k 0+2io 2106pf+0w

So we save the info from the last parsed cpp hash file line comment
to avoid making the second call to SrcMgr.FindLineNumber() most times
and end up with compile times like:

% time /Volumes/SandBox/build-llvm/Debug+Asserts/bin/llvm-mc -triple thumbv7-apple-ios -filetype=obj -o /tmp/x.o mscorlib.dll.E -g
3.404u 0.104s 0:03.80 92.1%	0+0k 0+3io 2105pf+0w

rdar://14156934

llvm-svn: 184592
2013-06-21 20:51:39 +00:00
Ulrich Weigand
8c70d558d3 [MC] Support @ variants with directional labels
The assembler parser common code supports recognizing symbol variants
using the @ modifer.  On PowerPC, it should also be possible to use
(some of) those modifiers with directional labels, like "1f@l".

This patch adds support for accepting symbol variants on directional
labels as well.

llvm-svn: 184437
2013-06-20 16:24:17 +00:00
Bill Wendling
49ef14ef73 Use pointers to the MCAsmInfo and MCRegInfo.
Someone may want to do something crazy, like replace these objects if they
change or something.

No functionality change intended.

llvm-svn: 184175
2013-06-18 07:20:20 +00:00
Sylvestre Ledru
8b2c792cff Fix two typo
llvm-svn: 181848
2013-05-14 23:36:24 +00:00
Kevin Enderby
4562d15159 Fix a bug in the MC asm parser evaluating expressions. It was treating:
A = 9
B = 3 * A - 2 * A + 1 as  B = 3 * A - (2 * A + 1)

rdar://13816516

llvm-svn: 181366
2013-05-07 21:40:58 +00:00
Dmitri Gribenko
82c92dc3dd Add ArrayRef constructor from None, and do the cleanups that this constructor enables
Patch by Robert Wilhelm.

llvm-svn: 181138
2013-05-05 00:40:33 +00:00
Chad Rosier
a83a69c04e [ms-inline asm] Get the OpDecl and remove a redundant lookup.
Part of rdar://13663589

llvm-svn: 180057
2013-04-22 22:12:12 +00:00
Chad Rosier
db1182911d [ms-inline asm] Refactor/clean up the SemaLookup interface. No functional
change indended.
Part of rdar://13663589

llvm-svn: 180028
2013-04-22 17:01:46 +00:00
Craig Topper
dcf0462f2d Fix indentation. No functional change.
llvm-svn: 179994
2013-04-22 04:24:02 +00:00
Craig Topper
04e44a9181 Put 'else' on same line as preceding curly brace per coding standards. No functional change.
llvm-svn: 179993
2013-04-22 04:22:40 +00:00
Craig Topper
9541948bfa Remove an unreachable 'break' following a 'return'.
llvm-svn: 179991
2013-04-22 04:06:59 +00:00
Peter Collingbourne
a0d11d0e11 Add support for subsections to the ELF assembler. Fixes PR8717.
Differential Revision: http://llvm-reviews.chandlerc.com/D598

llvm-svn: 179725
2013-04-17 21:18:16 +00:00
Chad Rosier
524aa6c52d [ms-inline asm] Add the implementation for the AOK_Delete kind, which was added
in r179325.  Test case coming shortly on the clang side.
Part of rdar://13453209

llvm-svn: 179383
2013-04-12 16:26:42 +00:00
Chad Rosier
b3012065df [ms-inline asm] Remove brackets from around a symbol reference in the target
specific logic.  This makes the code much less fragile.  Test case coming on the
clang side in a moment.
rdar://13634327

llvm-svn: 179323
2013-04-11 21:49:30 +00:00
Chad Rosier
411fdc3a74 Reapply r179115, but use parsePrimaryExpression a little more judiciously.
Test cases that regressed due to r179115, plus a few more, were added in
r179182.  Original commit message below:

[ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need to
parse an identifier.  Otherwise, parseExpression may parse multiple tokens,
which makes it impossible to properly compute an immediate displacement.
An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in
the below example:

 __asm mov eax, [Symbol + ImmDisp]

Part of rdar://13611297

llvm-svn: 179187
2013-04-10 17:35:30 +00:00
Chad Rosier
e040ffba05 Revert r179115 as it looks to have killed the ASan tests.
llvm-svn: 179120
2013-04-09 19:59:12 +00:00
Chad Rosier
4ef6c35911 [ms-inline asm] Use parsePrimaryExpr in lieu of parseExpression if we need to
parse an identifier.  Otherwise, parseExpression may parse multiple tokens,
which makes it impossible to properly compute an immediate displacement.
An example of such a case is the source operand (i.e., [Symbol + ImmDisp]) in
the below example:

 __asm mov eax, [Symbol + ImmDisp]

The existing test cases exercise this patch.
rdar://13611297

llvm-svn: 179115
2013-04-09 19:34:59 +00:00
Chad Rosier
5ec822982c [ms-inline asm] Maintain a StringRef to reference a symbol in a parsed operand,
rather than deriving the StringRef from the Start and End SMLocs.

Using the Start and End SMLocs works fine for operands such as [Symbol], but
not for operands such as [Symbol + ImmDisp].  All existing test cases that
reference a variable exercise this patch.
rdar://13602265

llvm-svn: 179109
2013-04-09 17:53:49 +00:00
Chad Rosier
7583b0a3c3 [ms-inline asm] Add support for ImmDisp [ Symbol ] memory operands.
rdar://13521249

llvm-svn: 179030
2013-04-08 17:43:47 +00:00
Chad Rosier
f40ec930c8 Dead code.
llvm-svn: 177451
2013-03-19 22:13:05 +00:00
Chad Rosier
3019e30cac [ms-inline asm] Move the immediate asm rewrite into the target specific
logic as a QOI cleanup.  No functional change.  Tests already in place.
rdar://13456414

llvm-svn: 177446
2013-03-19 21:58:18 +00:00
Chad Rosier
c72a354062 [ms-inline asm] Remove the brackets from X86Operand in the IR. These will be
added back in by X86AsmPrinter::printIntelMemReference() during codegen.
Previously, this following example

  void t() {
    int i;
    __asm mov eax, [i]
  }

would generate the below assembly

  mov eax, dword ptr [[eax]]

which resulted in a fatal error when compiling.  Test case coming on the
clang side.
rdar://13444264

llvm-svn: 177440
2013-03-19 21:12:14 +00:00
Chad Rosier
758abf9ba0 [ms-inline asm] Move the size directive asm rewrite into the target specific
logic as a QOI cleanup.
rdar://13445327

llvm-svn: 177413
2013-03-19 17:32:17 +00:00
Manman Ren
a557c34a03 Debug Info: use SmallVector instead of std::vector in MCDwarfDirsCUMap and MCDwarfFilesCUMap
llvm-svn: 176893
2013-03-12 20:17:00 +00:00
Jim Grosbach
89c0252c2a MCParser: Update method names per coding guidelines.
s/AddDirectiveHandler/addDirectiveHandler/
s/ParseMSInlineAsm/parseMSInlineAsm/
s/ParseIdentifier/parseIdentifier/
s/ParseStringToEndOfStatement/parseStringToEndOfStatement/
s/ParseEscapedString/parseEscapedString/
s/EatToEndOfStatement/eatToEndOfStatement/
s/ParseExpression/parseExpression/
s/ParseParenExpression/parseParenExpression/
s/ParseAbsoluteExpression/parseAbsoluteExpression/
s/CheckForValidSection/checkForValidSection/

http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

No functional change intended.

llvm-svn: 175675
2013-02-20 22:21:35 +00:00
Benjamin Kramer
7731c957a6 MCParser: Reject .balign with non-pow2 alignments.
GNU as rejects them and there are configure scripts in the wild that check if
the assembler rejects ".align 3" to determine whether the alignment is in bytes
or powers of two.

llvm-svn: 175360
2013-02-16 15:00:16 +00:00
Chad Rosier
d630718ae9 c[ms-inline asm] It's possible to have a SizeDirective rewrite and an
Input/Output rewrite to the same location.  Make sure the SizeDirective rewrite
is performed first.  This also ensure the sort algorithm is stable.

llvm-svn: 175317
2013-02-15 22:54:16 +00:00
Benjamin Kramer
121eaac90f AsmParser: Reformat the MS asm parser to reduce nesting.
While there postpone register name printing after uniquing.
No intended functionality change.

llvm-svn: 175292
2013-02-15 20:37:21 +00:00
Chad Rosier
0c12b80a10 [ms-inline asm] Add a comment about the determinism of the rewrite sort.
llvm-svn: 175082
2013-02-13 21:27:17 +00:00
Chad Rosier
5ead8d3901 [ms-inline-asm] Use an array_pod_sort, rather than a std:sort.
llvm-svn: 175063
2013-02-13 18:38:58 +00:00
Chad Rosier
271b9e136a [ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.
rdar://13202662

llvm-svn: 175021
2013-02-13 01:03:13 +00:00
Chad Rosier
fccc6d00f0 [ms-inline-asm] Implement align directive (which is roughly equivalent to .align).
Also, allow _EMIT and __EMIT for the emit directive.  We already do the same
for TYPE, SIZE, and LENGTH.
rdar://13200215

llvm-svn: 175008
2013-02-12 21:33:51 +00:00
Guy Benyei
92dac48079 Add static cast to unsigned char whenever a character classification function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
llvm-svn: 175006
2013-02-12 21:21:59 +00:00
Chad Rosier
3eb029b4c7 [ms-inline asm] Pass the length of the IDVal, so we can do a proper AsmRewrite.
llvm-svn: 174999
2013-02-12 19:42:32 +00:00
Chad Rosier
24b5149dc9 [ms-inline asm] Accept the emit directive as either _emit or __emit.
llvm-svn: 174998
2013-02-12 19:31:23 +00:00
Kevin Enderby
042547700a Add a warning when there is a macro defintion that has named parameters but
the body does not use them and it appears the body has positional parameters.

This can cause unexpected results as in the added test case.  As the darwin
version of gas(1) which only supported positional parameters, happened to
ignore the named parameters.  Now that we want to support both styles of
macros we issue a warning in this specific case.

rdar://12861644

llvm-svn: 173199
2013-01-22 21:44:53 +00:00
Kevin Enderby
8bfddfebbb Have the integrated assembler give an error if $1 is used as an identifier in
an expression.  Currently this bug causes the line to be ignored in a
release build and an assert in a debug build.

rdar://13062484

llvm-svn: 173195
2013-01-22 21:09:20 +00:00
Daniel Dunbar
870ae74b9b [MC] Expose ParseEscapedString to target AsmParser implementations.
llvm-svn: 172777
2013-01-18 01:25:33 +00:00
Chad Rosier
bb513e22fa [ms-inline asm] Add support for the 'SIZE' and 'LENGTH' operators.
Part of rdar://12576868

llvm-svn: 172743
2013-01-17 19:21:48 +00:00
Eli Bendersky
b713627125 Some small (and mostly cosmetic) fixes.
llvm-svn: 172640
2013-01-16 19:32:36 +00:00
Eli Bendersky
9748b9b3ad Now that GenericAsmParser was folded into AsmParser, some methods and types can
return into the safe harbor of AsmParser's private areas.

llvm-svn: 172637
2013-01-16 18:56:50 +00:00
Eli Bendersky
039d07cadd Use the ExtensionDirectiveHandler type in other places where it makes sense.
Since we already have this type it's a shame to keep dragging a pair of object
and method around explicitly.

llvm-svn: 172584
2013-01-16 00:50:52 +00:00
Chad Rosier
99207e5c20 [ms-inline asm] Address the FIXME in AsmParser.cpp.
// FIXME: Constraints are hard coded to 'm', but we need an 'r'
// constraint for addressof.  This needs to be cleaned up!

Test cases are already in place.  Specifically,
clang/test/CodeGen/ms-inline-asm.c t15(), t16(), and t24().

llvm-svn: 172569
2013-01-15 23:07:53 +00:00
Eli Bendersky
2e1c083b6f Refactor generic Asm directive parsing.
After discussing the refactoring with Jim and Daniel, the following changes were
made:

* All generic directive parsing is now done by AsmParser itself. The previous
  division between it and GenericAsmParser did not have clear boundaries and
  just produced unnatural code of GenericAsmParser juggling the internals of
  AsmParser through an interface. 
  The division of responsibilities is now clear: target-specific directives,
  other extensions (used by platform-specific parseres), and generic directives.
* Priority for directive parsing was reshuffled to ask extensions first and
  check the generic directives later.

No change in functionality.

llvm-svn: 172568
2013-01-15 22:59:42 +00:00
Eli Bendersky
44d6a7cbd6 Now GenericAsmParser and AsmParser are no longer friends, GenericAsmParser can
simply use the getParser method from MCAsmParserExtension, working through the
MCAsmParser interface. There's no longer a need to overload that method to
cast it to the concrete AsmParser.

llvm-svn: 172491
2013-01-14 23:43:18 +00:00
Eli Bendersky
d065fef2d9 Properly encapsulate additional methods and data from AsmParser.
This finally allows AsmParser to no longer list GenericAsmParser as a friend.
All member vars directly accessed by GenericAsmParser have been properly
encapsulated and exposed through the MCAsmParser interface. This reduces the
coupling between AsmParser and GenericAsmParser.

llvm-svn: 172490
2013-01-14 23:22:36 +00:00
Eli Bendersky
87b2978a18 Move CheckForValidSection to the MCAsmParser interface.
Now that it behaves itself in terms of streamer independence (r172450), this
method can be moved to MCAsmParser to be available to all extensions,
overriding, etc.

-- -This line, and those below, will be ignored--

M    lib/MC/MCParser/AsmParser.cpp
M    include/llvm/MC/MCParser/MCAsmParser.h

llvm-svn: 172451
2013-01-14 19:15:01 +00:00
Eli Bendersky
abe1a77c03 Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the
platform-independent AsmParser:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.SwitchSection(Ctx.getMachOSection(
                        "__TEXT", "__text",
                        MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
                        0, SectionKind::getText()));
  }
}

This was added for the "-n" option of llvm-mc.

The proposed fix adds another virtual method to MCStreamer, called
InitToTextSection. Conceptually, it's similar to the existing
InitSections which initializes all common sections and switches to
text. The new method is implemented by each platform streamer in a way
that it sees fit. So AsmParser can now do this:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.InitToTextSection();
  }
}

Which is much more reasonable.

llvm-svn: 172450
2013-01-14 19:04:57 +00:00
Eli Bendersky
38501d372e Move ParseMacroArgument to the MCAsmParser interfance.
Since it's used by extensions. One further step to fully decoupling
GenericAsmParser from an intimate knowledge of the internals of AsmParser,
pointing it to the MCASmParser interface instead (like all other parser
extensions do).

Since this change moves the MacroArgument type to the interface header, it's
renamed to be a bit more descriptive in a general context.

llvm-svn: 172449
2013-01-14 19:00:26 +00:00
Eli Bendersky
0b7c192145 Encapsulate the MacroEnabled flag in AsmParser behind accessor methods.
The methods are also exposed via the MCAsmParser interface, which allows more
than one client to control them. Previously, GenericAsmParser was playing with
a member var in AsmParser directly (by virtue of being its friend).

llvm-svn: 172440
2013-01-14 18:08:41 +00:00
Eli Bendersky
3857c4275f Stop hiding the interface-exposed EatToEndOfStatement (see r172276).
llvm-svn: 172277
2013-01-12 00:23:24 +00:00
Eli Bendersky
326f4b5f48 Make ParseIdentifier a public method instead of private.
The MCAsmParser interface defines ParseIdentifier is public. There's no reason
whatsoever for AsmParser (which implements the MCAsmParser interface) to hide
this method.

This is all part of a bigger scheme. Several asm parsing "extensions" use the
main parser properly through the MCAsmParser interface. However,
GenericAsmParser has much more exclusive access and uses implementation details
from the concrete implementation - AsmParser, in which it is also declared as
a friend. This makes for overly coupled code, and even makes it hard to split
GenericAsmParser into a separate file. There's no reason why GenericAsmParser
shouldn't be able to access AsmParser through an abstract interface, as long
as it's actually registered as an extension.

llvm-svn: 172276
2013-01-12 00:05:00 +00:00
Eli Bendersky
70f1007034 Proof of concept moving of generic directive parsing from AsmParser to the
GenericAsmParser extension, where a lot of directives are already being parsed.
The end goal is having just a single place (and a single lookup table) for
all directive parsing.

llvm-svn: 172268
2013-01-11 22:55:28 +00:00
NAKAMURA Takumi
1a798ac8dc Revert r172153, "llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a couple of undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg()."
It has been redundant since r172157.

llvm-svn: 172166
2013-01-11 02:50:09 +00:00
NAKAMURA Takumi
eaffa07ccd llvm/lib/MC/MCParser/AsmParser.cpp: [ms-inline-asm] Fix a couple of undefined behaviors. Operand->needAddressOf() is not initialized at !Operand->isReg().
llvm-svn: 172153
2013-01-11 00:37:35 +00:00
Eli Bendersky
1c110a3457 Rename enumerations s/VK/DK/ to conform to naming convention
llvm-svn: 172149
2013-01-10 23:40:56 +00:00
Eli Bendersky
e4b4e5f076 fix comments a bit
llvm-svn: 172146
2013-01-10 23:32:57 +00:00
Eli Bendersky
7247cfaf23 Remove a couple of if-else chains in parsing directives, replacing them by a
switch. Committed with Jim's and Chris's approval.

llvm-svn: 172136
2013-01-10 22:44:57 +00:00
Chad Rosier
f66d08be5c [ms-inline asm] Add support for calling functions from inline assembly.
Part of rdar://12991541

llvm-svn: 172121
2013-01-10 22:10:27 +00:00
Eli Bendersky
4236f7b1ee Add the align_to_end option to .bundle_lock in the MC implementation of aligned
bundling. The document describing this feature and the implementation has also
been updated:

https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm

llvm-svn: 171797
2013-01-07 21:51:08 +00:00
Chad Rosier
515c53ac4f [ms-inline asm] Make sure the NullStreamParser doesn't try to emit labels when
parsing MS-style inline assembly.

llvm-svn: 171784
2013-01-07 20:34:12 +00:00
Jordan Rose
c95190a559 Change SMRange to be half-open (exclusive end) instead of closed (inclusive)
This is necessary not only for representing empty ranges, but for handling
multibyte characters in the input. (If the end pointer in a range refers to
a multibyte character, should it point to the beginning or the end of the
character in a char array?) Some of the code in the asm parsers was already
assuming this anyway.

llvm-svn: 171765
2013-01-07 19:00:49 +00:00
Eli Bendersky
b0643bbb71 Aligned bundling support. Following the discussion here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056754.html

The proposal and implementation are fully documented here:
https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm

Tests will follow shortly.

llvm-svn: 170718
2012-12-20 19:05:53 +00:00
Eric Christopher
ed859a3fb8 Add support for passing -main-file-name all the way through to
the assembler.

Part of PR14624

llvm-svn: 170390
2012-12-18 00:31:01 +00:00
Eric Christopher
41e750e835 Cleanup formatting and whitespace.
llvm-svn: 170389
2012-12-18 00:30:54 +00:00
Eli Bendersky
689b282ca8 fix indentation
llvm-svn: 170381
2012-12-17 22:50:56 +00:00
Chad Rosier
2b1f874fc0 [ms-inline asm] Make sure we fail gracefully on parse errors. Parse errors
should only occur on invalid input.  Instruction matching errors aren't
unexpected, so we can't rely on the AsmParsers HadError variable directly.
rdar://12840278

llvm-svn: 170037
2012-12-12 22:45:52 +00:00
Daniel Dunbar
3d783b87ae MC/AsmParser: Avoid unnecessary use of SourceMgr::FindBufferForLoc()
- Each macro instantiation introduces a new buffer, and FindBufferForLoc() is
   linear, so previously macro instantiation could be N^2 for some pathological
   inputs.

llvm-svn: 169073
2012-12-01 01:38:48 +00:00