Commit Graph

17108 Commits

Author SHA1 Message Date
Richard Smith
fe4ef2c2ae Don't use -1 as a value of an unsigned 7-bit enumeration; that has undefined
behavior and violates the !range constraints we put on loads of this enum.
Found by clang -fsanitize=enum.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170653 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 04:02:58 +00:00
Richard Smith
e8ce626308 Don't leave IsUnsigned uninitialized in a default-constructed APSInt. Copying
such a structure has undefined behavior. Caught by -fsanitize=bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 03:59:24 +00:00
Bill Wendling
f6670729aa s/AttributesImpl/AttributeImpl/g This is going to apply to Attribute, not Attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170631 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 01:36:59 +00:00
Jim Grosbach
46367768f7 Clean up some DOxygen comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170629 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 01:14:48 +00:00
Jim Grosbach
39758cd55d Clean up some DOxygen comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170628 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 01:14:45 +00:00
Jim Grosbach
fbf3b4a076 MC: Add MCInstrDesc::mayAffectControlFlow() method.
MC disassembler clients (LLDB) are interested in querying if an
instruction may affect control flow other than by virtue of being
an explicit branch instruction. For example, instructions which
write directly to the PC on some architectures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170610 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 23:38:53 +00:00
Jim Grosbach
16f3204b95 Add isSubRegisterEq() and isSuperRegisterEq().
isSub and isSuper return false if RegA == RegB. Add variants which also
include the identity function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 23:38:49 +00:00
Jim Grosbach
e188fb7dd9 Move isSubRegister() and isSuperRegister to MCRegisterInfo.
These were defined on TargetRegisterInfo, but they don't use any information
that's not available in MCRegisterInfo, so sink them down to be available
at the MC layer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 23:38:46 +00:00
Jim Grosbach
dd2fa5195e Fix doc comment. '///' not '//'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 23:38:44 +00:00
Michael Ilseman
f846f16c92 Refactor isIntrinsic() to be quicker, and change classof() (and thus, isa<IntrinsicInst>()) to use it. This decreases the number of occurrences of the slow-path string matching performed by getIntrinsicID().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170602 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 23:17:20 +00:00
Bill Wendling
18e7211068 s/AttributeListImpl/AttributeSetImpl/g to match the namechange of AttributeList.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170600 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 22:42:22 +00:00
Jakob Stoklund Olesen
7f4bb1b9f0 Always use addOperand(MF, MO) from MachineInstrBuilder.
The single-argument MachineInstr::addOperand(MO) will be removed soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 22:35:46 +00:00
Jakob Stoklund Olesen
37a942cd52 Remove the explicit MachineInstrBuilder(MI) constructor.
Use the version that also takes an MF reference instead.

It would technically be possible to extract an MF reference from the MI
as MI->getParent()->getParent(), but that would not work for MIs that
are not inserted into any basic block.

Given the reasonably small number of places this constructor was used at
all, I preferred the compile time check to a run time assertion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170588 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 21:31:56 +00:00
Benjamin Kramer
28d24c95ad Remove edis remnant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170580 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 20:11:17 +00:00
Roman Divacky
759e3fa641 Remove edis - the enhanced disassembler. Fixes PR14654.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170578 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 19:55:47 +00:00
Jakob Stoklund Olesen
433cb080ba Add an MF argument to MachineInstr::addOperand().
Just like for addMemOperand(), the function pointer provides a context
for allocating memory. This will make it possible to use a better memory
allocation strategy for the MI operand list, which is currently a slow
std::vector.

Most calls to addOperand() come from MachineInstrBuilder, so give that
class an MF reference as well. Code using BuildMI() won't need changing
at all since the MF reference is already required to allocate a
MachineInstr.

