Commit Graph

330 Commits

Author SHA1 Message Date
Chandler Carruth ed0881b2a6 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Jim Grosbach 6f1f41b1ae X86: Better diagnostics for 32-bit vs. 64-bit mode mismatches.
When an instruction as written requires 32-bit mode and we're assembling
in 64-bit mode, or vice-versa, issue a more specific diagnostic about
what's wrong.

rdar://12700702

llvm-svn: 167937
2012-11-14 18:04:47 +00:00
Michael Liao 73cffddb95 Add support of RTM from TSX extension
- Add RTM code generation support throught 3 X86 intrinsics:
  xbegin()/xend() to start/end a transaction region, and xabort() to abort a
  tranaction region

llvm-svn: 167573
2012-11-08 07:28:54 +00:00
Chad Rosier 1bbaa449ad [ms-inline asm] Add support for the [] operator. Essentially, [expr1][expr2] is
equivalent to [expr1 + expr2].  See test cases for more examples.
rdar://12470392

llvm-svn: 166949
2012-10-29 18:01:54 +00:00
Chad Rosier 8e71f7c2d8 [ms-inline asm] Add a comment.
llvm-svn: 166819
2012-10-26 22:01:25 +00:00
Chad Rosier 5859356d80 [ms-inline asm] Emit an error for unsupported SIZE and LENGTH directives.
Part of rdar://12576868

llvm-svn: 166792
2012-10-26 18:32:44 +00:00
Chad Rosier 11c42f2d2c [ms-inline asm] Add support for the TYPE operator.
Part of rdar://12576868

llvm-svn: 166790
2012-10-26 18:04:20 +00:00
Chad Rosier e2f03771c4 [ms-inline asm] Have the target AsmParser create the asmrewrite for the offsetof
operator.

llvm-svn: 166779
2012-10-26 16:09:20 +00:00
Chad Rosier 240b7b963a [ms-inline asm] Perform field lookups with the dot operator.
llvm-svn: 166724
2012-10-25 21:51:10 +00:00
Chad Rosier f0e8720054 [ms-inline asm] Add support for creating AsmRewrites in the target specific
AsmParser logic.  To be used/tested in a subsequent commit.

llvm-svn: 166714
2012-10-25 20:41:34 +00:00
Chad Rosier 911c1f38b0 [ms-inline asm] Add error handling to the ParseIntelDotOperator() function.
llvm-svn: 166698
2012-10-25 17:37:43 +00:00
Chad Rosier 5dcb4664f2 [ms-inline asm] Add support for parsing the '.' operator. Given,
[register].field

The operator returns the value at the location pointed to by register plus the
offset of field within its structure or union.  This patch only handles
immediate fields (i.e., [eax].4).  The original displacement has to be a
MCConstantExpr as well.
Part of rdar://12470415 and rdar://12470514

llvm-svn: 166632
2012-10-24 22:21:50 +00:00
Chad Rosier 6844ea09fa Tidy up. No functional change intended.
llvm-svn: 166630
2012-10-24 22:13:37 +00:00
Chad Rosier 91c8266200 [ms-inline asm] Create a register operand, rather than a memory operand when we
see the offsetof operator.  Previously, we were matching something like MOVrm
in the front-end and later matching MOVrr in the back-end.  This change makes
things more consistent.  It also fixes cases where we can't match against a 
memory operand as the source (test cases coming).
Part of rdar://12470317

llvm-svn: 166592
2012-10-24 17:22:29 +00:00
Chad Rosier a623524487 [ms-inline asm] Offset operator - the size should be based on the size of a
pointer, not the size of the variable.
Part of rdar://12470317

llvm-svn: 166526
2012-10-23 23:42:06 +00:00
Chad Rosier eac2b2003e [ms-inline asm] Clean up comment.
llvm-svn: 166525
2012-10-23 23:34:28 +00:00
Chad Rosier 146310a1c1 [ms-inline asm] When parsing inline assembly we set the base register to a
non-zero value as we don't know the actual value at this point.  This is
necessary to get the matching correct in some cases.  However, the actual value
set as the base register doesn't matter, since we're just matching not emitting.

