1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
Commit Graph

3593 Commits

Author SHA1 Message Date
Misha Brukman
1a3c1a6208 ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::
The JIT is designed to code-generate a function at-a-time. That means that any
pass can only make local changes to its function. Period.

Because the Sparc PreSelection pass claims to be a BasicBlock pass while adding
globals to the Module, it cannot be run with the other passes, because by this
time, the globals have been output already by the JIT, and the addresses of any
globals appearing AFTER this point are not recognized.

However, the PreSelection pass is a requirement for correctness in the Sparc
codegen path, so it MUST be run.

::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::

llvm-svn: 6650
2003-06-06 06:59:55 +00:00
Misha Brukman
6762302093 Output function address as hex.
llvm-svn: 6649
2003-06-06 06:52:35 +00:00
Misha Brukman
960a2c69b5 Fixed a bunch of test cases in test/Regression/Jello which could not get the
address of a floating-point (allocated via ConstantPool) correctly.

llvm-svn: 6647
2003-06-06 04:41:22 +00:00
Chris Lattner
437985e52c Add statistic for # machine instrs emitted
Add GROSS HACK to get CompilationCallback to work when compiled in release mode

llvm-svn: 6646
2003-06-06 04:00:05 +00:00
Misha Brukman
4720f1af42 * If a global is not a function, just ask the MachineCodeEmitter for the addr
* Do not block a print statement with a DEBUG() guard if we're going to abort()

llvm-svn: 6645
2003-06-06 03:35:37 +00:00
Misha Brukman
9e8fd867b4 The SUB*i instructions belong to a different class than their SUB*r brethren.
llvm-svn: 6644
2003-06-06 03:34:47 +00:00
Misha Brukman
9136d8dd0d Put all debug print statements under the DEBUG() guard to make output clean so
that tests can automatically diff the output.

llvm-svn: 6642
2003-06-06 00:26:11 +00:00
Misha Brukman
999c7802ab Removed debug print statement.
llvm-svn: 6641
2003-06-06 00:00:54 +00:00
Misha Brukman
c3b2d93a5c Fixed confusion between register classes and register types.
Now %fcc registers are recognized correctly.

llvm-svn: 6640
2003-06-05 23:51:10 +00:00
Misha Brukman
f0c930a86c Added missing directive to store the instruction name.
llvm-svn: 6639
2003-06-05 23:35:11 +00:00
Misha Brukman
6026ff3361 Moved predict and annul fields to the end of each individual instruction
class, because they are currently unused.

llvm-svn: 6638
2003-06-05 23:33:15 +00:00
Misha Brukman
0c06cc4fb9 Do not preset the cc register, the instructions actually use it.
llvm-svn: 6637
2003-06-05 23:30:27 +00:00
Vikram S. Adve
9dea456cbd Minor tuning -- avoid a non-inlinable function call on every operand.
Also, reorder a couple of functions for inlining.

llvm-svn: 6635
2003-06-05 21:12:56 +00:00
Chris Lattner
6366fa53e5 Fix (bogus) possibly uninitialized warning
llvm-svn: 6634
2003-06-05 21:01:26 +00:00
Misha Brukman
26e89721e8 Added lazy function resolution to the JIT.
llvm-svn: 6633
2003-06-05 20:52:06 +00:00
Misha Brukman
33a2ade60f * The textual output of (non-)predicted FP branches is the same.
* Stop mapping FBcc instructions to deprecated opcodes, map to FBPcc instead.
* Fixed opf in FCMPxy instructions.

llvm-svn: 6632
2003-06-05 20:51:37 +00:00
Chris Lattner
1bbfcd901c Fix bug: InstCombine/2003-06-05-BranchInvertInfLoop.ll
llvm-svn: 6630
2003-06-05 20:12:51 +00:00
Chris Lattner
6a3d2fc70e Implement generation of cmp R, C to not use an extra register
llvm-svn: 6627
2003-06-05 19:30:30 +00:00
Chris Lattner
ee044c3179 Special case simple binary operator X op C
This avoid generating a register to hold C, which in turn speeds up the
  register allocator by a lot: ~9% on 164.gzip and ~17% on 256.bzip2.  This
  also speeds up other passes.  This also speeds up execution of the program
  marginally, and makes the asm much easier to read. :)

llvm-svn: 6626
2003-06-05 18:28:55 +00:00
Chris Lattner
c1bc144c7d Add instructions for (add|sub|and|or|xor)ri(8|16|32)
llvm-svn: 6625
2003-06-05 18:25:08 +00:00
Chris Lattner
060e5e326b Fix bug: Jello/2003-06-04-bzip2-bug.ll
llvm-svn: 6624
2003-06-05 17:15:04 +00:00
Anand Shukla
80e3f54082 Fixed a bug so initialization code is always inserted in main
llvm-svn: 6622
2003-06-05 06:02:46 +00:00
Chris Lattner
b7423ab729 Use a constant expr GEP instead of an actual instruction
llvm-svn: 6620
2003-06-05 04:48:18 +00:00
Misha Brukman
e8b6c4d380 All store instructions really want 'rd' in the first field.
Special cases: STFSRx and STXFSRx - they operate on predefined rd=0 or rd=1, and
expect %fsr as the parameter in assembly. They are disabled (since not used)
until an encoding, both for code generation and output, is chosen.

llvm-svn: 6619
2003-06-05 01:06:10 +00:00
Misha Brukman
93b1009318 Added missing 'rs1' field to F3_rdrs1imm13, 'rd' to F3_rdrs1rs2.
llvm-svn: 6618
2003-06-05 00:39:45 +00:00
Brian Gaeke
bc5ddca6a2 lib/CodeGen/Mapping/MappingInfo.cpp:
Update file comment to contain a bunch of the overview mapping-info
  documentation previously buried within the file.
 Remove some unnecessary include/using stmts.
 Rename pass to MappingInfoCollector.
 Rewrite a lot of it so it doesn't use global instance variables and so
  it outputs into MappingInfo objects and then dumps those out, instead of going
  straight to an assembly file.
 Change name of factory to getMappingInfoCollector.
 Fold prologue & epilogue writers into MappingInfo methods.

