58 return std::make_pair(operation.
name().
upper(), inputOperandId);
71 return std::multimap<ImmInfoKey, ImmInfoValue>::count(
72 key(operation, operand));
81 return count(operation, operation.
operand(inputOperandId));
90 if (std::multimap<ImmInfoKey, ImmInfoValue>::count(
key)) {
92 const_iterator it_largest = this->lower_bound(
key);
93 const_iterator it_begin = it_largest;
95 const_iterator it_end = this->upper_bound(
key);
96 for (it = it_begin; it != it_end; it++) {
97 if (*it > *it_largest) {
101 assert(it_largest != it_end);
102 return it_largest->second;
131 const Operation& operation,
int inputOperandId)
const {
141 if (std::multimap<ImmInfoKey, ImmInfoValue>::count(
key)) {
143 const_iterator it_largest = lower_bound(
key);
144 const_iterator it_begin = it_largest;
146 const_iterator it_end = upper_bound(
key);
147 for (it = it_begin; it != it_end; it++) {
148 if (*it < *it_largest) {
152 assert(it_largest != it_end);
153 return it_largest->second;
156 "No immediate info found for the key.");
173 : pair(immediateWidth, signExtending) {
183 return -(1ll << (first-1));
195 return (1ll << (first-1))-1;
197 return (1ll << (first));
218 std::pair<int64_t, int64_t>
222 std::pair<int64_t, int64_t> result{ 0, 0 };
224 const_iterator it_begin = lower_bound(
key);
225 const_iterator it_end = upper_bound(
key);
227 for (it = it_begin; it != it_end; it++) {
229 if (it->second.width() >= destWidth) {
230 return { (-(1ll << (destWidth-1))), ((1ll << destWidth)-1) };
234 int64_t currLowerBound = 0;
235 int64_t currUpperBound = 0;
236 if (it->second.signExtending()) {
237 currLowerBound = -(1ll << (it->second.width()-1));
238 currUpperBound = (1ll << (it->second.width()-1))-1;
240 currUpperBound = (1ll << (it->second.width()))-1;
243 result.first = std::min(result.first, currLowerBound);
244 result.second = std::max(result.second, currUpperBound);
260 auto theKey =
key(operation, inputOperandId);
261 const_iterator it_begin = lower_bound(theKey);
262 const_iterator it_end = upper_bound(theKey);
264 for (it = it_begin; it != it_end; it++) {
267 (unsignedReqBits <= imm.
width())) {
280 auto theKey =
key(operation, inputOperandId);
281 const_iterator it_begin = lower_bound(theKey);
282 const_iterator it_end = upper_bound(theKey);
284 for (it = it_begin; it != it_end; it++) {
286 if (bitWidth <= info.
width())
return true;
295 std::pair<int64_t, int64_t>
299 int destWidth)
const {
308 std::pair<int64_t, int64_t>
312 int destWidth)
const {
315 operation, operation.
operand(inputOperandId), destWidth);
328 bool allowSignExtension) {
338 if (MCC::busConnectedToRF(*bus, targetRF)) {
339 int immWidth = bus->immediateWidth();
340 if (!allowSignExtension && bus->signExtends()) {
343 result = std::max(result, immWidth);
349 int supportedWidth = it->supportedWidth(*iu);
350 if (!allowSignExtension && iu->signExtends()) {
353 result = std::max(result, supportedWidth);