Nikola Smiljanic
03ff2596cb
Refactoring. Remove Owned method from Sema.
...
llvm-svn: 209812
2014-05-29 14:05:12 +00:00
Nikola Smiljanic
01a7598561
Refactoring. Remove release and take methods from ActionResult. Rename takeAs to getAs.
...
llvm-svn: 209800
2014-05-29 10:55:11 +00:00
Craig Topper
c3ec149bb2
[C++11] Use 'nullptr'. Sema edition.
...
llvm-svn: 209613
2014-05-26 06:22:03 +00:00
Nico Weber
9ef9ca470f
Support field references to struct names and c++11 aliases from inline asm.
...
This is in addition to the existing support for typedefs.
llvm-svn: 208053
2014-05-06 03:13:27 +00:00
Alp Toker
b6cc592ea3
Fix a bunch of mislayered clang/Lex includes from Sema
...
llvm-svn: 207896
2014-05-03 03:45:55 +00:00
Chad Rosier
b9aff1edb3
[ms-inline asm] Don't diagnose an empty lookup for inline assmebly. This happen
...
for labels in inline assembly that aren't in the lookup tables. E.g.,
__asm {
a:
jmp a
}
rdar://13983623
llvm-svn: 182659
2013-05-24 18:32:55 +00:00
Dmitri Gribenko
ea2d5f818b
Remove redundant variable
...
llvm-svn: 181574
2013-05-10 01:14:26 +00:00
John McCall
f413f5ed44
Move parsing of identifiers in MS-style inline assembly into
...
the actual parser and support arbitrary id-expressions.
We're actually basically set up to do arbitrary expressions here
if we wanted to.
Assembly operands permit things like A::x to be written regardless
of language mode, which forces us to embellish the evaluation
context logic somewhat. The logic here under template instantiation
is incorrect; we need to preserve the fact that an expression was
unevaluated. Of course, template instantiation in general is fishy
here because we have no way of delaying semantic analysis in the
MC parser. It's all just fishy.
I've also fixed the serialization of MS asm statements.
This commit depends on an LLVM commit.
llvm-svn: 180976
2013-05-03 00:10:13 +00:00
Chad Rosier
7359d4793e
[ms-inline asm] Set the OpDecl to the InlineAsmIdentifierInfo struct.
...
Part of rdar://13663589
llvm-svn: 180055
2013-04-22 22:05:00 +00:00
Chad Rosier
b18a285525
[ms-inline asm] Refactor/clean up the SemaLookup interface. No functional
...
change indended.
Part of rdar://13663589
llvm-svn: 180027
2013-04-22 17:01:37 +00:00
Chad Rosier
7f2ab89774
[ms-inline asm] The parsing of C++ identifiers is a task of the front-end parser,
...
not the asm parser. As such, begin moving the parsing logic in that direction.
This patch is just a temporary hack until the real frontend parser can be hooked
up. Part of rdar://13663589
llvm-svn: 179882
2013-04-19 20:37:49 +00:00
Chad Rosier
384823dc32
Specify that we're parsing ms-style inline assembly.
...
llvm-svn: 179762
2013-04-18 15:45:31 +00:00
Chad Rosier
c3aa20265a
Use the ASYContext::getTypeSizeInChars API to cleanup some ugliness, per John
...
and Jordan's suggestion. No functional change intendend.
llvm-svn: 178507
2013-04-01 22:02:05 +00:00
Chad Rosier
10230d4d6e
Cleanup. No functional change intended.
...
llvm-svn: 178481
2013-04-01 17:58:03 +00:00
Bill Wendling
b68b7571a9
Pass the diagnostic in for better error messages.
...
llvm-svn: 178120
2013-03-27 06:06:26 +00:00
Bill Wendling
c4fc3a2ba5
Emit an error message instead of crashing when dereferencing an incomplete pointer type.
...
If the ASM statement is dereferencing an incomplete pointer type, issue an error
instead of crashing.
<rdar://problem/12700799>
llvm-svn: 177915
2013-03-25 21:09:49 +00:00
Bill Wendling
b3b4a37138
Use RequireCompleteType() instead of isIncompleteType().
...
isIncompleteType() returns true or false for template types depending on whether
the type is instantiated yet. In this context, that's arbitrary. The better way
to check for a complete type is RequireCompleteType().
Thanks to Eli Friedman for noticing this!
<rdar://problem/12700799>
llvm-svn: 177768
2013-03-22 21:33:46 +00:00
Jim Grosbach
6f54f787b4
MCParser: Update method names per coding guidelines.
...
s/ParseMSInlineAsm/parseMSInlineAsm/
llvm-svn: 175680
2013-02-20 22:25:15 +00:00
Chad Rosier
282d675b28
[ms-inline asm] Add an error when trying to compile MS-style inline assembly
...
for an unsupported architecture.
rdar://13063988
llvm-svn: 173364
2013-01-24 20:24:34 +00:00
Chad Rosier
4edf11fcf0
[ms-inline asm] Extend the Sema interface to get the size and length of a
...
VarDecl.
Part of rdar://12576868
llvm-svn: 172742
2013-01-17 19:21:24 +00:00
Dmitri Gribenko
f857950d39
Remove useless 'llvm::' qualifier from names like StringRef and others that are
...
brought into 'clang' namespace by clang/Basic/LLVM.h
llvm-svn: 172323
2013-01-12 19:30:44 +00:00
Chad Rosier
8a11f77cf3
[ms-inline asm] Extend the inline asm Sema lookup interface to determine if the
...
Decl is a VarDecl.
Part of rdar://12991541
llvm-svn: 172120
2013-01-10 22:10:16 +00:00
Chandler Carruth
3a02247dc9
Sort all of Clang's files under 'lib', and fix up the broken headers
...
uncovered.
This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.
I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.
llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Eric Christopher
d41010af44
Finish reverting r167761, it's causing test failures.
...
llvm-svn: 167777
2012-11-12 23:13:34 +00:00
Bill Wendling
b1da2cb3fd
Don't test for incomplete types.
...
llvm-svn: 167761
2012-11-12 22:01:56 +00:00
Bill Wendling
887b485dbe
Check that the input size is correct for the given constraint.
...
The 'a', 'c', and 'd' constraints on i386 mean a 32-bit register. We cannot
place a 64-bit value into the 32-bit register. Error out instead of causing the
compiler to spew general badness.
<rdar://problem/12415959>
llvm-svn: 167717
2012-11-12 06:42:51 +00:00
Bill Wendling
9d1ee1175d
Recommit Eric's code to validate ASM string's constraints and modifiers.
...
This code checks the ASM string to see if the output size is able to fit within
the variable specified as the output. For instance, scalar-to-vector conversions
may not really work. It's on by default, but can be turned off with a flag if
you think you know what you're doing.
This is placed under a flag ('-Wasm-operand-widths') and flag group ('-Wasm').
<rdar://problem/12284092>
llvm-svn: 166737
2012-10-25 23:28:48 +00:00
Chad Rosier
5c56364be9
[ms-inline asm] Add support for field lookup in the SemaCallback. Patch by Eli.
...
llvm-svn: 166723
2012-10-25 21:49:22 +00:00
Bill Wendling
d75987dde9
Revert r166647 to rethink the patch...
...
llvm-svn: 166655
2012-10-25 00:32:44 +00:00
Bill Wendling
753c8782df
Add some support for diagnosing possibly mismatched constraint, type size and
...
modifiers. (From an idea by Eric...)
<rdar://problem/12284092>
llvm-svn: 166647
2012-10-25 00:05:55 +00:00
Chad Rosier
b8097dec8f
[ms-inline asm] Update for r166433.
...
llvm-svn: 166489
2012-10-23 17:44:40 +00:00
Eli Friedman
d5d136be5b
[ms-inline-asm] Add handling for errors coming out of the backend.
...
llvm-svn: 166463
2012-10-23 02:43:30 +00:00
Benjamin Kramer
1cdb23db13
Move private classes into anonymous namespaces.
...
llvm-svn: 166377
2012-10-20 13:02:06 +00:00
Chad Rosier
46d8fc9d6b
[ms-inline asm] Set the SemaCallback in the TargetAsmParser.
...
llvm-svn: 166310
2012-10-19 20:36:37 +00:00
Chad Rosier
db97454f8e
[ms-inline asm] Set the MCTargetAsmParser as paring MS-style inline asm.
...
llvm-svn: 166293
2012-10-19 17:58:45 +00:00
Chad Rosier
b91b3f88ad
[ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback,
...
which will be used by the asm matcher in the near future.
llvm-svn: 166221
2012-10-18 20:27:06 +00:00
Chad Rosier
791bbe298d
[ms-inline asm] Have the LookupInlineAsmIdentifier() callback function return a
...
*NamedDecl. In turn, build the expressions after we're finished parsing the
asm. This avoids a crasher if the lookup fails.
llvm-svn: 166213
2012-10-18 19:39:37 +00:00
Chad Rosier
ce2bcbf8c0
[ms-inline asm] Move most of the AsmParsing logic in clang back into the MC
...
layer. Use the new ParseMSInlineAsm() API and add an implementation of the
MCAsmParserSemaCallback interface.
llvm-svn: 166184
2012-10-18 15:49:40 +00:00
Chad Rosier
f8037a1fb6
[ms-inline asm] Move some logic around to simplify the interface between the
...
front-end and the AsmParser. No functional change intended.
llvm-svn: 166063
2012-10-16 21:55:39 +00:00
Chad Rosier
4a0054f383
[ms-inline asm] Rework the front-end to use the API introduced in r165946.
...
-The front-end now builds a single assembly string and feeds it to the
AsmParser. The front-end iterates on a per statement basis by calling the
ParseStatement() function. Please note, the calling of ParseStatement() and
and any notion of MCAsmParsedOperands will be sunk into the MC layer in the
near future. I plan to expose more basic APIs such as getClobbers, etc.
-The enumeration of the AsmString expressions have been reworked to use SMLocs
rather than assembly Pieces, which were being parsed in the front-end.
-The test case, t8(), was modified due to r129223. I'll have to find a way to
work around things such as these.
Sorry for the large commit, but breaking this in multiple smaller commits proved
too irritating.
llvm-svn: 165957
2012-10-15 19:56:10 +00:00
Chad Rosier
ce17b0f5b8
Update for r165858.
...
llvm-svn: 165859
2012-10-13 00:26:22 +00:00
Chad Rosier
aac08d2c3d
[ms-inline asm] Remove a bunch of parsing code from the front-end.
...
llvm-svn: 165851
2012-10-12 23:32:10 +00:00
Chad Rosier
7d1ec922ff
Update for r165833.
...
llvm-svn: 165834
2012-10-12 22:53:52 +00:00
Chad Rosier
941faac455
[ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
...
reimplemented in the AsmParser where it belongs.
llvm-svn: 165825
2012-10-12 21:37:00 +00:00
Benjamin Kramer
25a3470371
Remove unused variable.
...
llvm-svn: 165793
2012-10-12 14:01:58 +00:00
Chad Rosier
98b4164503
Remove dead code introduced in r165751.
...
llvm-svn: 165772
2012-10-12 00:02:48 +00:00
Chad Rosier
dc12c45058
[ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
...
reimplemented in the AsmParser where it belongs.
llvm-svn: 165752
2012-10-11 21:44:41 +00:00
Chad Rosier
e66f42634f
[ms-inline asm] Lookup the IdentifierInfo using the Idents table and remove the
...
now unused static helper function.
The test case needs to be remove temporarily until I can better filter memory
operands that aren't actual variable reference.
llvm-svn: 165751
2012-10-11 21:28:29 +00:00
Chad Rosier
0c1b62779e
Revert 165058, per Jim request. This requires further discussion.
...
llvm-svn: 165070
2012-10-02 23:38:55 +00:00
Chad Rosier
09d7710e04
[ms-inline asm] Rewrite the symbol references as wildcard MCParsedAsmOperands.
...
A Sema lookup is used to determine the size of the variable, which is in turn
used during wildcard matching.
llvm-svn: 165058
2012-10-02 21:49:14 +00:00
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