forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mips] Replace MipsABIEnum with a MipsABIInfo class.
Summary: No functional change yet, it's just an object replacement for an enum. It will allow us to gather ABI information in a single place so that we can start testing for properties of the ABI's instead of the ABI itself. For example we will eventually be able to use: ABI.MinStackAlignmentInBytes() instead of: (isABI_N32() || isABI_N64()) ? 16 : 8 which is clearer and more maintainable. Reviewers: matheusalmeida Reviewed By: matheusalmeida Differential Revision: http://reviews.llvm.org/D3341 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220568 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
5ea0446
commit 2992ea0
Showing
7 changed files
with
70 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MIPSABIINFO_H | ||
#define MIPSABIINFO_H | ||
|
||
namespace llvm { | ||
class MipsABIInfo { | ||
public: | ||
enum class ABI { Unknown, O32, N32, N64, EABI }; | ||
|
||
protected: | ||
ABI ThisABI; | ||
|
||
public: | ||
MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {} | ||
|
||
static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); } | ||
static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); } | ||
static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); } | ||
static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); } | ||
static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); } | ||
|
||
bool IsKnown() const { return ThisABI != ABI::Unknown; } | ||
bool IsO32() const { return ThisABI == ABI::O32; } | ||
bool IsN32() const { return ThisABI == ABI::N32; } | ||
bool IsN64() const { return ThisABI == ABI::N64; } | ||
bool IsEABI() const { return ThisABI == ABI::EABI; } | ||
ABI GetEnumValue() const { return ThisABI; } | ||
|
||
/// Ordering of ABI's | ||
/// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given | ||
/// multiple ABI options. | ||
bool operator<(const MipsABIInfo Other) const { | ||
return ThisABI < Other.GetEnumValue(); | ||
} | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters