Commit Graph

15399 Commits

Author SHA1 Message Date
Pete Cooper
d8d110e08a Template specialize SmallVector::push_back based on POD-ness of the type. Reduces clang binary by 188KB
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16 04:58:48 +00:00
Andrew Trick
e746186ed4 Fix library visibility problems with VLIWPacketizer.
The existing framework for postra scheduling is library local. We want to keep it that way. Soon we will have a more general MachineScheduler interface. At that time, various bits will be exposed to targets. In the meantime, the VLIWPacketizer wants to use ScheduleDAGInstrs directly, so it needs to wrapped in a PIMPL to avoid exposing it to the target interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150633 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 23:34:15 +00:00
Bill Wendling
426f215732 Use the enum instead of 'unsigned'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 23:27:50 +00:00
Lang Hames
cc2037be2c Make LiveIntervals::handleMove() bundle aware.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150630 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 23:21:33 +00:00
Bill Wendling
057d521e3d Modify the code that emits the module flags to use the new module flags accessor
method. This allows the target lowering code to not have to deal with MDNodes.

Also, avoid leaking memory like a sieve by not creating a global variable for
the image info section, but just emitting the code directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150624 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 22:36:15 +00:00
Bill Wendling
f20f281368 Add a module flags accessor method which returns the flags in a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150623 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 22:34:20 +00:00
Kaelyn Uhrain
01d53ec176 Add function for computing the edit distance of two arrays.
Accomplished by moving the body of StringRef::edit_distance into
a separate function that accepts two ArrayRefs, and making
StringRef::edit_distance a wrapper around the new function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150621 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 22:13:07 +00:00
Andrew Trick
68c36e0c26 Don't expose DefaultVLIWScheduler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150619 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 22:06:21 +00:00
Andrew Trick
ebafa0c611 Generic "VLIW" packetizer based on a DFA generated from target itinerary.
Patch by Sundeep!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 18:55:14 +00:00
Eric Christopher
f32a960fd3 Add a way to replace a field inside a metadata node. This can be
used to incrementally update a created node without needing a
temporary node and RAUW.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150571 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 09:09:29 +00:00
Lang Hames
ac597ecfbc Add a check to make sure we don't assign slot indexes for instructions inside bundles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 04:33:48 +00:00
Andrew Trick
79bf288584 Allow CodeGen (llc) command line options to work as expected.
The llc command line options for enabling/disabling passes are local to CodeGen/Passes.cpp. This patch associates those options with standard pass IDs so they work regardless of how the target configures the passes.

A target has two ways of overriding standard passes:
1) Redefine the pass pipeline (override TargetPassConfig::add%Stage)
2) Replace or suppress individiual passes with TargetPassConfig::substitutePass.

In both cases, the command line options associated with the pass override the target default.

For example, say a target wants to disable machine instruction scheduling by default:

- The target calls disablePass(MachineSchedulerID) but otherwise does not override any TargetPassConfig methods.

- Without any llc options, no scheduler is run.

- With -enable-misched, the standard machine scheduler is run and honors the -misched=... flag to select the scheduler variant, which may be used for performance evaluation or testing.

Sorry overridePass is ugly. I haven't thought of a better way without replacing the cl::opt framework. I hope to do that one day...

I haven't figured out why CodeGen uses char& for pass IDs. AnalysisID is much easier to use and less bug prone. I'm using it wherever I can for internal implementation. Maybe later we can change the global pass ID definitions as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150563 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 03:21:51 +00:00
Andrew Trick
5e108eeeef Added TargetPassConfig::disablePass/substitutePass as a general mechanism to override specific passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 03:21:47 +00:00
Andrew Trick
5fd84a24e6 comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150561 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 03:21:43 +00:00
Lang Hames
da7984fbba Disentangle moving a machine instr from updating LiveIntervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150552 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 01:23:52 +00:00
Jakob Stoklund Olesen
1cf8b0f2a5 Handle regmasks in findRegisterDefOperandIdx().
Only accept register masks when looking for an 'overlapping' def. When
Overlap is not set, the function searches for a proper definition of
Reg.

