@@ -30,7 +30,7 @@ module InstructionSanity {
30
30
or
31
31
opcode instanceof MemoryAccessOpcode and tag instanceof AddressOperandTag
32
32
or
33
- opcode instanceof BufferAccessOpcode and tag instanceof BufferSizeOperand
33
+ opcode instanceof SizedBufferAccessOpcode and tag instanceof BufferSizeOperandTag
34
34
or
35
35
opcode instanceof OpcodeWithCondition and tag instanceof ConditionOperandTag
36
36
or
@@ -48,8 +48,8 @@ module InstructionSanity {
48
48
or
49
49
(
50
50
opcode instanceof ReadSideEffectOpcode or
51
- opcode instanceof MayWriteSideEffectOpcode or
52
- opcode instanceof Opcode:: InlineAsm
51
+ opcode instanceof Opcode :: InlineAsm or
52
+ opcode instanceof Opcode:: CallSideEffect
53
53
) and
54
54
tag instanceof SideEffectOperandTag
55
55
)
@@ -609,7 +609,7 @@ class VariableInstruction extends Instruction {
609
609
610
610
VariableInstruction ( ) { var = Construction:: getInstructionVariable ( this ) }
611
611
612
- final override string getImmediateString ( ) { result = var .toString ( ) }
612
+ override string getImmediateString ( ) { result = var .toString ( ) }
613
613
614
614
final IRVariable getVariable ( ) { result = var }
615
615
}
@@ -644,6 +644,16 @@ class ConstantValueInstruction extends Instruction {
644
644
final string getValue ( ) { result = value }
645
645
}
646
646
647
+ class IndexedInstruction extends Instruction {
648
+ int index ;
649
+
650
+ IndexedInstruction ( ) { index = Construction:: getInstructionIndex ( this ) }
651
+
652
+ final override string getImmediateString ( ) { result = index .toString ( ) }
653
+
654
+ final int getIndex ( ) { result = index }
655
+ }
656
+
647
657
class EnterFunctionInstruction extends Instruction {
648
658
EnterFunctionInstruction ( ) { getOpcode ( ) instanceof Opcode:: EnterFunction }
649
659
}
@@ -1175,20 +1185,48 @@ class CallReadSideEffectInstruction extends SideEffectInstruction {
1175
1185
*/
1176
1186
class IndirectReadSideEffectInstruction extends SideEffectInstruction {
1177
1187
IndirectReadSideEffectInstruction ( ) { getOpcode ( ) instanceof Opcode:: IndirectReadSideEffect }
1188
+
1189
+ Instruction getArgumentDef ( ) { result = getAnOperand ( ) .( AddressOperand ) .getDef ( ) }
1178
1190
}
1179
1191
1180
1192
/**
1181
1193
* An instruction representing the read of an indirect buffer parameter within a function call.
1182
1194
*/
1183
1195
class BufferReadSideEffectInstruction extends SideEffectInstruction {
1184
1196
BufferReadSideEffectInstruction ( ) { getOpcode ( ) instanceof Opcode:: BufferReadSideEffect }
1197
+
1198
+ Instruction getArgumentDef ( ) { result = getAnOperand ( ) .( AddressOperand ) .getDef ( ) }
1199
+ }
1200
+
1201
+ /**
1202
+ * An instruction representing the read of an indirect buffer parameter within a function call.
1203
+ */
1204
+ class SizedBufferReadSideEffectInstruction extends SideEffectInstruction {
1205
+ SizedBufferReadSideEffectInstruction ( ) {
1206
+ getOpcode ( ) instanceof Opcode:: SizedBufferReadSideEffect
1207
+ }
1208
+
1209
+ Instruction getArgumentDef ( ) { result = getAnOperand ( ) .( AddressOperand ) .getDef ( ) }
1210
+
1211
+ Instruction getSizeDef ( ) { result = getAnOperand ( ) .( BufferSizeOperand ) .getDef ( ) }
1212
+ }
1213
+
1214
+ /**
1215
+ * An instruction representing a side effect of a function call.
1216
+ */
1217
+ class WriteSideEffectInstruction extends SideEffectInstruction {
1218
+ WriteSideEffectInstruction ( ) { getOpcode ( ) instanceof WriteSideEffectOpcode }
1219
+
1220
+ Instruction getArgumentDef ( ) { result = getAnOperand ( ) .( AddressOperand ) .getDef ( ) }
1185
1221
}
1186
1222
1187
1223
/**
1188
1224
* An instruction representing the write of an indirect parameter within a function call.
1189
1225
*/
1190
- class IndirectWriteSideEffectInstruction extends SideEffectInstruction {
1191
- IndirectWriteSideEffectInstruction ( ) { getOpcode ( ) instanceof Opcode:: IndirectWriteSideEffect }
1226
+ class IndirectMustWriteSideEffectInstruction extends WriteSideEffectInstruction {
1227
+ IndirectMustWriteSideEffectInstruction ( ) {
1228
+ getOpcode ( ) instanceof Opcode:: IndirectMustWriteSideEffect
1229
+ }
1192
1230
1193
1231
final override MemoryAccessKind getResultMemoryAccess ( ) { result instanceof IndirectMemoryAccess }
1194
1232
}
@@ -1197,18 +1235,34 @@ class IndirectWriteSideEffectInstruction extends SideEffectInstruction {
1197
1235
* An instruction representing the write of an indirect buffer parameter within a function call. The
1198
1236
* entire buffer is overwritten.
1199
1237
*/
1200
- class BufferWriteSideEffectInstruction extends SideEffectInstruction {
1201
- BufferWriteSideEffectInstruction ( ) { getOpcode ( ) instanceof Opcode:: BufferWriteSideEffect }
1238
+ class BufferMustWriteSideEffectInstruction extends WriteSideEffectInstruction {
1239
+ BufferMustWriteSideEffectInstruction ( ) {
1240
+ getOpcode ( ) instanceof Opcode:: BufferMustWriteSideEffect
1241
+ }
1202
1242
1203
1243
final override MemoryAccessKind getResultMemoryAccess ( ) { result instanceof BufferMemoryAccess }
1204
1244
}
1205
1245
1246
+ /**
1247
+ * An instruction representing the write of an indirect buffer parameter within a function call. The
1248
+ * entire buffer is overwritten.
1249
+ */
1250
+ class SizedBufferMustWriteSideEffectInstruction extends WriteSideEffectInstruction {
1251
+ SizedBufferMustWriteSideEffectInstruction ( ) {
1252
+ getOpcode ( ) instanceof Opcode:: SizedBufferMustWriteSideEffect
1253
+ }
1254
+
1255
+ final override MemoryAccessKind getResultMemoryAccess ( ) { result instanceof BufferMemoryAccess }
1256
+
1257
+ Instruction getSizeDef ( ) { result = getAnOperand ( ) .( BufferSizeOperand ) .getDef ( ) }
1258
+ }
1259
+
1206
1260
/**
1207
1261
* An instruction representing the potential write of an indirect parameter within a function call.
1208
1262
* Unlike `IndirectWriteSideEffectInstruction`, the ___location might not be completely overwritten.
1209
1263
* written.
1210
1264
*/
1211
- class IndirectMayWriteSideEffectInstruction extends SideEffectInstruction {
1265
+ class IndirectMayWriteSideEffectInstruction extends WriteSideEffectInstruction {
1212
1266
IndirectMayWriteSideEffectInstruction ( ) {
1213
1267
getOpcode ( ) instanceof Opcode:: IndirectMayWriteSideEffect
1214
1268
}
@@ -1222,14 +1276,30 @@ class IndirectMayWriteSideEffectInstruction extends SideEffectInstruction {
1222
1276
* An instruction representing the write of an indirect buffer parameter within a function call.
1223
1277
* Unlike `BufferWriteSideEffectInstruction`, the buffer might not be completely overwritten.
1224
1278
*/
1225
- class BufferMayWriteSideEffectInstruction extends SideEffectInstruction {
1279
+ class BufferMayWriteSideEffectInstruction extends WriteSideEffectInstruction {
1226
1280
BufferMayWriteSideEffectInstruction ( ) { getOpcode ( ) instanceof Opcode:: BufferMayWriteSideEffect }
1227
1281
1228
1282
final override MemoryAccessKind getResultMemoryAccess ( ) {
1229
1283
result instanceof BufferMayMemoryAccess
1230
1284
}
1231
1285
}
1232
1286
1287
+ /**
1288
+ * An instruction representing the write of an indirect buffer parameter within a function call.
1289
+ * Unlike `BufferWriteSideEffectInstruction`, the buffer might not be completely overwritten.
1290
+ */
1291
+ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstruction {
1292
+ SizedBufferMayWriteSideEffectInstruction ( ) {
1293
+ getOpcode ( ) instanceof Opcode:: SizedBufferMayWriteSideEffect
1294
+ }
1295
+
1296
+ final override MemoryAccessKind getResultMemoryAccess ( ) {
1297
+ result instanceof BufferMayMemoryAccess
1298
+ }
1299
+
1300
+ Instruction getSizeDef ( ) { result = getAnOperand ( ) .( BufferSizeOperand ) .getDef ( ) }
1301
+ }
1302
+
1233
1303
/**
1234
1304
* An instruction representing a GNU or MSVC inline assembly statement.
1235
1305
*/
0 commit comments