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

338 Commits

Author SHA1 Message Date
Bruno Cardoso Lopes
f377d1721e Add mcr* and mr*c support to thumb targets
llvm-svn: 123917
2011-01-20 16:35:57 +00:00
Bruno Cardoso Lopes
6e4c5af01e Fix the encoding of t2ISB by using the right class and also parse it correctly
llvm-svn: 123776
2011-01-18 21:17:09 +00:00
Bruno Cardoso Lopes
c1e21b06b9 Follow the current hack set and enable the correct parsing of bkpt while in thumb mode.
llvm-svn: 123772
2011-01-18 20:55:11 +00:00
Daniel Dunbar
12dd48769d McARM: Use accessors where appropriate.
llvm-svn: 123746
2011-01-18 05:55:27 +00:00
Daniel Dunbar
51fef8d445 McARM: Fill in ASMOperand::dump() for memory operands.
llvm-svn: 123745
2011-01-18 05:55:21 +00:00
Daniel Dunbar
f966e16cb0 McARM: Make ARMOperand use a union where appropriate.
llvm-svn: 123744
2011-01-18 05:55:15 +00:00
Daniel Dunbar
0cff3f953b McARM: Unify ParseMemory() successfull return.
llvm-svn: 123740
2011-01-18 05:34:24 +00:00
Daniel Dunbar
3cb5e8b0cb McARM: Early exit on failure (NEFC).
llvm-svn: 123739
2011-01-18 05:34:17 +00:00
Daniel Dunbar
9ea6873c89 McARM: Always keep an offset expression, if used (instead of assuming == 0 if used but not present), and simplify logic.
Also, clean up various non-sensicalisms in isMemModeRegThumb() and isMemModeImmThumb().

llvm-svn: 123738
2011-01-18 05:34:11 +00:00
Daniel Dunbar
8d7ed1f6a8 McARM: Add a variety of asserts on the sanity of memory operands.
llvm-svn: 123737
2011-01-18 05:34:05 +00:00
Daniel Dunbar
aa5e17f3a7 McARM: Use a consistent marker for not-set OffsetRegNum.
llvm-svn: 123736
2011-01-18 05:33:57 +00:00
Owen Anderson
58bcb5d7f2 Recognize alternative register names like ip -> r12.
Fixes <rdar://problem/8857982>.

llvm-svn: 123409
2011-01-13 22:50:36 +00:00
Owen Anderson
18dfab2332 Add support to the ARM MC infrastructure to support mcr and friends. This requires supporting
the symbolic immediate names used for these instructions, fixing their pretty-printers, and
adding proper encoding information for them.

With this, we can properly pretty-print and encode assembly like:
	mrc p15, #0, r3, c13, c0, #3

Fixes <rdar://problem/8857858>.

llvm-svn: 123404
2011-01-13 21:46:02 +00:00
Kevin Enderby
eee2f3489b Fix ARMAsmParser::ParseOperand() to allow it to parse . as a branch target and
directional local labels like 1f and 2b.

llvm-svn: 123393
2011-01-13 20:32:36 +00:00
Evan Cheng
cc474b4864 Model :upper16: and :lower16: as ARM specific MCTargetExpr. This is a step
in the right direction. It eliminated some hacks and will unblock codegen
work. But it's far from being done. It doesn't reject illegal expressions,
e.g. (FOO - :lower16:BAR). It also doesn't work in Thumb2 mode at all.

llvm-svn: 123369
2011-01-13 07:58:56 +00:00
Kevin Enderby
1f82daa2d8 Add a FIXME and two asserts for now in the ARMAsmParser when it sees .code 16 or
.code 32 if the TargetMachine's isThumb() boolean does not match.  The correct
fix is to switch ARM subtargets at that point and is tracked by rdar://8856789
which is bigger task.

