Chad Rosier
04d5664295
[ms-inline asm] Enhance the isSimpleMSAsm() function to handle operands with pointer size
...
directives (e.g., dword ptr [eax]).
llvm-svn: 165031
2012-10-02 18:51:05 +00:00
Chad Rosier
0ede0986b9
No need to call the InitializeAll* functions.
...
llvm-svn: 165025
2012-10-02 16:41:12 +00:00
Chad Rosier
bb90c414c4
[ms-inline asm] Use the convertToMapAndConstraints() function in the front-end.
...
Rework the logic to account for the fact that we no longer create a MCInst.
llvm-svn: 164980
2012-10-01 23:45:59 +00:00
Bob Wilson
24719e3236
Examine the last, not the first, instruction from the MC matcher.
...
If an MS-style inline asm is matched to multiple instructions, e.g., with a
a WAIT-prefix, then we need to examine the operands of the last instruction
instruction, not the prefix instruction.
llvm-svn: 164608
2012-09-25 16:30:16 +00:00
Chad Rosier
93b3eb7793
Update for r164567.
...
llvm-svn: 164568
2012-09-24 22:58:50 +00:00
Bob Wilson
317be45091
Replace an assertion with an error for empty __asm statements.
...
llvm-svn: 164551
2012-09-24 19:57:59 +00:00
Bob Wilson
0fc64f0b11
Fix a comment typo and clean up formatting.
...
llvm-svn: 164550
2012-09-24 19:57:55 +00:00
Chad Rosier
90cad09ba5
[ms-inline asm] Use mnemonicIsValid() in a helpful assert.
...
llvm-svn: 164421
2012-09-21 22:22:39 +00:00
Chad Rosier
f83315fd4a
Add a few FIXMEs.
...
llvm-svn: 163758
2012-09-13 00:20:37 +00:00
Chad Rosier
b261a50b40
[ms-inline asm] Handle the enumeration of input and output expressions in a
...
more robust way to address a few FIXMEs.
The initial implementation, r163342, built the IR asm string and then tried to
patch things on the fly without enough context. Specifically, it didn't skip
mnemonics nor did it track with assembly instruction an expression was related
to. The new implementation patches the operands and then builds the final
IR string.
llvm-svn: 163756
2012-09-13 00:06:55 +00:00
Chad Rosier
57cd91f683
[ms-inline asm] If we have a single asm operand that maps to multiple
...
MCOperands then iterate over all of then when computing clobbers, inputs and
outputs.
On x86 the 1-to-many mapping is a memory operand that includes a BaseReg(reg),
MemScale(imm), MemIndexReg(reg), an Expr(MCExpr or imm) and a MemSegReg(reg).
Invalid register (Op.getReg() == 0) are not considered when computing clobber.
llvm-svn: 163728
2012-09-12 18:14:25 +00:00
Chad Rosier
a4f52e16a5
[ms-inline asm] isDef/NumDefs in this context only refer to register definitions, not memory definitions.
...
llvm-svn: 163666
2012-09-11 23:53:48 +00:00
Chad Rosier
911d50fe4e
[ms-inline asm] As of r163657 this check is unnecessary.
...
llvm-svn: 163665
2012-09-11 23:48:00 +00:00
Chad Rosier
ee94a2ebd5
[ms-inline asm] Don't consider tokens or immediates when computing clobbers, inputs and outputs.
...
llvm-svn: 163657
2012-09-11 23:13:15 +00:00
Chad Rosier
bd7fdadb90
[ms-inline asm] Add $$ before numeric constants in the IR.
...
llvm-svn: 163581
2012-09-11 00:51:28 +00:00
Chad Rosier
46b0a0adbe
[ms-inline asm] Output empty asm statements for the directives we don't
...
handle. Otherwise, the AsmParser will explode if we try to generate an
object files.
llvm-svn: 163345
2012-09-06 19:56:25 +00:00
Chad Rosier
c05d2c908d
[ms-inline asm] The IR representation of inline assembly enumerates the input
...
and output expressions much like that in GNU-style inline assembly. Output
expressions are first. Do this for MS-style inline asms.
llvm-svn: 163342
2012-09-06 19:35:00 +00:00
Chad Rosier
87b3d03cc2
Update for r163187.
...
llvm-svn: 163188
2012-09-05 01:16:06 +00:00
Chad Rosier
dea7964ddb
[ms-inline asm] The MCInstrDesc only tracks register definitions. For now,
...
assume that if the 1st operands is an expression and the instruction mayStore,
then it is a memory definition.
llvm-svn: 163144
2012-09-04 16:39:38 +00:00
Chad Rosier
5c8822d3ff
Fix 80-column violation.
...
llvm-svn: 163142
2012-09-04 15:58:44 +00:00
Chad Rosier
93380f63c9
[ms-inline asm] Use the new GetMCInstOperandNum() interface in the front-end.
...
llvm-svn: 163126
2012-09-03 20:40:52 +00:00
Chad Rosier
fd648a0320
Removed unused argument.
...
llvm-svn: 163105
2012-09-03 03:16:15 +00:00
Chad Rosier
30c0cb2f30
[ms-inline asm] Update for the MatchInstruction API change in r163101.
...
llvm-svn: 163102
2012-09-03 02:30:13 +00:00
Chad Rosier
6f0a9a2e2f
Revert r162424 now that the scoping issue has been fixed in r162444.
...
llvm-svn: 162797
2012-08-28 22:08:58 +00:00
Chad Rosier
7ae6360758
Tidy up.
...
llvm-svn: 162786
2012-08-28 20:35:06 +00:00
Chad Rosier
3dd7bf2c86
[ms-inline asm] Add constraints to MSAsmStmt. We don't currently compute
...
the constraints, so in the interim we speculatively assume a 'r' constraint.
This is expected to work for most cases on x86.
llvm-svn: 162784
2012-08-28 20:28:20 +00:00
Chad Rosier
de70e0ef45
[ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
...
No functional change intended.
llvm-svn: 162632
2012-08-25 00:11:56 +00:00
Chad Rosier
175ea24e38
[ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a
...
CodeGen option to a LangOpt option. In turn, hoist the guard into the parser
so that we avoid the new (and fairly unstable) Sema/AST/CodeGen logic. This
should restore the behavior of clang to that prior to r158325.
<rdar://problem/12163681>
llvm-svn: 162602
2012-08-24 21:42:51 +00:00
Benjamin Kramer
c5d00f61b6
Remove unnecessary calls to c_str.
...
llvm-svn: 162590
2012-08-24 20:43:21 +00:00
Chad Rosier
1e17cf9c22
[ms-inline asm] Generate the Input/Output expressions using
...
Sema::ActOnIdExpression().
llvm-svn: 162564
2012-08-24 16:38:58 +00:00
Chad Rosier
ab24b6e24e
Fix 80-column violation.
...
llvm-svn: 162560
2012-08-24 15:51:10 +00:00
Chad Rosier
fe31e626ca
[ms-inline asm] Add the basic APIs for Exprs to the MSAsmStmt AST. Next we need
...
generate the Input/Output expressions using Sema::ActOnIdExpression().
llvm-svn: 162509
2012-08-24 00:07:09 +00:00
Benjamin Kramer
cc4c49dd63
Now that ASTMultiPtr is nothing more than a array reference, make it a MutableArrayRef.
...
This required changing all get() calls to data() and using the simpler constructors.
llvm-svn: 162501
2012-08-23 23:38:35 +00:00
Chad Rosier
8e0744312b
[ms-inline asm] Rename a few induction variables to avoid confusion and silence
...
a gcc warning.
llvm-svn: 162444
2012-08-23 15:44:35 +00:00
Matt Beaumont-Gay
1e774bc835
Don't recycle loop variables (to keep GCC happy).
...
llvm-svn: 162424
2012-08-23 01:51:18 +00:00
Chad Rosier
0cf0615571
Fix 80-column violation.
...
llvm-svn: 162416
2012-08-23 00:12:51 +00:00
Chad Rosier
f4958d1f10
[ms-inline asm] Compute the inputs and outputs. No test case (yet) as this
...
requires codegen support.
llvm-svn: 162410
2012-08-22 23:42:09 +00:00
Chad Rosier
dc5311aab6
[ms-inline asm] Refactor code so that we can begin computing the Inputs/Outputs.
...
No functional change intended.
llvm-svn: 162403
2012-08-22 22:10:51 +00:00
Chad Rosier
eb7deb2851
[ms-inline asm] Add comments.
...
llvm-svn: 162396
2012-08-22 21:12:19 +00:00
Chad Rosier
53d79d9905
[ms-inline asm] Add comments.
...
llvm-svn: 162394
2012-08-22 21:08:06 +00:00
Chad Rosier
bb365caf80
[ms-inline asm] Add helper function. No functional change intended.
...
llvm-svn: 162393
2012-08-22 21:04:07 +00:00
Chad Rosier
6b6a8a363b
[ms-inline asm] Simplify logic. No functional change intended.
...
llvm-svn: 162392
2012-08-22 20:57:07 +00:00
Chad Rosier
060c0ea89a
[ms-inline asm] Compute the token range for each instruction within the asm.
...
Eventually, we'll need a way of mapping tokens (and their IdentifierInfo*) to
the operands computed by buildMSAsmPieces().
llvm-svn: 162388
2012-08-22 20:30:58 +00:00
Chad Rosier
a766697f4e
[ms-inline asm] Simplify logic. No functional change intended.
...
llvm-svn: 162385
2012-08-22 19:50:28 +00:00
Chad Rosier
d997bd1422
[ms-inline asm] Start sending non-simple inline asms to the AsmParser.
...
The parser still can't handle all cases, so fall back to emitting a simple
MSAsmStmt if we get into trouble.
llvm-svn: 162382
2012-08-22 19:18:30 +00:00
Chad Rosier
bbdd467895
[ms-inline asm] Remove the patchMSAsmStrings function. After some discussion
...
between Bob, Jim, Eric and I, we've decided to take a slightly different
approach.
llvm-svn: 162327
2012-08-21 23:09:21 +00:00
Chad Rosier
b958037958
[ms-inline asm] Have buildMSAsmString build a vector of unmodified AsmStrings.
...
Add a new static function, buildMSAsmPieces, that will break these strings down
into mnemonic and operands. Upon a match failure, the idea is to use the
ErrorInfo from MatchInstructionImpl to inspect the mnemonic/operand and
decide a course of action. Unfortunately, there's no easy way to test this at
the moment.
llvm-svn: 162321
2012-08-21 21:56:39 +00:00
Chad Rosier
5111f8650d
[ms-inline asm] Do not report a Parser error when matching inline assembly.
...
llvm-svn: 162307
2012-08-21 19:37:55 +00:00
Chad Rosier
19160b6e39
[ms-inline asm] Expose the ErrorInfo from the MatchInstructionImpl. In general,
...
this is the index of the operand that failed to match.
llvm-svn: 162296
2012-08-21 18:15:08 +00:00
Chad Rosier
5e80ced3f6
[ms-inline asm] Append identifier for better debugging.
...
llvm-svn: 162289
2012-08-21 17:02:27 +00:00
Chad Rosier
b84cc6cfa3
[ms-inline asm] Remove this test case and the associated special case code.
...
llvm-svn: 162288
2012-08-21 17:01:26 +00:00
Chad Rosier
d4e55b8e35
[ms-inline asm] Remove old cruft now that MS-style asms their own code path.
...
llvm-svn: 162210
2012-08-20 17:11:53 +00:00
Chad Rosier
571c5e91c4
[ms-inline asm] Update comment.
...
llvm-svn: 162134
2012-08-17 21:27:25 +00:00
Chad Rosier
0731affaca
[ms-inline asm] Extract AsmStmt handling into a separate file, so as to not
...
pollute SemaStmt with extraneous asm handling logic.
llvm-svn: 162132
2012-08-17 21:19:40 +00:00