This is an archive of the discontinued LLVM Phabricator instance.

RegCall - Handling v64i1 in 32/64 bit target
ClosedPublic

Authored by oren_ben_simhon on Nov 1 2016, 2:45 AM.

Details

Summary

Register Calling Convention defines a new behavior for v64i1 types.
This type should be saved in GPR.
However for 32 bit machine we need to split the value into 2 GPRs (because each is 32 bit).

Diff Detail

Repository
rL LLVM

Event Timeline

oren_ben_simhon retitled this revision from to RegCall - Handling v64i1 in 32/64 bit target.
oren_ben_simhon updated this object.
oren_ben_simhon set the repository for this revision to rL LLVM.
oren_ben_simhon added a subscriber: llvm-commits.

A kindly reminder. I will appreciate your inputs on the review.

igorb added a subscriber: igorb.Nov 10 2016, 12:16 AM

Hi, please change
Variable names should be camel case, and start with an upper case letter (e.g. Leader or Boats).

delena added inline comments.Nov 10 2016, 12:59 AM
lib/Target/X86/X86CallingConv.h
27

This function is too big to be inline. Can you move it to .c** file?

34

dot at the end of the sentence.

35

What is this list for?

39

std::vector is not "popular" in the LLVM code. SmallVector can be used instead.

50

Why 2 ? Please add comments here.

53

Does this loop allays have 2 iterations?

oren_ben_simhon marked 5 inline comments as done.Nov 13 2016, 7:37 AM
oren_ben_simhon added inline comments.
lib/Target/X86/X86CallingConv.h
35

This is the list of registers that can be used to pass the value, according to regcall calling convention.
Only if two registers will be available the value will be passed.

Implementing comments posted until 11/12

delena added inline comments.Nov 15 2016, 11:58 PM
lib/Target/X86/X86CallingConv.cpp
26 ↗(On Diff #77745)

#defines like this are not allowed in LLVM, I think.

43 ↗(On Diff #77745)

How the case is handled when there is no available registers? I did not see assign-to stack for this type.

49 ↗(On Diff #77745)

All variables names should start with capital letter

lib/Target/X86/X86CallingConv.td
19

do you implement CC_X86_RegCall_Error for the types that will come in the next commit?

lib/Target/X86/X86ISelLowering.cpp
194–1

I don't understand this change

194–1

Why do you drop SIGN_EXTEND?

195

wrong line alignment

196

Please add 2 words about the Root, VA and NextVA arguments in doxygen format. And InFlag role is not clear.

196

Why do we need this additional condition? Please add comments.

199

wrong line alignment, function name lower case

200

BMI implies BWI

201

the original condition for this operation was VA.getValVT().getScalarType() == MVT::i1

234

you can combine this "if" with the previous one, right?

255

do not pass calling convention here

262

compilation will fail for unreferenced variable in the buildbot.

269

unreachable or assert - ?

273

The function may return SDValue. But you do many asserts and one bitcast. Do you really need a function?

oren_ben_simhon marked 8 inline comments as done.Nov 16 2016, 4:55 AM
oren_ben_simhon added inline comments.
lib/Target/X86/X86CallingConv.cpp
43 ↗(On Diff #77745)

Since v64i1 is promoted to i64, the following rule will assign to stack (in case we don't have available registers):

// In 64 bit, assign 64/32 bit values to 8 byte stack
CCIfSubtarget<"is64Bit()", CCIfType<[i32, i64, f32, f64], 
  CCAssignToStack<8, 8>>>,
lib/Target/X86/X86CallingConv.td
19

Yes

lib/Target/X86/X86ISelLowering.cpp
194–1

LLVM Coding Standards prefer all variables to be capitalized including iterator.
They share the following example:

for (unsigned I = 0, E = List.size(); I != E; ++I)
    if (List[I]->isFoo())
      return true;
194–1

It resides inside the function

195

Clang-format did it

199

The alignment was created by clang-format.
I will move to lower case.

234

I can do so but it will require duplication of the following lines:

// Convert the i32 type into v32i1 type
Lo = DAG.getBitcast(MVT::v32i1, ArgValue);

...

// Convert the i32 type into v32i1 type
Hi = DAG.getBitcast(MVT::v32i1, ArgValue);

So i prefered to seprate it into two different if statements.

262

It is referenced in the next line. It will be referenced in the future as well.

269

This decision was made due to future design.

delena added inline comments.Nov 16 2016, 4:59 AM
lib/Target/X86/X86CallingConv.td
19

I think we can stay with TODO comment till the next commit and remove CC_X86_RegCall_Error

delena added inline comments.Nov 16 2016, 5:04 AM
lib/Target/X86/X86ISelLowering.cpp
234

Use ArgValueLo and ArgValueHi inside if-else blocks

Implemented comments posted until 11/16.

oren_ben_simhon marked an inline comment as done.Nov 16 2016, 6:15 AM
oren_ben_simhon added inline comments.
lib/Target/X86/X86CallingConv.td
19

The custom function was introduced in the previous commit and was requested by other reviewers.
The community wants a user (of this version) to have an error message if it uses something that is not yet supported.
I agree with this approach and prefer to leave this as is.

Implemented additional 2 comments posted by delena.

delena accepted this revision.Nov 16 2016, 11:33 AM
delena edited edge metadata.
delena added inline comments.
lib/Target/X86/X86ISelLowering.cpp
2411

Please refer to my comment here

This revision is now accepted and ready to land.Nov 16 2016, 11:33 AM
This revision was automatically updated to reflect the committed changes.