Jakob Stoklund Olesen
670458b3be
Teach SimplifyCFG about magic pointer constants.
...
Weird code sometimes uses pointer constants other than null. This patch
teaches SimplifyCFG to build switch instructions in those cases.
Code like this:
void f(const char *x) {
if (!x)
puts("null");
else if ((uintptr_t)x == 1)
puts("one");
else if (x == (char*)2 || x == (char*)3)
puts("two");
else if ((intptr_t)x == 4)
puts("four");
else
puts(x);
}
Now becomes a switch:
define void @f(i8* %x) nounwind ssp {
entry:
%magicptr23 = ptrtoint i8* %x to i64 ; <i64> [#uses=1]
switch i64 %magicptr23, label %if.else16 [
i64 0, label %if.then
i64 1, label %if.then2
i64 2, label %if.then9
i64 3, label %if.then9
i64 4, label %if.then14
]
Note that LLVM's own DenseMap uses magic pointers.
llvm-svn: 95439
2010-02-05 22:03:18 +00:00
Jeffrey Yasskin
1604115c5a
Move --march, --mcpu, and --mattr from JIT/TargetSelect.cpp to lli.cpp.
...
llc.cpp also defined these flags, meaning that when I linked all of LLVM's
libraries into a single shared library, llc crashed on startup with duplicate
flag definitions. This patch passes them through the EngineBuilder into
JIT::selectTarget().
llvm-svn: 95390
2010-02-05 16:19:36 +00:00
Daniel Dunbar
96bc973155
MC: Change default comment column to 40 characters.
...
llvm-svn: 95378
2010-02-05 07:32:18 +00:00
Evan Phoenix
a44be8b7f3
Disable external stubs for X86-32 and X86-64
...
Instruction selection for X86 now can choose an instruction
sequence that will fit any address of any symbol, no matter
the pointer width. X86-64 uses a mov+call-via-reg sequence
for this.
llvm-svn: 95323
2010-02-04 19:56:59 +00:00
Chris Lattner
e43007d443
add support for the sparcv9-*-* target triple to turn on
...
64-bit sparc codegen. Patch by Nathan Keynes!
llvm-svn: 95293
2010-02-04 06:34:01 +00:00
Dan Gohman
be6cf8cfb0
Change the argument to getIntegerSCEV to be an int64_t, rather
...
than int. This will make it more convenient for LSR, which does
a lot of things with int64_t offsets.
llvm-svn: 95281
2010-02-04 02:43:51 +00:00
Devang Patel
83d905f82b
Provide interface to identifiy artificial methods.
...
llvm-svn: 95240
2010-02-03 19:57:19 +00:00
Jeffrey Yasskin
92abe5abcc
r94686 changed all ModuleProvider parameters to Modules, which made the
...
1-argument ExecutionEngine::create(Module*) ambiguous with the signature that
used to be ExecutionEngine::create(ModuleProvider*, defaulted_params). Fixed
by removing the 1-argument create(). Fixes PR6221.
llvm-svn: 95236
2010-02-03 19:18:04 +00:00
Daniel Dunbar
d997cd69cd
llvm-mc: Add --show-inst option, for showing the MCInst inline with the assembly
...
output.
llvm-svn: 95227
2010-02-03 18:18:30 +00:00
Zhongxing Xu
bbb98cd401
Remove redundant declaration.
...
llvm-svn: 95213
2010-02-03 09:05:21 +00:00
Zhongxing Xu
07020ea237
Add constructors.
...
llvm-svn: 95212
2010-02-03 09:04:11 +00:00
Chris Lattner
837d242070
make MachineModuleInfoMachO hold non-const MCSymbol*'s instead
...
of const ones. non-const ones aren't very useful, because you can't
even, say, emit them.
llvm-svn: 95205
2010-02-03 06:18:30 +00:00
Chris Lattner
e8811c3222
change addPassesToEmitFile to return true on failure instead of its input,
...
add -filetype=null for performance testing and remove -filetype=dynlib,
which isn't planned to be implemented.
llvm-svn: 95202
2010-02-03 05:55:08 +00:00
Jeffrey Yasskin
853eeb0db1
Reconfigure with autoconf-2.60, and fix autoconf.ac to work with that version.
...
llvm-svn: 95191
2010-02-03 02:11:49 +00:00
Chris Lattner
a64be6d665
privatize a bunch of methods and move \n printing into them.
...
llvm-svn: 95186
2010-02-03 01:46:05 +00:00
Chris Lattner
78f57ac8dc
Hook up -filetype=obj through the MachO streamer. Here's a demo:
...
$ cat t.ll
@g = global i32 42
$ llc t.ll -o t.o -filetype=obj
$ nm t.o
00000000 D _g
There is still a ton of work left. Instructions are not being encoded
yet apparently.
llvm-svn: 95162
2010-02-02 23:57:42 +00:00
Evan Cheng
9057fea7ef
Revert 95130.
...
llvm-svn: 95160
2010-02-02 23:55:14 +00:00
Chris Lattner
643f2f9bc4
refactor code so that LLVMTargetMachine creates the asmstreamer and
...
mccontext instead of having AsmPrinter do it. This allows other
types of MCStreamer's to be passed in.
llvm-svn: 95155
2010-02-02 23:37:42 +00:00
Chris Lattner
7dd4ad3ced
Remove a bunch of stuff around the edges of the ELF writer.
...
Now the only use of the ELF writer is the JIT, which won't be
easy to fix in the short term. :( :(
llvm-svn: 95148
2010-02-02 22:31:11 +00:00
Daniel Dunbar
eb0b81040a
MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
...
llvm-svn: 95135
2010-02-02 21:44:01 +00:00
Chris Lattner
21bcba21e7
eliminate all the dead addSimpleCodeEmitter implementations.
...
eliminate random "code emitter" stuff in Alpha, except for
the JIT path. Next up, remove the template cruft.
llvm-svn: 95131
2010-02-02 21:31:47 +00:00
Evan Cheng
48375fbf4f
Pass callsite return type to TargetLowering::LowerCall and use that to check sibcall eligibility.
...
llvm-svn: 95130
2010-02-02 21:29:10 +00:00
Dan Gohman
612cbcdc1a
Make DenseSet's erase pass on the return value rather than swallowing it.
...
llvm-svn: 95127
2010-02-02 21:11:22 +00:00
Dan Gohman
c4096b6671
Fix function names in comments. Thanks Duncan!
...
llvm-svn: 95126
2010-02-02 21:10:27 +00:00
Chris Lattner
7d162688a9
eliminate FileModel::Model, just use CodeGenFileType. The client
...
of the code generator shouldn't care what object format a target
uses.
llvm-svn: 95124
2010-02-02 21:06:45 +00:00
Chris Lattner
cb4d0d0df4
remove the remnants of TargetMachOWriterInfo.
...
llvm-svn: 95114
2010-02-02 19:41:23 +00:00
Chris Lattner
3cae149179
Add a new top-level MachO.h file for manifest constants, fixing
...
a layering violation from MC -> Target.
llvm-svn: 95113
2010-02-02 19:38:14 +00:00
Chris Lattner
ff8ba8fc79
eliminate all forms of addPassesToEmitMachineCode except
...
the one used by the JIT. Remove all forms of
addPassesToEmitFileFinish except the one used by the static
code generator. Inline the remaining version of
addPassesToEmitFileFinish into its only caller.
llvm-svn: 95109
2010-02-02 19:14:27 +00:00
Chris Lattner
fa04a6e968
Inline addAssemblyEmitter into its one real caller and delete
...
the -print-emitted-asm option. The JIT shouldn't have to pull
in the asmprinter.
llvm-svn: 95100
2010-02-02 18:44:12 +00:00
Duncan Sands
364e9510fb
Adding missing methods for creating Add, Mul, Neg and Sub with NUW.
...
llvm-svn: 95086
2010-02-02 12:53:04 +00:00
Zhongxing Xu
2f90f25c13
Return value on every path.
...
llvm-svn: 95075
2010-02-02 07:05:31 +00:00
Zhongxing Xu
c41eb88823
simplify code.
...
llvm-svn: 95074
2010-02-02 06:33:32 +00:00
Zhongxing Xu
107fc8962f
More logic correction: RemoveOverlap should always create new tree. Add a
...
parameter to record whether changes actually happened.
llvm-svn: 95073
2010-02-02 06:22:08 +00:00
Zhongxing Xu
7c9608096b
Add a lookup method to the IntervalMap. The difference from the original
...
lookup is that if the lookup key is contained in the key, we return the data.
llvm-svn: 95070
2010-02-02 05:23:23 +00:00
Zhongxing Xu
007e05dce7
Fix a bunch of errors in the old logic.
...
llvm-svn: 95056
2010-02-02 02:40:56 +00:00
Zhongxing Xu
fa062ef731
11.8p1: A nested class is a member and as such has the same access rights as
...
any other member.
llvm-svn: 95047
2010-02-02 01:57:01 +00:00
Nate Begeman
4d489ea053
Kill the Mach-O writer, and temporarily make filetype=obj an error.
...
The MCStreamer based assemblers will take over for this functionality.
llvm-svn: 95033
2010-02-01 23:56:58 +00:00
Bill Wendling
8a000012f2
Add "dump" method to IVUsersOneStride.
...
llvm-svn: 95022
2010-02-01 22:51:23 +00:00
Duncan Sands
4db1f01c24
Do an early exit when the result is known cheaply.
...
llvm-svn: 95002
2010-02-01 20:57:35 +00:00
Chris Lattner
af2e10ddef
eliminate a bunch of pointless LLVMContext arguments.
...
llvm-svn: 95001
2010-02-01 20:48:08 +00:00
Dan Gohman
0b2c2769ba
Generalize target-independent folding rules for sizeof to handle more
...
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.
Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.
Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.
And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.
llvm-svn: 94987
2010-02-01 18:27:38 +00:00
Dan Gohman
d1d30c5ec2
Add a getNUWMul function.
...
llvm-svn: 94982
2010-02-01 16:38:14 +00:00
Dan Gohman
9026a494ae
Add a generalized form of ConstantExpr::getOffsetOf which works for
...
array types as well as struct types, and which accepts arbitrary
Constant indicies.
llvm-svn: 94981
2010-02-01 16:37:38 +00:00
Zhongxing Xu
e075bd78c6
Add an immutable interval map, prepared to be used by flat memory model
...
in the analyzer. WIP.
llvm-svn: 94976
2010-02-01 10:43:31 +00:00
Zhongxing Xu
f9abfaa0c2
Simplify code. We can compare TNew with T in one batch.
...
llvm-svn: 94973
2010-02-01 07:32:52 +00:00
Sean Callanan
5458663492
Moved InstallLexer() from the X86-specific AsmLexer
...
to the TargetAsmLexer class so that clients can
actually use the TargetAsmLexer they get from a
Target.
llvm-svn: 94940
2010-01-31 02:28:18 +00:00
Bob Wilson
0f04082970
Check alignment of loads when deciding whether it is safe to execute them
...
unconditionally. Besides checking the offset, also check that the underlying
object is aligned as much as the load itself.
llvm-svn: 94875
2010-01-30 04:42:39 +00:00
Junjie Gu
4d7286efef
Make sure the size is doubled (not 4x).
...
llvm-svn: 94845
2010-01-29 21:34:26 +00:00
Jeffrey Yasskin
6838a27b47
Rename two IRReader.h functions to indicate that they return a Module
...
that loads its contents lazily from bitcode. I think these are the
only remaining mis-named functions.
llvm-svn: 94840
2010-01-29 21:11:04 +00:00
Bob Wilson
f897b7b37e
Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
...
indices are safe if the result is known to be within the bounds of the
underlying object.
llvm-svn: 94829
2010-01-29 19:19:08 +00:00