Revision tags: llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1 |
|
#
3d9674cf |
| 11-Nov-2014 |
Bill Schmidt <wschmidt@linux.vnet.ibm.com> |
[PowerPC] Replace foul hackery with real calls to __tls_get_addr
My original support for the general dynamic and local dynamic TLS models contained some fairly obtuse hacks to generate calls to __tl
[PowerPC] Replace foul hackery with real calls to __tls_get_addr
My original support for the general dynamic and local dynamic TLS models contained some fairly obtuse hacks to generate calls to __tls_get_addr when lowering a TargetGlobalAddress. Rather than generating real calls, special GET_TLS_ADDR nodes were used to wrap the calls and only reveal them at assembly time. I attempted to provide correct parameter and return values by chaining CopyToReg and CopyFromReg nodes onto the GET_TLS_ADDR nodes, but this was also not fully correct. Problems were seen with two back-to-back stores to TLS variables, where the call sequences ended up overlapping with unhappy results. Additionally, since these weren't real calls, the proper register side effects of a call were not recorded, so clobbered values were kept live across the calls.
The proper thing to do is to lower these into calls in the first place. This is relatively straightforward; see the changes to PPCTargetLowering::LowerGlobalTLSAddress() in PPCISelLowering.cpp. The changes here are standard call lowering, except that we need to track the fact that these calls will require a relocation. This is done by adding a machine operand flag of MO_TLSLD or MO_TLSGD to the TargetGlobalAddress operand that appears earlier in the sequence.
The calls to LowerCallTo() eventually find their way to LowerCall_64SVR4() or LowerCall_32SVR4(), which call FinishCall(), which calls PrepareCall(). In PrepareCall(), we detect the calls to __tls_get_addr and immediately snag the TargetGlobalTLSAddress with the annotated relocation information. This becomes an extra operand on the call following the callee, which is expected for nodes of type tlscall. We change the call opcode to CALL_TLS for this case. Back in FinishCall(), we change it again to CALL_NOP_TLS for 64-bit only, since we require a TOC-restore nop following the call for the 64-bit ABIs.
During selection, patterns in PPCInstrInfo.td and PPCInstr64Bit.td convert the CALL_TLS nodes into BL_TLS nodes, and convert the CALL_NOP_TLS nodes into BL8_NOP_TLS nodes. This replaces the code removed from PPCAsmPrinter.cpp, as the BL_TLS or BL8_NOP_TLS nodes can now be emitted normally using their patterns and the associated printTLSCall print method.
Finally, as a result of these changes, all references to get-tls-addr in its various guises are no longer used, so they have been removed.
There are existing TLS tests to verify the changes haven't messed anything up). I've added one new test that verifies that the problem with the original code has been fixed.
llvm-svn: 221703
show more ...
|
#
da84e337 |
| 14-Oct-2014 |
Eric Christopher <echristo@gmail.com> |
Use the triple to figure out if this is a darwin target, not the subtarget.
llvm-svn: 219673
|
Revision tags: llvmorg-3.5.0, llvmorg-3.5.0-rc4, llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2 |
|
#
d913448b |
| 04-Aug-2014 |
Eric Christopher <echristo@gmail.com> |
Remove the TargetMachine forwards for TargetSubtargetInfo based information and update all callers. No functional change.
llvm-svn: 214781
|
Revision tags: llvmorg-3.5.0-rc1 |
|
#
3ee2af7d |
| 18-Jul-2014 |
Hal Finkel <hfinkel@anl.gov> |
[PowerPC] 32-bit ELF PIC support
This adds initial support for PPC32 ELF PIC (Position Independent Code; the -fPIC variety), thus rectifying a long-standing deficiency in the PowerPC backend.
Patch
[PowerPC] 32-bit ELF PIC support
This adds initial support for PPC32 ELF PIC (Position Independent Code; the -fPIC variety), thus rectifying a long-standing deficiency in the PowerPC backend.
Patch by Justin Hibbits!
llvm-svn: 213427
show more ...
|
Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1, llvmorg-3.4.1, llvmorg-3.4.1-rc2 |
|
#
062a2bae |
| 25-Apr-2014 |
Craig Topper <craig.topper@gmail.com> |
[C++] Use 'nullptr'. Target edition.
llvm-svn: 207197
|
Revision tags: llvmorg-3.4.1-rc1 |
|
#
a3ad4e69 |
| 19-Feb-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
move getNameWithPrefix and getSymbol to TargetMachine.
TargetLoweringBase is implemented in CodeGen, so before this patch we had a dependency fom Target to CodeGen. This would show up as a link fail
move getNameWithPrefix and getSymbol to TargetMachine.
TargetLoweringBase is implemented in CodeGen, so before this patch we had a dependency fom Target to CodeGen. This would show up as a link failure of llvm-stress when building with -DBUILD_SHARED_LIBS=ON.
This fixes pr18900.
llvm-svn: 201711
show more ...
|
#
daeafb4c |
| 19-Feb-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Add back r201608, r201622, r201624 and r201625
r201608 made llvm corretly handle private globals with MachO. r201622 fixed a bug in it and r201624 and r201625 were changes for using private linkage,
Add back r201608, r201622, r201624 and r201625
r201608 made llvm corretly handle private globals with MachO. r201622 fixed a bug in it and r201624 and r201625 were changes for using private linkage, assuming that llvm would do the right thing.
They all got reverted because r201608 introduced a crash in LTO. This patch includes a fix for that. The issue was that TargetLoweringObjectFile now has to be initialized before we can mangle names of private globals. This is trivially true during the normal codegen pipeline (the asm printer does it), but LTO has to do it manually.
llvm-svn: 201700
show more ...
|
#
7e198ad8 |
| 19-Feb-2014 |
Daniel Jasper <djasper@google.com> |
Revert r201622 and r201608.
This causes the LLVMgold plugin to segfault. More information on the replies to r201608.
llvm-svn: 201669
|
#
09dcc6a5 |
| 18-Feb-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Fix PR18743.
The IR @foo = private constant i32 42
is valid, but before this patch we would produce an invalid MachO from it. It was invalid because it would use an L label in a section where the l
Fix PR18743.
The IR @foo = private constant i32 42
is valid, but before this patch we would produce an invalid MachO from it. It was invalid because it would use an L label in a section where the liker needs the labels in order to atomize it.
One way of fixing it would be to just reject this IR in the backend, but that would not be very front end friendly.
What this patch does is use an 'l' prefix in sections that we know the linker requires symbols for atomizing them. This allows frontends to just use private and not worry about which sections they go to or how the linker handles them.
One small issue with this strategy is that now a symbol name depends on the section, which is not available before codegen. This is not a problem in practice. The reason is that it only happens with private linkage, which will be ignored by the non codegen users (llvm-nm and llvm-ar).
llvm-svn: 201608
show more ...
|
#
894843cb |
| 07-Jan-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Move the llvm mangler to lib/IR.
This makes it available to tools that don't link with target (like llvm-ar).
llvm-svn: 198708
|
#
58873566 |
| 03-Jan-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Make the llvm mangler depend only on DataLayout.
Before this patch any program that wanted to know the final symbol name of a GlobalValue had to link with Target.
This patch implements a compromise
Make the llvm mangler depend only on DataLayout.
Before this patch any program that wanted to know the final symbol name of a GlobalValue had to link with Target.
This patch implements a compromise solution where the mangler uses DataLayout. This way, any tool that already links with Target (llc, clang) gets the exact behavior as before and new IR files can be mangled without linking with Target.
With this patch the mangler is constructed with just a DataLayout and DataLayout is extended to include the information the Mangler needs.
llvm-svn: 198438
show more ...
|
Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3 |
|
#
117b20c4 |
| 05-Dec-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove the isImplicitlyPrivate argument of getNameWithPrefix.
getSymbolWithGlobalValueBase use is to create a name of a new symbol based on the name of an existing GV. Assert that and then remove th
Remove the isImplicitlyPrivate argument of getNameWithPrefix.
getSymbolWithGlobalValueBase use is to create a name of a new symbol based on the name of an existing GV. Assert that and then remove the last call to pass true to isImplicitlyPrivate.
This gives the mangler API a 1:1 mapping from GV to names, which is what we need to drop the mangler dependency on the target (and use an extended datalayout instead).
llvm-svn: 196472
show more ...
|
Revision tags: llvmorg-3.4.0-rc2 |
|
#
32635781 |
| 02-Dec-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Refactor for clarity and efficiency.
The PPC GetSymbolFromOperand already prefixed stubs of MO_ExternalSymbol, so this should be a nop.
llvm-svn: 196059
|
#
3e3a3f1f |
| 28-Nov-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Use the mangler consistently instead of using getGlobalPrefix directly.
llvm-svn: 195911
|
Revision tags: llvmorg-3.4.0-rc1 |
|
#
79858aa3 |
| 29-Oct-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Add a helper getSymbol to AsmPrinter.
llvm-svn: 193627
|
Revision tags: llvmorg-3.3.1-rc1 |
|
#
266db7fe |
| 08-Jul-2013 |
Ulrich Weigand <ulrich.weigand@de.ibm.com> |
[PowerPC] Always use "assembler dialect" 1
A setting in MCAsmInfo defines the "assembler dialect" to use. This is used by common code to choose between alternatives in a multi-alternative GNU inlin
[PowerPC] Always use "assembler dialect" 1
A setting in MCAsmInfo defines the "assembler dialect" to use. This is used by common code to choose between alternatives in a multi-alternative GNU inline asm statement like the following:
__asm__ ("{sfe|subfe} %0,%1,%2" : "=r" (out) : "r" (in1), "r" (in2));
The meaning of these dialects is platform specific, and GCC defines those for PowerPC to use dialect 0 for old-style (POWER) mnemonics and 1 for new-style (PowerPC) mnemonics, like in the example above.
To be compatible with inline asm used with GCC, LLVM ought to do the same. Specifically, this means we should always use assembler dialect 1 since old-style mnemonics really aren't supported on any current platform.
However, the current LLVM back-end uses: AssemblerDialect = 1; // New-Style mnemonics. in PPCMCAsmInfoDarwin, and AssemblerDialect = 0; // Old-Style mnemonics. in PPCLinuxMCAsmInfo.
The Linux setting really isn't correct, we should be using new-style mnemonics everywhere. This is changed by this commit.
Unfortunately, the setting of this variable is overloaded in the back-end to decide whether or not we are on a Darwin target. This is done in PPCInstPrinter (the "SyntaxVariant" is initialized from the MCAsmInfo AssemblerDialect setting), and also in PPCMCExpr. Setting AssemblerDialect to 1 for both Darwin and Linux no longer allows us to make this distinction.
Instead, this patch uses the MCSubtargetInfo passed to createPPCMCInstPrinter to distinguish Darwin targets, and ignores the SyntaxVariant parameter. As to PPCMCExpr, this patch adds an explicit isDarwin argument that needs to be passed in by the caller when creating a target MCExpr. (To do so this patch implicitly also reverts commit 184441.)
llvm-svn: 185858
show more ...
|
#
5b427591 |
| 05-Jul-2013 |
Ulrich Weigand <ulrich.weigand@de.ibm.com> |
[PowerPC] Support @tls in the asm parser
This adds support for the last missing construct to parse TLS-related assembler code: add 3, 4, symbol@tls
The ADD8TLS currently hard-codes the @tls into
[PowerPC] Support @tls in the asm parser
This adds support for the last missing construct to parse TLS-related assembler code: add 3, 4, symbol@tls
The ADD8TLS currently hard-codes the @tls into the assembler string. This cannot be handled by the asm parser, since @tls is parsed as a symbol variant. This patch changes ADD8TLS to have the @tls suffix printed as symbol variant on output too, which allows us to remove the isCodeGenOnly marker from ADD8TLS. This in turn means that we can add a AsmOperand to accept @tls marked symbols on input.
As a side effect, this means that the fixup_ppc_tlsreg fixup type is no longer necessary and can be merged into fixup_ppc_nofixup.
llvm-svn: 185692
show more ...
|
#
d51c09f5 |
| 21-Jun-2013 |
Ulrich Weigand <ulrich.weigand@de.ibm.com> |
[PowerPC] Rename some more VK_PPC_ enums
This renames more VK_PPC_ enums, to make them more closely reflect the @modifier string they represent. This also prepares for adding a bunch of new VK_PPC_
[PowerPC] Rename some more VK_PPC_ enums
This renames more VK_PPC_ enums, to make them more closely reflect the @modifier string they represent. This also prepares for adding a bunch of new VK_PPC_ enums in upcoming patches.
For consistency, some MO_ flags related to VK_PPC_ enums are likewise renamed.
No change in behaviour.
llvm-svn: 184547
show more ...
|
#
4727888f |
| 20-Jun-2013 |
Ulrich Weigand <ulrich.weigand@de.ibm.com> |
[PowerPC] Remove unused parameter
The isDarwin parameter to the llvm::LowerPPCMachineInstrToMCInst routine is now no longer needed; remove it.
llvm-svn: 184441
|
#
96e65783 |
| 20-Jun-2013 |
Ulrich Weigand <ulrich.weigand@de.ibm.com> |
[PowerPC] Optimize @ha/@l constructs
This patch adds support for having the assembler optimize fixups to constructs like "symbol@ha" or "symbol@l" if "symbol" can be resolved at assembler time.
Thi
[PowerPC] Optimize @ha/@l constructs
This patch adds support for having the assembler optimize fixups to constructs like "symbol@ha" or "symbol@l" if "symbol" can be resolved at assembler time.
This optimization is already present in the PPCMCExpr.cpp code for handling PPC_HA16/PPC_LO16 target expressions. However, those target expression were used only on Darwin targets.
This patch changes target expression code so that they are usable also with the GNU assembler (using the @ha / @l syntax instead of the ha16() / lo16() syntax), and changes the MCInst lowering code to generate those target expressions where appropriate.
It also changes the asm parser to generate HA16/LO16 target expressions when parsing assembler source that uses the @ha / @l modifiers. The effect is that now the above- mentioned optimization automatically becomes available for those situations too.
llvm-svn: 184436
show more ...
|
Revision tags: llvmorg-3.3.0, llvmorg-3.3.0-rc3 |
|
#
41789de1 |
| 23-May-2013 |
Ulrich Weigand <ulrich.weigand@de.ibm.com> |
[PowerPC] Clean up generation of ha16() / lo16() markers
When targeting the Darwin assembler, we need to generate markers ha16() and lo16() to designate the high and low parts of a (symbolic) immedi
[PowerPC] Clean up generation of ha16() / lo16() markers
When targeting the Darwin assembler, we need to generate markers ha16() and lo16() to designate the high and low parts of a (symbolic) immediate. This is necessary not just for plain symbols, but also for certain symbolic expression, typically along the lines of ha16(A - B). The latter doesn't work when simply using VariantKind flags on the symbol reference. This is why the current back-end uses hacks (explicitly called out as such via multiple FIXMEs) in the symbolLo/symbolHi print methods.
This patch uses target-defined MCExpr codes to represent the Darwin ha16/lo16 constructs, following along the lines of the equivalent solution used by the ARM back end to handle their :upper16: / :lower16: markers. This allows us to get rid of special handling both in the symbolLo/symbolHi print method and in the common code MCExpr::print routine. Instead, the ha16 / lo16 markers are printed simply in a custom print routine for the target MCExpr types. (As a result, the symbolLo/symbolHi print methods can now replaced by a single printS16ImmOperand routine that also handles symbolic operands.)
The patch also provides a EvaluateAsRelocatableImpl routine to handle ha16/lo16 constructs. This is not actually used at the moment by any in-tree code, but is provided as it makes merging into David Fang's out-of-tree Mach-O object writer simpler.
Since there is no longer any need to treat VK_PPC_GAS_HA16 and VK_PPC_DARWIN_HA16 differently, they are merged into a single VK_PPC_ADDR16_HA (and likewise for the _LO16 types).
llvm-svn: 182616
show more ...
|
Revision tags: llvmorg-3.3.0-rc2, llvmorg-3.3.0-rc1 |
|
#
1357ab74 |
| 27-Apr-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Make all darwin ppc stubs local.
This fixes pr15763. Patch by David Fang.
llvm-svn: 180657
|
#
3822ef2c |
| 21-Feb-2013 |
Bill Schmidt <wschmidt@linux.vnet.ibm.com> |
Relocation enablement for PPC DAG postprocessing pass
llvm-svn: 175693
|
#
2be3832d |
| 20-Feb-2013 |
Jakub Staszak <kubastaszak@gmail.com> |
Add missing #include.
llvm-svn: 175583
|
Revision tags: llvmorg-3.2.0 |
|
#
732eb91f |
| 13-Dec-2012 |
Bill Schmidt <wschmidt@linux.vnet.ibm.com> |
This is just a clean-up patch that simplifies the initial-exec TLS logic by avoiding use of machine operand flags. No change in observable behavior, so no new test cases.
llvm-svn: 170141
|