Commit Graph

493 Commits

Author SHA1 Message Date
Chris Lattner
78771c886a Fix bug: test/Regression/CBackend/2002-05-16-NameCollide.ll by tracking
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
2002-05-17 04:55:35 +00:00
Chris Lattner
3af3ba8b38 Last minor cleanups, this code still does not work for all cases, but it
works much better than it used to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2588 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 21:31:18 +00:00
Chris Lattner
d0c668c380 Two Cleanups to generated C code:
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
2002-05-09 21:18:38 +00:00
Chris Lattner
4fbf26d2fc * Remove CInstPrintVisitor class, incorporating it into the CWriter class
* Reorder code in the file to make it more logically laid out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2586 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:53:56 +00:00
Chris Lattner
497e19aee0 Remove CLocalVars data structure entirely, instead of building stuff and
then printing it out, just print as we go.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2585 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:39:03 +00:00
Chris Lattner
7683a12e20 Simplify code by removing InstLocalVarsVisitor, replacing it with a simple
inst_iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2584 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:33:35 +00:00
Chris Lattner
1f02c8910a * Clean up how PHI nodes are handled
* 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
2002-05-09 20:14:10 +00:00
Chris Lattner
8c8a37061a Emit:
l3_reg109 = l81_this->field0;
Instead of:
  l3_reg109 = l81_this[0u].field0;

where possible


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2579 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:59:50 +00:00
Chris Lattner
8c3c4bfcfe * Print structures types correctly
* 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
2002-05-09 15:49:41 +00:00
Chris Lattner
deed7a5ae3 * Continue cleanup of type printing code
* 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
2002-05-09 15:18:52 +00:00
Chris Lattner
3ef6dc7bdd Gut the type printing code so there is only one copy of it instead of 3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2576 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 14:40:11 +00:00
Chris Lattner
2d05a1acb0 * Remove dead "constant printing" code
* 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
2002-05-09 05:16:40 +00:00
Chris Lattner
2a7ab2e46d Remove gross "Operand" instance variable
Remove lots of unneccesary arguments to methods


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2574 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 04:39:00 +00:00
Chris Lattner
2f49902374 Simplify and clean up function calls.
Now indirect function calls work, except that function pointer types are not correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2573 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 04:21:21 +00:00
Chris Lattner
2f5eb4e9a5 * Remove dead function
* Print C strings correctly
* Expand C escape sequences nicely (ie \n \t, etc get generated instead of hex escapes)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2572 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:56:52 +00:00
Chris Lattner
4440826cae Make Getelementptr, load & store all work the right way.
Handle global variables correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2571 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:50:42 +00:00
Chris Lattner
2f5f51a852 Many random fixes:
* Use binary operator logic for shifts instead of cloning code
 * Unary not is '~' not '!'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2570 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:28:37 +00:00
Chris Lattner
f34ee81c5e Incorporate and purge function before and after printing them so unnamed values
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
2002-05-09 03:12:34 +00:00
Chris Lattner
b5af06a0ec Factor out the code to print a value to ONE place.
It turns out that unnamed values DO NOT work at all, that's next on the list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2568 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:06:06 +00:00
Chris Lattner
16c7bb2c8f First wave of cleanups, looks like the first of many.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2567 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 02:28:59 +00:00
Sumant Kowshik
9ddc86c6e5 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2552 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 18:09:58 +00:00
Chris Lattner
a163fdfc80 Extend TargetData::getIndexedOffset to support arrays and pointers!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2535 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 20:00:33 +00:00
Chris Lattner
9b625030c8 Replace all usages of Type::isPointerType with isa<PointerType>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2486 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:15:30 +00:00
Chris Lattner
86e9187dcc Add neccesary #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2406 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:48:55 +00:00
Chris Lattner
c6f3ae5c66 Eliminate duplicate or unneccesary #include's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2397 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 17:42:12 +00:00
Chris Lattner
96c466b06a Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2395 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 14:57:45 +00:00
Chris Lattner
97e52e4336 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2386 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:27:06 +00:00
Chris Lattner
d50b671280 Add #include that was removed from TargetMachine.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2381 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 20:40:59 +00:00
Chris Lattner
97453d60c6 Include appropriate file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2379 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 20:40:16 +00:00
Chris Lattner
31bcdb822f Split ConstantVals.h into Constant.h and Constants.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2378 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:55:58 +00:00
Chris Lattner
bfeec103e1 Simplify and update code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2376 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:20:10 +00:00
Chris Lattner
1b7f7dc4b4 Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2370 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:21:30 +00:00
Chris Lattner
8fc2f2072d Remove all contents of the cfg namespace to the global namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2369 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:19:42 +00:00
Chris Lattner
fd63f25fbd Simplify code
Remove unneccesary getID variant for module's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2353 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:50:54 +00:00
Chris Lattner
483e14ee04 s/Method/Function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2336 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 07:27:19 +00:00
Chris Lattner
f57b845547 * Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2333 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 06:56:12 +00:00
Chris Lattner
35504209a0 Use the cast<> operator in favor of C style casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2331 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 03:14:39 +00:00
Chris Lattner
1a18b7cf80 Change Constant::getNullConstant to Constant::getNullValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2323 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:25:14 +00:00
Chris Lattner
87e873bd3d Simplify code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2322 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:24:17 +00:00
Vikram S. Adve
d23a229c4c Don't record instructions for copying method arguments in the
AddedInstrns sets for the first machine instruction.  It is hard
to ensure that the right order is preserved, and sure enough, the
order was broken.  Instead, use a separate set for the function entry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2318 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:46:28 +00:00
Vikram S. Adve
0bc0516078 Don't pad spills and temp. stack areas for alignment.
Freeze auto vars and spill areas when their sizes are used
for computing other offsets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2317 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:43:45 +00:00
Vikram S. Adve
31f78c4f6b Major changes to how int and FP arguments are handled. Varargs
function calls were simply wrong; other functions were just not
using all available registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2316 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:42:21 +00:00
Vikram S. Adve
6d78311fd2 Added functions to compute which register, if any, to use
for a particular argument in a list of arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2315 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:40:24 +00:00
Vikram S. Adve
dbc4fad577 Insert copy operations for FP arguments to a varargs function,
to copy the FP arg. to an integer.  Necessary so that the
register allocator has two different live ranges for the FP value
and the int. argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2314 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:37:51 +00:00
Vikram S. Adve
a4a943dd5a Implementation of class MachineFrameInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2313 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:35:27 +00:00
Vikram S. Adve
4876209aa6 Don't record instructions for copying method arguments in the
AddedInstrns sets for the first machine instruction.  It is hard
to ensure that the right order is preserved, and sure enough, the
order was broken.  Instead, use a separate set for the function entry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2312 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:34:15 +00:00
Chris Lattner
4b1de8eb99 * getAsString requires that the input array is string compatible, so
assert it.
* Use WriteAsOperand instead of getStringValue for constants


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2296 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:15:38 +00:00
Chris Lattner
6228106e9f Just use << isntead of forcing getStrValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2294 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:14:40 +00:00
Chris Lattner
e4a94f2b0f Only print debug message if DEBUG_RA is on
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2254 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-15 22:41:48 +00:00
Chris Lattner
167b9629e1 Only emit message if DEBUG_RA is on
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2252 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-15 20:36:15 +00:00