llvm-svn: 166523
2012-10-23 23:31:33 +00:00
Chad Rosier 37e755cee2 [ms-inline asm] Add an implementation of the offset operator. This is a follow
on patch to r166433.
rdar://12470317

llvm-svn: 166488
2012-10-23 17:43:43 +00:00
Chad Rosier 5bca3f9b8e [ms-inline asm] Add the isOffsetOf() function.
Part of rdar://12470317

llvm-svn: 166436
2012-10-22 19:50:35 +00:00
Chad Rosier c14ed95da4 [ms-inline asm] Add support for parsing the offset operator. Callback for
CodeGen in the front-end not implemented yet.
rdar://12470317

llvm-svn: 166433
2012-10-22 19:42:52 +00:00
Chad Rosier f1f6a72901 [ms-inline asm] Reset the opcode prior to parsing a statement.
llvm-svn: 166349
2012-10-19 22:57:33 +00:00
Chad Rosier 0f48c55e70 [ms-inline asm] Have the TargetParser callback to Sema to determine the size of
a memory operand.  Retain this information and then add the sizing directives
to the IR.  This allows the backend to do proper instruction selection.

llvm-svn: 166316
2012-10-19 20:57:14 +00:00
Chad Rosier f3bc599680 [ms-inline asm] If we parsed a statement and the opcode is valid, then it's an instruction.
llvm-svn: 165955
2012-10-15 19:08:18 +00:00
Chad Rosier 499d4a1468 [ms-inline asm] Update the end loc for ParseIntelMemOperand.
llvm-svn: 165947
2012-10-15 17:26:38 +00:00
Chad Rosier 4996355592 [ms-inline asm] Remove the MatchInstruction() function. Previously, this was
the interface between the front-end and the MC layer when parsing inline
assembly.  Unfortunately, this is too deep into the parsing stack. Specifically,
we're unable to handle target-independent assembly (i.e., assembly directives,
labels, etc.).  Note the MatchAndEmitInstruction() isn't the correct
abstraction either.  I'll be exposing target-independent hooks shortly, so this
is really just a cleanup.

llvm-svn: 165858
2012-10-13 00:26:04 +00:00
Chad Rosier 4453e8453e [ms-inline asm] Capitalize per coding standard.
llvm-svn: 165847
2012-10-12 23:09:25 +00:00
Chad Rosier 2f480a8a50 [ms-inline asm] Use the new API introduced in r165830 in lieu of the
MapAndConstraints vector.  Also remove the unused Kind argument.

llvm-svn: 165833
2012-10-12 22:53:36 +00:00
Chad Rosier 8f06e7dea4 [ms-inline asm] Add a few typedefs to simplify future changes.
llvm-svn: 165324
2012-10-05 18:41:14 +00:00
Chad Rosier 0397edd9c8 [ms-inline asm] Add support for parsing [Intel dialect] memory operands that use
segmented registers.  Test case to come.

llvm-svn: 165275
2012-10-04 23:59:38 +00:00
Chad Rosier 985b1dc2d8 Revert 165057, per Jim's request. This requires further discussion.
llvm-svn: 165069
2012-10-02 23:38:50 +00:00
Chad Rosier 25f5cbcd13 [ms-inline asm] Add basic support for wildcard MCParsedAsmOperands. This type
of operand is specific to MS-style inline assembly and should not be generated
when parsing normal assembly.

The purpose of the wildcard operands are to allow the AsmParser to match
multiple instructions (i.e., MCInsts) to a given ms-style asm statement.  For
the time being the matcher just returns the first match.  This patch only
implements wildcard matches for memory operands.  Support for register
wildcards will be added in the near future.

llvm-svn: 165057
2012-10-02 21:49:07 +00:00
Chad Rosier f4e35dc672 [ms-inline asm] Add the convertToMapAndConstraints() function that is used to
map constraints and MCInst operands to inline asm operands.  This replaces the
getMCInstOperandNum() function.