llvm-svn: 123353
2011-01-13 01:07:01 +00:00
Jason W Kim
af9782e470 Change call to Error() to assert()
llvm-svn: 123350
2011-01-13 00:27:00 +00:00
Bill Wendling
e82361731d Sort the register list based on the *actual* register numbers rather than the
enum values we give to them. <rdar://problem/8823730>

llvm-svn: 123321
2011-01-12 21:20:59 +00:00
Jason W Kim
db6eddeea3 Workaround for bug 8721.
.s Test added.

llvm-svn: 123292
2011-01-11 23:53:41 +00:00
Evan Cheng
05ef00f4dc Clean up ARM subtarget code by using Triple ADT.
llvm-svn: 123276
2011-01-11 21:46:47 +00:00
Daniel Dunbar
c9c0581897 McARM: Fill in GetMnemonicAcceptInfo().
llvm-svn: 123253
2011-01-11 19:06:29 +00:00
Daniel Dunbar
0cc3d4d8bc McARM: Sketch some logic for determining when to add carry set and predication code operands based on the "canonical mnemonic".
llvm-svn: 123239
2011-01-11 15:59:53 +00:00
Daniel Dunbar
fbc0b96c34 McARM: Add more hard coded logic to SplitMnemonicAndCC to also split out the
carry setting flag from the mnemonic.

Note that this currently involves me disabling a number of working cases in
arm_instructions.s, this is a hopefully short term evil which will be rapidly
fixed (and greatly surpassed), assuming my current approach flies.

llvm-svn: 123238
2011-01-11 15:59:50 +00:00
Daniel Dunbar
0e9ece99bb McARM: Flush out hard coded known non-predicated mnemonic list.
llvm-svn: 123189
2011-01-10 21:01:03 +00:00
Daniel Dunbar
9e911c13c5 MC/ARM/AsmParser: Minor nitty fixes.
llvm-svn: 123175
2011-01-10 15:26:21 +00:00
Daniel Dunbar
d17b4ac127 MC/ARM/AsmParser: Split out SplitMnemonicAndCC().
llvm-svn: 123169
2011-01-10 12:24:52 +00:00
Bill Wendling
b402d3881e Formatting changes. No functionality change.
llvm-svn: 122789
2011-01-03 23:59:05 +00:00
Jim Grosbach
7fc4f99084 Use a StringSwitch<> instead of a manually constructed string matcher.
llvm-svn: 122530
2010-12-24 00:03:39 +00:00
Jim Grosbach
14f46d80df Recognize a few more documented register name aliases for ARM in the asm lexer.
llvm-svn: 122523
2010-12-23 23:19:54 +00:00
Jim Grosbach
b0e9926c33 Trailing whitespace.
llvm-svn: 122456
2010-12-22 23:26:02 +00:00
Bill Wendling
61720b79f9 The tLDR et al instructions were emitting either a reg/reg or reg/imm
instruction based on the t_addrmode_s# mode and what it returned. There is some
obvious badness to this. In particular, it's hard to do MC-encoding when the
instruction may change out from underneath you after the t_addrmode_s# variable
is finally resolved.

The solution is to revert a long-ago change that merged the reg/reg and reg/imm
versions. There is the addition of several new addressing modes. They no longer
have extraneous operands associated with them. I.e., if it's reg/reg we don't
have to have a dummy zero immediate tacked on to the SDNode.

There are some obvious cleanups here, which will happen shortly.

llvm-svn: 121747
2010-12-14 03:36:38 +00:00
Kevin Enderby
a2efb1ad4e Fix the leak from r121401 of the Operands erased in the list but not deleted.
llvm-svn: 121450
2010-12-10 01:41:56 +00:00
Kevin Enderby
55cb19813e Add support for parsing ARM arithmetic instructions that update or don't update
the condition codes.  Where the ones that do have an 's' suffix and the ones
that don't don't have the suffix.  The trick is if MatchInstructionImpl() fails
we try again after adding a CCOut operand with the correct value and removing
the 's' if present.  Four simple test cases added for now, lots more to come.

