mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 06:32:09 +00:00
Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
16222c006d
commit
f5626a38a7
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -333,7 +333,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||||
#line 280 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
|
#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
|
||||||
typedef union YYSTYPE {
|
typedef union YYSTYPE {
|
||||||
std::string* String;
|
std::string* String;
|
||||||
TypeInfo Type;
|
TypeInfo Type;
|
||||||
|
@ -333,7 +333,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||||
#line 280 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
|
#line 289 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
|
||||||
typedef union YYSTYPE {
|
typedef union YYSTYPE {
|
||||||
std::string* String;
|
std::string* String;
|
||||||
TypeInfo Type;
|
TypeInfo Type;
|
||||||
|
@ -38,6 +38,15 @@ static uint64_t unique = 1;
|
|||||||
// definitions and calls.
|
// definitions and calls.
|
||||||
static bool AddAttributes = false;
|
static bool AddAttributes = false;
|
||||||
|
|
||||||
|
// This bool is used to communicate between the InstVal and Inst rules about
|
||||||
|
// whether or not a cast should be deleted. When the flag is set, InstVal has
|
||||||
|
// determined that the cast is a candidate. However, it can only be deleted if
|
||||||
|
// the value being casted is the same value name as the instruction. The Inst
|
||||||
|
// rule makes that comparison if the flag is set and comments out the
|
||||||
|
// instruction if they match.
|
||||||
|
static bool deleteUselessCastFlag = false;
|
||||||
|
static std::string* deleteUselessCastName = 0;
|
||||||
|
|
||||||
typedef std::vector<TypeInfo> TypeVector;
|
typedef std::vector<TypeInfo> TypeVector;
|
||||||
static TypeVector EnumeratedTypes;
|
static TypeVector EnumeratedTypes;
|
||||||
typedef std::map<std::string,TypeInfo> TypeMap;
|
typedef std::map<std::string,TypeInfo> TypeMap;
|
||||||
@ -1152,10 +1161,18 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef {
|
|||||||
|
|
||||||
Inst
|
Inst
|
||||||
: OptAssign InstVal {
|
: OptAssign InstVal {
|
||||||
if (!$1->empty())
|
if (!$1->empty()) {
|
||||||
*$1 += " = ";
|
if (deleteUselessCastFlag && *deleteUselessCastName == *$1) {
|
||||||
|
*$1 += " = ";
|
||||||
|
$1->insert(0, "; "); // don't actually delete it, just comment it out
|
||||||
|
delete deleteUselessCastName;
|
||||||
|
} else {
|
||||||
|
*$1 += " = ";
|
||||||
|
}
|
||||||
|
}
|
||||||
*$1 += *$2;
|
*$1 += *$2;
|
||||||
delete $2;
|
delete $2;
|
||||||
|
deleteUselessCastFlag = false;
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1250,6 +1267,20 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
|||||||
} else {
|
} else {
|
||||||
*$$ += *$1 + " " + source + " to " + *DstTy.newTy;
|
*$$ += *$1 + " " + source + " to " + *DstTy.newTy;
|
||||||
}
|
}
|
||||||
|
// Check to see if this is a useless cast of a value to the same name
|
||||||
|
// and the same type. Such casts will probably cause redefinition errors
|
||||||
|
// when assembled and perform no code gen action so just remove them.
|
||||||
|
if (*$1 == "cast" || *$1 == "bitcast")
|
||||||
|
if ($2.type.isInteger() && $4.isInteger() &&
|
||||||
|
$2.type.getBitWidth() == $4.getBitWidth()) {
|
||||||
|
deleteUselessCastFlag = true; // Flag the "Inst" rule
|
||||||
|
deleteUselessCastName = new std::string(*$2.val); // save the name
|
||||||
|
size_t pos = deleteUselessCastName->find_first_of("%\"",0);
|
||||||
|
if (pos != std::string::npos) {
|
||||||
|
// remove the type portion before val
|
||||||
|
deleteUselessCastName->erase(0, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
delete $1; $2.destroy();
|
delete $1; $2.destroy();
|
||||||
delete $3; $4.destroy();
|
delete $3; $4.destroy();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user