The logic to determine the constraints are not in place, so we still default to
a register constraint (i.e., "r"). Also, we no longer build the MCInst but
rather return just the opcode to get the MCInstrDesc.

llvm-svn: 164979
2012-10-01 23:45:51 +00:00
Bob Wilson 165f0a24c6 Consistently specify the assembly variant to MatchInstructionImpl.
llvm-svn: 164611
2012-09-25 17:19:29 +00:00
Chad Rosier c4734c8950 Rather then have a wrapper function, have tblgen instantiate the implementation.
Also remove an unused argument.

llvm-svn: 164567
2012-09-24 22:57:55 +00:00
Chad Rosier 3cb355d11f Rather then have a wrapper function, have tblgen instantiate the implementation.
llvm-svn: 164548
2012-09-24 19:32:29 +00:00
Chad Rosier 17ede627f0 [ms-inline asm] Expose the mnemonicIsValid() function in the AsmParser.
llvm-svn: 164420
2012-09-21 22:21:26 +00:00
Chad Rosier 3d325cf3f1 Add comment.
llvm-svn: 164415
2012-09-21 21:08:46 +00:00
Chad Rosier ab53b4f6d0 [ms-inline asm] Make the operand size directives case insensitive.
llvm-svn: 163729
2012-09-12 18:24:26 +00:00
Chad Rosier b6b8e966d6 StringSwitchify.
llvm-svn: 163649
2012-09-11 21:10:25 +00:00
Chad Rosier 30888b176a Simplify logic. No functional change intended.
llvm-svn: 163648
2012-09-11 20:57:04 +00:00
Chad Rosier 6f8d8b2406 [ms-inline asm] Add support for .att_syntax directive.
llvm-svn: 163542
2012-09-10 20:54:39 +00:00
Benjamin Kramer e3d658bb6c PR13754: llvm-mc/x86 crashes on .cfi directives without the % prefix for registers.
gas accepts this and it seems to be common enough to be worth supporting. This
doesn't affect the parsing of reg operands outside of .cfi directives.

llvm-svn: 163390
2012-09-07 14:51:35 +00:00
Chad Rosier a05ea0f3e3 Fix function name per coding standard.
llvm-svn: 163187
2012-09-05 01:15:43 +00:00
Chad Rosier 9e2aff8b6d [ms-inline asm] Asm operands can map to one or more MCOperands. Therefore, add
the NumMCOperands argument to the GetMCInstOperandNum() function that is set
to the number of MCOperands this asm operand mapped to.

llvm-svn: 163124
2012-09-03 20:31:23 +00:00
Chad Rosier 391d299737 [ms-inline asm] Add an interface to the GetMCInstOperandNum() function in the
MCTargetAsmParser class.

llvm-svn: 163122
2012-09-03 18:47:45 +00:00
Chad Rosier a353dba17d Removed unused argument.
llvm-svn: 163104
2012-09-03 03:16:09 +00:00
Chad Rosier e38bb6a34e [ms-inline asm] Expose the Kind and Opcode variables from the
MatchInstructionImpl() function.

These values are used by the ConvertToMCInst() function to index into the
ConversionTable.  The values are also needed to call the GetMCInstOperandNum()
function.

llvm-svn: 163101
2012-09-03 02:06:46 +00:00
Chad Rosier a8f3c4fe35 The ConvertToMCInst() function can't fail, so remove the now dead Match_ConversionFail enum.
llvm-svn: 163002
2012-08-31 16:41:07 +00:00
Chad Rosier 3b1336ceb9 Typo.
llvm-svn: 162807
2012-08-28 23:57:47 +00:00
Chad Rosier cf172e5e28 [ms-inline asm] Avoid a false positive assertion
Assertion failed: (Start.isValid() == End.isValid() && "Start and end should 
either both be valid or both be invalid!")

when parsing inline asm.  SMLoc assumes that the first char * in the source is
invalid.  However, when parsing an inline asm the mnemonic is at this location.
I don't want to change SMLoc, so use a trivial workaround.

llvm-svn: 162381
2012-08-22 19:14:29 +00:00