ARM: Support marking intrinsic definitions as 'unavailable'

llvm-svn: 156490
This commit is contained in:
Jim Grosbach 2012-05-09 18:17:30 +00:00
parent f761fe9d23
commit 6f855e3024
3 changed files with 11 additions and 4 deletions

View File

@ -15,6 +15,7 @@
class Op;
def OP_NONE : Op;
def OP_UNAVAILABLE : Op;
def OP_ADD : Op;
def OP_ADDL : Op;
def OP_ADDW : Op;

View File

@ -1012,7 +1012,7 @@ static std::string GenIntrinsic(const std::string &name,
StringRef outTypeStr, StringRef inTypeStr,
OpKind kind, ClassKind classKind) {
assert(!proto.empty() && "");
bool define = UseMacro(proto);
bool define = UseMacro(proto) && kind != OpUnavailable;
std::string s;
// static always inline + return type
@ -1040,9 +1040,11 @@ static std::string GenIntrinsic(const std::string &name,
if (define) {
s += " __extension__ ({ \\\n ";
s += GenMacroLocals(proto, inTypeStr);
} else {
} else if (kind == OpUnavailable) {
s += " __attribute__((unavailable));\n";
return s;
} else
s += " { \\\n ";
}
if (kind != OpNone)
s += GenOpString(kind, proto, outTypeStr);
@ -1238,7 +1240,7 @@ static unsigned RangeFromType(const char mod, StringRef typestr) {
/// runHeader - Emit a file with sections defining:
/// 1. the NEON section of BuiltinsARM.def.
/// 2. the SemaChecking code for the type overload checking.
/// 3. the SemaChecking code for validation of intrinsic immedate arguments.
/// 3. the SemaChecking code for validation of intrinsic immediate arguments.
void NeonEmitter::runHeader(raw_ostream &OS) {
std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
@ -1551,6 +1553,8 @@ void NeonEmitter::runTests(raw_ostream &OS) {
ParseTypes(R, Types, TypeVec);
OpKind kind = OpMap[R->getValueAsDef("Operand")->getName()];
if (kind == OpUnavailable)
continue;
for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
if (kind == OpReinterpret) {
bool outQuad = false;

View File

@ -23,6 +23,7 @@
enum OpKind {
OpNone,
OpUnavailable,
OpAdd,
OpAddl,
OpAddw,
@ -130,6 +131,7 @@ namespace llvm {
public:
NeonEmitter(RecordKeeper &R) : Records(R) {
OpMap["OP_NONE"] = OpNone;
OpMap["OP_UNAVAILABLE"] = OpUnavailable;
OpMap["OP_ADD"] = OpAdd;
OpMap["OP_ADDL"] = OpAddl;
OpMap["OP_ADDW"] = OpAddw;