llvm-svn: 121401
2010-12-09 19:19:43 +00:00
Benjamin Kramer
fb17a54866 Add parens to pacify gcc.
llvm-svn: 121142
2010-12-07 15:50:35 +00:00
Jim Grosbach
6c27b4f3cf Encode the register operand of ARM CondCode operands correctly. ARM::CPSR if
the instruction is predicated, reg0 otherwise.

llvm-svn: 121020
2010-12-06 18:30:57 +00:00
Jim Grosbach
c79c6290ee The ARM AsmMatcher needs to know that the CCOut operand is a register value,
not an immediate. It stores either ARM::CPSR or reg0.

llvm-svn: 121018
2010-12-06 18:21:12 +00:00
Bill Wendling
e85934f8a5 * Add support for encoding t_addrmode_s2 and t_addrmode_s1. They are the same as
t_addrmode_s4, but with a different scaling factor.

* Encode the Thumb1 load and store instructions. This involved a bit of
  refactoring (hi, Chris! :-). Some of the patterns became dead afterwards and
  were removed.

llvm-svn: 120482
2010-11-30 22:57:21 +00:00
Bill Wendling
ae920bcc50 Add parsing for the Thumb t_addrmode_s4 addressing mode. This can almost
certainly be made more generic. But it does allow us to parse something like:

          ldr     r3, [r2, r4]

correctly in Thumb mode.

llvm-svn: 120408
2010-11-30 07:44:32 +00:00
Jim Grosbach
81880e96fc Add a few missing initializers.
llvm-svn: 120350
2010-11-29 23:41:10 +00:00
Jim Grosbach
4e37703b2c Nuke trailing whitespace.
llvm-svn: 120344
2010-11-29 23:18:01 +00:00
Bill Wendling
a017020098 The "trap" instruction is one of this which doesn't have a condition code. Hack
the code to not add a "condition code" if it's trap.

llvm-svn: 119937
2010-11-21 10:56:05 +00:00
Bill Wendling
48cce64ab5 Use array_pod_sort because the list is contiguous.
llvm-svn: 119769
2010-11-19 00:38:19 +00:00
Bill Wendling
ef43273c51 Add support for parsing the writeback ("!") token.
llvm-svn: 119761
2010-11-18 23:43:05 +00:00
Bill Wendling
510e600542 Don't allocate the SmallVector of Registers. It gets messy figuring out who
should delete what when the object gets copied around. It's also making valgrind
upset.

llvm-svn: 119747
2010-11-18 21:50:54 +00:00
Bill Wendling
f0a1acba8c Proper encoding for VLDM and VSTM instructions. The register lists for these
instructions have to distinguish between lists of single- and double-precision
registers in order for the ASM matcher to do a proper job. In all other
respects, a list of single- or double-precision registers are the same as a list
of GPR registers.

llvm-svn: 119460
2010-11-17 04:32:08 +00:00
Bill Wendling
87c781b411 Emit a '!' if this is a "writeback" register or memory address.
llvm-svn: 118662
2010-11-10 01:07:54 +00:00
Matt Beaumont-Gay
993d07638e Rename a parameter to avoid confusion with a local variable
llvm-svn: 118656
2010-11-10 00:08:58 +00:00
Bill Wendling
0c082b811f Emit the warning about the register list not being in ascending order only once.
llvm-svn: 118653
2010-11-09 23:45:59 +00:00
Bill Wendling
8cfb0a507e s/std::vector/SmallVector/
llvm-svn: 118648
2010-11-09 23:28:44 +00:00
Bill Wendling
01897eaa4e Delete the allocated vector.
llvm-svn: 118644
2010-11-09 22:51:42 +00:00
Bill Wendling
63cfae801d Two types of instructions have register lists:
* LDM, et al, uses a bit mask to indicate the register list.
* VLDM, et al, uses a base register plus number.

The LDM instructions may be non-contiguous, but the VLDM ones must be
contiguous. Those are semantic checks that should be done later in the
compiler. Also postpone the creation of the bit mask until it's needed.