lib/Target/Sparc/FInfo.cpp:
 Correct file comment to reflect above change

lib/Target/Sparc/Sparc.cpp:
 Change name of factory to getMappingInfoCollector.

llvm-svn: 6617
2003-06-04 22:07:12 +00:00
Brian Gaeke
a7ab370eb9 Add file comment. Include <vector> and <string>. Update include guards
to reflect file's current location.  Add definition of class
MappingInfo.

llvm-svn: 6616
2003-06-04 22:02:47 +00:00
Chris Lattner
947a0974df Revert brians patch to get mapping info working again
sorry dude

llvm-svn: 6615
2003-06-04 21:01:12 +00:00
Tanya Lattner
f08c51ca3b Had to comment out a line in outByte() to get it to compile because Out and tmp were
undeclared. I was not sure what Brian wanted, so I will let him fix this. But now it compiles.

llvm-svn: 6614
2003-06-04 20:53:46 +00:00
Chris Lattner
3c98c8953a Make this work with counter > 127
llvm-svn: 6613
2003-06-04 20:08:47 +00:00
Misha Brukman
a8c409ad9b * Instead of re-inventing the MachineConstantPool emitter that's already given
in Emitter.cpp, just convert the Sparc version of the constant pool into
  what's already supported and inter-operate.
* Implemented a first pass at lazy function resolution in the JITResolver. That
  required adding a SparcV9CodeEmitter pointer to simplify generating
  bit-patterns of the instructions.
* SparcV9CodeEmitter now creates and destroys static TheJITResolver, which makes
  sense because the SparcV9CodeEmitter is the only user of TheJITResolver, and
  lives for the entire duration of the JIT (via PassManager which lives in VM).
* Changed all return values in the JITResolver to uint64_t because of the 64-bit
  Sparc architecture.
* Added a new version of getting the value of a GlobalValue in the
  SparcV9CodeEmitter, which now works for already-generated functions (JITted or
  library functions).
* Removed little-used and unused functions, cleaning up the internal view of the
  SparcV9CodeEmitter.

llvm-svn: 6612
2003-06-04 20:01:13 +00:00
Misha Brukman
b2cf47cfc1 * Institute a hack for the Sparc call to mmap() to get our generated code to be
laid out closer to the VM so that calls to library functions (e.g. puts()) and
  callback (e.g.  JITResolver::CompilationCallback) fit into 30 bits of the call
  instruction.
* Abort if architecture is not yet supported (not X86 or Sparc) because it
  likely requires a different set of parameters to mmap() .
* Stop using hard-coded values for page size; use sysconf(_SC_PAGESIZE) instead.

llvm-svn: 6610
2003-06-04 19:45:25 +00:00
Brian Gaeke
abf48764ff Make writeNumber() void. Get ready to decouple it from .byte directive output.
llvm-svn: 6609
2003-06-04 18:17:22 +00:00
Sumant Kowshik
a961b3c083 Made changes suggested by Chris
llvm-svn: 6606
2003-06-04 08:03:57 +00:00
Chris Lattner
95d21756aa Clean up previous code.
Add new combination to turn seteq X, 0 -> not(cast X to bool)

llvm-svn: 6604
2003-06-04 05:10:11 +00:00
Misha Brukman
b126ea43eb I have finally seen the light. The code to change the opcode must live higher in
the loop, and in both cases. In the first case, it is a VReg that is a constant
so it may be actually converted to a constant. In the second case, it is already
a constant, but then if it doesn't change its type (e.g. to become a register
and have the value loaded from memory if it is too large to live in its
instruction field), we must change the opcode BEFORE the 'continue', otherwise
we miss the opportunity.

llvm-svn: 6602
2003-06-04 04:54:06 +00:00
Misha Brukman
29b191bbed Added the 4.7 instruction class and all the FMOVcc instructions in them.
llvm-svn: 6601
2003-06-04 04:48:31 +00:00
Chris Lattner
b2ea03d03a Implement combination of boolean not with branch
llvm-svn: 6599
2003-06-04 04:46:00 +00:00
Misha Brukman
168c089a59 Comment out opcodes currently unused in the Sparc backend.
llvm-svn: 6597
2003-06-04 02:57:55 +00:00
Chris Lattner
7190c04fc5 No really, you _cannot use_ getelementptr on an unsized type: that makes
no sense.

llvm-svn: 6595
2003-06-04 02:35:35 +00:00
Misha Brukman
ee88ddfc38 Added instruction format class 3.15 and floating-point compare instructions.
llvm-svn: 6594
2003-06-04 02:26:14 +00:00
Vikram S. Adve
15a27e40c6 Undo one of those last fixes -- it was incorrect.
llvm-svn: 6593
2003-06-04 02:10:37 +00:00
Misha Brukman
6e22f0fa52 Sparc's dlsym() requires the special operand RTLD_SELF to find a symbol in the
currently-running process.