Future patches will fix code that calls MI::addOperand(Op) directly, as
well as code that uses the now deprecated MachineInstrBuilder(MI)
constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170574 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 19:19:01 +00:00
Chad Rosier
e7ff165a40 Remove superfluous brief command from getAsString.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170569 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 18:06:44 +00:00
Patrik Hagglund
c698d3a2a4 Change AsmOperandInfo::ConstraintVT to MVT, instead of EVT.
Accordingly, add MVT::getVT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170550 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 15:19:11 +00:00
Rafael Espindola
cd7ee1ced0 Revert 170545 while I debug the ppc failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 14:48:05 +00:00
Benjamin Kramer
35d3462941 Make TargetLowering::getTypeConversion more resilient against odd illegal MVTs.
- An MVT can become an EVT when being split (e.g. v2i8 -> v1i8, the latter doesn't exist)
- Return the scalar value when an MVT is scalarized (v1i64 -> i64)

Fixes PR14639ff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 14:34:28 +00:00
Rafael Espindola
f9a6bd8524 Add r170095 back.
I cannot reproduce it the failures locally, so I will keep an eye at the ppc
bots. This patch does add the change to the "Disassembly of section" message,
but that is not what was failing on the bots.

Original message:

Add a funciton to get the segment name of a section.

On MachO, sections also have segment names. When a tool looking at a .o file
prints a segment name, this is what they mean. In reality, a .o has only one
anonymous, segment.

This patch adds a MachO only function to fetch that segment name. I named it
getSectionFinalSegmentName since the main use for the name seems to be infor
the linker with segment this section should go to.

The patch also changes MachOObjectFile::getSectionName to return just the
section name instead of computing SegmentName,SectionName.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170545 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 14:15:04 +00:00
Evgeniy Stepanov
33660cdfbd [msan] Add track-origins argument to the pass constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170544 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 13:55:51 +00:00
Patrik Hagglund
e5c65911a6 Change TargetLowering::getTypeForExtArgOrReturn to take and return
MVTs, instead of EVTs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170537 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 12:02:25 +00:00
Patrik Hagglund
ee211d2b8d Change a parameter of TargetLowering::getVectorTypeBreakdown to MVT,
from EVT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:53:21 +00:00
Patrik Hagglund
dfcf33a287 Change TargetLowering::RegisterTypeForVT to contain MVTs, instead of
EVTs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170535 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:48:16 +00:00
Patrik Hagglund
ff01277841 Change TargetLowering::TransformToType to contain MVTs, instead of
EVTs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170534 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:42:00 +00:00
Patrik Hagglund
1317d26461 Change TargetLowering::getRepRegClassCostFor, getIndexedLoadAction,
getIndexedStoreAction, and addRegisterClass to take and MVT, instead
of EVT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170533 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:37:12 +00:00
Patrik Hagglund
0340557fb8 Change TargetLowering::findRepresentativeClass to take an MVT, instead
of EVT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170532 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:30:36 +00:00
Patrik Hagglund
319bb39923 Change TargetLowering::getTypeToPromoteTo to take and return MVTs,
instead of EVTs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170529 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:21:04 +00:00
Benjamin Kramer
fc8657be34 MapVector: Add lookup().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170527 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 11:08:33 +00:00
Patrik Hagglund
fdbeb057b8 Change TargetLowering::isCondCodeLegal to take an MVT, instead of EVT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170524 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 10:19:55 +00:00
Patrik Hagglund
9c5ab9355e Change TargetLowering::getCondCodeAction to take an MVT, instead of
EVT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 10:09:26 +00:00
Bill Wendling
6424a783ad Inline hasFunctionOnlyAttrs into its only use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170518 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 09:15:11 +00:00
Bill Wendling
5d122b6ec0 Inline the only use of the hasParameterOnlyAttrs method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170517 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 09:04:58 +00:00
Bill Wendling
1d3dcfe424 Inline the 'hasIncompatibleWithVarArgsAttrs' method into its only uses. And some minor comment reformatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170516 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 08:57:40 +00:00
Patrik Hagglund
88ef514cc6 Change TargetLowering::getTruncStoreAction to take MVTs, instead of EVTs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170510 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 08:28:51 +00:00
Bill Wendling
034b94b170 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 07:18:57 +00:00
Kevin Enderby
5469f605fe Add to the disassembler C API an option to print the disassembled
instructions in the assembly code variant if one exists.

The intended use for this is so tools like lldb and darwin's otool(1)
can be switched to print Intel-flavored disassembly.

I discussed extensively this API with Jim Grosbach and we feel
while it may not be fully general, in reality there is only one syntax
for each assembly with the exception of X86 which has exactly
two for historical reasons.

rdar://10989182


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170477 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 23:47:28 +00:00
Jakob Stoklund Olesen
445a02b5ad Remove MachineInstr::setIsInsideBundle().
The bundle flags are now maintained by the slightly higher-level
functions bundleWithPred() / bundleWithSucc() which enforce consistent
bundle flags between neighboring instructions.

See also MIBundleBuilder for an even higher-level approach to building
bundles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170475 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 23:40:14 +00:00
Jakob Stoklund Olesen
2e4b639790 Use bidirectional bundle flags to simplify important functions.
The bundle_iterator::operator++ function now doesn't need to dig out the
basic block and check against end(). It can use the isBundledWithSucc()
flag to find the last bundled instruction safely.

Similarly, MachineInstr::isBundled() no longer needs to look at
iterators etc. It only has to look at flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170473 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 23:21:49 +00:00
Jakob Stoklund Olesen
bd7b36e780 Don't allow the automatically updated MI flags to be set directly.
The bundle-related MI flags need to be kept in sync with the neighboring
instructions. Don't allow the bulk flag-setting setFlags() function to
change them.

Also don't copy MI flags when cloning an instruction. The clone's bundle
flags will be set when it is explicitly inserted into a bundle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170459 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 21:36:05 +00:00
Jakob Stoklund Olesen
9b04104a5e Tighten up the splice() API for bundled instructions.
Remove the instr_iterator versions of the splice() functions. It doesn't
seem useful to be able to splice sequences of instructions that don't
consist of full bundles.

The normal splice functions that take MBB::iterator arguments are not
changed, and they can move whole bundles around without any problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170456 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 20:59:41 +00:00
Jakob Stoklund Olesen
7f1d6d688f Add an assertion for a likely ilist::splice() contract violation.
The single-element ilist::splice() function supports a noop move:

  List.splice(I, List, I);

The corresponding std::list function doesn't allow that, so add a unit
test to document that behavior.

This also means that

  List.splice(I, List, F);

is somewhat surprisingly not equivalent to

  List.splice(I, List, F, next(F));

This patch adds an assertion to catch the illegal case I == F above.
Alternatively, we could make I == F a legal noop, but that would make
ilist differ even more from std::list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170443 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 19:28:37 +00:00
Jakob Stoklund Olesen
edc3503ca5 Tighten the insert() API for bundled instructions.
The normal insert() function takes an MBB::iterator position, and
inserts a stand-alone MachineInstr as before.

The insert() function that takes an MBB::instr_iterator position can
insert instructions inside a bundle, and will now update the bundle
flags correctly when that happens.

When the insert position is between two bundles, it is unclear whether
the instruction should be appended to the previous bundle, prepended to
the next bundle, or stand on its own. The MBB::insert() function doesn't
bundle the instruction in that case, use the MIBundleBuilder class for
that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 17:54:53 +00:00
Eli Bendersky
745bf82eba Cleanup comment and formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170398 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 00:53:36 +00:00
Eric Christopher
6c583141bf Add support for passing -main-file-name all the way through to
the assembler.

Part of PR14624

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170390 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 00:31:01 +00:00
Jakob Stoklund Olesen
9f4692d295 Tighten up the erase/remove API for bundled instructions.
Most code is oblivious to bundles and uses the MBB::iterator which only
visits whole bundles. MBB::erase() operates on whole bundles at a time
as before.

MBB::remove() now refuses to remove bundled instructions. It is not safe
to remove all instructions in a bundle without deleting them since there
is no way of returning pointers to all the removed instructions.

MBB::remove_instr() and MBB::erase_instr() will now update bundle flags
correctly, lifting individual instructions out of bundles while leaving
the remaining bundle intact.

The MachineInstr convenience functions are updated so

  eraseFromParent() erases a whole bundle as before
  eraseFromBundle() erases a single instruction, leaving the rest of its bundle.
  removeFromParent() refuses to operate on bundled instructions, and
  removeFromBundle() lifts a single instruction out of its bundle.

These functions will no longer accidentally split or coalesce bundles -
bundle flags are updated to preserve the existing bundling, and explicit
bundleWith* / unbundleFrom* functions should be used to change the
instruction bundling.

This API update is still a work in progress. I am going to update APIs
first so they maintain bundle flags automatically when possible. Then
I'll add stricter verification of the bundle flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170384 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17 23:55:38 +00:00
Chandler Carruth
6c31d31357 Prepare LLVM to fix PR14625, exposing a hook in MCContext to manage the
compilation directory.

This defaults to the current working directory, just as it always has,
but now an assembler can choose to override it with a custom directory.
I've taught llvm-mc about this option and added a test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170371 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17 21:32:42 +00:00
Michael Ilseman
f3ceaff639 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170368 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17 20:40:14 +00:00
Nick Kledzik
fbc8a73e0c Use different trait techniques to be compatible with g++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170355 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17 19:02:05 +00:00