llvm-svn: 118640
2010-11-09 22:44:22 +00:00
Bill Wendling
2ff2ee2765 The "addRegListOperands()" function returns the start register and the total
number of registers in the list.

llvm-svn: 118456
2010-11-08 23:49:57 +00:00
Bill Wendling
611dbaee50 Revert.
llvm-svn: 118389
2010-11-08 00:32:40 +00:00
Bill Wendling
1338bc5cac In this context, a reglist is a reg.
llvm-svn: 118375
2010-11-07 13:08:28 +00:00
Bill Wendling
0493b6982a Add support for parsing register lists. We can't use a bitfield to keep track of
the registers, because the register numbers may be much greater than the number
of bits available in the machine's register.

I extracted the register list verification code out of the actual parsing of the
registers. This made checking for errors much easier. It also limits the number
of warnings that would be emitted for cascading infractions.

llvm-svn: 118363
2010-11-06 22:36:58 +00:00
Bill Wendling
7e32b2f98a Return the base register of a register list for the "getReg()" method. This is
to satisfy the ClassifyOperand method of the Asm matcher without having to add a
RegList type to every back-end.

llvm-svn: 118360
2010-11-06 22:19:43 +00:00
Bill Wendling
dabc5e5b02 General cleanup:
- Make ARMOperand a class so that some things are internal to the class.
- Reformatting.

llvm-svn: 118357
2010-11-06 21:42:12 +00:00
Bill Wendling
ac0e90a877 Add a RegList (register list) object to ARMOperand. It will be used soon to hold
(surprise!) a list of registers. Register lists are consecutive, so we only need
to record the start register plus the number of registers.

llvm-svn: 118351
2010-11-06 19:56:04 +00:00
Bill Wendling
e35565699c Fix grammar.
llvm-svn: 118341
2010-11-06 10:51:53 +00:00
Bill Wendling
84ce225095 Fix grammar.
llvm-svn: 118340
2010-11-06 10:48:18 +00:00
Bill Wendling
f2e9379095 MatchRegisterName() returns 0 if it can't match the register.
llvm-svn: 118339
2010-11-06 10:45:34 +00:00
Bill Wendling
f65f39e7a1 Use TryParseRegister() instead of MatchRegisterName(). The former returns -1
while the latter doesn't.

