Page MenuHomePhabricator

[PowerPC][PCRelative] Add new pseudo instructions for PCRel TLS to fix R2 clobber issue
AcceptedPublic

Authored by NeHuang on Nov 13 2020, 6:47 AM.

Details

Reviewers
nemanjai
stefanp
bsaleil
amyk
Group Reviewers
Restricted Project
Summary

New pseudo instructions GETtlsADDRPCREL and GETtlsldADDRPCREL are added for properly setting REGMASK for tls_get_addr function when using PCRelative address.

Diff Detail

Event Timeline

NeHuang created this revision.Nov 13 2020, 6:47 AM
NeHuang requested review of this revision.Nov 13 2020, 6:47 AM
bsaleil added inline comments.Nov 13 2020, 8:45 AM
llvm/lib/Target/PowerPC/PPCInstr64Bit.td
1324

Some of these pseudo-instruction definitions are the same. Could you refactor this code to use a common definition so we can define the pseudo-instructions with something like:

let Defs = [X0,X2,X4,X5,X6,X7,X8,X9,X10,X11,X12,LR8,CTR8,CR0,CR1,CR5,CR6,CR7], Size = 8 in
def GETtlsADDRPCREL: GETtlsADDRPseudo<"#GETtlsADDRPCREL">

let Defs = [X0,X4,X5,X6,X7,X8,X9,X10,X11,X12,LR8,CTR8,CR0,CR1,CR5,CR6,CR7] in
def GETtlsldADDR : GETtlsADDRPseudo<"#GETtlsldADDR">;

let Defs = [X0,X2,X4,X5,X6,X7,X8,X9,X10,X11,X12,LR8,CTR8,CR0,CR1,CR5,CR6,CR7] in
def GETtlsldADDRPCRel : GETtlsADDRPseudo<"#GETtlsldADDRPCREL">;

...
NeHuang updated this revision to Diff 306721.Nov 20 2020, 9:53 AM

Addressed review comment to merge common code.

NeHuang marked an inline comment as done.Nov 20 2020, 9:53 AM
NeHuang updated this revision to Diff 307342.Nov 24 2020, 7:00 AM

Address review comments to create the class.

NeHuang updated this revision to Diff 307367.Nov 24 2020, 8:11 AM

Add the missing test case.

bsaleil accepted this revision as: bsaleil.Nov 24 2020, 8:24 AM

LGTM, thanks.

This revision is now accepted and ready to land.Nov 24 2020, 8:24 AM
NeHuang retitled this revision from [PowerPC][PCRelative] Add new seudo instructions for PCRel TLS to fix R2 clobber issue to [PowerPC][PCRelative] Add new pseudo instructions for PCRel TLS to fix R2 clobber issue.Nov 24 2020, 8:48 AM
NeHuang edited the summary of this revision. (Show Details)