summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenTarget.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-08 21:43:21 +0000
committerChris Lattner <sabre@nondot.org>2005-09-08 21:43:21 +0000
commite9f4ba8dd47de9da2a98db3bbe25b54d5a9607f1 (patch)
tree124f61dc8037c2d4b74211c078899e92b2537e2a /utils/TableGen/CodeGenTarget.h
parent33c92e92961c9a1aaaac767edeeac62dd787111e (diff)
downloadllvm-e9f4ba8dd47de9da2a98db3bbe25b54d5a9607f1.tar.gz
llvm-e9f4ba8dd47de9da2a98db3bbe25b54d5a9607f1.tar.bz2
llvm-e9f4ba8dd47de9da2a98db3bbe25b54d5a9607f1.tar.xz
Compute the value types that are natively supported by a target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23282 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenTarget.h')
-rw-r--r--utils/TableGen/CodeGenTarget.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/utils/TableGen/CodeGenTarget.h b/utils/TableGen/CodeGenTarget.h
index 05d5cb2ddb..1748e8ca82 100644
--- a/utils/TableGen/CodeGenTarget.h
+++ b/utils/TableGen/CodeGenTarget.h
@@ -47,9 +47,11 @@ class CodeGenTarget {
mutable std::map<std::string, CodeGenInstruction> Instructions;
mutable std::vector<CodeGenRegister> Registers;
mutable std::vector<CodeGenRegisterClass> RegisterClasses;
+ mutable std::vector<MVT::ValueType> LegalValueTypes;
void ReadRegisters() const;
void ReadRegisterClasses() const;
void ReadInstructions() const;
+ void ReadLegalValueTypes() const;
public:
CodeGenTarget();
@@ -70,16 +72,29 @@ public:
///
Record *getAsmWriter() const;
- const std::vector<CodeGenRegister> &getRegisters() {
+ const std::vector<CodeGenRegister> &getRegisters() const {
if (Registers.empty()) ReadRegisters();
return Registers;
}
- const std::vector<CodeGenRegisterClass> getRegisterClasses() {
+ const std::vector<CodeGenRegisterClass> &getRegisterClasses() const {
if (RegisterClasses.empty()) ReadRegisterClasses();
return RegisterClasses;
}
+ const std::vector<MVT::ValueType> &getLegalValueTypes() const {
+ if (LegalValueTypes.empty()) ReadLegalValueTypes();
+ return LegalValueTypes;
+ }
+
+ /// isLegalValueType - Return true if the specified value type is natively
+ /// supported by the target (i.e. there are registers that directly hold it).
+ bool isLegalValueType(MVT::ValueType VT) const {
+ const std::vector<MVT::ValueType> &LegalVTs = getLegalValueTypes();
+ for (unsigned i = 0, e = LegalVTs.size(); i != e; ++i)
+ if (LegalVTs[i] == VT) return true;
+ return false;
+ }
/// getInstructions - Return all of the instructions defined for this target.
///