llvm-svn: 6592
2003-06-04 01:57:22 +00:00
Chris Lattner
48586849db Avoid generating a getelementptr instruction of a function
llvm-svn: 6591
2003-06-04 01:24:40 +00:00
Misha Brukman
a69a008010 Pass through the emitConstantPool() call to the real emitter.
llvm-svn: 6590
2003-06-03 20:00:49 +00:00
Brian Gaeke
0caf021e69 Make the write*map methods more self-contained. Document some more.
llvm-svn: 6589
2003-06-03 19:30:15 +00:00
Chris Lattner
1cb899dd19 Remove usage of typedef
llvm-svn: 6583
2003-06-03 15:41:58 +00:00
Chris Lattner
92fba99afb Add namespace comments for doxygen
llvm-svn: 6581
2003-06-03 15:31:23 +00:00
Brian Gaeke
e55a000638 I documented this file, in an attempt to understand it, with a view toward
rewriting it.  I also vacuumed out all the commented-out code and
inaccurate comments, etc.

(We need to put the mapping information in a data structure so that we can
pass it out to the JIT, instead of automagically converting it to .byte
directives.)

llvm-svn: 6574
2003-06-03 07:56:05 +00:00
Chris Lattner
88a500368b Use the new -o tablegen option
llvm-svn: 6572
2003-06-03 05:06:33 +00:00
Misha Brukman
e5c5705c02 Constants are laid out in memory in PC-relative form.
llvm-svn: 6568
2003-06-03 03:24:12 +00:00
Misha Brukman
1b73726832 Added opcode conversion for conditional move of integers.
llvm-svn: 6567
2003-06-03 03:23:35 +00:00
Misha Brukman
28430ecbc6 * Convert load/store opcodes from register to immediate forms.
* Stop code from wrapping to the next line.

llvm-svn: 6566
2003-06-03 03:21:58 +00:00
Misha Brukman
77188166d5 Convert load/store opcodes from register to immediate forms, if necessary.
llvm-svn: 6565
2003-06-03 03:20:57 +00:00
Misha Brukman
4c382415f6 Store instructions are different from other Format 3.1/3.2 instructions in that
they prefer the destination register to be last. Thus, two new classes were made
for them that accomodate for having this layout of operands (F3_1rd, F3_2rd).

llvm-svn: 6564
2003-06-03 03:20:14 +00:00
Misha Brukman
7a5eac8485 Moved code to modify the opcode from 'reg' to 'imm' form to a more logical place.
llvm-svn: 6563
2003-06-03 03:18:20 +00:00
Misha Brukman
2a257c6d5d * Added section A.34: Move FP register on int reg condition (FMOVr)
* Labeled sections that are not currently used in the Sparc backend as not
  requiring completion at this time.

llvm-svn: 6562
2003-06-03 01:16:27 +00:00
Misha Brukman
7340e85998 * Removed unused classes (rd field is always mentioned last); fixed comments.
* Added instruction classes which start building from rs1, then rs2, and rd.
* Fixed order of operands in classes 4.1 and 4.2; added 4.6 .