This means MI->modifiesRegister() considers register masks, but
MI->definesRegister() doesn't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150529 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 23:49:37 +00:00
Dmitri Gribenko
c50b433989 Silence the new -Wempty-body warning. It appeared because the next statement
after the `for(...) ;' has more indentation than for itself.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150516 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 22:17:14 +00:00
Bill Wendling
b464d3ff72 Add code to the target lowering object file module to handle module flags.
The MachO back-end needs to emit the garbage collection flags specified in the
module flags. This is a WIP, so the front-end hasn't been modified to emit these
flags just yet. Documentation and front-end switching to occur soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150507 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 21:28:13 +00:00
Lang Hames
342c64c904 Tighten physical register invariants: Allocatable physical registers can
only be live in to a block if it is the function entry point or a landing pad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150494 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 18:51:53 +00:00
Lang Hames
0796134bde Rename getExceptionAddressRegister() to getExceptionPointerRegister() for consistency with setExceptionPointerRegister(...).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150460 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 04:45:49 +00:00
Kostya Serebryany
60ebb1947f ThreadSanitizer, a race detector. First LLVM commit.
Clang patch (flags) will follow shortly.
The run-time library will also follow, but not immediately.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150423 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 22:50:51 +00:00
Owen Anderson
ce9259923d v2f16 is a floating point type. Add symbolic floating point type ranges to prevent this kind of issue in the future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150416 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 21:47:20 +00:00
Dylan Noblesmith
fde8237cd9 add LLVM_VERSION_MAJOR and _MINOR defines
This is useful for clients that want to maintain compatibility
across multiple releases of LLVM. Currently users like Klee and
Mesa all have to roll their own 'parse llvm-config --version
output and generate defines' solution.

Also reuse the new macros so that version information is less
redundant/likely to fall out of sync again in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150405 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 18:48:10 +00:00
Ahmed Charles
b83a67e1e3 Fix various issues (or do cleanups) found by enabling certain MSVC warnings.
- Use unsigned literals when the desired result is unsigned. This mostly allows unsigned/signed mismatch warnings to be less noisy even if they aren't on by default.
- Remove misplaced llvm_unreachable.
- Add static to a declaration of a function on MSVC x86 only.
- Change some instances of calling a static function through a variable to simply calling that function while removing the unused variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150364 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 06:30:56 +00:00
Eli Bendersky
f4eff4baeb Expose the ELFObjectFile class directly in the Object/ELF.h header, similarly
to what's done for MachO and COFF. This allows advanced uses of the class to
be implemented outside the Object library. In particular, the DyldELFObject
subclass is now moved into its logical home - ExecutionEngine/RuntimeDyld.

This patch was reviewed by Michael Spencer.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150327 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-12 06:12:10 +00:00
Nick Lewycky
6a7df9aae6 Remove redundant getAnalysis<> calls in GlobalOpt. Add a few Itanium ABI calls
to TargetLibraryInfo and use one of them in GlobalOpt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150323 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-12 02:15:20 +00:00
Anton Korobeynikov
d4a19b6a72 Add support for implicit TLS model used with MS VC runtime.
Patch by Kai Nacke!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150307 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 17:26:53 +00:00
Benjamin Kramer
88b6fc06db Make the EDis tables const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150304 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 14:51:07 +00:00
Bill Wendling
d34cb1e09f [WIP] Initial code for module flags.
Module flags are key-value pairs associated with the module. They include a
'behavior' value, indicating how module flags react when mergine two
files. Normally, it's just the union of the two module flags. But if two module
flags have the same key, then the resulting flags are dictated by the behaviors.

Allowable behaviors are:

     Error
       Emits an error if two values disagree.

     Warning
       Emits a warning if two values disagree.

     Require
       Emits an error when the specified value is not present
       or doesn't have the specified value. It is an error for
       two (or more) llvm.module.flags with the same ID to have
       the Require behavior but different values. There may be
       multiple Require flags per ID.

     Override
       Uses the specified value if the two values disagree. It
       is an error for two (or more) llvm.module.flags with the
       same ID to have the Override behavior but different
       values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150300 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 11:38:06 +00:00
Andrew Trick
746f24b732 Add TargetPassConfig hooks for scheduling/bundling.
In case the MachineScheduling pass I'm working on doesn't work well
for another target, they can completely override it. This also adds a
hook immediately after the RegAlloc pass to cleanup immediately after
vregs go away. We may want to fold it into the postRA hook later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150298 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 07:11:32 +00:00
Andrew Trick
fda655ec23 comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 07:11:29 +00:00
Jakob Stoklund Olesen
f1deaff53b Clean up comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150262 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 19:27:34 +00:00
Jakob Stoklund Olesen
938200859e Add a static MachineOperand::clobbersPhysReg().
It can be necessary to detach a register mask pointer from its
MachineOperand. This method is convenient for checking clobbered
physregs on a detached bitmask pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150261 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 19:23:53 +00:00
Hal Finkel
1a4ccc3aa2 Make aliasesPointer and aliasesUnknownInst public members of AliasSet.
These query functions are safe for external use and, furthermore,
are the only way to make queries against the "unknown instructions" array.
BBVectorize will use these functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150248 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 15:52:37 +00:00
Duncan Sands
edfb931edb Revert commit 149912 (lattner) and add a testcase that shows the problem (which
is that patterns no longer match for vectors of booleans, because you only get
ConstantDataVector when the vector element type is i8, i16, etc, not when it is
i1).  Original commit message:
Remove some dead code and tidy things up now that vectors use ConstantDataVector
instead of always using ConstantVector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150246 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 14:26:42 +00:00
Benjamin Kramer
c667ba69ac Put instruction names into an indexed string table on the side, removing a pointer from MCInstrDesc.
Make them accessible through MCInstrInfo. They are only used for debugging purposes so this doesn't
have an impact on performance. X86MCTargetDesc.o goes from 630K to 461K on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150245 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 13:18:44 +00:00
Andrew Trick
8dd26253f5 RegAlloc superpass: includes phi elimination, coalescing, and scheduling.
Creates a configurable regalloc pipeline.

Ensure specific llc options do what they say and nothing more: -reglloc=... has no effect other than selecting the allocator pass itself. This patch introduces a new umbrella flag, "-optimize-regalloc", to enable/disable the optimizing regalloc "superpass". This allows for example testing coalscing and scheduling under -O0 or vice-versa.

When a CodeGen pass requires the MachineFunction to have a particular property, we need to explicitly define that property so it can be directly queried rather than naming a specific Pass. For example, to check for SSA, use MRI->isSSA, not addRequired<PHIElimination>.

CodeGen transformation passes are never "required" as an analysis

ProcessImplicitDefs does not require LiveVariables.

We have a plan to massively simplify some of the early passes within the regalloc superpass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150226 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 04:10:36 +00:00
Lang Hames
4465b6f6b2 Remove unused 'isAlias' parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150224 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 03:19:36 +00:00
Jakob Stoklund Olesen
34e85d0307 Cache basic block boundaries for faster RegMaskSlots access.
Provide API to get a list of register mask slots and bits in a basic
block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150219 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 01:26:29 +00:00
Jakob Stoklund Olesen
ebf2750a70 Optimize LiveIntervals::intervalIsInOneMBB().
No looping and binary searches necessary.

Return a pointer to the containing block instead of just a bool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150218 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 01:23:55 +00:00
David Blaikie
58604cd944 Change default error_code ctor to a 'named ctor' so it's more self-documenting.
Unify default construction of error_code uses on this idiom so that users don't
feel compelled to make static globals for naming convenience. (unfortunately I
couldn't make the original ctor private as some APIs don't return their result,
instead using an out parameter (that makes sense to default construct) - which
is a bit of a pity. I did, however, find/fix some cases of unnecessary default
construction of error_code before I hit the unfixable cases)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150197 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 19:24:12 +00:00
Benjamin Kramer
2c6ae095b8 Store just the SimpleValueType in the generated VT tables for each register class, eliminating static ctors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150173 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 12:35:37 +00:00
Benjamin Kramer
133f9d9894 Move the Name field in MCInstrDesc to the end, saving 8 bytes of padding per entry on x86_64.
No change on i386.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150170 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 11:25:09 +00:00
Andrew Trick
f7b96311d2 Improve TargetPassConfig. No intended functionality.
Split CodeGen into stages.
Distinguish between optimization and correctness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150122 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 00:40:55 +00:00
Andrew Trick
1dd8c8560d Codegen pass definition cleanup. No functionality.
Moving toward a uniform style of pass definition to allow easier target configuration.
Globally declare Pass ID.
Globally declare pass initializer.
Use INITIALIZE_PASS consistently.
Add a call to the initializer from CodeGen.cpp.
Remove redundant "createPass" functions and "getPassName" methods.

While cleaning up declarations, cleaned up comments (sorry for large diff).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150100 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 21:23:13 +00:00
Andrew Trick
9d41bd5c78 Move pass configuration out of pass constructors: MachineLICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150099 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 21:23:03 +00:00
Andrew Trick
32986572bf Move pass configuration out of pass constructors: StackSlotColoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150097 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 21:22:57 +00:00
Andrew Trick
c7d081b594 Move pass configuration out of pass constructors: PostRAScheduler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150096 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 21:22:53 +00:00
Andrew Trick
61f1e3db43 Move pass configuration out of pass constructors: BranchFolderPass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150095 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 21:22:48 +00:00
Andrew Trick
ffea03f216 Added TargetPassConfig::setOpt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150093 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 21:22:39 +00:00