aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2003-07-24Cleanups:Brian Gaeke
Mangler.cpp: Constify parameter to makeNameProper, and use const_iterator. Make Count an unsigned int, and use utostr(). Don't name parameters things that start with underscore. Mangler.h: All of the above, and also: Add Emacs mode-line. Include <set>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7301 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Factor out name-mangling from X86/Printer, which is derived from CWriter,Brian Gaeke
into this new support class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7300 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Use unified CWriter-X86/Printer name mangler. Do not bother usingBrian Gaeke
SlotCalculator in CWriter. (Unfortunately, all this means a lot of X86/Printer's methods have to be de-constified again. Oh well.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7299 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Instcombine: (A >> c1) << c2 for signed integersChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7295 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Reorganization of code, no functional changes.Chris Lattner
Now it shoudl be a bit more efficient git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7292 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24It doesn't appear that we need to #include these.Brian Gaeke
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7291 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Allow folding several instructions into casts, which can simplify a lotChris Lattner
of codes. For example, short kernel (short t1) { t1 >>= 8; t1 <<= 8; return t1; } became: short %kernel(short %t1.1) { %tmp.3 = shr short %t1.1, ubyte 8 ; <short> [#uses=1] %tmp.5 = cast short %tmp.3 to int ; <int> [#uses=1] %tmp.7 = shl int %tmp.5, ubyte 8 ; <int> [#uses=1] %tmp.8 = cast int %tmp.7 to short ; <short> [#uses=1] ret short %tmp.8 } before, now it becomes: short %kernel(short %t1.1) { %tmp.3 = shr short %t1.1, ubyte 8 ; <short> [#uses=1] %tmp.8 = shl short %tmp.3, ubyte 8 ; <short> [#uses=1] ret short %tmp.8 } which will become: short %kernel(short %t1.1) { %tmp.3 = and short %t1.1, 0xFF00 ret short %tmp.3 } This implements cast-set.ll:test4 and test5 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7290 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Minor cleanupsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7289 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24Constify most methods. We could have constified doInitialization andBrian Gaeke
doFinalization too except that would have made them shadow, not override, the parent class :-P. Allow *any* constant cast expression between pointers and longs, or vice-versa, or any widening (not just same-size) conversion that isLosslesslyConvertibleTo approves. This fixes oopack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7288 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Fix bug: FunctionResolve/2003-07-23-CPR-Reference.llChris Lattner
This fixes a long time annoyance which caused prototypes for bzero, bcopy, bcmp, fputs, and fputs_unlocked to never get deleted. Grr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Add commentsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7283 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Remove explicit check for: not (not X) = X, it is already handled because ↵Chris Lattner
xor is commutative - InstCombine: (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0 - InstCombine: (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7282 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Fix program: SingleSource/UnitTests/2003-07-09-SignedArgs with the CBEChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7276 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Printer.cpp: Ditch addRequired/getAnalysis, because they leaveBrian Gaeke
Printer::doFinalization() out in the cold. Now we pass in a TargetMachine to Printer's constructor and get the TargetData from the TargetMachine. Don't pass TargetMachine or MRegisterInfo objects around in the Printer. Constify TargetData references. X86.h: Update comment and prototype of createX86CodePrinterPass(). X86TargetMachine.cpp: Update callers of createX86CodePrinterPass(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7275 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Make Module::getNamedFunction prefer non-external functions if there is more ↵Chris Lattner
than one function of the same name git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7274 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Fix spaceChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7273 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7272 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 - InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0Chris Lattner
- InstCombine: (X | C) & C --> C - InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7269 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Add, rewrite, and/or reformat many comments.Brian Gaeke
Stop passing ostreams around: we already have one perfectly good ostream and we can all share it. Stop stashing a pointer to TargetData in the Pass object, because that will lead to a crash if there are no functions in the module (ouch!) Instead, use addRequired() and getAnalysis(), like we always should have done. Move the check for ConstantExpr up before the check for isPrimitiveType, because we need to be able to catch e.g. ubyte (cast bool false to ubyte), whose type is primitive but which is nevertheless a ConstantExpr, by calling our specialized handler instead of the AsmWriter. This would result in assembler errors when we would try to output something like ".byte (cast bool false to ubyte)". GC some unused variable declarations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7265 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23IC: (X & C1) | C2 --> (X | C2) & (C1|C2)Chris Lattner
IC: (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2) We are now guaranteed that all 'or's will be inside of 'and's, and all 'and's will be inside of 'xor's, if the second operands are constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7264 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)Chris Lattner
Minor code cleanup git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7262 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23InstCombine: (X ^ 4) == 8 --> X == 12Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7260 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Add support for ~ operator on constantsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7258 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23IC: (X & 5) == 13 --> falseChris Lattner
IC: (X | 8) == 4 --> false git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7257 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Remove redundant const qualifierChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7254 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Remove redundant const qualifiers from cast<> expressionsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7253 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Simplify code by using ConstantInt::getRawValue instead of checking to seeChris Lattner
whether the constant is signed or unsigned, then casting git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7252 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Remove unnecessary castsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7250 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Fit code into 80 columnsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7249 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Eliminate old-style castChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7248 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Random cleanupsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7247 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Remove using declChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7246 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Remove explicit const qualifiersChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7245 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23Fix bug: TailDup/2003-07-22-InfiniteLoop.llChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7243 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-22 - InstCombine (cast (xor A, B) to bool) ==> (setne A, B)Chris Lattner
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7241 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-22Fix comment.Vikram S. Adve
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7227 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21Simplify code a bitChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7217 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21Added code that checks to see if a global variable is external before replacingJohn Criswell
a load of the global variable with the variable's constant value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7216 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21Eliminated dead code.Misha Brukman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7209 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-20Added special consideration for instrumentation strategyAnand Shukla
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7208 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18Added check for inlinable functionAnand Shukla
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7206 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18Please, save your applause^H^H^H^H^H^H^H^Hflames for the end...Brian Gaeke
Avoid a fall-through in the (stubby) treatment of the longjmp intrinsic call which causes llc & lli to core-dump. Add a sort-of treatment of cast double to ulong. I am not really sure what a user should expect to see upon casting a negative FP value to unsigned long long. But with what is given here, I was able to write a program that could cast -123.456 to ulong and back and get -123.0, which seems like a step in the right direction. GCC seems to give you 0. I don't know if I'd consider that useful. These cases were coming up in GNU coreutils-5.0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7205 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18Cleaned up the code which chooses the appropriate value for the file descriptorMisha Brukman
to pass to dlsym() -- Linux/x86 wants 0 while Sparc/Solaris wants RTLD_SELF, which is not zero. Thanks to Chris for the suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7204 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18A pass to combine multiple backedges that go to same targetAnand Shukla
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7201 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17Use getClassB for load and store; we don't want to abort when weBrian Gaeke
try to load or store through a bool*. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7195 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17Fix typo in call to isUnresolvableFunc, which was breaking the build.Brian Gaeke
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7194 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17Dinakar and I fixed a bug where we were trying to get the initializer ofJohn Criswell
an external constant. Since external constants don't have initializers, we were failing on an assert() call in llvm/GlobalVariable.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7193 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16Rematerialize nodes from the globals graph into the current graphVikram S. Adve
after all callees are inlined into the current graph. NOTE: There's also a major bug fix for the BU pass in DataStructure.cpp, which ensures that resolvable indirect calls are not moved out to the globals graph, so that they are eventually inlined (if possible). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7189 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16(1) Rematerialize nodes from the globals graph into the current graphVikram S. Adve
after all callers are inlined into the current graph. (2) Optimize the way a graph is inlined into its callees in the TD phase: (a) Use DSGraph::cloneReachableSubgraph to clone only a subgraph at each call site, for faster inlining. (b) Clone separately for the same callee at different call sites, since only the reachable subgraph is being cloned, not the entire caller graph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7188 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16Implement 2 important changes: (1) rematerialization from the globals graph,Vikram S. Adve
and (2) faster inlining by cloning only reachable nodes. In particular: (1) Added DSGraph::cloneReachableSubgraph and DSGraph::cloneReachableNodes to clone the subgraph reachable from a set of root nodes, into the current graph, merging the global nodes into thos in the current graph. The TD pass now uses this for faster inlining, and so does the next function. (2) Added DSGraph::updateFromGlobalGraph() to rematerialize nodes from the globals graph into the current graph in both BU and TD passes. (3) `I' flags are removed from all nodes in the globals graph, because they are difficult to maintain correctly and are not needed anyway. (4) Aux. function calls are only removed to the globals graph if they will never be resovled. (This is what fixed gap.) The immediate reason is that if we took these out of a function (and moved them to the globals graph) we would need to rematerialize these nodes into the function graph for every function in the BU pass. The longer term problem is that we would need to find a way to remove them from the globals graph iff they have been resolved on all paths through the call graph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7187 91177308-0d34-0410-b5e6-96231b3b80d8