llvm-svn: 6561
2003-06-03 01:13:53 +00:00
Misha Brukman
2de19586d6 * Removed unused classes: the rd field is always mentioned as the last reg.
* Added new classes which start building from rs1, adding rs2, and then rd.
* Fixed order of operands in classes 3.11, 3.12, 3.16, and 3.17 .
* Fixed comments to reflect Real Life (tm).
* Removed "don't care" commented out assignments and dead classes (#if 0).

llvm-svn: 6560
2003-06-03 01:11:58 +00:00
Misha Brukman
8866b56ddd The rd field goes after the immediate field in format 2.1 instructions.
llvm-svn: 6559
2003-06-03 01:04:04 +00:00
Misha Brukman
8871478c0c Moved FInfo.cpp to lib/Target/Sparc as it is Sparc-specific.
llvm-svn: 6554
2003-06-02 23:27:09 +00:00
Chris Lattner
abad1ceca0 Minor cleanups.
This pass should be moved to lib/Target/Sparc since it's sparc specific
It also needs a file comment.

llvm-svn: 6553
2003-06-02 22:57:41 +00:00
Chris Lattner
46e24d4492 Remove usage of noncopyable classes to clean up doxygen output.
In particular these classes are the last that link the noncopyable classes
with the hash_map, vector, and list classes.

llvm-svn: 6552
2003-06-02 22:45:07 +00:00
Chris Lattner
322afbda9d Add #include
llvm-svn: 6550
2003-06-02 22:05:13 +00:00
Misha Brukman
f343fb82d0 Added MOVR (move int reg on register condition), aka comparison with zero.
None of these instructions are actually used in the Sparc backend, so no changes
were required in the instruction selector.

llvm-svn: 6549
2003-06-02 21:16:54 +00:00
Misha Brukman
6f65b13ed3 SparcInstr.def: added 'r' and 'i' versions of MOV(F)cc instructions
SparcInstrSelection.cpp:
* Fixed opcodes to return correct 'i' version since the two functions are each
  only used in one place.
* Changed name of function to have an 'i' in the name to signify that they each
  return an immediate form of the opcode.
* Added a warning if either of the functions is ever used in a context which
  requires a register-version opcode.

SparcV9_F4.td: fixed class F4_3, added F4_4 and notes that F4_{1,2} need fixing
SparcV9.td: added the MOV(F)cc instructions

llvm-svn: 6548
2003-06-02 20:55:14 +00:00
Misha Brukman
e837bd5b48 Removed a useless ofstream.
llvm-svn: 6547
2003-06-02 20:49:09 +00:00
Misha Brukman
a285dbf6fd * Added casts to/from floating-point to integers.
* Changed // comments to #ifdef 0 to maintain syntax highlighting.

llvm-svn: 6546
2003-06-02 19:08:37 +00:00
Guochun Shi
c41e21ef9e compiled with the new SchedGraphCommon
llvm-svn: 6545
2003-06-02 17:48:56 +00:00
Chris Lattner
37b01d74e4 * Make assertion message useful
* Kill dead conditional

llvm-svn: 6544
2003-06-02 17:42:47 +00:00
Chris Lattner
c17deffb2b Fix bug: Linker/2003-06-02-TypeResolveProblem.ll
llvm-svn: 6542
2003-06-02 17:25:46 +00:00
Chris Lattner
fe6eef643c Be more robust in the face of undefined behavior.
Fixes bug: BasicAA/2003-06-01-AliasCrash.ll

llvm-svn: 6538
2003-06-02 05:42:39 +00:00
Misha Brukman
5e6f3a150c Clean up after merging in SparcEmitter.cpp; branches and return work again.
llvm-svn: 6536
2003-06-02 05:24:46 +00:00
Chris Lattner
a6e3ff1b5a Minor cleanups
llvm-svn: 6535
2003-06-02 05:21:06 +00:00
Misha Brukman
cb7c80a95c Eliminated a compiler warning due to casting to a different-sized datatype.
llvm-svn: 6531
2003-06-02 04:13:58 +00:00
Misha Brukman
5f7d301059 Merged in tools/lli/JIT/SparcEmitter.cpp, coupled with the JITResolver taken
from lib/Target/X86/X86CodeEmitter.cpp .

llvm-svn: 6530
2003-06-02 04:12:39 +00:00
Misha Brukman
1407922069 Remove spurious assert()
llvm-svn: 6529
2003-06-02 04:10:41 +00:00
Misha Brukman
8ce9f2956e Renamed MachineCodeEmitter.cpp -> X86CodeEmitter.cpp as it conflicts with the
target-independent lib/CodeGen/MachineCodeEmitter.cpp; preserved CVS history.

llvm-svn: 6528
2003-06-02 03:28:00 +00:00
Misha Brukman
1c70c3f7a3 * Removed SparcEmitter.cpp; rolled into lib/Target/Sparc/SparcV9CodeEmitter.cpp
* No more createX86Emitter() vs. createSparcEmitter() -- there can be only one
* As a result, the memory management semantics must be handled according to
  platform -- the parameters to mmap() are particularly sensitive to the host
  architecture.

llvm-svn: 6527
2003-06-02 03:23:16 +00:00
Chris Lattner
c8c58138b6 Fix bug: CBackend/2003-06-01-NullPointerType.ll
llvm-svn: 6526
2003-06-02 03:10:53 +00:00
Brian Gaeke
1547687d07 Deal with %lo/%lm/%hm/%hh flags in getMachineOpValue().
llvm-svn: 6522
2003-06-02 02:13:26 +00:00
Brian Gaeke
bbbe5d71d2 The flag modifications weren't picking up the old values of the
flags before. Save them in a temporary variable, then restore them from the
temporary after creating the new constant.

llvm-svn: 6520
2003-06-02 02:10:31 +00:00
Chris Lattner
1136441fcf Remove obsolete code
llvm-svn: 6518
2003-06-02 00:09:00 +00:00
Chris Lattner
a87f53efca Move target specific code to target files. The new MachineCodeEmitter
class is actually target independent!

llvm-svn: 6517
2003-06-01 23:24:36 +00:00
Chris Lattner
be569e986d Move X86 specific code out of the JIT into the X86 backend
llvm-svn: 6516
2003-06-01 23:23:50 +00:00
Chris Lattner
3422940bc8 Changes to be compatible with MachineCodeEmitter.h
llvm-svn: 6515
2003-06-01 23:22:11 +00:00
Brian Gaeke
495826a0e5 Fix induction variable name clash in for loops, in finishFunction().
Modify new MachineOperand so that its flags match the old MachineOperand's
 flags, for the flags that matter.

llvm-svn: 6513
2003-06-01 22:08:29 +00:00
Brian Gaeke
b9ab2b7ba2 Make the .inc file depend on $(TBLGEN), so that changes to TableGen followed
by a re-link of TableGen will notify Make to rebuild the .inc file.

llvm-svn: 6512
2003-06-01 04:52:51 +00:00
Chris Lattner
a108915211 Don't print out unique identifier for opaque types
llvm-svn: 6511
2003-06-01 03:45:51 +00:00
Chris Lattner
bf8929c4bb * Implement cast (long|ulong) to bool
* Fix cast of (short|ushort|int|uint) to bool to work right

llvm-svn: 6510
2003-06-01 03:38:24 +00:00
Chris Lattner
dce4ab92a4 Add RR forms of test instruction
llvm-svn: 6509
2003-06-01 03:37:46 +00:00
Chris Lattner
010cda7529 Fix a bug with casts to bool. This fixes testcase UnitTests/2003-05-31-CastToBool.c
llvm-svn: 6507
2003-06-01 03:36:51 +00:00
Chris Lattner
eaafbfd2df Implement xform: (X != 0) -> (bool)X
llvm-svn: 6506
2003-06-01 03:35:25 +00:00
Anand Shukla
3f99ba3fc9 Add map info for arguments to call (copies)
llvm-svn: 6503
2003-06-01 02:48:23 +00:00
Anand Shukla
6939133e23 Added the #(internal functions) to output
llvm-svn: 6502
2003-06-01 02:40:49 +00:00
Chris Lattner
92eb5bbb15 Add support for shl and shr for 64 bit integer types
llvm-svn: 6499
2003-06-01 01:56:54 +00:00
Chris Lattner
96f7ec62fe Add definitions for TEST instructions
llvm-svn: 6498
2003-06-01 01:56:39 +00:00
Chris Lattner
f37c407475 Add new cmovne32 instruction
llvm-svn: 6496
2003-06-01 00:05:15 +00:00
Chris Lattner
fb76ebe95a Fix bug: CBackend/2003-05-31-MissingStructName.ll
llvm-svn: 6495
2003-05-31 23:30:52 +00:00
Chris Lattner
0897583c5c Fix bug: FunctionResolve/2003-05-31-AllInternalDecls.ll
llvm-svn: 6486
2003-05-31 21:57:06 +00:00
Chris Lattner
00751219b0 Fix bug: FuncResolve/2003-05-31-InternalDecl.ll
Count resolutions correctly.

llvm-svn: 6482
2003-05-31 21:08:45 +00:00
Chris Lattner
d825cf5ee3 Simplify funcresolve a bit more
llvm-svn: 6480
2003-05-31 20:44:46 +00:00
Chris Lattner
a7b50146af Fix bug: FunctionResolve/2003-05-31-FuncPointerResolve.ll
llvm-svn: 6479
2003-05-31 20:33:31 +00:00
Tanya Lattner
eaa01f0821 Fixed comment width, changed arg to be const, fixed indentation, removed unnecessary includes.
llvm-svn: 6476
2003-05-31 20:01:37 +00:00
Vikram S. Adve
540655e2ae Minor changes.
llvm-svn: 6470
2003-05-31 07:41:54 +00:00
Vikram S. Adve
d43c10b583 Added MachineCodeForInstruction object as an argument to
TmpInstruction constructors because every TmpInstruction object has
to be registered with a MachineCodeForInstruction to prevent leaks.
This simplifies the user's code.

llvm-svn: 6469
2003-05-31 07:41:24 +00:00
Vikram S. Adve
b2bb0dd8ca Allow explicit physical registers for implicit operands.
llvm-svn: 6468
2003-05-31 07:39:06 +00:00
Vikram S. Adve
2d906f4550 Changes to allow explicit physical register arguments that have been
preallocated.  While reg-to-reg dependences were already handled, this
change required new code for adding edges to/from call instructions.
This was part of the extensive changes to the way code generation occurs
for function call arguments and return values.
See log for CodeGen/PhyRegAlloc.cpp.

llvm-svn: 6467
2003-05-31 07:37:05 +00:00
Vikram S. Adve
83409b0b78 Several bug fixes: globals in call operands were not being pulled out;
globals in some other places may not have been pulled out either;
globals in phi operands were being put just before the phi instead of
in the predecessor basic blocks.

llvm-svn: 6466
2003-05-31 07:34:57 +00:00
Vikram S. Adve
194a5862e0 Extensive changes to the way code generation occurs for function
call arguments and return values:
Now all copy operations before and after a call are generated during
selection instead of during register allocation.
The values are copied to virtual registers (or to the stack), but
in the former case these operands are marked with the correct physical
registers according to the calling convention.
Although this complicates scheduling and does not work well with
live range analysis, it simplifies the machine-dependent part of
register allocation.

llvm-svn: 6465
2003-05-31 07:32:01 +00:00
Vikram S. Adve
884f4c7a97 Reverting previous beautification changes.
llvm-svn: 6464
2003-05-31 07:27:17 +00:00
Misha Brukman
afa8e60f9f Fixed rewriting of branches -- they now work forward and backward.
llvm-svn: 6463
2003-05-31 06:26:48 +00:00
Misha Brukman
be11d6eed3 Removed useless code -- the byte order of output code is correct as is.
llvm-svn: 6462
2003-05-31 06:26:06 +00:00
Misha Brukman
32fae9b78a The 'rd' register is consistently mentioned last in instruction definitions.
Created new classes from which instructions inherit their ordering of fields.

llvm-svn: 6461
2003-05-31 06:25:19 +00:00
Misha Brukman
ee757debd1 * Put back into action SLL/SRL/SRA{r,i}6 instructions
* Fixed page numbers referring to the Sparc manual

llvm-svn: 6460
2003-05-31 06:24:29 +00:00
Misha Brukman
3fc07ad7b8 Code beautification, no functional changes.
llvm-svn: 6459
2003-05-31 06:22:37 +00:00
Misha Brukman
a49daf449e Enabling some of these passes causes lli to break
llvm-svn: 6457
2003-05-31 04:23:04 +00:00
Misha Brukman
0fae161230 The actual order of parameters in a 2-reg-immediate assembly instructions is
"rs1, imm, rd": most importantly, rd goes last.

llvm-svn: 6456
2003-05-31 04:22:26 +00:00
Misha Brukman
a9a5c77dd4 Since malloc is no longer used, no need to free() memory.
Fixed BasicBlock patching by supplying correct type for the displacement.

llvm-svn: 6453
2003-05-30 20:39:37 +00:00
Misha Brukman
b1b8a6732e When converting virtual registers to immediate constants, change the opcode.
llvm-svn: 6452
2003-05-30 20:36:27 +00:00
Misha Brukman
c5a1e94883 Added saveBBreferences() for BasicBlock resolution.
llvm-svn: 6451
2003-05-30 20:32:45 +00:00
Misha Brukman
d40446e90c Added:
* ability to save BasicBlock references to be resolved later
* register remappings from the enum values to the real hardware numbers

llvm-svn: 6449
2003-05-30 20:17:33 +00:00
Misha Brukman
6b36ebb7a9 Fixed the namespace to match SparcInternals.h; added notes on some missing
sections of instructions.

llvm-svn: 6448
2003-05-30 20:15:59 +00:00
Misha Brukman
0edfa6f237 The register types need to be visible outside of the class to be useful.
For one, converting register numbers based on class in the code emitter.

llvm-svn: 6447
2003-05-30 20:12:42 +00:00
Misha Brukman
ce67ffb229 Moved and expanded convertOpcodeFromRegToImm() to conver more opcodes.
Code beautification for the rest of the code: changed layout to match the rest
of the code base.

llvm-svn: 6446
2003-05-30 20:11:56 +00:00
Misha Brukman
e787ba07ed Make LLI behave just like LLC with regard to the compile passes it uses.
llvm-svn: 6444
2003-05-30 20:00:13 +00:00
Chris Lattner
1c10a30949 Okay totally give up on trying to optimize aggregates that cannot be completely
broken up into their elements.  Too many programs break because of this.

llvm-svn: 6440
2003-05-30 19:22:14 +00:00
Misha Brukman
f4345bcdb6 Made the register and immediate versions of instructions consecutive.
llvm-svn: 6439
2003-05-30 19:14:01 +00:00
Chris Lattner
bf8c1cb6a3 add a check that allows the SRoA pass to avoid breaking programs, even if their
behavior is technically undefined

llvm-svn: 6438
2003-05-30 18:09:57 +00:00
Misha Brukman
9c38927f33 Because the format of the shift instructions is `shift r, shcnt, r', the
instructions of format 3.12 and 3.13 cannot inherit from F3rdrs1, because that
implies that the two registers are the first two parameters to the instruction.

Thus I made the instructions inherit from F3rd again, and manually added an rs1
field AFTER the shcnt field in the instruction, which maps to the appropriate
place in the instruction.

The other changes are just elimination of unnecessary spaces.

llvm-svn: 6437
2003-05-30 18:06:10 +00:00
Tanya Lattner
ce23a1f169 Added the CloneTrace function which clones traces. It takes a vector of basic blocks, removes
internal phi nodes, and returns a new vector of basic blocks.

llvm-svn: 6431
2003-05-30 15:50:18 +00:00
Brian Gaeke
240b6d81b8 Makefile: Make SparcV9CodeEmitter.inc depend on SparcV9_F*.td as well.
SparcV9_F3.td: F3_12 and F3_13 instructions have rd and rs1 fields. Also,
 their fields were totally screwed up. This seems to fix the problem.

llvm-svn: 6429
2003-05-30 08:02:14 +00:00
Chris Lattner
c9d950434b Fix bug: ScalarRepl/2003-05-30-MultiLevel.ll
llvm-svn: 6428
2003-05-30 05:26:30 +00:00
Chris Lattner
0d415b2dd3 Fix bug: ScalarRepl/2003-05-29-ArrayFail.ll
llvm-svn: 6425
2003-05-30 04:15:41 +00:00
Brian Gaeke
ad23dd697f Fix call to mmap, so that it can be used on sparc.
llvm-svn: 6424
2003-05-30 03:37:13 +00:00
Guochun Shi
21f3083978 so far everything compiles
llvm-svn: 6423
2003-05-30 00:17:09 +00:00
Sumant Kowshik
3186cb2b05 Added support for function pointers
llvm-svn: 6420
2003-05-29 22:42:44 +00:00
Chris Lattner
58c7aaa0e5 Add comment
llvm-svn: 6415
2003-05-29 20:26:30 +00:00
Misha Brukman
4636cc8a1d Since there is now another derived .inc file, ignore them all.
llvm-svn: 6411
2003-05-29 20:15:27 +00:00
Misha Brukman
4686564906 Use an absolute path to TableGen because not everyone (e.g. automatic tester)
has their path set up by this point.

llvm-svn: 6410
2003-05-29 20:09:56 +00:00
Misha Brukman
36876c8132 Added the target-independent part of TableGen data.
llvm-svn: 6403
2003-05-29 18:48:17 +00:00
Chris Lattner
01cbfa9317 Eliminate unnecessary ->get calls that are now automatically handled.
llvm-svn: 6397
2003-05-29 15:12:27 +00:00
Chris Lattner
24947af013 * Separate all of the grunt work of inlining out into the Utils library.
* Make the function inliner _significantly_ smarter.  :)

llvm-svn: 6396
2003-05-29 15:11:31 +00:00
Misha Brukman
1a404de2c8 When TableGen finds an error in the SparcV9.td file, it exits with a non-zero
exit code. This, in turn, makes an empty file SparcV9CodeEmitter.inc, and only
much later, produces a link error because the key function that TableGen creates
isn't found.

Using a temporary file in the middle forces a good .INC file to be generated by
TableGen, and it will keep trying until you fix the input file.

llvm-svn: 6392
2003-05-29 05:29:22 +00:00
Misha Brukman
43b9b22635 Fixed to use the correct format of the instruction.
llvm-svn: 6390
2003-05-29 04:53:56 +00:00
Misha Brukman
acc59595e3 This should work better with re-generating the SparcV9CodeEmitter.inc file.
Also, added a rule to delete the generated .inc file on `make clean'.

llvm-svn: 6389
2003-05-29 03:32:49 +00:00
Misha Brukman
d0b1d8fa42 * Broke up SparcV9.td into separate files as it was getting unmanageable
* Added some Format 4 classes, but not instructions
* Added notes on missing sections with FIXMEs
* Added RDCCR instr

llvm-svn: 6388
2003-05-29 03:31:43 +00:00
Misha Brukman
e1a9c59304 mmap() seems to be failing on Sparc, so just use malloc()/free() .
llvm-svn: 6387
2003-05-28 18:44:38 +00:00
Misha Brukman
51eb037b1e Correctly write out binary data as chars, before they're cast to ints.
llvm-svn: 6385
2003-05-28 18:27:19 +00:00
Misha Brukman
45acae8fa4 Fixed ordering of elements in instructions: although the binary instructions
list (rd, rs1, imm), in that order (bit-wise), the actual assembly syntax is
instr rd, imm, rs1, and that is how they are constructed in the instruction
selector. This fixes the discrepancy.

Also fixed some comments along the same lines and fixed page numbers referring
to where instructions are described in the Sparc manual.

llvm-svn: 6384
2003-05-28 17:49:29 +00:00
Brian Gaeke
85c00e2ef2 Add dependency to make TableGen rule fire.
llvm-svn: 6383
2003-05-28 17:41:09 +00:00
Misha Brukman
69c46ee879 Fixed an error preventing compilation.
llvm-svn: 6381
2003-05-27 22:48:28 +00:00
Misha Brukman
3da906bb36 Added the 'r' and 'i' annotations to instructions as their opcode names have
changed.

llvm-svn: 6380
2003-05-27 22:44:44 +00:00
Misha Brukman
4960b8db94 Added a debugging code emitter that prints code to a file, debug to std::cerr,
and passes the real code to a memory-outputting code emitter. This may be
removed at a later point in development.

llvm-svn: 6379
2003-05-27 22:43:19 +00:00
Misha Brukman
6e1f75f37c Keep track of the current BasicBlock being processed so that a referencing
MachineInstr can later be patched up correctly.

llvm-svn: 6378
2003-05-27 22:41:44 +00:00
Misha Brukman
87d98c1707 Added 'r' and 'i' annotations to instructions as SparcInstr.def has changed.
llvm-svn: 6377
2003-05-27 22:40:34 +00:00
Misha Brukman
e534d3bde2 Added 'r' or 'i' annotations to instructions, as SparcInstr.def has changed.
Non-obvious change: since I have changed ST and STD to be STF and STDF to
(a) closer resemble their name (NOT assembly text) in the Sparc manual, and
(b) clearly specify that they they are floating-point opcodes,
I made the same changes in this file.

llvm-svn: 6376
2003-05-27 22:39:01 +00:00
Misha Brukman
1d3512486a Added 'r' or 'i' annotations to instructions, as SparcInstr.def has changed.
Here I had to make one non-trivial change: add a function to get a version of
the opcode that takes an immediate, given an opcode that takes all registers.

This is required because sometimes it is not known at construction time which
opcode is used because opcodes are passed around between functions.

llvm-svn: 6375
2003-05-27 22:37:00 +00:00
Misha Brukman
4a16c0cab3 Added 'r' or 'i' annotations to instructions, as SparcInstr.def has changed.
llvm-svn: 6373
2003-05-27 22:35:43 +00:00
Misha Brukman
1b839ffe58 Added entries for each of the instructions with annotations ('r' or 'i').
llvm-svn: 6372
2003-05-27 22:33:39 +00:00
Misha Brukman
806f354c57 One of the first major changes to make the work of JITting easier: adding
annotations on instructions to specify which format they are (i.e., do they take
2 registers and 1 immediate or just 3 registers) as that changes their binary
representation and hence, code emission.

This makes instructions more like how X86 defines them to be. Now, writers of
instruction selection must choose the correct opcode based on what instruction
type they are building, which they already know. Thus, the JIT doesn't have to
do the same work by `discovering' which operands an instruction really has.

As this involves lots of small changes to a lot of files in lib/target/Sparc,
I'll commit them individually because otherwise the diffs will be unreadable.

llvm-svn: 6371
2003-05-27 22:32:38 +00:00
Misha Brukman
ab3b2ea95c * Allow passing in an unsigned configuration to allocateSparcTargetMachine()
a default value is set in the header file.
* Fixed some code layout to make it more consistent with the rest of codebase
* Added addPassesToJITCompile() with relevant passes

llvm-svn: 6369
2003-05-27 22:24:48 +00:00
Misha Brukman
30ca3282a1 Moved generation of the SparcV9CodeEmitter.inc file higher in the Makefile so
that Makefile.common would see it.

llvm-svn: 6367
2003-05-27 22:04:38 +00:00
Misha Brukman
0d507cb055 Add prototypes to add passes to JIT compilation and code emission.
Also, added annotations to how instructions are modified (reg/imm operands).
Added prototype for adding register numbers to values pass for interfacing with
the target-independent register allocators in the JIT.

llvm-svn: 6366
2003-05-27 22:01:10 +00:00
Misha Brukman
125a99a9a3 Broke out class definition from SparcV9CodeEmitter, and added ability to take a
MachineCodeEmitter to make a pass-through debugger -- output to memory and to
std::cerr.

llvm-svn: 6363
2003-05-27 21:45:05 +00:00
Misha Brukman
4931c59635 Link in Sparc libs for the JIT, even on X86 to be able to support debugging
of Sparc JIT (printing out instrs) on X86. Con: this increases linking time.

llvm-svn: 6361
2003-05-27 21:42:05 +00:00
Misha Brukman
afffd58fe6 Allow for specification of which JIT to run on the commandline.
`lli -march=x86' or `lli -march=sparc' will forcefully select the JIT even on a
different platform. Running lli without the -march option will select the JIT
for the platform that it's currently running on.

Pro: can test Sparc JIT (debug printing mode) on X86 -- faster to compile/link
LLVM source base to test changes.
Con: Linking lli on x86 now pulls in all the Sparc libs -> longer link time
(but X86 can bear it, right?)

In the future, perhaps this should be a ./configure option to enable/disable
target JITting...

llvm-svn: 6360
2003-05-27 21:40:39 +00:00
Misha Brukman
e315a4f211 SparcV9CodeEmitter.cpp is a part of the Sparc code emitter. The main function
that assembles instructions is generated via TableGen (and hence must be built
before building this directory, but that's already the case in the top-level
Makefile).

Also added is .cvsignore to ignore the generated file `SparcV9CodeEmitter.inc',
which is included by SparcV9CodeEmitter.cpp .

llvm-svn: 6357
2003-05-27 20:07:58 +00:00
Misha Brukman
ae0cac1d7a Added definitions for a bunch of floating-point instructions.
llvm-svn: 6356
2003-05-27 20:03:29 +00:00
Chris Lattner
66432896b4 Fix constant folding to ALWAYS work.
llvm-svn: 6355
2003-05-27 19:16:07 +00:00
Chris Lattner
416e30b07b Fix bug: Instcombine/2003-05-27-ConstExprCrash.ll
llvm-svn: 6352
2003-05-27 16:40:51 +00:00
Chris Lattner
6796f5a374 Make _sure_ we don't go into an infinite loop if a signal happens!
llvm-svn: 6351
2003-05-27 16:25:04 +00:00
Chris Lattner
8a6c3b5cbe * Actually USE the statistic that we made
* Implement SRoA for arrays

llvm-svn: 6349
2003-05-27 16:09:27 +00:00
Chris Lattner
5c093a1a93 Implementation of the simple "scalar replacement of aggregates" transformation
llvm-svn: 6346
2003-05-27 15:45:27 +00:00
Vikram S. Adve
ab50c0aee5 Renamed MachienOperand::opIsDef to MachineOperand::opIsDefOnly()
and related functions and flags.  Fixed several bugs where only
"isDef" was being checked, not "isDefAndUse".

llvm-svn: 6342
2003-05-27 00:06:48 +00:00
Vikram S. Adve
681b3c77fa (1) Added special register class containing (for now) %fsr.
Fixed spilling of %fcc[0-3] which are part of %fsr.

(2) Moved some machine-independent reg-class code to class TargetRegInfo
    from SparcReg{Class,}Info.

(3) Renamed MachienOperand::opIsDef to MachineOperand::opIsDefOnly()
    and related functions and flags.  Fixed several bugs where only
    "isDef" was being checked, not "isDefAndUse".

llvm-svn: 6341
2003-05-27 00:05:23 +00:00
Vikram S. Adve
743adbaff7 Renamed opIsDef to opIsDefOnly.
llvm-svn: 6340
2003-05-27 00:03:17 +00:00
Vikram S. Adve
66969014b2 Added special register class containing (for now) %fsr.
Fixed spilling of %fcc[0-3] which are part of %fsr.
Moved some machine-independent reg-class code to class TargetRegInfo
from SparcReg{Class,}Info.

llvm-svn: 6339
2003-05-27 00:02:22 +00:00
Chris Lattner
1fde83c9b5 Fix bug: InstCombine/2003-05-26-CastMiscompile.ll
llvm-svn: 6338
2003-05-26 23:41:32 +00:00
Vikram S. Adve
ba61ed4fc2 Bug fix: right shift for int divide-by-power-of-2 was incorrect for
negative values.  Need to add one to a negative value before right shift!

llvm-svn: 6334
2003-05-25 21:59:47 +00:00
Vikram S. Adve
f8bb6381df Bug fix: padding bytes within a structure should go after each field!
llvm-svn: 6333
2003-05-25 21:59:09 +00:00
Vikram S. Adve
b78161976c Bug fix: sign-extension was not happening for C = -MININT since C == -C!
llvm-svn: 6332
2003-05-25 21:58:11 +00:00
Chris Lattner
fbb45c1b92 Fix problem with last checkin.
llvm-svn: 6328
2003-05-25 16:15:32 +00:00
Vikram S. Adve
5553ed755a Add support for compiling varargs functions.
llvm-svn: 6325
2003-05-25 15:59:47 +00:00
Misha Brukman
6ffaa5b188 Reword to remove reference to how things worked in the past.
llvm-svn: 6323
2003-05-24 01:08:43 +00:00
Misha Brukman
b7a0d570a8 Implement the TargetInstrInfo's createNOPinstr() and isNOPinstr() interface.
llvm-svn: 6320
2003-05-24 00:09:50 +00:00
Chris Lattner
500984b918 Fix Bug: Linker/2003-04-26-NullPtrLinkProblem.ll
This was a problem with constants having their types resolved to some new type,
but there was already a constant of the new type created.  Before, these types
were never merged together, now they are.

llvm-svn: 6314
2003-05-23 20:03:32 +00:00
Misha Brukman
b385c22d80 Cleaned up code layout; no functional changes.
llvm-svn: 6312
2003-05-23 19:20:57 +00:00
Chris Lattner
e58f6153f4 Remove using declarations
llvm-svn: 6306
2003-05-22 22:00:07 +00:00
Chris Lattner
6751acb59b Add using declarations
llvm-svn: 6305
2003-05-22 21:59:35 +00:00
Misha Brukman
daf2cc3c48 Cleaned up code layout. No functional changes.
llvm-svn: 6304
2003-05-22 21:49:18 +00:00
Chris Lattner
1cab8ed666 Remove using declarations and extraneous #includes
llvm-svn: 6303
2003-05-22 21:47:17 +00:00
Chris Lattner
2fb982f365 Fix static constructor ordering problem
llvm-svn: 6302
2003-05-22 21:31:52 +00:00
Misha Brukman
7d91017b21 Kill `using' directives.
llvm-svn: 6301
2003-05-22 21:24:35 +00:00
Chris Lattner
20c876a592 Remove using declarations
llvm-svn: 6300
2003-05-22 21:21:43 +00:00
Chris Lattner
e1d3dfec23 Make the list accept comma separated names
llvm-svn: 6295
2003-05-22 20:27:13 +00:00
Chris Lattner
7099c87692 Add new CommaSeparated option modifier
llvm-svn: 6294
2003-05-22 20:26:17 +00:00
Chris Lattner
802d657a39 Destroy using declarations
llvm-svn: 6291
2003-05-22 20:06:43 +00:00
Chris Lattner
ab034e55b5 * Revert to old behavior of ignoring a module if it doesn't contain a main
function and no symbols were explicitly marked to be externalized.
* Add new -internalize-public-api-list option that can be used if the symbol
  list is small, and making a new file is annoying.

llvm-svn: 6289
2003-05-22 19:48:00 +00:00
Chris Lattner
f26f3f74a3 Add option to internalize to allow it to read a file to determine which symbols
should not be internalized

llvm-svn: 6288
2003-05-22 19:34:49 +00:00