This change fixes programs that have multiple functions named the same thing,
where are least one of them is static/internal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2954 91177308-0d34-0410-b5e6-96231b3b80d8
- I->use_empty() can never be true because of the IHolder's
* Fix bug: test/Regression/Transforms/LevelRaise/2002-07-16-SourceAndDestCrash.ll
- Add a new NewCasts member to VMC to keep track of casts that have been
created and to ensure there is always a reference to the cast.
- Extend ValueHandle a bit so it can be used in an STL container
- Make sure we destroy the ValueMapCache before verifying the function
in LevelRaise.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2936 91177308-0d34-0410-b5e6-96231b3b80d8
- Verify the function every time it is exprconverted if DEBUG is on
- Provide a way to start exprconversion AT a specific instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2934 91177308-0d34-0410-b5e6-96231b3b80d8
* Do NOT add a prefix to global variables that are external
* Add newline after emitting a constpointerref
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2925 91177308-0d34-0410-b5e6-96231b3b80d8
* The global variable cannot be internal or else we cannot use it!
* Always add a function to the table, even if it only has a single basic
block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2921 91177308-0d34-0410-b5e6-96231b3b80d8
Also, avoid asserting out when writing out an invalid tree
since the assembly writer is used when debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2902 91177308-0d34-0410-b5e6-96231b3b80d8
constants using operators such as cast, getelementptr, add, shl, etc.
Note that a ConstantExpr can be of any type, so classof() in most
other subclasses (that discriminate by type) have to check that it
is also not a ConstantExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2901 91177308-0d34-0410-b5e6-96231b3b80d8
can be invoked with only an opcode (i.e., without an instruction).
Move all opCode->opCodeName translations there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2900 91177308-0d34-0410-b5e6-96231b3b80d8
may be constructed by expressions of other types (and so the
contents of the primitive type planes must come after all types).
Use a helper function outputConstantsInPlane in outputConstants to
do this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2898 91177308-0d34-0410-b5e6-96231b3b80d8
Add class ConstantFwdRefs to resolve forward references to constants
and to globals. (Hmm... this class could be renamed I guess.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2896 91177308-0d34-0410-b5e6-96231b3b80d8
Add class ConstantFwdRefs to resolve forward references to constants
and to globals (unified old code for globals into this).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2895 91177308-0d34-0410-b5e6-96231b3b80d8
(Major new non-terminal is ConstExpr.)
Add YYERROR_VERBOSE and print additional information on errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2894 91177308-0d34-0410-b5e6-96231b3b80d8
* Print the globals list in the node
* Print the scalars in the scalar node
* Eliminate Scalar "label" edges in the graph
* Print fake edges lighter instead of dotted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2880 91177308-0d34-0410-b5e6-96231b3b80d8
* Only dead-node-eliminate nodes with no flags
* Don't merge scalars, only merge what they point to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2878 91177308-0d34-0410-b5e6-96231b3b80d8
and generate actual machine instruction sequences directly.
Also a couple of bug fixes in code for putting constants into registers:
-- Do *not* sign-extend unsigned constant that is shorter than int reg size
-- Fix handling of address constant (a GlobalValue) vs. constant that
must be loaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2856 91177308-0d34-0410-b5e6-96231b3b80d8
-- FP argument to a function with no prototype going on stack
was not being copied to the stack in colorCallArgs().
-- Put caller-saving code *before* argument copying code so that
we don't trash a register before saving it!
-- Two other minor fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2855 91177308-0d34-0410-b5e6-96231b3b80d8
changes in class MachineRegInfo (see MachineRegInfo.h for details).
Added {LD,ST}[X]FSR instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2839 91177308-0d34-0410-b5e6-96231b3b80d8
basic block.
Mark setCCInstr used as dest. of conditional-move as both a def and a use.
BA instruction no longer has the unused CC argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2836 91177308-0d34-0410-b5e6-96231b3b80d8
handle conditional move instructions:
-- cpMem<->Reg functions now support CC registers (int and FP) correctly.
Also, cpMem<->Reg functions now return a vector of machine instructions.
-- Scratch registers must be explicitly provided to cpMem<->Reg when
needed, since CC regs need one to be copied to/from memory.
-- CC regs are saved to a scratch register instead of stack.
-- All regs used by a instruction are now recorded in MachineInstr::regsUsed,
since regs used to save values *across* an instruction are not obvious
either from the operands or from the LiveVar sets.
-- An (explicit or implicit) operand may now be both a def and a use.
This is needed for conditional move operations.
So an operand may need spill code both before and after the instruction.
Other changes:
-- Added several get{Class,Type} functions.
-- Added unified-to-local register number conversion.
-- class MachineCodeForBasicBlock is now an annotation on BasicBlock.
-- Suggest/Color methods may modify the MachineInstr (and always did),
so don't make that argument const!
-- Caller-saving code doesn't need its special purpose code for
handling CC registers since cpMem<->Reg handle those correctly now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2834 91177308-0d34-0410-b5e6-96231b3b80d8
handle conditional move instructions:
-- cpMem<->Reg functions now support CC registers (int and FP) correctly.
-- Scratch registers must be explicitly provided to cpMem<->Reg when
needed, since CC regs need one to be copied to/from memory.
-- CC regs are saved to a scratch register instead of stack.
-- All regs used by a instruction are now recorded in MachineInstr::regsUsed,
since regs used to save values *across* an instruction are not obvious
either from the operands or from the LiveVar sets.
-- An (explicit or implicit) operand may now be both a def and a use.
This is needed for conditional move operations.
So an operand may need spill code both before and after the instruction.
-- class MachineCodeForBasicBlock is now an annotation on BasicBlock.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2833 91177308-0d34-0410-b5e6-96231b3b80d8
because operands may be modified directly to set register.
Also, class MachineCodeForBasicBlock is now an annotation on BasicBlock.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2832 91177308-0d34-0410-b5e6-96231b3b80d8
so additional dep. edges have to be added.
This was needed to correctly handle conditional move instructions!
MachineCodeForBasicBlock is now an annotation on BasicBlock.
Renamed "earliestForNode" to "earliestReadyTimeForNode".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2826 91177308-0d34-0410-b5e6-96231b3b80d8
An (explicit or implicit) operand may now be both a def and a use.
Also add a set of regs used by each instruction.
dump() no longer takes an optional argument, which doesn't work in gdb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2821 91177308-0d34-0410-b5e6-96231b3b80d8
* Add two new checks:
* PHI nodes must be the first thing in a basic block, all grouped together
* All basic blocks should only end with terminator insts, not contain them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2773 91177308-0d34-0410-b5e6-96231b3b80d8
* The newly installed version of Bison now really likes there to be ;'s
after productions. Add them to avoid tons of warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2757 91177308-0d34-0410-b5e6-96231b3b80d8
test/Regression/Transforms/FunctionResolve/retmismatch[12].ll
This makes it much more useful for running benchmarks that are missing
prototypes for some functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2745 91177308-0d34-0410-b5e6-96231b3b80d8
for malloc and free. Lots of crufty benchmarks are using stuff like:
char *malloc();
void free();
to forward declare malloc and free. Now we recognize and raise these forms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2740 91177308-0d34-0410-b5e6-96231b3b80d8
the random debugging macros scattered throughout llvm.
The new DEBUG(x) macro should be used instead of special purpose debug macros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2709 91177308-0d34-0410-b5e6-96231b3b80d8
to certain classes. This is nice because it means that in header files we can
just declare a value, and still have that value be set based on a command-line
argument. The difference is now that the #include of CommandLine.h does not
need to go into the header file as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2708 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide a #include of <malloc.h> so that the sun C compiler does not
miscompile malloc function calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2702 91177308-0d34-0410-b5e6-96231b3b80d8
May be slightly less efficient but significantly reduces special
cases interfaces in code generation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2649 91177308-0d34-0410-b5e6-96231b3b80d8
lli and llc. This is controlled with options -tracehash on|off.
Also, added an option to specify which functions should be traced.
Particularly useful to reduce output volume in basic-block tracing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2646 91177308-0d34-0410-b5e6-96231b3b80d8
array and struct indexes.
Update operand values in CallArgsDescriptor (a new class)
when replacing constant values with immediates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2645 91177308-0d34-0410-b5e6-96231b3b80d8
-- passing FP arguments to functions with more than 6 arguments
-- passing FP arguments to varargs functions
-- passing FP arguments to functions with no prototypes
-- incorrect coloring for CC registers (both int and FP): interferences
were being completely ignored for int CC and were considered but no
spills were marked for fp CC!
Also some code improvements:
-- better interface to generating machine instr for common cases
(many places still need to be updated to use this interface)
-- annotations on MachineInstr to communicate information from
one codegen phase to another (now used to pass information about
CALL/JMPLCALL operands from selection to register allocation)
-- all sizes and offests in class TargetData are uint64_t instead of uint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2642 91177308-0d34-0410-b5e6-96231b3b80d8
Make all sizes and offsets uint64_t instead of uint.
Fixed GetIndexedOffset to handle mixed array and struct indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2641 91177308-0d34-0410-b5e6-96231b3b80d8
-- correct sign extensions for integer casts and for shift-by-constant
instructions generated for integer multiply
-- passing FP arguments to functions with more than 6 arguments
-- passing FP arguments to varargs functions
-- passing FP arguments to functions with no prototypes
-- incorrect stack frame size when padding a section
-- folding getelementptr operations with mixed array and struct indexes
-- use uint64_t instead of uint for constant offsets in mem operands
-- incorrect coloring for CC registers (both int and FP): interferences
were being completely ignored for int CC and were considered but no
spills were marked for fp CC!
Also some code improvements:
-- better interface to generating machine instr for common cases
(many places still need to be updated to use this interface)
-- annotations on MachineInstr to communicate information from
one codegen phase to another (now used to pass information about
CALL/JMPLCALL operands from selection to register allocation)
-- all sizes and offests in class TargetData are uint64_t instead of uint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2640 91177308-0d34-0410-b5e6-96231b3b80d8
which global variables would have name collisions if they were not mangled,
and use this info to mangle them iff they would collide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2639 91177308-0d34-0410-b5e6-96231b3b80d8
* Add optimization to rank computation to not recursively search when
unneccesary.
* More agressively negate expressions to open reassociation opportunities.
* Linearize (A+B)+(C+D) into ((A+B)+C)+D
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2637 91177308-0d34-0410-b5e6-96231b3b80d8
By making sure to consider binary expressions identical if their operands
are backwards, but swappable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2629 91177308-0d34-0410-b5e6-96231b3b80d8
"This testcase caused instcombine to fail because it got the same instruction on
it's worklist more than once (which is ok), but then deleted the instruction.
Since the inst stayed on the worklist, as soon as it came back up to be
processed, bad things happened, and opt asserted."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2623 91177308-0d34-0410-b5e6-96231b3b80d8
be put either before or after a load. We chose to cast the value loaded
instead of the pointer to load from.
Fixes bug: test/Regression/Transforms/LevelRaise/2002-05-10-LoadPeephole.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2621 91177308-0d34-0410-b5e6-96231b3b80d8
* Make cast-of-self-ty DCE the dead cast instruction immediately instead of
waiting for it to be DCE'd by another sweep over the function. This speeds
this up noticably.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2597 91177308-0d34-0410-b5e6-96231b3b80d8
1. Avoid printing *(&globalvariable), instead print globalvariable alone
as a special case.
2. Inline subexpressions into expressions as much as legal that preserves
execution characteristics of expressions. Now we get nice (but
over-parenthesized, oh well) things like:
ltmp_428_7 = spec__putc(((unsigned char )((bsBuff) >> 24)), (bsStream));
instead of five seperate instructions (bsBuff & bsStream are globals).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2587 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct global variable references
* Fix loads & stores with zero indices
* Do not emit an else part of a branch if there is no code (no phi node
and a fallthrough branch), makes code more readable to get:
if (l2_cond240) {
goto l13_bb10;
}
with no else{} branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2583 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up generated code to not emit basic block labels and goto
instructions if they are unneccesary (for example, fall throughs)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2578 91177308-0d34-0410-b5e6-96231b3b80d8
* Print a newline after a malloc instruction
* Convert unprintable characters to x_ instead of _x so that we don't
generate identifiers that start with underscores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2577 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle names with only a prefix so that they are easier on the eyes.
* Put spaces around binary operators with low precedence to make them easier to read
* Don't prefix function names with &, although it's correct, it's unnecesary and
easier to read without it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2575 91177308-0d34-0410-b5e6-96231b3b80d8
have some hope of working right.
Function calls do not try to emit an lvalue if they return void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2569 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert main constant propogation pass to be worklist driven instead of
iterative.
* -constprop pass no longer "constant propogates" terminator instructions
- CFG is now preserved!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2502 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead PHI case (which could not work due to getNumOperands rather than
getNumIncomingValues. This really belongs in InstCombine, anyway so we'll
move it there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2497 91177308-0d34-0410-b5e6-96231b3b80d8