This is an archive of the discontinued LLVM Phabricator instance.

Add basic functionality for assignment of ints. This creates a lot of core infrastructure in which to add, with little effort, quite a bit more to mips fast-isel
ClosedPublic

Authored by rkotler on Apr 27 2014, 5:58 PM.

Diff Detail

Event Timeline

rkotler updated this revision to Diff 8879.Apr 27 2014, 5:58 PM
rkotler retitled this revision from to Add basic functionality for assignment of ints. This creates a lot of core infrastructure in which to add, with little effort, quite a bit more to mips fast-isel.
rkotler updated this object.
rkotler edited the test plan for this revision. (Show Details)
rkotler added a reviewer: dsanders.
rkotler updated this revision to Diff 8880.Apr 27 2014, 6:01 PM

I messed up this arc call. Hopefully this adds the rest of the files.

Updating D3527: Add basic functionality for assignment of ints.

This creates a lot of core infrastructure in which to add, with little
effort, quite a bit more to mips fast-isel

dsanders edited edge metadata.Apr 29 2014, 7:30 AM

I've added a few comments inline.

One high-level suggestion I'd like to make is that I think it would be good to flesh out the materialization of constants before you go much further on things that depend on materializing constants. I'm thinking along the lines of a set of tests similar to nullvoid.ll with 'return i8 1', 'return i32 65536', etc.

lib/Target/Mips/MipsFastISel.cpp
20

plus some?

29

This should probably be an APInt or at least an int64_t

96–100

It looks like you are accounting for future changes here. When would this be different from isTypeLegal()?

103–106

It would be better to make this a test to allow things you are able to handle than a test to exclude things you can't.

For example, it seems unlikely that ConstantArray or FPMathOperator are an acceptable values but these if-statements will currently accept them.

117–118

In isTypeLegal() you checked for MVT::Other as well as isSimple(). Is that not necessary here?

133–134

It would be good to have a fixme comment explaining that this is temporary

165–167

I'd invert this if-statement to:

if (EmitStore(...))
  return true;
return false;
208

In what way is it broken?

210–211

Is the IsThreadLocal variable necessary? It looks like it would be more readable in the if-statement condition

I agree with your high level comment regarding finishing materialize. I will work on more incremental changes to finish that. I'm essentially copying what other ports do, and modifying it for Mips specifics.

I'm cut and pasting some code from other ports in other areas too and I agree that at time it's awkward because I'm taking out pieces and those that remain can be structured better.

I'll take out things as you suggested that are not being used now and clean things.

I will add it back in as necessary in order to keep the code looking nice.

Essentially, all these fast-isel ports look the same so I know, at least for this first version, what most of these functions will eventually look like.

I'm trying not to allow things to pass through fast-isel that we can't handle yet; but it's not easy to always know.
The existing ports are the best way barring spending months reading the supporting code.

lib/Target/Mips/MipsFastISel.cpp
96–100

This is copied from other ports. They allow types that can be simply zero or sign extended like i1, i8 and i16

I will add a comment to that effect.

103–106

This is kind of a catch 22 in terms of what I am doing here.
I'm stripping down and porting and existing port.

I'm making sure that I don't accept cases that I don't intend to by mimicking the behavior of other ports.

I will try and do most of what you want except in cases where it will take a huge amount of time because the code will morph back to how it looks now when the additional features are added.

rkotler updated this revision to Diff 8946.Apr 29 2014, 4:28 PM
rkotler edited edge metadata.

Updating D3527: Add basic functionality for assignment of ints.

This creates a lot of core infrastructure in which to add, with little
effort, quite a bit more to mips fast-isel

dsanders accepted this revision.May 1 2014, 1:55 AM
dsanders edited edge metadata.

With the following changes it will LGTM:

  • Address::Offset changed to an APInt or at least an int64_t
  • The various FIXME comments added. Particularly the ones that point out thing that are present in other ports but not implemented yet. They will make it obvious that some of the odd-looking style only looks odd because of the missing pieces.
  • The ARM-specific comment about FastISel TLS changed to be accurate for MIPS.
lib/Target/Mips/MipsFastISel.cpp
103–106

Ok, having looked at the other ports I see what you are doing.

A few fixme comments mentioning the missing pieces would be useful.

165–167

I still think this if-statement ought to be inverted but I see all the other ports are using the same style. Up to you if you invert it or not.

208

Having looked at the other ports, this comment seems to be ARM specific. Please change it to something like 'FastISel TLS support is not implemented, punt to SelectionDAG'.

This revision is now accepted and ready to land.May 1 2014, 1:55 AM
rkotler updated this revision to Diff 9017.May 1 2014, 11:30 AM
rkotler edited edge metadata.

Updating D3527: Add basic functionality for assignment of ints.

This creates a lot of core infrastructure in which to add, with little
effort, quite a bit more to mips fast-isel

rkotler closed this revision.May 1 2014, 1:46 PM