Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: src/IceIntrinsics.h

Issue 577353003: Add call instructions to Subzero's bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix remaining issues raised. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInst.cpp ('k') | src/IceIntrinsics.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceIntrinsics.h
diff --git a/src/IceIntrinsics.h b/src/IceIntrinsics.h
index d984b4c6cad7774076b72b27c625c668024d2cfc..bd0f118cbfb5f33b4ed09a0a81c78847cbcc9074 100644
--- a/src/IceIntrinsics.h
+++ b/src/IceIntrinsics.h
@@ -19,6 +19,8 @@
namespace Ice {
+class InstCall;
+
static const size_t kMaxIntrinsicParameters = 6;
class Intrinsics {
@@ -108,6 +110,14 @@ public:
enum ReturnsTwice ReturnsTwice : 1;
};
+ // The types of validation values for FullIntrinsicInfo.validateCall.
+ enum ValidateCallValue {
+ IsValidCall, // Valid use of instrinsic call.
+ BadReturnType, // Return type invalid for intrinsic.
+ WrongNumOfArgs, // Wrong number of arguments for intrinsic.
+ WrongCallArgType, // Argument of wrong type.
+ };
+
// The complete set of information about an intrinsic.
struct FullIntrinsicInfo {
struct IntrinsicInfo Info; // Information that CodeGen would care about.
@@ -115,6 +125,27 @@ public:
// Sanity check during parsing.
Type Signature[kMaxIntrinsicParameters];
uint8_t NumTypes;
+
+ // Validates that type signature of call matches intrinsic.
+ // If WrongArgumentType is returned, ArgIndex is set to corresponding
+ // argument index.
+ ValidateCallValue validateCall(const Ice::InstCall *Call,
+ SizeT &ArgIndex) const;
+
+ // Returns the return type of the intrinsic.
+ Type getReturnType() const {
+ assert(NumTypes > 1);
+ return Signature[0];
+ }
+
+ // Returns number of arguments expected.
+ SizeT getNumArgs() const {
+ assert(NumTypes > 1);
+ return NumTypes - 1;
+ }
+
+ // Returns type of Index-th argument.
+ Type getArgType(SizeT Index) const;
};
// Find the information about a given intrinsic, based on function name.
« no previous file with comments | « src/IceInst.cpp ('k') | src/IceIntrinsics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698