llvm-svn: 118338
2010-11-06 10:40:24 +00:00
Jim Grosbach
009007e690 Hook up the '.code {16|32}' directive to the streamer.
llvm-svn: 118310
2010-11-05 22:40:53 +00:00
Jim Grosbach
3d432a39dd Hook up the '.thumb_func' directive to the streamer.
llvm-svn: 118307
2010-11-05 22:33:53 +00:00
Jim Grosbach
dfa87da932 Fix past-o.
llvm-svn: 118304
2010-11-05 22:11:33 +00:00
Bill Wendling
34599f4aa8 The MC code couldn't handle ARM LDR instructions with negative offsets:
vldr.64 d1, [r0, #-32]

The problem was with how the addressing mode 5 encodes the offsets. This change
makes sure that the way offsets are handled in addressing mode 5 is consistent
throughout the MC code. It involves re-refactoring the "getAddrModeImmOpValue"
method into an "Imm12" and "addressing mode 5" version. But not to worry! The
majority of the duplicated code has been unified.

llvm-svn: 118144
2010-11-03 01:49:29 +00:00
Jim Grosbach
acc28d1b2a Add FIXME.
llvm-svn: 117936
2010-11-01 18:11:14 +00:00
Jim Grosbach
76910aa62f Mark ARM subtarget features that are available for the assembler.
llvm-svn: 117929
2010-11-01 16:59:54 +00:00
Jim Grosbach
2605b2b54f trailing whitespace
llvm-svn: 117927
2010-11-01 16:44:21 +00:00
Jim Grosbach
775afa274f Tidy up.
llvm-svn: 117782
2010-10-30 12:59:16 +00:00
Chris Lattner
deabc3d7fa simplify this code.
llvm-svn: 117771
2010-10-30 04:35:59 +00:00
Chris Lattner
3a36dd4a0b split MaybeParseRegister into its two logical uses, eliminating malloc+free traffic.
llvm-svn: 117769
2010-10-30 04:09:10 +00:00
Bill Wendling
b68e0d0ee3 Some instructions end with an "ls" prefix, but it doesn't indicate that they are
conditional. Check for those instructions explicitly.

llvm-svn: 117747
2010-10-29 23:50:21 +00:00
Jim Grosbach
e811e91d02 add FIXME
llvm-svn: 117718
2010-10-29 21:56:51 +00:00
Jim Grosbach
edec5cc6b8 Handle ARM addrmode5 instructions with an offset.
llvm-svn: 117672
2010-10-29 17:41:25 +00:00
Jim Grosbach
6f257bd31b Revert 117660. Apparently it's not as trivial as that...
llvm-svn: 117663
2010-10-29 16:50:53 +00:00
Jim Grosbach
8c9a2ee86e ARM addrmode5 instructions have neither writeback nor post-indexed modes.
llvm-svn: 117660
2010-10-29 16:38:59 +00:00
Jim Grosbach
29961ebfc5 Trailing whitespace.
llvm-svn: 117651
2010-10-29 14:46:02 +00:00
Benjamin Kramer
f2442da5f6 ARMAsmParser: Plug a memory leak.
llvm-svn: 117648
2010-10-29 09:43:39 +00:00
Eric Christopher
930a767468 Add an unreachable to silence warning - the switch is actually
fully enumerated.

llvm-svn: 117647
2010-10-29 09:26:59 +00:00
Chris Lattner
115cd02d22 add simple support for addrmode5 operands, allowing
vldr.64 to work.  I have no idea if this is fully right, but 
it is in the right direction.

llvm-svn: 117626
2010-10-29 00:27:31 +00:00
Chris Lattner
ef237e6013 give better error diagnostics, for example:
t.s:1:14: error: invalid operand for instruction
vldr.64	d17, [r0]   
       	     ^

instead of:

t.s:1:1: error: unrecognized instruction
vldr.64	d17, [r0]   
^

llvm-svn: 117611
2010-10-28 21:41:58 +00:00
Chris Lattner
4210ffb9c5 move a method out of line.
llvm-svn: 117605
2010-10-28 21:28:01 +00:00
Chris Lattner
b6c7a9e204 remove the rest of hte owningptr's, no functionality change.
llvm-svn: 117603
2010-10-28 20:52:15 +00:00
Chris Lattner
0a21ad2553 rearrange ParseRegisterList.
llvm-svn: 117560
2010-10-28 17:23:41 +00:00
Chris Lattner
a9c0f00f10 refactor some code to simplify it, eliminating some owningptr's.
llvm-svn: 117559
2010-10-28 17:20:03 +00:00
Chandler Carruth
55850cad48 Remove remaining uses of ATTRIBUTE_UNUSED on variables, and delete three
#includes in the process.

llvm-svn: 116919
2010-10-20 08:27:02 +00:00
Chris Lattner
cbecb9a4d3 implement rdar://8456378 and PR7557 - support for the fstsw,
an instruction that requires a WHOLE NEW wonderful kind of alias.

llvm-svn: 115015
2010-09-29 01:50:45 +00:00
Chris Lattner
9b9a847b8c change the protocol TargetAsmPArser::MatchInstruction method to take an
MCStreamer to emit into instead of an MCInst to fill in.  This allows the
matcher extra flexibility and is more convenient.

llvm-svn: 115014
2010-09-29 01:42:58 +00:00
Michael J. Spencer
90f807fda5 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

llvm-svn: 113819
2010-09-13 23:59:48 +00:00
Chris Lattner
ffe1efe7ef fix the asmparser so that the target is responsible for skipping to
the end of the line on a parser error, allowing skipping to happen
for syntactic errors but not for semantic errors.  Before we would
miss emitting a diagnostic about the second line, because we skipped
it due to the semantic error on the first line:

  foo %eax
  bar %al

This fixes rdar://8414033 - llvm-mc ignores lines after an invalid instruction mnemonic errors

llvm-svn: 113688
2010-09-11 16:18:25 +00:00
Michael J. Spencer
98ad3f2ea7 CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Chris Lattner
0e0f9094e9 change the MC "ParseInstruction" interface to make it the
implementation's job to check for and lex the EndOfStatement
marker.

llvm-svn: 113347
2010-09-08 05:10:46 +00:00
Chris Lattner
6bfa0d9988 in the case where an instruction only has one implementation
of a mneumonic, report operand errors with better location
info.  For example, we now report:

t.s:6:14: error: invalid operand for instruction
        cwtl $1
             ^

but we fail for common cases like:

t.s:11:4: error: invalid operand for instruction
   addl $1, $1
   ^

because we don't know if this is supposed to be the reg/imm or imm/reg
form.

llvm-svn: 113178
2010-09-06 22:11:18 +00:00
Chris Lattner
22bb9cb511 change MatchInstructionImpl to return an enum instead of bool.
llvm-svn: 113165
2010-09-06 19:22:17 +00:00
Chris Lattner
45a204be76 have AsmMatcherEmitter.cpp produce the hunk of code that gets included
into the middle of the class, and rework how the different sections of
the generated file are conditionally included for simplicity.

llvm-svn: 113163
2010-09-06 19:11:01 +00:00
Chris Lattner
b911e51b26 zap dead code.
llvm-svn: 112712
2010-09-01 16:04:34 +00:00
Daniel Dunbar
f2b4982344 MC/AsmParser: Push the burdon of emitting diagnostics about unmatched
instructions onto the target specific parser, which can do a better job.

llvm-svn: 110889
2010-08-12 00:55:38 +00:00
Daniel Dunbar
0a98bc5619 tblgen/AsmMatcher: Always emit the match function as 'MatchInstructionImpl',
target specific parsers can adapt the TargetAsmParser to this.

llvm-svn: 110888
2010-08-12 00:55:32 +00:00
Daniel Dunbar
bc7c0a60da MC/ARM: Add basic support for handling predication by parsing it out of the mnemonic into a separate operand form.
llvm-svn: 110794
2010-08-11 06:37:20 +00:00
Daniel Dunbar
63628f1443 MC/ARM: Split mnemonic on '.' characters.
llvm-svn: 110793
2010-08-11 06:37:16 +00:00
Daniel Dunbar
bbaa88a848 MC/ARM: Fill in ARMOperand::dump a bit.
llvm-svn: 110792
2010-08-11 06:37:12 +00:00
Daniel Dunbar
ee80a239ed MCAsmParser: Add dump() hook to MCParsedAsmOperand.
llvm-svn: 110790
2010-08-11 06:37:04 +00:00
Daniel Dunbar
74ed9321a3 MC/ARM: Add an ARMOperand class for condition codes.
llvm-svn: 110788
2010-08-11 06:36:53 +00:00
Daniel Dunbar
89a64ee590 MC/ARM: Switch to using the generated match functions instead of stub implementations.
llvm-svn: 110783
2010-08-11 05:24:50 +00:00
Daniel Dunbar
150021561c Target: Give the TargetAsmParser access to the TargetMachine.
- Unfortunate, but necessary for now to handle subtarget instruction matching. Eventually we should factor out the lower level target machine information so we don't need to do this.

llvm-svn: 108664
2010-07-19 00:33:49 +00:00
Benjamin Kramer
da3e6cdb26 Don't pass StringRef by reference.
llvm-svn: 108366
2010-07-14 22:38:02 +00:00
Duncan Sands
f7b98e2b1e Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Duncan Sands
9eff796264 Remove unused variable Loc and pointless variables unified_syntax
and thumb_mode.

llvm-svn: 107133
2010-06-29 13:04:35 +00:00
Ted Kremenek
cce8f54757 Update CMake build.
llvm-svn: 100714
2010-04-07 23:05:23 +00:00
Sean Callanan
8ac8cf3f10 Added an AsmLexer for the ARM target, which uses
a simple mapping of register names to IDs to
identify register tokens.

llvm-svn: 100685
2010-04-07 20:29:34 +00:00
Sean Callanan
d04b3e0657 Added support for reporting operand token ranges
to the ARM AsmParser.

llvm-svn: 100232
2010-04-02 22:27:05 +00:00
Jeffrey Yasskin
876e602378 Fix LLVM build when the user specifies CPPFLAGS on the make command line.
llvm-svn: 98394
2010-03-12 21:42:14 +00:00
Chris Lattner
5a57121631 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Chris Lattner
276811b58a Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner
9a84d96edf create a new MCParser library and move some stuff into it.
llvm-svn: 94129
2010-01-22 01:44:57 +00:00
Sean Callanan
4bb95fd7d6 Promoted the getTok() method to MCAsmParser so that
the two token accessor functions are declared consistently.
Modified the clients of MCAsmParser to reflect this change.

llvm-svn: 93916
2010-01-19 21:44:56 +00:00
Sean Callanan
7fa5ebbed0 Propagated the parser-side Lex function's declaration to
MCAsmParser, and changed the target-specific AsmParsers
to use it.

llvm-svn: 93900
2010-01-19 20:27:46 +00:00
Chris Lattner
336c2b0d47 Generalize mcasmstreamer data emission APIs to take an address space
identifier.  There is no way to work around it.

llvm-svn: 93896
2010-01-19 19:46:13 +00:00
Chris Lattner
882cb240a6 Split the TargetAsmParser "ParseInstruction" interface in half:
the new ParseInstruction method just parses and returns a list of
target operands.  A new MatchInstruction interface is used to
turn the operand list into an MCInst.

This requires new/deleting all the operands, but it also gives 
targets the ability to use polymorphic operands if they want to. 

llvm-svn: 93469
2010-01-14 22:21:20 +00:00
Chris Lattner
ceabb11a5e prune #includes in TargetAsmParser.h
Pass in SMLoc of instr opcode into ParseInstruction.
Make AsmToken be a class, not a struct.

llvm-svn: 93457
2010-01-14 21:32:45 +00:00
Chris Lattner
c0321eb1aa introduce MCParsedAsmOperand
llvm-svn: 93455
2010-01-14 21:21:40 +00:00
Bill Wendling
baec6e54f4 Add an "ATTRIBUTE_UNUSED" macro (and use it). It's for variables which are
mainly used in debugging and/or assert situations. It should make the compiler
and the static analyzer stop nagging us about them.

llvm-svn: 92181
2009-12-28 01:20:29 +00:00
John McCall
e3df19422d Every anonymous namespace is different. Caught by clang++.
llvm-svn: 91481
2009-12-16 00:15:28 +00:00
Kevin Enderby
633b294095 Fix ARMAsmParser::ParseMemoryOffsetReg() where the parameter OffsetRegNum should
have been passed as a reference.

llvm-svn: 85823
2009-11-02 20:14:39 +00:00
Kevin Enderby
c8d047130a Updates to the ARM target assembler for llvm-mc per review comments from
Daniel Dunbar.
- Reordered the fields in the ARMOperand Mem struct to make the struct smaller.
Making bool's into 1 bit fields and put the MCExpr* fields adjacent to each
other.
- Fixed a number of places in ARMAsmParser.cpp so they have doxygen comments.
- Change the name of ARMAsmParser::ParseRegister() to MaybeParseRegister and
added the bool ParseWriteBack parameter.
- Changed ARMAsmParser::ParseMemory() to call MaybeParseRegister().
- Added ARMAsmParser::ParseMemoryOffsetReg to factor out parsing the offset of a
memory operand.  And use it for both parsing both preindexed and post indexing
addressing forms in ARMAsmParser::ParseMemory.
- Changed the first argument to ParseShift() to a reference.
- Changed ParseShift() to check for Rrx first and return to reduce nesting.

llvm-svn: 85632
2009-10-30 22:55:57 +00:00
Daniel Dunbar
87b361d3d6 Wire up the ARM MCInst printer, for llvm-mc.
llvm-svn: 84600
2009-10-20 05:15:36 +00:00
Kevin Enderby
f2a8226515 Fix ARM memory operand parsing of post indexing with just a base register, that
is just "[Rn]" and no tailing comma with an offset, etc.

llvm-svn: 84205
2009-10-15 21:42:45 +00:00
Kevin Enderby
48a0aac679 More bits of the ARM target assembler for llvm-mc, code added to parse labels
as expressions, code for parsing a few arm specific directives (still needs
the MCStreamer calls for these).  Some clean up of the operand parsing code
and adding some comments.

llvm-svn: 84201
2009-10-15 20:48:48 +00:00
Kevin Enderby
8d8e57983a Correct comment about ARM immediates using '#' not '$' and TODO for modifiers.
llvm-svn: 84055
2009-10-13 23:33:38 +00:00
Kevin Enderby
959ec973ad More bits of the ARM target assembler for llvm-mc to parse immediates.
Also fixed a couple of coding style things that crept in.  And added more
to the temporary hacked up ARMAsmParser::MatchInstruction() method for testing.

llvm-svn: 84040
2009-10-13 22:19:02 +00:00
Kevin Enderby
c4125fbeb8 Fix two warnings about unused variables that are only used in assert() calls.
llvm-svn: 83917
2009-10-12 22:51:49 +00:00
Kevin Enderby
29f78ac638 Fix a problem in the code where ARMAsmParser::ParseShift() second argument
should have been a pointer to a reference.

llvm-svn: 83915
2009-10-12 22:39:54 +00:00
Kevin Enderby
430e05312d Added another bit of the ARM target assembler to llvm-mc to parse register
lists.  Changed ARMAsmParser::MatchRegisterName to return -1 instead of 0 on
errors so 0-15 values could be returned as register numbers.  Also added the
rest of the arm register names to the currently hacked up version to allow more
testing.  Some changes to ARMAsmParser::ParseOperand to give different errors
for things not yet supported and some additions to the hacked
ARMAsmParser::MatchInstruction to allow more testing for now.

llvm-svn: 83673
2009-10-09 21:12:28 +00:00
Kevin Enderby
c0d0a1ec58 Add another bit of the ARM target assembler to llvm-mc to parse registers
with writeback, things like "sp!", etc.  Also added some more stuff to the
temporarily hacked methods ARMAsmParser::MatchRegisterName and
ARMAsmParser::MatchInstruction to allow more parser testing.

llvm-svn: 83477
2009-10-07 18:01:35 +00:00
Kevin Enderby
2c772c1ae9 Added bits of the ARM target assembler to llvm-mc to parse some load instruction
operands.  Some parsing of arm memory operands for preindexing and postindexing
forms including with register controled shifts.  This is a work in progress.

llvm-svn: 83424
2009-10-06 22:26:42 +00:00
Ted Kremenek
477a21a996 Remove invalid add_dependencies line to unbreak the CMake build.
llvm-svn: 81827
2009-09-15 04:06:36 +00:00
Kevin Enderby
da3290e68c Added the first bits of the ARM target assembler to llvm-mc. For now it only
parses the .word directive as 4 bytes and ARMAsmParser::ParseInstruction will
give an error is called.  Broke out the test of the .word directive into two
different test cases, one for x86 and one for arm.

llvm-svn: 81817
2009-09-15 00:27:25 +00:00